/* SAL-16 Jot — Epix OS design tokens (DESIGN.md is source of truth) */
:root {
  --color-primary: #1f3b61;
  --color-accent: #f28926;
  --color-success: #28a745;
  --color-warning: #e67e00;
  --color-error: #dc3545;
  --color-bg: #f5f7fa;
  --color-surface: #ffffff;
  --color-border: #e2e6ea;
  --color-text: #1a1a2e;
  --color-text-muted: #6b7280;
  --amber-tint: #fff7ec;
  --green-tint: #f0faf2;
  --font-body: 'Hanken Grotesk', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius: 4px;
  --radius-pill: 999px;
  --nav-h: 64px;
}
[data-theme="dark"] {
  --color-bg: #0a1018;
  --color-surface: #0f1923;
  --color-border: #2a3a4a;
  --color-text: #ffffff;
  --color-text-muted: #a0aab4;
  --amber-tint: #2a1f0e;
  --green-tint: #0e2415;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 16px;
  line-height: 1.5;
}
#app { min-height: 100%; display: flex; flex-direction: column; max-width: 520px; margin: 0 auto; }

/* header */
.hdr {
  background: var(--color-primary); color: #fff;
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; padding-top: max(14px, env(safe-area-inset-top));
  position: sticky; top: 0; z-index: 10;
}
.hdr img { width: 32px; height: 32px; }
.hdr .t { font-weight: 700; font-size: 20px; letter-spacing: -0.01em; }
.hdr .spacer { flex: 1; }
.badge {
  font-family: var(--font-mono); font-size: 12px; font-weight: 500;
  padding: 3px 10px; border-radius: var(--radius-pill);
}
.badge.amber { background: rgba(230,126,0,.18); color: #ffd9a8; border: 1px solid rgba(242,137,38,.5); }
.badge.ok { background: rgba(40,167,69,.18); color: #b8e6c4; }

/* layout */
.page { flex: 1; padding: 16px 20px calc(var(--nav-h) + 24px); display: flex; flex-direction: column; gap: 16px; }
.center { align-items: center; justify-content: center; text-align: center; }
.card {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius); padding: 16px; width: 100%;
}
.card h3 {
  font-family: var(--font-mono); font-size: 12px; font-weight: 500;
  color: var(--color-text-muted); text-transform: uppercase; letter-spacing: .06em;
  margin-bottom: 12px;
}
.muted { color: var(--color-text-muted); font-size: 14px; }
.mono { font-family: var(--font-mono); font-size: 12px; }

/* record button */
.rec-wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 24px 0 8px; }
.rec-btn {
  width: 148px; height: 148px; border-radius: 50%; border: none;
  background: var(--color-accent); color: #fff; font-size: 52px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 30px rgba(242,137,38,.35); cursor: pointer;
  transition: transform .1s ease; touch-action: none; user-select: none;
}
.rec-btn:active, .rec-btn.recording { transform: scale(.96); }
.rec-btn.recording { animation: pulse 1.2s infinite; background: var(--color-error); }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(220,53,69,.4);} 50% { box-shadow: 0 0 0 22px rgba(220,53,69,0);} }
.rec-timer { font-family: var(--font-mono); font-size: 14px; color: var(--color-text-muted); min-height: 20px; }

/* inputs */
.inp {
  width: 100%; padding: 12px 14px; border: 1px solid var(--color-border);
  border-radius: var(--radius); background: var(--color-surface); color: var(--color-text);
  font-family: var(--font-body); font-size: 16px;
}
.inp:focus { outline: none; border-color: var(--color-primary); border-width: 2px; padding: 11px 13px; }
.inp-row { display: flex; gap: 8px; width: 100%; }
label.f-label {
  font-family: var(--font-mono); font-size: 11px; font-weight: 500;
  color: var(--color-text-muted); text-transform: uppercase; letter-spacing: .05em;
  display: block; margin-bottom: 4px;
}
.field { margin-bottom: 12px; position: relative; }
.field.ai .inp { border-left: 3px solid var(--color-success); background: var(--green-tint); }
.field.missing .inp { border-left: 3px solid var(--color-warning); background: var(--amber-tint); }
.field .miss-tag {
  position: absolute; right: 8px; top: 0;
  font-family: var(--font-mono); font-size: 10px; color: var(--color-warning);
}

/* buttons + chips */
.btn {
  border: none; border-radius: var(--radius-pill); cursor: pointer;
  font-family: var(--font-body); font-weight: 600; font-size: 16px;
  padding: 14px 24px; width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .08s ease;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--color-accent); color: #fff; }
.btn.ghost { background: transparent; color: var(--color-primary); border: 1px solid var(--color-border); }
[data-theme="dark"] .btn.ghost { color: #fff; }
.btn.quiet { background: transparent; color: var(--color-text-muted); font-weight: 500; }
.btn:disabled { opacity: .5; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.stack { flex-direction: column; }
.chip {
  border: 1px solid var(--color-border); border-radius: var(--radius-pill);
  background: var(--color-surface); color: var(--color-text);
  padding: 10px 16px; font-size: 15px; cursor: pointer; text-align: center;
  transition: all .12s ease;
}
.chips.stack .chip { width: 100%; padding: 14px 16px; }
.chip.sel { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.chip.sm { padding: 6px 12px; font-size: 13px; }
.chip.mono { font-family: var(--font-mono); font-size: 11px; }
.chip.amber { border-color: var(--color-warning); color: var(--color-warning); background: var(--amber-tint); }

/* discovery */
.disc-progress { display: flex; align-items: center; gap: 10px; }
.disc-progress .bar { flex: 1; height: 4px; background: var(--color-border); border-radius: 2px; overflow: hidden; }
.disc-progress .bar i { display: block; height: 100%; background: var(--color-accent); transition: width .3s; }
.disc-q { font-size: 22px; font-weight: 600; line-height: 1.3; margin: 8px 0 16px; }

/* sticky submit */
.sticky-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  max-width: 520px; margin: 0 auto;
  padding: 10px 20px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, var(--color-bg) 30%);
}
.sticky-bar .cap { text-align: center; font-family: var(--font-mono); font-size: 11px; color: var(--color-warning); margin-bottom: 6px; }

/* bottom nav */
.nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 15;
  max-width: 520px; margin: 0 auto; height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  background: var(--color-surface); border-top: 1px solid var(--color-border);
  display: flex; padding-bottom: env(safe-area-inset-bottom);
}
.nav button {
  flex: 1; border: none; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--color-text-muted); font-family: var(--font-mono); font-size: 11px; position: relative;
}
.nav button.active { color: var(--color-accent); }
.nav button .ic { font-size: 22px; }
.nav .nbadge {
  position: absolute; top: 8px; right: calc(50% - 22px);
  background: var(--color-error); color: #fff; font-size: 10px;
  border-radius: var(--radius-pill); min-width: 16px; height: 16px; line-height: 16px;
}

/* tray */
.tray-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--color-border); cursor: pointer; }
.tray-item:last-child { border-bottom: none; }
.tray-item .grow { flex: 1; min-width: 0; }
.tray-item .nm { font-weight: 600; }
.card.pending { background: var(--amber-tint); border-color: var(--color-warning); }

/* toast + misc */
.toast {
  position: fixed; bottom: calc(var(--nav-h) + 16px); left: 50%; transform: translateX(-50%);
  background: var(--color-primary); color: #fff; padding: 10px 20px;
  border-radius: var(--radius-pill); font-size: 14px; z-index: 50; white-space: nowrap;
  box-shadow: 0 10px 30px rgba(31,59,97,.3);
}
.toast.err { background: var(--color-error); }
.seg { display: flex; border: 1px solid var(--color-border); border-radius: var(--radius-pill); overflow: hidden; }
.seg button { flex: 1; border: none; background: none; padding: 10px 4px; font-size: 14px; color: var(--color-text); cursor: pointer; }
.seg button.sel { background: var(--color-primary); color: #fff; }
.spin { width: 22px; height: 22px; border: 3px solid var(--color-border); border-top-color: var(--color-accent); border-radius: 50%; animation: rot .8s linear infinite; display: inline-block; }
@keyframes rot { to { transform: rotate(360deg); } }
.logo-splash { width: 110px; margin-bottom: 16px; }
a { color: var(--color-accent); }
