/* Design tokens from DESIGN-claude.md — warm cream canvas, coral primary,
   serif display type, dark product surfaces. */
:root {
  --primary: #cc785c;
  --primary-active: #a9583e;
  --primary-disabled: #e6dfd8;
  --ink: #141413;
  --body: #3d3d3a;
  --body-strong: #252523;
  --muted: #6c6a64;
  --muted-soft: #8e8b82;
  --hairline: #e6dfd8;
  --hairline-soft: #ebe6df;
  --canvas: #faf9f5;
  --surface-soft: #f5f0e8;
  --surface-card: #efe9de;
  --surface-cream-strong: #e8e0d2;
  --surface-dark: #181715;
  --surface-dark-elevated: #252320;
  --surface-dark-soft: #1f1e1b;
  --on-primary: #ffffff;
  --on-dark: #faf9f5;
  --on-dark-soft: #a09d96;
  --accent-teal: #5db8a6;
  --accent-amber: #e8a55a;
  --success: #5db872;
  --warning: #d4a017;
  --error: #c64545;

  --serif: "Cormorant Garamond", "Tiempos Headline", Garamond, "Times New Roman", serif;
  --sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;

  --r-sm: 6px; --r-md: 8px; --r-lg: 12px; --r-xl: 16px; --r-pill: 9999px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: var(--sans);
  font-size: 16px; line-height: 1.55;
  color: var(--body);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}

#app { display: flex; height: 100vh; }

/* ---------- sidebar ---------- */
#sidebar {
  width: 232px; flex: none;
  display: flex; flex-direction: column;
  padding: 24px 16px 16px;
  background: var(--canvas);
  border-right: 1px solid var(--hairline-soft);
}
.brand {
  display: flex; align-items: center; gap: 10px; padding: 0 10px 24px;
  background: transparent; border: none; cursor: pointer;
  font: inherit; text-align: left; border-radius: var(--r-md);
}
.brand:hover .brand-name { color: var(--primary); }
.brand:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.brand-mark { flex: none; }
.brand-name {
  font-family: var(--serif);
  font-size: 22px; font-weight: 600; color: var(--ink);
  letter-spacing: -0.3px;
  transition: color .12s ease;
}
#nav { display: flex; flex-direction: column; gap: 2px; }
.nav-link {
  text-align: left;
  font-family: var(--sans); font-size: 14px; font-weight: 500;
  color: var(--muted);
  background: transparent; border: none; cursor: pointer;
  padding: 8px 14px; border-radius: var(--r-md);
}
.nav-link:hover { color: var(--ink); }
.nav-link.active { background: var(--surface-card); color: var(--ink); }

.sidebar-foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid var(--hairline-soft); }
.mic-status { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: var(--muted); }
.mic-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); }
.mic-status .dot.recording { background: var(--primary); }
.mic-status .dot.muted { background: var(--muted-soft); }
.version { font-size: 12px; color: var(--muted-soft); margin-top: 6px; }

/* ---------- main ---------- */
#main { flex: 1; overflow-y: auto; }
.page { display: none; }
.page.active { display: block; }
.page-inner { max-width: 860px; margin: 0 auto; padding: 56px 48px 96px; }

.eyebrow {
  font-size: 12px; font-weight: 500; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--muted-soft); margin-bottom: 12px;
}
h1.display {
  font-family: var(--serif); font-weight: 500;
  font-size: 48px; line-height: 1.1; letter-spacing: -1px;
  color: var(--ink); margin-bottom: 16px;
}
h1.display-sm, .display-sm {
  font-family: var(--serif); font-weight: 500;
  font-size: 32px; line-height: 1.2; letter-spacing: -0.4px;
  color: var(--ink); margin-bottom: 12px;
}
.lede { font-size: 16px; color: var(--body); max-width: 60ch; margin-bottom: 32px; }
.section-title {
  font-family: var(--serif); font-weight: 500;
  font-size: 24px; letter-spacing: -0.3px; color: var(--ink);
  margin: 48px 0 16px;
}
.kbd-combo {
  font-family: var(--mono); font-size: 14px;
  background: var(--surface-card); color: var(--ink);
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm); padding: 2px 8px; white-space: nowrap;
}

/* ---------- stat cards (cream feature cards) ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }
.stat-card {
  background: var(--surface-card);
  border-radius: var(--r-lg);
  padding: 20px;
}
.stat-value {
  font-family: var(--serif); font-weight: 500;
  font-size: 34px; letter-spacing: -0.5px; color: var(--ink); line-height: 1.1;
}
.stat-label { font-size: 13px; font-weight: 500; color: var(--muted); margin-top: 4px; }

/* ---------- dark product card ---------- */
.dark-card {
  display: flex; align-items: center; gap: 24px;
  background: var(--surface-dark);
  border-radius: var(--r-lg);
  padding: 32px;
  margin-bottom: 8px;
}
.dark-card-title {
  font-family: var(--serif); font-size: 24px; font-weight: 500;
  letter-spacing: -0.3px; color: var(--on-dark); margin-bottom: 8px;
}
.dark-card-body { font-size: 14px; color: var(--on-dark-soft); max-width: 52ch; }
.dark-card-text { flex: 1; }
.model-status { font-family: var(--mono); font-size: 12px; color: var(--accent-teal); margin-top: 10px; min-height: 16px; }

.mic-button {
  flex: none; width: 72px; height: 72px; border-radius: 50%;
  background: var(--primary); color: var(--on-primary);
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s ease, transform .12s ease;
}
.mic-button:hover { background: var(--primary-active); }
.mic-button:active { transform: scale(0.96); }
.mic-button.recording { background: var(--error); animation: micpulse 1.4s ease-in-out infinite; }
@keyframes micpulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(204,120,92,0.4); }
  50% { box-shadow: 0 0 0 14px rgba(204,120,92,0); }
}

/* ---------- notes ---------- */
.note-list { display: flex; flex-direction: column; gap: 10px; }
.note-card {
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: 16px 20px;
}
.note-text { color: var(--body-strong); white-space: pre-wrap; word-break: break-word; }
.note-meta {
  display: flex; align-items: center; gap: 14px;
  font-size: 12px; font-weight: 500; color: var(--muted-soft);
  margin-top: 10px;
}
.note-meta .spacer { flex: 1; }
.note-action {
  background: transparent; border: none; cursor: pointer;
  font-size: 12px; font-weight: 500; color: var(--primary);
  padding: 2px 4px;
}
.note-action:hover { text-decoration: underline; }
.note-action.danger { color: var(--muted-soft); }
.note-action.danger:hover { color: var(--error); }
.empty { color: var(--muted-soft); font-size: 14px; padding: 32px 0; display: none; }

.page-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 24px; flex-wrap: wrap;
}
.head-actions { display: flex; gap: 10px; }

/* ---------- forms ---------- */
.input {
  font-family: var(--sans); font-size: 15px; color: var(--ink);
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: 9px 14px; height: 40px; outline: none;
  width: 100%;
}
textarea.input { height: auto; resize: vertical; }
.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(204, 120, 92, 0.15);
}
select.input { appearance: auto; }

.btn-primary {
  font-family: var(--sans); font-size: 14px; font-weight: 500;
  color: var(--on-primary); background: var(--primary);
  border: none; border-radius: var(--r-md);
  padding: 0 20px; height: 40px; cursor: pointer; white-space: nowrap;
}
.btn-primary:hover, .btn-primary:active { background: var(--primary-active); }
.btn-secondary {
  font-family: var(--sans); font-size: 14px; font-weight: 500;
  color: var(--ink); background: var(--canvas);
  border: 1px solid var(--hairline); border-radius: var(--r-md);
  padding: 0 20px; height: 40px; cursor: pointer; white-space: nowrap;
}
.btn-secondary:hover { background: var(--surface-soft); }

.row-form { display: flex; gap: 10px; margin-bottom: 24px; }
.row-form.snip { flex-direction: column; align-items: flex-start; max-width: 560px; }
.row-form.snip .btn-primary { align-self: flex-start; }

/* ---------- pill table (dictionary / snippets) ---------- */
.pill-table { display: flex; flex-direction: column; gap: 8px; }
.pill-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface-soft);
  border-radius: var(--r-lg);
  padding: 12px 18px;
}
.pill-row .word { font-weight: 500; color: var(--ink); }
.pill-row .arrow { color: var(--muted-soft); }
.pill-row .replacement { color: var(--body); flex: 1; white-space: pre-wrap; word-break: break-word; }
.pill-row .remove {
  background: transparent; border: none; cursor: pointer;
  color: var(--muted-soft); font-size: 14px; padding: 2px 6px;
}
.pill-row .remove:hover { color: var(--error); }

/* ---------- settings ---------- */
.card {
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: 24px;
  display: flex; flex-direction: column; gap: 18px;
  max-width: 560px;
}
.field label {
  display: block; font-size: 13px; font-weight: 500;
  color: var(--muted); margin-bottom: 6px;
}
.field.check label {
  display: flex; align-items: center; gap: 10px;
  font-size: 14px; color: var(--body-strong); margin: 0; cursor: pointer;
}
.field.check input { accent-color: var(--primary); width: 16px; height: 16px; }
.settings-note { font-size: 13px; color: var(--muted-soft); margin-top: 16px; min-height: 18px; }

/* ---------- toast ---------- */
#toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 50;
  background: var(--surface-dark); color: var(--on-dark);
  font-size: 14px; border-radius: var(--r-lg);
  padding: 14px 20px; max-width: 380px;
  opacity: 0; transform: translateY(8px); pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
#toast.show { opacity: 1; transform: translateY(0); }
#toast.error { border-left: 3px solid var(--error); }

/* ---------- dictation result ---------- */
.result-box {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--surface-dark-elevated);
  border-radius: var(--r-md);
  padding: 14px 16px; margin-top: 14px;
}
.result-text {
  flex: 1; color: var(--on-dark);
  font-size: 15px; white-space: pre-wrap; word-break: break-word;
}
.result-copy {
  flex: none; background: transparent; border: 1px solid var(--on-dark-soft);
  color: var(--on-dark); font-family: var(--sans); font-size: 12px; font-weight: 500;
  border-radius: var(--r-sm); padding: 4px 10px; cursor: pointer;
}
.result-copy:hover { border-color: var(--on-dark); }

/* ---------- responsive ---------- */
@media (max-width: 1024px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .page-inner { padding: 40px 28px 72px; }
}

@media (max-width: 720px) {
  #app { flex-direction: column; height: auto; min-height: 100vh; }
  #sidebar {
    width: 100%; border-right: none;
    border-bottom: 1px solid var(--hairline-soft);
    padding: 16px 16px 12px;
  }
  #nav { flex-direction: row; flex-wrap: wrap; }
  .brand { padding-bottom: 12px; }
  .sidebar-foot { display: none; }
  #main { overflow: visible; }
  h1.display { font-size: 36px; }
  .dark-card { flex-direction: column; align-items: stretch; }
  .mic-button { align-self: center; }
  .row-form { flex-wrap: wrap; }
}

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-thumb { background: var(--surface-cream-strong); border-radius: 5px; }
::-webkit-scrollbar-track { background: transparent; }
