*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0c0c10;
  --surface: #13131a;
  --surface-2: #1a1a24;
  --surface-3: #22222e;
  --border: #28283a;
  --border-light: #33334a;
  --text: #dcdce8;
  --text-secondary: #9898b0;
  --text-dim: #6868808;
  --accent: #e94560;
  --accent-soft: rgba(233, 69, 96, 0.1);
  --accent-glow: rgba(233, 69, 96, 0.25);
  --success: #4cd9a0;
  --mono: 'SF Mono', 'Cascadia Code', 'JetBrains Mono', 'Fira Code', monospace;
  --sans: system-ui, -apple-system, sans-serif;
  --radius: 6px;
  --radius-lg: 10px;

  /* Category colors */
  --cat-characters: #4a9eff;
  --cat-plot: #f5a623;
  --cat-world: #4cd9a0;
  --cat-themes: #c084fc;
  --cat-relationships: #f472b6;
  --cat-notes: #8888a0;
  --cat-manuscripts: #fbbf24;
}

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 0.875rem;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ──────────────────────────────────────────────────────────────── */

.writing-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  height: 100vh;
  overflow: hidden;
}

.writing-panel {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  overflow: hidden;
  background: var(--surface);
}

/* ── Nav ─────────────────────────────────────────────────────────────────── */

.writing-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.logo {
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.nav-project {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-family: var(--mono);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-back, .nav-sub {
  font-size: 0.72rem;
  color: var(--text-dim);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s;
}

.nav-back:hover { color: var(--text); }

/* ── Toolbar ─────────────────────────────────────────────────────────────── */

.writing-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.78rem;
  padding: 0.35rem 0.6rem;
  font-family: var(--sans);
  transition: border-color 0.15s;
}

.search-input:focus { outline: none; border-color: var(--accent); }
.search-input::placeholder { color: var(--text-dim); }

.mode-toggle {
  display: flex;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  flex-shrink: 0;
}

.mode-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 0.65rem;
  font-family: var(--sans);
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 0.3rem 0.55rem;
  cursor: pointer;
  transition: all 0.15s;
}

.mode-btn:not(:last-child) { border-right: 1px solid var(--border); }
.mode-btn:hover { color: var(--text); background: var(--surface-2); }
.mode-btn.active { color: var(--accent); background: var(--accent-soft); }

/* ── Filter pills ────────────────────────────────────────────────────────── */

.filter-pills {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  background: color-mix(in srgb, var(--cat-color, var(--text-dim)) 12%, transparent);
  color: var(--cat-color, var(--text-dim));
  border: 1px solid color-mix(in srgb, var(--cat-color, var(--text-dim)) 25%, transparent);
  cursor: pointer;
  transition: all 0.15s;
}

.filter-pill:hover {
  background: color-mix(in srgb, var(--cat-color, var(--text-dim)) 25%, transparent);
}

.pill-x { opacity: 0.6; }

/* ── File list ───────────────────────────────────────────────────────────── */

.writing-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.25rem 0;
}

.writing-list::-webkit-scrollbar { width: 3px; }
.writing-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.section { margin-bottom: 0.15rem; }

.section-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  text-transform: uppercase;
  padding: 0.85rem 0.85rem 0.35rem;
}

.add-chapter-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-dim);
  font-size: 0.72rem;
  width: 1.3rem;
  height: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  margin-left: auto;
  transition: all 0.15s;
}

.add-chapter-btn:hover { color: var(--accent); border-color: var(--accent); }

/* ── Group headers (tree) ────────────────────────────────────────────────── */

.group-header {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.85rem;
  cursor: pointer;
  user-select: none;
  font-size: 0.76rem;
  color: var(--text-secondary);
  transition: all 0.1s;
  border-radius: 3px;
  margin: 0 4px;
}

.group-header:hover { color: var(--text); background: var(--surface-2); }

.group-episode { padding-left: 1.6rem; font-size: 0.73rem; }
.group-chapter { padding-left: 2.2rem; font-size: 0.72rem; }
.group-kb { padding-left: 0.85rem; }

.group-arrow {
  font-size: 0.5rem;
  opacity: 0.5;
  width: 0.65rem;
  flex-shrink: 0;
  transition: transform 0.15s;
}

.group-label { flex: 1; font-weight: 500; }
.group-count { font-size: 0.68rem; color: var(--text-dim); opacity: 0.6; }

.group-files { padding: 0 0 0.15rem; }

/* ── Category dot ────────────────────────────────────────────────────────── */

.cat-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--cat-color);
}

/* ── File items ──────────────────────────────────────────────────────────── */

.file-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.85rem 0.3rem 2.8rem;
  cursor: pointer;
  font-size: 0.76rem;
  border-left: 2px solid transparent;
  transition: all 0.1s;
  line-height: 1.35;
  border-radius: 0 3px 3px 0;
  margin-right: 4px;
}

.file-item:hover { background: var(--surface-2); }

.file-item.active {
  background: var(--accent-soft);
  border-left-color: var(--accent) !important;
}

.file-concept { border-left-color: color-mix(in srgb, var(--concept-border, #7c6fc2) 50%, transparent); }
.file-draft   { border-left-color: color-mix(in srgb, var(--draft-border, #d4843e) 50%, transparent); }

.kb-note { padding-left: 2.2rem; }

.file-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.note-tags {
  display: flex;
  gap: 0.2rem;
  flex-shrink: 0;
  flex-wrap: nowrap;
  overflow: hidden;
  max-width: 100px;
}

.latest-dot {
  font-size: 0.5rem;
  color: var(--draft-border, #d4843e);
  flex-shrink: 0;
  line-height: 1;
}

.empty-section {
  padding: 0.6rem 1rem 0.6rem 2rem;
  font-size: 0.73rem;
  color: var(--text-dim);
  font-style: italic;
}

/* ── Category badges ─────────────────────────────────────────────────────── */

.cat-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.3rem;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 0.05rem 0.3rem;
  border-radius: 3px;
  cursor: pointer;
  flex-shrink: 0;
  background: color-mix(in srgb, var(--cat-color) 12%, transparent);
  color: var(--cat-color);
  border: 1px solid color-mix(in srgb, var(--cat-color) 25%, transparent);
  transition: all 0.15s;
  text-transform: none;
}

.cat-badge:hover { background: color-mix(in srgb, var(--cat-color) 22%, transparent); }
.cat-badge.active { background: var(--cat-color); color: #000; border-color: var(--cat-color); }

/* ── Tag chips ─────────────────────────────────────────────────────────────── */

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.12rem;
  font-size: 0.6rem;
  padding: 0.06rem 0.28rem;
  border-radius: 10px;
  cursor: pointer;
  flex-shrink: 0;
  background: color-mix(in srgb, var(--tag-color) 12%, transparent);
  color: var(--tag-color);
  transition: background 0.15s;
  white-space: nowrap;
}

.tag-chip:hover { background: color-mix(in srgb, var(--tag-color) 25%, transparent); }
.tag-chip.active { background: var(--tag-color); color: #000; }

.tag-chip.editable .remove-tag {
  opacity: 0.5;
  font-size: 0.72rem;
  line-height: 1;
  cursor: pointer;
  margin-left: 0.08rem;
}

.tag-chip.editable .remove-tag:hover { opacity: 1; }

/* ── Editor panel ────────────────────────────────────────────────────────── */

.editor-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

.editor-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.editor-header {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.7rem 1.5rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface);
}

.editor-title-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.editor-breadcrumb {
  flex: 1;
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-family: var(--mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-save-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.save-status {
  font-size: 0.7rem;
  color: var(--text-dim);
  font-family: var(--mono);
  min-width: 3rem;
  text-align: right;
}

.save-status.dirty { color: var(--accent); }
.save-status.saved { color: var(--success); }

.save-btn {
  font-size: 0.7rem;
  padding: 0.22rem 0.7rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  font-family: var(--sans);
  font-weight: 500;
  transition: all 0.15s;
}

.save-btn:hover { border-color: var(--accent); color: var(--accent); }
.save-btn:disabled { opacity: 0.4; cursor: default; }

.editor-tags-row {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.add-tag-btn {
  font-size: 0.6rem;
  color: var(--text-dim);
  background: none;
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 0.06rem 0.4rem;
  cursor: pointer;
  font-family: var(--sans);
  transition: all 0.15s;
}

.add-tag-btn:hover { border-color: var(--accent); color: var(--accent); }

.editor-textarea {
  flex: 1;
  resize: none;
  border: none;
  outline: none;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.9rem;
  line-height: 1.8;
  padding: 2rem 3rem;
  overflow-y: auto;
  caret-color: var(--accent);
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
}

.editor-textarea::-webkit-scrollbar { width: 3px; }
.editor-textarea::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.editor-footer {
  padding: 0.4rem 1.5rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
}

.word-count {
  font-size: 0.7rem;
  color: var(--text-dim);
  font-family: var(--mono);
}

.editor-path {
  font-size: 0.65rem;
  color: var(--text-dim);
  font-family: var(--mono);
  opacity: 0.5;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 400px;
  text-align: right;
}

/* ── Project Overview (empty state dashboard) ─────────────────────────────── */

.project-overview {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  padding: 2.5rem 3rem;
  max-width: 800px;
  margin: 0 auto;
}

.project-overview::-webkit-scrollbar { width: 3px; }
.project-overview::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.overview-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.4rem;
  letter-spacing: -0.02em;
}

.overview-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
  line-height: 1.5;
}

.overview-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.65rem;
  margin-bottom: 2.5rem;
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.85rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  border-left: 3px solid var(--cat-color);
  cursor: pointer;
  transition: all 0.15s;
}

.stat-card:hover {
  background: var(--surface-2);
  border-color: var(--border-light);
}

.stat-count {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  font-family: var(--mono);
  line-height: 1;
}

.stat-label {
  font-size: 0.68rem;
  color: var(--cat-color);
  font-weight: 600;
  text-transform: capitalize;
}

.overview-section {
  margin-bottom: 2rem;
}

.overview-section-title {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

/* Structure map */
.structure-map {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.structure-book {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.structure-book-header {
  padding: 0.6rem 0.85rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.structure-chapters {
  padding: 0.5rem 0.85rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.structure-chip {
  font-size: 0.68rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

.structure-chip:hover {
  border-color: var(--accent);
  color: var(--text);
}

.structure-chip.is-draft {
  border-left: 2px solid #d4843e;
}

.structure-chip.is-concept {
  border-left: 2px solid #7c6fc2;
}

/* Recent files */
.recent-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.recent-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
}

.recent-item:hover {
  background: var(--surface-2);
  border-color: var(--border-light);
}

.recent-name {
  flex: 1;
  font-size: 0.78rem;
  color: var(--text);
  font-weight: 500;
}

.recent-location {
  font-size: 0.68rem;
  color: var(--text-dim);
  font-family: var(--mono);
}

.recent-type {
  width: 4px;
  height: 24px;
  border-radius: 2px;
  flex-shrink: 0;
}

.recent-type.draft { background: #d4843e; }
.recent-type.concept { background: #7c6fc2; }
.recent-type.note { background: var(--cat-characters); }

/* No content state */
.overview-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-dim);
}

.overview-empty-title {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.overview-empty-sub {
  font-size: 0.78rem;
  line-height: 1.5;
}

/* ── New chapter modal ───────────────────────────────────────────────────── */

.new-chapter-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}

.new-chapter-dialog {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  width: 420px;
  max-width: 90vw;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

.new-chapter-dialog h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 1.2rem;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0.85rem;
}

.form-row label {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.form-input, .form-select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.82rem;
  padding: 0.45rem 0.65rem;
  font-family: var(--sans);
  width: 100%;
  transition: border-color 0.15s;
}

.form-input:focus, .form-select:focus { outline: none; border-color: var(--accent); }
.form-select option { background: var(--surface); }

.dialog-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1.2rem;
}

.btn-primary {
  padding: 0.45rem 1.2rem;
  border-radius: var(--radius);
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--sans);
  transition: filter 0.15s;
}

.btn-primary:hover { filter: brightness(1.15); }
.btn-primary:disabled { opacity: 0.4; cursor: default; }

.btn-secondary {
  padding: 0.45rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: none;
  color: var(--text-dim);
  font-size: 0.82rem;
  cursor: pointer;
  font-family: var(--sans);
  transition: all 0.15s;
}

.btn-secondary:hover { color: var(--text); border-color: var(--text-dim); }

/* ── Project list page ───────────────────────────────────────────────────── */

.project-list-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 2rem;
}

.project-list-page .writing-nav {
  border: none;
  padding: 0 0 1rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.project-search-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.project-search-input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.82rem;
  padding: 0.5rem 0.75rem;
  font-family: var(--sans);
  transition: border-color 0.15s;
}

.project-search-input:focus { outline: none; border-color: var(--accent); }
.project-search-input::placeholder { color: var(--text-dim); }

.project-count {
  font-size: 0.72rem;
  color: var(--text-dim);
  font-family: var(--mono);
  white-space: nowrap;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
}

.project-card {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 1rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

.project-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  opacity: 0;
  transition: opacity 0.2s;
}

.project-card:hover {
  border-color: var(--border-light);
  background: var(--surface-2);
  transform: translateY(-1px);
}

.project-card:hover::before { opacity: 1; }

.project-card-header {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.project-name {
  font-size: 0.88rem;
  color: var(--text);
  font-weight: 600;
  flex: 1;
  line-height: 1.3;
}

.project-stage {
  font-size: 0.6rem;
  font-weight: 600;
  padding: 0.12rem 0.4rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}

.stage-draft { background: rgba(212, 132, 62, 0.15); color: #d4843e; }
.stage-outline { background: rgba(74, 158, 255, 0.15); color: #4a9eff; }
.stage-brainstorm { background: rgba(192, 132, 252, 0.15); color: #c084fc; }
.stage-revision { background: rgba(76, 217, 160, 0.15); color: #4cd9a0; }
.stage-complete { background: rgba(76, 217, 160, 0.15); color: #4cd9a0; }

.project-desc {
  font-size: 0.72rem;
  color: var(--text-dim);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.project-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.15rem;
}

.project-stat {
  font-size: 0.65rem;
  color: var(--text-dim);
  font-family: var(--mono);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.project-stat-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
}

.project-touched {
  font-size: 0.62rem;
  color: var(--text-dim);
  font-family: var(--mono);
  margin-left: auto;
}

/* ── Misc ────────────────────────────────────────────────────────────────── */

.loading, .empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.82rem;
}

/* ── Scrollbar global ─────────────────────────────────────────────────────── */

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ── Auth screens ────────────────────────────────────────────────────────── */

.auth-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 1rem;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  width: 360px;
  text-align: center;
}

.auth-title {
  font-weight: 800;
  font-size: 1.3rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
  letter-spacing: -0.03em;
}

.auth-sub {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.auth-error {
  color: var(--accent);
  font-size: 0.82rem;
  min-height: 1.2em;
  margin-bottom: 0.5rem;
}

.auth-input {
  width: 100%;
  padding: 0.6rem 0.85rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.9rem;
  margin-bottom: 1rem;
  font-family: var(--sans);
  transition: border-color 0.15s;
}

.auth-input:focus { outline: none; border-color: var(--accent); }

.auth-btn {
  width: 100%;
  padding: 0.7rem 1rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  font-family: var(--sans);
  transition: filter 0.15s;
}

.auth-btn:hover { filter: brightness(1.15); }
.auth-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Logout button in nav ────────────────────────────────────────────────── */

.nav-logout {
  font-size: 0.65rem;
  color: var(--text-dim);
  background: none;
  border: 1px solid var(--border);
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  cursor: pointer;
  font-family: var(--sans);
  transition: all 0.15s;
}

.nav-logout:hover { border-color: var(--accent); color: var(--accent); }
