/* ── Design Tokens ──────────────────────────────────── */
:root {
  --bg:       #111116;
  --surface:  #18181d;
  --surface2: #1f1f25;
  --surface3: #27272e;
  --border:   rgba(255,255,255,0.08);
  --border2:  rgba(255,255,255,0.14);
  --text:     #f0ede8;
  --text2:    #9b9890;
  --text3:    #848180;  /* raised from #5a5855 — passes WCAG AA (4.7:1) */
  --accent:   #7ab8e8;
  --danger:   #e87864;
  --r:  10px;
  --r2: 14px;
  --nav-h: 60px;    /* mobile bottom nav height */
  --nav-w: 200px;   /* desktop sidebar width */

  /* memo type colors */
  --task:            #e8c17a;
  --task-bg:         rgba(232,193,122,0.08);
  --task-border:     rgba(232,193,122,0.2);
  --note:            #7ab8e8;
  --note-bg:         rgba(122,184,232,0.08);
  --note-border:     rgba(122,184,232,0.2);
  --question:        #b07ae8;
  --question-bg:     rgba(176,122,232,0.08);
  --question-border: rgba(176,122,232,0.2);
}

/* ── Reset ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; background: var(--bg); }
body { font-family: 'DM Sans', sans-serif; color: var(--text); font-size: 15px; line-height: 1.5; }
a { color: var(--accent); text-decoration: none; }

/* ── App shell (wraps nav + page) ───────────────────── */
.app-shell { min-height: 100vh; }

/* ── Page content ───────────────────────────────────── */
.page {
  max-width: 680px;
  margin: 0 auto;
  padding: 16px 14px calc(var(--nav-h) + 20px);
  min-height: 100vh;
}
@media (min-width: 600px) {
  .page { padding-left: 24px; padding-right: 24px; }
}

/* ── Mobile: bottom nav ─────────────────────────────── */
.bottom-nav {
  position: fixed; bottom: 0;
  left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 680px;
  height: var(--nav-h);
  background: var(--bg);
  border-top: 0.5px solid var(--border);
  display: flex; justify-content: space-around; align-items: center;
  padding-bottom: env(safe-area-inset-bottom, 0);
  z-index: 100;
}
.nav-wordmark { display: none; }  /* hidden on mobile */
.nav-footer { display: none; }  /* hidden on mobile, shown in desktop sidebar */
.nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  color: var(--text3); font-size: 10px; font-family: 'DM Mono', monospace;
  letter-spacing: 0.06em; padding: 4px 16px;
  transition: color 0.15s; text-decoration: none;
  background: none; border: none; cursor: pointer;
}
.nav-item svg { display: block; }
.nav-item.active { color: var(--text); }

/* ── Mobile: "more" overflow menu ───────────────────── */
.nav-more-group { display: contents; }
.nav-more-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 90;
}
.nav-more-panel {
  display: none;
  position: fixed;
  left: 50%; transform: translateX(-50%);
  bottom: var(--nav-h);
  width: 100%; max-width: 680px;
  flex-direction: column;
  background: var(--bg);
  border-top: 0.5px solid var(--border);
  padding: 6px 0;
  padding-bottom: env(safe-area-inset-bottom, 0);
  z-index: 95;
}
.nav-more-panel.open { display: flex; }
.nav-more-panel .nav-item {
  flex-direction: row;
  justify-content: flex-start;
  gap: 10px;
  padding: 12px 20px;
  font-size: 12px;
  width: 100%;
}
.nav-more-panel .nav-footer {
  display: flex; flex-direction: row; align-items: center; gap: 6px;
  padding: 10px 20px 6px;
}
.nav-more-panel .nav-footer a {
  font-family: 'DM Mono', monospace; font-size: 11px;
  letter-spacing: 0.06em; color: var(--text3);
  text-decoration: none; transition: color 0.15s;
}
.nav-more-panel .nav-footer a:hover { color: var(--text2); }
.nav-more-panel .nav-footer-sep { color: var(--border2); font-size: 10px; }

/* ── Desktop: left sidebar ──────────────────────────── */
@media (min-width: 640px) {
  body { overflow: hidden; }

  .app-shell {
    display: grid;
    grid-template-columns: var(--nav-w) 1fr;
    grid-template-areas: "nav main";
    height: 100vh;
    overflow: hidden;
  }

  .bottom-nav {
    grid-area: nav;
    /* reset mobile positioning */
    position: static;
    transform: none;
    left: auto;
    bottom: auto;
    /* sidebar layout */
    width: var(--nav-w);
    max-width: var(--nav-w);
    height: 100vh;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    border-top: none;
    border-right: 0.5px solid var(--border);
    padding: 0;
    padding-bottom: 20px;
  }

  .nav-wordmark {
    display: block;
    text-decoration: none;
    font-family: 'DM Mono', monospace;
    font-size: 22px;
    font-weight: 300;
    color: var(--surface3);
    letter-spacing: -0.02em;
    padding: 28px 20px 24px;
  }

  .nav-item {
    flex-direction: row;
    justify-content: flex-start;
    gap: 10px;
    padding: 9px 20px;
    font-size: 11px;
    width: 100%;
  }
  .nav-item:hover { color: var(--text2); }
  .nav-logout { margin-top: auto; }

  /* the mobile "more" menu becomes a no-op on desktop — its contents
     render inline in the sidebar like any other nav item */
  .nav-more-toggle { display: none; }
  .nav-more-backdrop { display: none; }
  .nav-more-panel,
  .nav-more-panel.open {
    display: contents;
  }

  .nav-footer {
    display: flex; flex-direction: row; align-items: center; gap: 6px;
    padding: 10px 20px 14px;
  }
  .nav-footer a {
    font-family: 'DM Mono', monospace; font-size: 10px;
    letter-spacing: 0.06em; color: var(--text3);
    text-decoration: none; transition: color 0.15s;
  }
  .nav-footer a:hover { color: var(--text2); }
  .nav-footer-sep { color: var(--border2); font-size: 10px; }

  .page {
    grid-area: main;
    max-width: none;
    margin: 0;
    width: 100%;
    /* own scroll context */
    height: 100vh;
    overflow-y: auto;
    /* center a 720px content column using padding (not max-width + margin)
       so the native scrollbar sits flush against the true viewport edge
       instead of floating next to the centered content */
    padding-top: 28px;
    padding-bottom: 28px;
    padding-left: max(32px, calc(50% - 360px));
    padding-right: max(32px, calc(50% - 360px));
    min-height: unset;
  }
}

/* ── Topbar ─────────────────────────────────────────── */
.topbar {
  font-family: 'DM Mono', monospace; font-size: 13px;
  color: var(--text2); letter-spacing: 0.08em;
  padding: 0 2px 16px;
}

/* ── Memo Cards (Feed) ──────────────────────────────── */
.memo-card {
  background: var(--surface); border: 0.5px solid var(--border);
  border-radius: var(--r2); margin-bottom: 8px; overflow: hidden;
  transition: border-color 0.12s;
}
.memo-card:hover { border-color: var(--border2); }
.memo-head { display: flex; align-items: center; gap: 8px; padding: 10px 13px 0; }
.memo-time { font-size: 10px; font-family: 'DM Mono', monospace; color: var(--text3); }
.memo-summary { padding: 8px 13px 10px; font-size: 14px; color: var(--text2); line-height: 1.5; }
.memo-response { padding: 0 13px 10px; font-size: 13px; color: var(--text3); line-height: 1.5; }
.memo-actions {
  border-top: 0.5px solid var(--border); background: var(--surface2);
  padding: 8px 13px; display: flex; gap: 8px;
}

/* ── Capture / Input Box ────────────────────────────── */
.wordmark {
  display: block; width: 100%;
  text-align: center; padding: 48px 0 0;
  font-family: 'DM Mono', monospace; font-size: 48px;
  color: var(--surface3); letter-spacing: -0.02em; font-weight: 300;
}
.wordmark-sub {
  text-align: center; margin-top: 6px; margin-bottom: 28px;
  font-family: 'DM Mono', monospace; font-size: 10px;
  color: var(--text3); letter-spacing: 0.14em;
}
/* tone down the big wordmark on desktop — sidebar already has it */
@media (min-width: 640px) {
  .wordmark { font-size: 32px; padding-top: 20px; color: var(--surface2); }
}

.input-box {
  background: var(--surface); border: 0.5px solid var(--border2);
  border-radius: var(--r2); padding: 14px 14px 52px; position: relative;
  transition: border-color 0.2s;
}
.input-box:focus-within { border-color: rgba(255,255,255,0.2); }
.input-box textarea, .input-box input[type="text"], .input-box input[type="email"], .input-box input[type="password"], .input-box input[type="tel"], .input-box select {
  width: 100%; background: transparent; border: none; outline: none;
  color: var(--text); font-family: 'DM Sans', sans-serif; font-size: 15px;
  line-height: 1.6; resize: none; min-height: 48px;
}
.input-box textarea::placeholder,
.input-box input::placeholder { color: var(--text3); }
.input-box select { cursor: pointer; }
.input-box-actions {
  position: absolute; bottom: 10px; left: 10px; right: 10px;
  display: flex; align-items: center; justify-content: space-between;
}

/* ── Buttons ────────────────────────────────────────── */
.btn {
  height: 32px; border-radius: 20px; border: none; cursor: pointer;
  font-family: 'DM Mono', monospace; font-size: 11px; letter-spacing: 0.06em;
  padding: 0 14px; transition: all 0.15s; user-select: none;
  background: var(--surface3); color: var(--text2);
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.btn-primary { background: var(--text); color: var(--bg); }
.btn-primary:disabled { opacity: 0.35; cursor: not-allowed; }
.btn-danger { background: rgba(232,120,100,0.1); color: var(--danger); border: 0.5px solid rgba(232,120,100,0.25); }
.btn-ghost { background: transparent; border: 0.5px solid var(--border2); color: var(--text3); }
.btn-ghost:hover { color: var(--text2); }
.btn-row { display: flex; gap: 8px; margin-top: 12px; }

.tier-btn { border: 0.5px solid transparent; }
.tier-btn.selected {
  background: rgba(122,184,232,0.16); color: var(--accent);
  border-color: var(--accent); font-weight: 600;
}

/* ── Recording state ────────────────────────────────── */
.btn.recording { background: rgba(232,120,100,0.15); color: var(--danger); border: 0.5px solid rgba(232,120,100,0.3); }
.rec-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.recording .rec-dot { animation: blink 0.9s ease-in-out infinite; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.3} }

/* ── Consent checkbox ───────────────────────────────── */
.consent-checkbox {
  display: flex; align-items: flex-start; gap: 10px; cursor: pointer;
  font-size: 12px; color: var(--text3); line-height: 1.5; margin-top: 4px;
}
.consent-checkbox input[type="checkbox"] {
  width: 16px; height: 16px; margin: 1px 0 0; flex-shrink: 0;
  accent-color: var(--accent); cursor: pointer;
}

/* ── Toggle switch ──────────────────────────────────── */
.toggle-row { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.toggle-switch { position: relative; display: inline-block; width: 38px; height: 22px; flex-shrink: 0; }
.toggle-switch input {
  position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; z-index: 1;
}
.toggle-switch input:disabled { cursor: not-allowed; }
.toggle-track {
  position: absolute; inset: 0;
  background: var(--surface3); border-radius: 999px;
  transition: background 0.15s;
}
.toggle-thumb {
  position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--text2); transition: transform 0.15s, background 0.15s;
}
.toggle-switch input:checked ~ .toggle-track { background: rgba(122,184,232,0.3); }
.toggle-switch input:checked ~ .toggle-track .toggle-thumb { background: var(--accent); transform: translateX(16px); }
.toggle-switch input:disabled ~ .toggle-track { opacity: 0.5; }

/* ── Status / feedback messages ─────────────────────── */
.status-msg {
  font-size: 12px; font-family: 'DM Mono', monospace;
  color: var(--text3); margin: 10px 0; min-height: 1.4em;
}
.status-msg.error { color: var(--danger); }

/* ── Waveform canvas ────────────────────────────────── */
#waveform { display: block; width: 100%; height: 56px; border-radius: var(--r); background: var(--surface2); margin: 10px 0; }

/* ── Detail cards ───────────────────────────────────── */
.detail-card {
  background: var(--surface); border: 0.5px solid var(--border);
  border-radius: var(--r2); padding: 14px; margin-bottom: 10px;
}
.detail-label {
  font-size: 10px; font-family: 'DM Mono', monospace; color: var(--text3);
  letter-spacing: 0.08em; margin-bottom: 8px; text-transform: uppercase;
}
.detail-text { font-size: 14px; color: var(--text2); line-height: 1.6; }
.help-text { font-size: 12px; color: var(--text3); line-height: 1.5; margin-bottom: 10px; }
.detail-title { font-size: 18px; font-weight: 500; color: var(--text); margin-bottom: 4px; }
.detail-card-head { display: flex; flex-direction: column; gap: 8px; }
.detail-head-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.verify-nudge {
  background: var(--surface); border: 0.5px solid var(--border2);
  border-radius: var(--r2); padding: 12px 14px; margin: 10px 0;
  display: flex; flex-direction: column; gap: 10px;
}
.verify-nudge-msg {
  font-size: 13px; color: var(--text2); line-height: 1.5;
}
.verify-nudge-input {
  background: var(--surface2); border: 0.5px solid var(--border2);
  border-radius: var(--r); padding: 8px 10px; color: var(--text);
  font-family: 'DM Mono', monospace; font-size: 12px; outline: none; width: 100%;
}
.verify-nudge-input::placeholder { color: var(--text3); }

.spinner {
  display: inline-block; width: 12px; height: 12px; flex-shrink: 0;
  border: 1.5px solid var(--border2); border-top-color: var(--text2);
  border-radius: 50%; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Empty state ────────────────────────────────────── */
.empty {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 60px 0; gap: 8px;
  color: var(--text3); font-family: 'DM Mono', monospace;
  font-size: 11px; letter-spacing: 0.06em;
}
.empty-glyph { font-size: 28px; opacity: 0.3; }

/* ── Audio player ───────────────────────────────────── */
audio { width: 100%; margin-top: 10px; }

/* ── Type badges ─────────────────────────────────────── */
.type-badge {
  font-size: 10px; font-family: 'DM Mono', monospace;
  padding: 2px 7px; border-radius: 8px;
  cursor: pointer; transition: opacity 0.1s;
  font-weight: 500; letter-spacing: 0.03em;
  flex-shrink: 0; user-select: none;
}
.type-pending  { color: var(--text3); background: var(--surface2); border: 0.5px solid var(--border); }
.type-task     { color: var(--task);     background: var(--task-bg);     border: 0.5px solid var(--task-border); }
.type-note     { color: var(--note);     background: var(--note-bg);     border: 0.5px solid var(--note-border); }
.type-question { color: var(--question); background: var(--question-bg); border: 0.5px solid var(--question-border); }
.type-loading  { opacity: 0.5; cursor: wait; }

/* ── Reclassify picker ───────────────────────────────── */
.memo-head { position: relative; }
.rc-picker {
  position: absolute; top: calc(100% + 4px); left: 60px; z-index: 200;
  background: var(--surface2); border: 0.5px solid var(--border2);
  border-radius: var(--r); padding: 4px; min-width: 110px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.rc-opt {
  padding: 7px 10px; border-radius: 6px; cursor: pointer;
  font-size: 12px; font-family: 'DM Mono', monospace;
  display: flex; align-items: center; gap: 7px;
  color: var(--text2); transition: background 0.1s;
}
.rc-opt:hover { background: var(--surface3); }
.rc-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.rc-dot-task     { background: var(--task); }
.rc-dot-note     { background: var(--note); }
.rc-dot-question { background: var(--question); }

/* ── Filter pills ────────────────────────────────────── */
.filter-bar {
  display: flex; gap: 6px; padding: 0 2px 14px;
  overflow-x: auto; scrollbar-width: none;
}
.filter-bar::-webkit-scrollbar { display: none; }
.fpill {
  padding: 5px 12px; border-radius: 20px; font-size: 11px;
  font-family: 'DM Mono', monospace; letter-spacing: 0.04em;
  cursor: pointer; white-space: nowrap; flex-shrink: 0;
  border: 0.5px solid var(--border); color: var(--text3);
  background: transparent; transition: all 0.12s;
}
.fpill.active { border-color: var(--border2); color: var(--text); background: var(--surface); }
.fpill:hover:not(.active) { color: var(--text2); }

/* ── Insights ────────────────────────────────────────── */
.insights-scroll { padding-bottom: 24px; }

.insights-card {
  background: var(--surface); border: 0.5px solid var(--border);
  border-radius: var(--r2); padding: 14px 14px 12px; margin-bottom: 10px;
}
.insights-card-label {
  font-size: 10px; font-family: 'DM Mono', monospace; letter-spacing: 0.08em;
  color: var(--text3); margin-bottom: 14px;
}

.insights-chart-row {
  display: flex; align-items: flex-end; gap: 5px; height: 56px;
}
.vol-col { display: flex; flex-direction: column; align-items: center; gap: 5px; flex: 1; }
.vol-bar-wrap { flex: 1; width: 100%; display: flex; align-items: flex-end; }
.vol-bar { width: 100%; border-radius: 3px 3px 0 0; min-height: 2px; transition: height 0.3s ease; }
.vol-day { font-size: 9px; font-family: 'DM Mono', monospace; color: var(--text3); }

.insights-breakdown { display: flex; flex-direction: column; gap: 8px; }
.breakdown-row { display: flex; align-items: center; gap: 10px; }
.breakdown-label { font-size: 11px; font-family: 'DM Mono', monospace; color: var(--text2); width: 52px; flex-shrink: 0; }
.breakdown-track { flex: 1; height: 4px; background: var(--surface3); border-radius: 2px; overflow: hidden; }
.breakdown-fill { height: 100%; border-radius: 2px; transition: width 0.4s ease; }
.breakdown-count { font-size: 11px; font-family: 'DM Mono', monospace; color: var(--text3); width: 20px; text-align: right; flex-shrink: 0; }

.insights-stats {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px;
}
.stat-card {
  background: var(--surface); border: 0.5px solid var(--border);
  border-radius: var(--r2); padding: 12px 14px;
}
.stat-value { font-size: 26px; font-family: 'DM Mono', monospace; font-weight: 300; color: var(--text); line-height: 1; margin-bottom: 5px; }
.stat-label { font-size: 10px; font-family: 'DM Mono', monospace; color: var(--text3); letter-spacing: 0.06em; }

.insights-heatmap { display: flex; gap: 3px; align-items: center; }
.heatmap-cell { flex: 1; height: 20px; border-radius: 3px; background: var(--surface3); }
.insights-heatmap-labels {
  display: flex; justify-content: space-between; margin-top: 5px;
  font-size: 9px; font-family: 'DM Mono', monospace; color: var(--text3);
}

/* ── Task workflow ────────────────────────────────────── */
:root {
  --todo:            var(--text3);
  --in-progress:     var(--task);
  --in-progress-bg:  var(--task-bg);
  --in-progress-border: var(--task-border);
  --done:            #7ae8a8;
  --done-bg:         rgba(122,232,168,0.08);
  --done-border:     rgba(122,232,168,0.2);
}

.task-status-row {
  display: flex; gap: 6px; margin-bottom: 14px;
}
.task-status-btn {
  flex: 1; padding: 7px 4px; border-radius: var(--r);
  font-size: 11px; font-family: 'DM Mono', monospace; letter-spacing: 0.03em;
  cursor: pointer; border: 0.5px solid var(--border); color: var(--text3);
  background: transparent; transition: all 0.12s;
}
.task-status-btn:disabled { opacity: 0.5; cursor: wait; }
.task-status-btn:hover:not(:disabled):not(.active) { border-color: var(--border2); color: var(--text2); }

.task-status-btn.task-status-todo.active    { color: var(--text2); background: var(--surface2); border-color: var(--border2); }
.task-status-btn.task-status-in_progress.active { color: var(--task); background: var(--task-bg); border-color: var(--task-border); }
.task-status-btn.task-status-done.active    { color: var(--done); background: var(--done-bg); border-color: var(--done-border); }

.task-due-row {
  display: flex; align-items: center; gap: 10px;
}
.task-due-label {
  font-size: 10px; font-family: 'DM Mono', monospace; color: var(--text3);
  letter-spacing: 0.06em; white-space: nowrap; flex-shrink: 0;
}
.task-due-inputs { display: flex; align-items: center; gap: 8px; }
.task-due-input {
  background: var(--surface2); border: 0.5px solid var(--border2);
  border-radius: var(--r); padding: 6px 10px; color: var(--text);
  font-family: 'DM Mono', monospace; font-size: 12px; outline: none;
  color-scheme: dark;
}
.task-due-input:disabled { opacity: 0.5; }

/* ── Transcript edit ─────────────────────────────────── */
.transcript-edit-area {
  width: 100%; background: var(--surface2); border: 0.5px solid var(--border2);
  border-radius: var(--r); padding: 10px 12px; color: var(--text);
  font-family: 'DM Sans', sans-serif; font-size: 14px; line-height: 1.6;
  resize: vertical; min-height: 80px; outline: none;
}
.transcript-edit-area:focus { border-color: rgba(255,255,255,0.2); }
.transcript-edit-area:disabled { opacity: 0.5; }

/* ── Inline chat ─────────────────────────────────────── */
.inline-chat-start {
  width: 100%; justify-content: center; color: var(--question);
  border-color: var(--question-border);
}
.inline-chat-history {
  display: flex; flex-direction: column; gap: 12px;
  max-height: 360px; overflow-y: auto; scrollbar-width: none;
  margin-bottom: 12px;
}
.inline-chat-history::-webkit-scrollbar { display: none; }
.inline-chat-sending { margin-top: 12px; }
.inline-chat-input-area {
  position: relative; margin-top: 12px;
  background: var(--surface2); border: 0.5px solid var(--border2);
  border-radius: var(--r2); padding: 12px 12px 44px;
  transition: border-color 0.2s;
}
.inline-chat-input-area:focus-within { border-color: rgba(255,255,255,0.2); }
.chat-msg { display: flex; flex-direction: column; gap: 4px; }
.chat-msg-user { align-items: flex-end; }
.chat-msg-assistant { align-items: flex-start; }
.chat-msg-label {
  font-size: 9px; font-family: 'DM Mono', monospace; color: var(--text3); letter-spacing: 0.08em;
}
.chat-msg-text {
  font-size: 14px; line-height: 1.6; color: var(--text2);
  background: var(--surface2); border-radius: var(--r); padding: 9px 12px;
  max-width: 90%;
}
.chat-msg-user .chat-msg-text { background: var(--surface3); color: var(--text); }
.chat-msg-assistant .chat-msg-text { width: 100%; max-width: 100%; }
.chat-thinking {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; font-family: 'DM Mono', monospace; color: var(--text3);
}
/* markdown inside chat bubbles */
.chat-msg-md p { margin: 0 0 0.5em; }
.chat-msg-md p:last-child { margin-bottom: 0; }
.chat-msg-md ul, .chat-msg-md ol { margin: 0.4em 0 0.4em 1.2em; padding: 0; }
.chat-msg-md li { margin-bottom: 0.2em; }
.chat-msg-md h1, .chat-msg-md h2, .chat-msg-md h3 {
  font-size: 13px; font-weight: 600; color: var(--text); margin: 0.6em 0 0.3em;
}
.chat-msg-md h1:first-child, .chat-msg-md h2:first-child, .chat-msg-md h3:first-child { margin-top: 0; }
.chat-msg-md code {
  font-family: 'DM Mono', monospace; font-size: 12px;
  background: var(--surface3); border-radius: 4px; padding: 1px 5px;
}
.chat-msg-md pre {
  background: var(--surface3); border-radius: var(--r); padding: 10px 12px;
  overflow-x: auto; margin: 0.5em 0; scrollbar-width: none;
}
.chat-msg-md pre::-webkit-scrollbar { display: none; }
.chat-msg-md pre code { background: none; padding: 0; font-size: 12px; }
.chat-msg-md blockquote {
  border-left: 2px solid var(--border2); margin: 0.4em 0; padding-left: 10px;
  color: var(--text3);
}
.chat-msg-md a { color: var(--accent); }
.chat-msg-md strong { color: var(--text); font-weight: 600; }
.chat-msg-md hr { border: none; border-top: 0.5px solid var(--border); margin: 0.6em 0; }
/* KaTeX override — inherit our text color */
.chat-msg-md .katex { color: var(--text); font-size: 1em; }

.chat-input {
  width: 100%; background: transparent; border: none; outline: none;
  color: var(--text); font-family: 'DM Sans', sans-serif; font-size: 14px;
  line-height: 1.6; resize: none; min-height: 24px; max-height: 120px;
}
.chat-input:disabled { opacity: 0.5; }
.chat-input::placeholder { color: var(--text3); }
.chat-send {
  position: absolute; bottom: 8px; right: 8px;
  height: 28px; border-radius: 20px; padding: 0 12px;
  font-size: 10px;
}
.chat-send:disabled { opacity: 0.35; cursor: not-allowed; }
.chat-limit-notice {
  margin-top: 12px; padding: 10px 12px; border-radius: var(--r);
  background: var(--surface2); border: 0.5px solid var(--border);
  font-size: 12px; font-family: 'DM Mono', monospace; color: var(--text3);
  line-height: 1.5; letter-spacing: 0.02em;
}
.chat-char-count {
  margin-top: 5px; text-align: right;
  font-size: 10px; font-family: 'DM Mono', monospace; color: var(--text3);
}

/* feed card task meta */
.memo-task-meta {
  display: flex; align-items: center; gap: 8px;
  padding: 0 13px 8px;
}
.task-status-chip {
  font-size: 10px; font-family: 'DM Mono', monospace; letter-spacing: 0.03em;
  padding: 2px 7px; border-radius: 8px; border: 0.5px solid var(--border);
  color: var(--text3); background: var(--surface2);
}
.task-status-chip.task-status-in_progress { color: var(--task); background: var(--task-bg); border-color: var(--task-border); }
.task-status-chip.task-status-done        { color: var(--done); background: var(--done-bg); border-color: var(--done-border); }
.memo-due-date {
  font-size: 10px; font-family: 'DM Mono', monospace; color: var(--text3);
}

/* ── Landing page ───────────────────────────────────── */
.landing { max-width: 480px; }
.landing .wordmark { color: var(--text); padding-top: 64px; }
@media (min-width: 640px) {
  .landing .wordmark { color: var(--text); font-size: 48px; padding-top: 64px; }
}
.landing-taglines {
  text-align: center; margin: 8px 0 24px;
  font-family: 'DM Mono', monospace; font-size: 13px;
  color: var(--text2); line-height: 1.9;
}
.landing-taglines strong { color: var(--accent); font-weight: 500; }
.landing-blurb {
  color: var(--text2); font-size: 14px; line-height: 1.7;
  margin-bottom: 24px;
  text-align: justify;
}
.landing-cta { justify-content: center; margin-bottom: 20px; }
.landing-cta .btn { height: 38px; padding: 0 20px; font-size: 12px; }
.landing-privacy-link {
  text-align: center; font-size: 12px; font-family: 'DM Mono', monospace;
  color: var(--text3); margin-top: 8px;
}

/* ── Privacy page ───────────────────────────────────── */
.privacy { max-width: 760px; }
.privacy .detail-card p {
  color: var(--text2); font-size: 14px; line-height: 1.7;
}
.privacy .detail-card p + p { margin-top: 10px; }
.privacy .detail-card ul {
  color: var(--text2); font-size: 14px; line-height: 1.7;
  margin: 10px 0; padding-left: 0; list-style: none;
}
.privacy .detail-card ul li {
  position: relative; padding-left: 16px; margin-bottom: 8px;
}
.privacy .detail-card ul li:last-child { margin-bottom: 0; }
.privacy .detail-card ul li::before {
  content: '–'; position: absolute; left: 0; color: var(--text3);
}
.privacy-back {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: 'DM Mono', monospace; font-size: 12px; letter-spacing: 0.04em;
  color: var(--text3); background: none; border: none; cursor: pointer;
  padding: 4px 0; margin-top: 12px;
}
.privacy-back:hover { color: var(--text2); }
.privacy-back svg { display: block; }

/* .landing isn't wrapped in the sidebar Layout, so undo .page's
   own-scroll-context rule from the desktop grid layout — let the document scroll instead.
   body has overflow:hidden on desktop for the sidebar layout's internal scroll; re-enable
   it here since this standalone page has no sidebar to scroll instead of the document. */
@media (min-width: 640px) {
  .landing {
    height: auto;
    min-height: 100vh;
    overflow-y: visible;
    /* .page's desktop rule sets viewport-relative padding sized for the
       full-width grid layout (max-width: none) — on wide screens that
       padding alone exceeds .landing's 480px cap and squishes the content
       to 0 width. Reset to a fixed padding and re-center with margin. */
    margin: 0 auto;
    padding-left: 24px;
    padding-right: 24px;
  }
  body:has(.landing) {
    overflow-y: auto;
  }
}
