/* ============================================================================
   AMETHYST PWA — Liquid Glass · deep-blue dark system.
   Implemented from the Claude Design handoff (Amethyst PWA.html + screens-*.jsx).
   Blue accent, glass surfaces, aurora background. Adapted from the fixed-frame
   mockup to a real full-screen PWA (safe-area insets, 5-tab shell, functional
   classes the app.js render layer relies on).
============================================================================ */

*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  height: 100%;
  width: 100%;
  overflow: hidden;
  /* Blue-tinted base (not flat black) so iOS safe-area regions — the status
     bar at the very top and the home-indicator strip at the very bottom —
     blend into the aurora instead of reading as black bars. */
  background: linear-gradient(178deg, #0d1a44 0%, #081026 44%, #060b18 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ---- design tokens (blue theme baked in) ---- */
body.az {
  --bg0: #03050d;   /* near-black, blue cast */
  --bg1: #070b18;   /* ink */
  --bg2: #081026;   /* deep blue */
  --steel: rgba(60,80,128,0.22);

  --fg:     #eef2fa;
  --fg-mid: #9aa4bd;
  --fg-dim: #6b7491;
  --fg-faint: #49526c;

  --glass:    rgba(70,98,165,0.07);
  --glass-2:  rgba(86,116,190,0.11);
  --glass-3:  rgba(110,142,215,0.15);
  --edge:     rgba(150,178,235,0.16);
  --edge-lo:  rgba(140,168,228,0.085);
  --hairline: rgba(150,178,235,0.07);

  --r-lg: 26px;
  --r:    20px;
  --r-sm: 14px;

  --danger: #ff6a86;
  --ok: #56e0b0;

  /* blue accent (theme-blue) */
  --ac:      #5b93f0;
  --ac-mid:  #2c5fdd;
  --ac-deep: #1431a8;
  --ac-fg:   #ffffff;
  --glow:    rgba(34,72,180,0.40);
  --glow-2:  rgba(18,42,128,0.30);

  --blur: 26px;

  font-family: -apple-system, "SF Pro Text", "SF Pro", system-ui, sans-serif;
  color: var(--fg);
  letter-spacing: -0.01em;
}

/* ============================================================
   Screen shell
   ============================================================ */
.screen { position: fixed; inset: 0; overflow: hidden; background: var(--bg0); }
.screen-bg {
  position: absolute; inset: 0; z-index: 0;
  background:
    radial-gradient(122% 74% at 50% -24%, var(--glow) 0%, transparent 48%),
    radial-gradient(60% 44% at 84% 4%, color-mix(in oklab, var(--ac) 26%, transparent) 0%, transparent 54%),
    radial-gradient(64% 52% at 6% 102%, var(--glow-2) 0%, transparent 56%),
    radial-gradient(120% 96% at 50% 48%, rgba(22,44,104,0.20) 0%, transparent 68%),
    linear-gradient(178deg, #0d1a44 0%, var(--bg2) 24%, var(--bg1) 58%, var(--bg0) 100%);
}
.screen-bg::before {
  content: ""; position: absolute; inset: 0; opacity: 0.05;
  mix-blend-mode: overlay; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.screen-bg::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(150% 64% at 50% 132%, rgba(0,0,0,0.30), transparent 62%),
    radial-gradient(130% 92% at 50% -10%, rgba(0,0,0,0.32), transparent 44%);
}
.screen-scroll {
  position: absolute; inset: 0; z-index: 2;
  overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding:
    calc(env(safe-area-inset-top) + 20px)
    max(env(safe-area-inset-right), 20px)
    calc(env(safe-area-inset-bottom) + 124px)
    max(env(safe-area-inset-left), 20px);
  /* nothing peeks below the floating tab-bar island */
  -webkit-mask-image: linear-gradient(180deg, #000 calc(100% - 112px), transparent calc(100% - 88px));
  mask-image: linear-gradient(180deg, #000 calc(100% - 112px), transparent calc(100% - 88px));
}
.screen-scroll::-webkit-scrollbar { display: none; }

/* one scroll area holds all tabs; only the active one shows */
.tab { display: none; }
.tab.active { display: block; animation: fadeIn .22s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
/* record tab pushes its stage into the upper-middle (not glued to the top) */
#tab-record.tab.active { display: flex; flex-direction: column; }

/* ---- aurora shimmer ---- */
.aurora {
  position: absolute; z-index: 0; pointer-events: none;
  width: 130%; height: 60%; left: -15%; border-radius: 50%;
  filter: blur(46px); will-change: transform, opacity; mix-blend-mode: screen;
}
.aurora.a1 { top: -8%; background: radial-gradient(circle at 50% 50%, var(--glow), transparent 68%); animation: drift1 38s ease-in-out infinite; }
.aurora.a2 { top: 30%; background: radial-gradient(circle at 50% 50%, var(--glow-2), transparent 68%); animation: drift2 46s ease-in-out infinite; }
/* Calm, slow drift with near-constant opacity. The old version pulsed opacity
   .55→.85 / .4→.7 over 17–23s, which read as a cheap "blinking" shimmer; this
   keeps the glow steady and the motion gentle for a more premium feel. */
@keyframes drift1 { 0%,100% { transform: translate3d(-6%,0,0) scale(1.02); opacity:.6; } 50% { transform: translate3d(6%,4%,0) scale(1.08); opacity:.66; } }
@keyframes drift2 { 0%,100% { transform: translate3d(8%,3%,0) scale(1.04); opacity:.46; } 50% { transform: translate3d(-7%,-4%,0) scale(1); opacity:.52; } }

/* ---- large title header ---- */
.lg-title { font-size: 32px; font-weight: 800; letter-spacing: -0.025em; margin: 4px 0 2px; line-height: 1.05; }
.lg-sub { font-size: 14px; color: var(--fg-dim); margin: 0 0 4px; font-weight: 480; }
.ic { width: 18px; height: 18px; flex: 0 0 auto; vertical-align: middle; }
.row { display: flex; align-items: center; }
.between { justify-content: space-between; }
.gap-s { gap: 10px; }

/* ============================================================
   Liquid glass primitive
   ============================================================ */
.glass {
  position: relative; isolation: isolate;
  background:
    linear-gradient(177deg, rgba(104,134,200,0.13) 0%, rgba(58,80,148,0.07) 46%, rgba(34,50,100,0.05) 100%),
    rgba(18,28,56,0.42);
  backdrop-filter: blur(var(--blur)) saturate(135%) brightness(0.97);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(135%) brightness(0.97);
  border-radius: var(--r);
  box-shadow:
    inset 0 1px 0 rgba(190,212,255,0.14),
    inset 0 0 26px rgba(40,70,150,0.05),
    inset 0 -30px 48px rgba(1,4,14,0.42),
    0 1px 1px rgba(0,2,12,0.4),
    0 3px 10px rgba(0,0,0,0.34),
    0 24px 56px rgba(0,1,8,0.62);
}
.glass::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  padding: 1px; pointer-events: none; z-index: 2;
  background: linear-gradient(150deg, rgba(190,210,255,0.32) 0%, rgba(150,178,235,0.06) 28%, rgba(255,255,255,0) 54%, rgba(50,90,200,0.12) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
.glass::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 1;
  background:
    radial-gradient(120% 60% at 22% -14%, rgba(170,198,255,0.07), transparent 56%),
    linear-gradient(180deg, rgba(160,190,255,0.035), rgba(255,255,255,0) 30%);
  mask: linear-gradient(180deg, #000, transparent 50%);
}
.glass > * { position: relative; z-index: 1; }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-family: inherit; font-size: 15px; font-weight: 600;
  border-radius: 13px; border: 0; cursor: pointer;
  padding: 11px 16px; min-height: 44px; box-sizing: border-box;
  color: var(--fg); letter-spacing: -0.01em;
  transition: transform .12s ease, filter .12s ease, opacity .12s ease;
}
.btn:active { transform: scale(0.965); }
.btn .ic { width: 18px; height: 18px; flex: 0 0 auto; }
.btn-primary {
  color: var(--ac-fg);
  background: linear-gradient(180deg, color-mix(in oklab, var(--ac-mid) 88%, #5a78b0) 0%, var(--ac-deep) 100%);
  box-shadow: inset 0 1px 0 rgba(190,212,255,0.30), inset 0 -10px 18px rgba(0,4,30,0.34), 0 1px 1px rgba(0,2,12,0.4), 0 10px 22px var(--glow-2);
}
.btn-ghost {
  background: linear-gradient(180deg, rgba(108,138,200,0.20), rgba(70,96,160,0.12)), rgba(20,30,58,0.5);
  color: var(--fg);
  backdrop-filter: blur(16px) saturate(130%); -webkit-backdrop-filter: blur(16px) saturate(130%);
  box-shadow: inset 0 1px 0 rgba(190,212,255,0.16), inset 0 -7px 14px rgba(0,2,14,0.28), inset 0 0 0 1px var(--edge-lo), 0 1px 1px rgba(0,2,12,0.3), 0 6px 16px rgba(0,1,8,0.42);
}
.btn-ghost:disabled, .btn:disabled { color: var(--fg-faint); opacity: 0.5; cursor: default; }
.btn-block, .btn.full { width: 100%; }

.icon-btn {
  width: 36px; height: 36px; border-radius: 50%; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(124,154,214,0.12); color: var(--fg-mid); cursor: pointer; padding: 0; border: 0;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  transition: transform .12s ease, background .15s ease;
}
.icon-btn:hover { background: rgba(124,154,214,0.18); }
.icon-btn:active { transform: scale(0.9); }
.icon-btn .ic { width: 18px; height: 18px; }
.icon-btn-danger { color: var(--danger); background: rgba(255,106,134,0.13); }
.icon-btn-danger:hover { background: rgba(255,106,134,0.20); }
.az button:focus, .az button:focus-visible { outline: none; }

/* native iOS-style nav-bar buttons */
.navbar { display: flex; align-items: center; justify-content: space-between; min-height: 44px; margin: -6px -6px 14px; position: relative; }
.nav-btn { display: inline-flex; align-items: center; gap: 1px; background: none; border: 0; cursor: pointer; padding: 6px; min-height: 44px; font-family: inherit; font-size: 17px; font-weight: 400; letter-spacing: -0.02em; color: var(--ac); transition: opacity .12s ease; }
.nav-btn:active { opacity: 0.35; }
.nav-btn .ic { width: 22px; height: 22px; }
.nav-btn.back .ic { width: 25px; height: 25px; margin-right: -1px; }
.nav-btn-danger { color: var(--danger); }
.nav-actions { display: flex; align-items: center; gap: 16px; }
.nav-center { font-size: 13px; color: var(--fg-dim); font-weight: 500; display: inline-flex; align-items: center; gap: 6px; position: absolute; left: 50%; transform: translateX(-50%); }
.nav-center::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.nav-center.saving::before { background: var(--ac); box-shadow: 0 0 8px var(--ac); }
.nav-center.error::before { background: var(--danger); box-shadow: 0 0 8px var(--danger); }

/* settings → modes nav row */
.nav-row { display: flex; align-items: center; gap: 12px; padding: 14px 15px; cursor: pointer; }
.nav-row .lead { width: 36px; height: 36px; border-radius: 11px; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; color: var(--ac); background: color-mix(in oklab, var(--ac) 15%, transparent); }
.nav-row .lead .ic { width: 19px; height: 19px; }
.nav-row .chev { margin-left: auto; color: var(--fg-faint); }
.nav-row .chev .ic { width: 17px; height: 17px; }

/* ============================================================
   Bottom tab bar — floating liquid glass
   ============================================================ */
.tabbar {
  position: fixed; z-index: 8;
  left: 14px; right: 14px; bottom: calc(env(safe-area-inset-bottom) + 14px);
  max-width: 520px; margin: 0 auto;
  height: 64px; border-radius: 30px;
  display: flex; align-items: center; justify-content: space-around; padding: 0 6px;
  background: linear-gradient(177deg, rgba(90,120,190,0.08), rgba(6,11,28,0.3)), rgba(6,10,24,0.74);
  backdrop-filter: blur(calc(var(--blur) + 6px)) saturate(150%);
  -webkit-backdrop-filter: blur(calc(var(--blur) + 6px)) saturate(150%);
  box-shadow: inset 0 1px 0 rgba(170,198,255,0.10), inset 0 0 0 1px var(--edge-lo), 0 18px 44px rgba(0,1,8,0.7);
}
.tab-item {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  flex: 1; color: var(--fg-dim); font-size: 10px; font-weight: 560; letter-spacing: 0;
  padding: 4px 2px 2px; background: none; border: 0; cursor: pointer; font-family: inherit;
  transition: color .15s ease, transform .1s ease;
}
.tab-item:active { transform: scale(0.92); }
.tab-item .ic { width: 24px; height: 24px; }
.tab-item.active { color: var(--ac); }

/* ============================================================
   Record stage
   ============================================================ */
.rec-stage { display: flex; flex-direction: column; align-items: center; margin-top: clamp(40px, 12vh, 120px); }
.rec-btn {
  position: relative; width: 168px; height: 168px; border-radius: 50%; border: 0; cursor: pointer; padding: 0;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(120% 120% at 32% 22%, rgba(150,185,255,0.22), transparent 52%),
    linear-gradient(158deg, var(--ac-mid), var(--ac-deep) 96%);
  box-shadow: inset 0 2px 1px rgba(180,205,255,0.32), inset 0 -18px 34px rgba(0,4,30,0.5), 0 0 0 1px var(--edge), 0 24px 60px var(--glow-2), 0 0 64px var(--glow-2);
  color: #fff;
  transition: transform .14s ease;
}
.rec-btn::before, .rec-btn::after { content: ""; position: absolute; inset: -2px; border-radius: 50%; z-index: 0; opacity: 0; pointer-events: none; mix-blend-mode: screen; transition: opacity .5s ease; }
.rec-btn::before { background: conic-gradient(from 0deg, #1431a8, #2c5fdd, #2aa6f0, #36d3e0, #6f9ef0, #8a7cf0, #b06ae8, #2c5fdd, #1431a8); filter: blur(3px) saturate(1.2); }
.rec-btn::after { background: conic-gradient(from 140deg, transparent, #36d3e0, transparent, #8a7cf0, transparent, #2aa6f0, transparent); filter: blur(6px) saturate(1.25); }
.rec-btn.recording::before { opacity: 0.6; animation: sheen 13s linear infinite; }
.rec-btn.recording::after  { opacity: 0.42; animation: sheen 19s linear infinite reverse; }
@keyframes sheen { to { transform: rotate(360deg); } }
.rec-btn .ic { width: 58px; height: 58px; position: relative; z-index: 1; }
/* mic/stop glyph swap driven by .recording */
.rec-btn .rec-ic-stop { display: none; }
.rec-btn.recording .rec-ic-mic { display: none; }
.rec-btn.recording .rec-ic-stop { display: block; }
.rec-ring { position: absolute; inset: -14px; border-radius: 50%; border: 1.5px solid var(--ac); opacity: 0; z-index: -1; }
.rec-btn:not(.recording) { animation: breathe 3.4s ease-in-out infinite; }
@keyframes breathe { 0%,100% { transform: scale(1); filter: brightness(1); } 50% { transform: scale(1.035); filter: brightness(1.08); } }
.rec-btn.recording ~ .rec-ring,
.rec-stage.recording .rec-ring { animation: ripple 2s ease-out infinite; }
.rec-stage.recording .rec-ring.r2 { animation-delay: 1s; }
@keyframes ripple { 0% { opacity: 0.55; transform: scale(1); } 100% { opacity: 0; transform: scale(1.28); } }

.timer { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; font-size: 40px; font-weight: 300; letter-spacing: 0.01em; margin-top: 26px; color: var(--fg); }
.status { font-size: 14px; color: var(--fg-dim); margin-top: 6px; min-height: 18px; text-align: center; white-space: pre-line; }
.status.status-ac { color: var(--ac); }

.wave { display: flex; align-items: center; gap: 5px; height: 26px; margin-top: 16px; opacity: 0; transition: opacity .25s ease; }
.rec-stage.recording .wave { opacity: 1; }
.wave span { width: 4px; height: 8px; border-radius: 2px; background: var(--ac); animation: bounce 1s ease-in-out infinite; }
.wave span:nth-child(2){animation-delay:.15s} .wave span:nth-child(3){animation-delay:.3s}
.wave span:nth-child(4){animation-delay:.45s} .wave span:nth-child(5){animation-delay:.6s}
.wave span:nth-child(6){animation-delay:.3s} .wave span:nth-child(7){animation-delay:.15s}
@keyframes bounce { 0%,100%{height:8px;opacity:.5} 50%{height:24px;opacity:1} }

/* Done indicator row (appears after transcription above the result card) */
.result-done-row { margin-bottom: 0; }
.result-done-check {
  width: 44px; height: 44px; border-radius: 50%; display: flex;
  align-items: center; justify-content: center; color: var(--ac);
  background: var(--glass-2); box-shadow: inset 0 0 0 1px var(--edge-lo); flex: 0 0 auto;
}
.result-done-check .ic { width: 22px; height: 22px; }

/* iOS activity indicator — 8 tapering spokes */
.ios-spinner { position: relative; display: inline-block; flex: none; width: 15px; height: 15px; color: var(--fg-dim); }
.ios-spinner i { position: absolute; inset: 0; transform: rotate(calc(var(--n) * 45deg)); }
.ios-spinner i::after { content: ""; position: absolute; top: 0; left: 50%; width: 1.7px; height: 4.4px; border-radius: 1px; background: currentColor; transform: translateX(-50%); animation: iosSpoke 0.8s linear infinite; animation-delay: calc(var(--n) * -0.1s); }
@keyframes iosSpoke { 0% { opacity: 1; } 100% { opacity: 0.16; } }
@media (prefers-reduced-motion: reduce) { .ios-spinner i::after { animation: none; opacity: 0.45; } }

/* ============================================================
   Result card
   ============================================================ */
.result-card { padding: 18px; margin-top: 6px; }
.result-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: 11.5px; color: var(--fg-dim); margin-bottom: 12px; }
.meta-pill { background: var(--glass-2); padding: 3px 8px; border-radius: 8px; font-weight: 560; color: var(--fg-mid); box-shadow: inset 0 0 0 1px var(--edge-lo); }
.meta-pill.ac { color: var(--ac); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--ac) 34%, transparent); }
.result-text { font-size: 16.5px; line-height: 1.55; color: var(--fg); margin-bottom: 16px; font-weight: 420; white-space: pre-wrap; overflow-wrap: anywhere; }

.seg-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--fg-dim); font-weight: 680; margin-bottom: 7px; display: block; }
.seg { display: flex; gap: 3px; padding: 3px; border-radius: 12px; background: rgba(2,6,20,0.4); box-shadow: inset 0 0 0 1px var(--hairline); }
.seg-btn { flex: 1; border: 0; cursor: pointer; padding: 8px 4px; border-radius: 9px; font-family: inherit; font-size: 13px; font-weight: 600; background: transparent; color: var(--fg-mid); transition: all .15s; }
.seg-btn.active { background: var(--glass-3); color: var(--fg); box-shadow: inset 0 1px 0 rgba(170,198,255,0.10), 0 2px 8px rgba(0,1,8,0.5); }
.seg-btn.ac.active, .source-btn.active { color: var(--ac); }
.seg-btn:disabled { color: var(--fg-faint); opacity: 0.5; cursor: default; }
.seg-block { margin-bottom: 14px; }

.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.action-grid .span2 { grid-column: 1 / -1; }

/* ============================================================
   Search bar
   ============================================================ */
.search-bar { display: flex; align-items: center; gap: 9px; padding: 0 13px; height: 44px; border-radius: 14px; margin-bottom: 14px; background: var(--glass-2); box-shadow: inset 0 0 0 1px var(--edge-lo), inset 0 1px 0 rgba(255,255,255,0.08); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.search-bar .ic { width: 18px; height: 18px; color: var(--fg-dim); flex: 0 0 auto; }
.search-bar input { flex: 1; background: transparent; border: 0; outline: none; color: var(--fg); font-family: inherit; font-size: 15px; padding: 0; }
.search-bar input::placeholder { color: var(--fg-dim); }
.search-bar .icon-btn { width: 30px; height: 30px; background: transparent; }

/* ============================================================
   List cards (history / notes)
   ============================================================ */
.list { display: flex; flex-direction: column; gap: 10px; list-style: none; padding: 0; margin: 0; }
.list-card { padding: 14px 15px; cursor: pointer; }
.lc-top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.lc-time { font-size: 12px; color: var(--fg-dim); font-weight: 560; }
.lc-snippet { font-size: 14.5px; line-height: 1.45; color: var(--fg); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.lc-title { font-size: 16px; font-weight: 680; margin-bottom: 4px; color: var(--fg); }
.tag { margin-left: auto; font-size: 10.5px; font-weight: 680; letter-spacing: 0.03em; text-transform: uppercase; padding: 3px 7px; border-radius: 7px; color: var(--ac); background: color-mix(in oklab, var(--ac) 16%, transparent); }
.tag.neutral { color: var(--fg-dim); background: var(--glass-2); }
.day-h { font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--fg-dim); font-weight: 720; margin: 18px 4px 9px; }
.day-h:first-of-type { margin-top: 4px; }
.mini-meta { display: flex; align-items: center; gap: 7px; margin-top: 9px; font-size: 11.5px; color: var(--fg-dim); font-weight: 540; }
.mini-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--fg-faint); flex: 0 0 auto; }
.mini-wave { display: inline-flex; align-items: flex-end; gap: 2px; height: 13px; }
.mini-wave i { width: 2.5px; border-radius: 2px; background: color-mix(in oklab, var(--ac) 62%, transparent); }
.queued-h { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ac); font-weight: 700; margin: 2px 2px 8px; }
.progress, .note-progress { height: 5px; border-radius: 3px; background: rgba(255,255,255,0.1); overflow: hidden; margin-top: 8px; }
.progress > i, .note-progress-bar { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--ac-mid), var(--ac)); }
.note-progress-text { font-size: 11px; color: var(--ac); letter-spacing: 0.02em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.spin { animation: spin 1.4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   Forms / fields
   ============================================================ */
.field-label { font-size: 13px; font-weight: 620; color: var(--fg-mid); margin: 0 0 7px; display: block; }
.field-hint { color: var(--fg-faint); font-weight: 480; }
.input, .textarea, select.selectbox, textarea.textarea, input.input {
  width: 100%; box-sizing: border-box; font-family: inherit;
  background: rgba(2,6,20,0.38); box-shadow: inset 0 0 0 1px var(--hairline);
  border: 0; border-radius: 12px; color: var(--fg); font-size: 15px; padding: 12px 13px;
  -webkit-appearance: none; appearance: none; outline: none;
  transition: box-shadow .15s ease;
}
.input:focus, .textarea:focus, select.selectbox:focus, textarea.textarea:focus, input.input:focus {
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--ac) 55%, transparent), 0 0 0 3px var(--glow-2);
}
.input::placeholder, .textarea::placeholder { color: var(--fg-faint); }
textarea.textarea { min-height: 86px; line-height: 1.6; resize: vertical; }
select.selectbox {
  background-image:
    linear-gradient(45deg, transparent 50%, var(--fg-dim) 50%),
    linear-gradient(135deg, var(--fg-dim) 50%, transparent 50%);
  background-position: calc(100% - 19px) 52%, calc(100% - 14px) 52%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 34px;
}
.field + .field { margin-top: 14px; }
.card-pad { padding: 16px; }
.card-pad + .card-pad { margin-top: 12px; }
.hint { font-size: 12.5px; color: var(--fg-dim); line-height: 1.5; }

/* usage grid */
.usage-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }
.usage-item { background: rgba(2,6,20,0.3); box-shadow: inset 0 0 0 1px var(--hairline); border-radius: 14px; padding: 12px 13px; }
.usage-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--fg-dim); font-weight: 640; }
.usage-value { font-size: 23px; font-weight: 760; color: var(--fg); margin-top: 5px; font-variant-numeric: tabular-nums; }
.usage-sub { font-size: 11.5px; color: var(--fg-faint); margin-top: 1px; }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; list-style: none; padding: 0; }
.chip { font-size: 12px; font-weight: 560; padding: 5px 9px; border-radius: 8px; background: var(--glass-2); box-shadow: inset 0 0 0 1px var(--edge-lo); color: var(--fg-mid); }

/* collapse rows */
.collapse { display: flex; align-items: center; justify-content: space-between; padding: 14px 15px; cursor: pointer; }
.collapse .ic { width: 16px; height: 16px; color: var(--fg-dim); transition: transform .2s ease; }
.collapse.open .ic.chev { transform: rotate(180deg); }

/* ============================================================
   Modes & models
   ============================================================ */
.mode-card { padding: 16px; }
.mode-head { display: flex; align-items: flex-start; gap: 12px; }
.mode-ic { width: 42px; height: 42px; border-radius: 13px; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; color: var(--ac); background: color-mix(in oklab, var(--ac) 16%, transparent); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--ac) 30%, transparent); }
.mode-ic .ic { width: 22px; height: 22px; }
.mode-title { font-size: 16.5px; font-weight: 720; color: var(--fg); }
.mode-desc { font-size: 13px; color: var(--fg-dim); line-height: 1.5; margin-top: 2px; }
.mode-model { display: flex; align-items: center; gap: 7px; margin-top: 13px; font-size: 12.5px; color: var(--fg-mid); font-weight: 600; }
.mode-model .ic { width: 15px; height: 15px; color: var(--ac); }
.model-tag { font-family: "SF Mono", ui-monospace, monospace; font-size: 12px; color: var(--fg); background: rgba(2,6,20,0.4); padding: 2px 7px; border-radius: 7px; box-shadow: inset 0 0 0 1px var(--hairline); letter-spacing: -0.02em; }
.limit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin-top: 14px; border-radius: 12px; overflow: hidden; box-shadow: inset 0 0 0 1px var(--hairline); background: var(--hairline); }
.limit-cell { background: rgba(6,10,24,0.55); padding: 9px 11px; }
.limit-k { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--fg-dim); font-weight: 660; }
.limit-v { font-size: 14px; font-weight: 680; color: var(--fg); margin-top: 2px; font-variant-numeric: tabular-nums; }
.instr { margin-top: 13px; border-radius: 12px; padding: 12px 13px; background: rgba(2,6,20,0.42); box-shadow: inset 0 0 0 1px var(--hairline); }
.instr-h { display: flex; align-items: center; gap: 7px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ac); font-weight: 700; }
.instr-h .ic { width: 14px; height: 14px; }
.instr-body { font-size: 12.5px; line-height: 1.6; color: var(--fg-mid); margin-top: 8px; font-family: "SF Mono", ui-monospace, monospace; letter-spacing: -0.02em; white-space: pre-wrap; }

/* ============================================================
   Notes editor
   ============================================================ */
.notes-title-input { font-size: 22px; font-weight: 760; color: var(--fg); background: transparent; border: 0; width: 100%; padding: 0; margin-bottom: 10px; outline: none; font-family: inherit; }
.notes-title-input::placeholder { color: var(--fg-faint); }
.notes-body { width: 100%; box-sizing: border-box; font-size: 16px; line-height: 1.6; color: var(--fg-mid); font-weight: 420; background: transparent; border: 0; outline: none; resize: none; min-height: 46vh; font-family: inherit; }
.pipeline-summary { font-size: 12px; color: var(--fg-dim); margin-top: 14px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.notes-settings-popover { margin-top: 12px; }
.settings-grid { display: grid; grid-template-columns: 92px 1fr; gap: 10px 12px; align-items: center; }
.settings-grid .field-label { margin: 0; }
.mic-fab {
  position: fixed; right: 22px; bottom: calc(env(safe-area-inset-bottom) + 96px); z-index: 7;
  width: 60px; height: 60px; border-radius: 50%; border: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center; color: #fff;
  background: radial-gradient(120% 120% at 32% 22%, rgba(150,185,255,0.22), transparent 52%), linear-gradient(158deg, var(--ac-mid), var(--ac-deep));
  box-shadow: inset 0 1px 0 rgba(170,198,255,0.32), 0 14px 30px var(--glow-2), 0 0 32px var(--glow-2);
  transition: transform .12s ease;
}
.mic-fab:active { transform: scale(0.94); }
.mic-fab .ic { width: 26px; height: 26px; }
.mic-fab.recording { background: radial-gradient(120% 120% at 32% 22%, rgba(255,180,200,0.25), transparent 52%), linear-gradient(158deg, #c43f63, var(--danger)); animation: breathe 1.6s ease-in-out infinite; }

/* dictation overlay */
.notes-rec-overlay { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; background: rgba(2,5,16,0.74); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); cursor: pointer; }
.notes-rec-card { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 32px 40px; position: relative; }
.rec-pulse-ring { position: absolute; width: 132px; height: 132px; border-radius: 50%; border: 2px solid var(--ac); animation: ripple 1.8s ease-out infinite; pointer-events: none; }
.rec-overlay-icon { width: 46px; height: 46px; color: var(--ac); }
.rec-overlay-timer { font-size: 36px; font-weight: 300; color: var(--fg); margin: 0; }
.rec-overlay-status { font-size: 14px; color: var(--fg-dim); margin: 0; }
.save-status { font-size: 13px; color: var(--fg-dim); display: inline-flex; align-items: center; gap: 6px; }

/* ============================================================
   Modal (polish-too-long) + toast
   ============================================================ */
.modal { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(2,5,16,0.62); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); animation: fadeIn .2s ease; }
.modal-card { width: 100%; max-width: 420px; padding: 22px; }
.modal-title { margin: 0 0 8px; font-size: 18px; font-weight: 740; color: var(--fg); }
.modal-message { margin: 0 0 18px; font-size: 14px; line-height: 1.5; color: var(--fg-mid); overflow-wrap: anywhere; }
.modal-actions { display: flex; flex-direction: column; gap: 8px; }
.modal-actions .btn { width: 100%; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom) + 96px); z-index: 45; max-width: calc(100vw - 32px); padding: 12px 18px; border-radius: 14px; color: var(--fg); font-size: 14px; line-height: 1.4; background: linear-gradient(177deg, rgba(104,134,200,0.16), rgba(8,12,30,0.6)), rgba(10,16,36,0.85); backdrop-filter: blur(28px) saturate(150%); -webkit-backdrop-filter: blur(28px) saturate(150%); box-shadow: inset 0 1px 0 rgba(190,212,255,0.16), 0 18px 44px rgba(0,1,8,0.7); animation: toastIn .22s ease both; }
.toast.fading { animation: toastOut .28s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes toastOut { to { opacity: 0; transform: translate(-50%, 8px); } }

/* ---- utilities ---- */
.hidden { display: none !important; }
.muted { color: var(--fg-dim); font-size: 14px; padding: 18px 4px; text-align: center; list-style: none; }

@media (prefers-reduced-motion: reduce) {
  .aurora, .rec-btn, .rec-btn::before, .rec-btn::after, .rec-ring, .wave span, .spin, .mic-fab, .rec-pulse-ring { animation: none !important; }
}
