:root {
  --bg: #0b0d10;
  --bg2: #12151a;
  --bg3: #191d24;
  --line: #262b34;
  --text: #e8ebef;
  --dim: #8a93a0;
  --accent: #2ee6a8;
  --accent-dim: #1a8f68;
  --danger: #ff5d5d;
  --warn: #ffb14d;
  --radius: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; }

[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  display: flex;
  flex-direction: column;
  max-width: 680px;
  margin: 0 auto;
  padding: env(safe-area-inset-top) 0 0;
}

/* header */
.top {
  position: sticky; top: 0; z-index: 5;
  background: linear-gradient(var(--bg) 75%, transparent);
  padding: 14px 16px 8px;
}
.brand { display: flex; align-items: center; gap: 9px; }
.brand-mark {
  width: 13px; height: 13px; border-radius: 4px;
  background: var(--accent);
  box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 60%, transparent);
}
.brand h1 { font-size: 19px; font-weight: 650; letter-spacing: .04em; }
.sync-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--line); margin-left: 2px; transition: background .3s;
}
.sync-dot.busy { background: var(--warn); }
.sync-dot.ok { background: var(--accent); }
.sync-dot.err { background: var(--danger); }

.tabs { display: flex; gap: 4px; margin-top: 12px; }
.tab {
  background: none; border: none; color: var(--dim);
  font: inherit; font-weight: 550; padding: 6px 12px;
  border-radius: 999px; cursor: pointer;
}
.tab.active { background: var(--bg3); color: var(--text); }
.tab .count { color: var(--accent); font-size: 12px; }

.chips { display: flex; gap: 6px; margin-top: 8px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; background: none; border: 1px solid var(--line); color: var(--dim);
  font: inherit; font-size: 12.5px; padding: 3px 10px; border-radius: 999px; cursor: pointer;
}
.chip.active { border-color: var(--accent-dim); color: var(--accent); }

/* list */
.list { flex: 1; padding: 4px 12px 160px; }
.empty { flex: 1; text-align: center; color: var(--dim); padding: 60px 30px 160px; }
.empty .hint { font-size: 13px; margin-top: 8px; opacity: .7; }

.card {
  background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 8px;
}
.card.processing { border-style: dashed; }
.card.overdue { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.card-head { display: flex; align-items: flex-start; gap: 11px; cursor: pointer; }
.done-toggle {
  flex: none; width: 21px; height: 21px; margin-top: 1px;
  border: 1.6px solid var(--dim); border-radius: 7px; background: none;
  cursor: pointer; color: transparent; padding: 0; font-size: 13px; line-height: 1;
}
.done-toggle.checked { background: var(--accent); border-color: var(--accent); color: #06251a; }
.card-title { font-weight: 560; overflow-wrap: anywhere; }
.card.done-item .card-title { color: var(--dim); text-decoration: line-through; }
.card-meta {
  display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 3px;
  font-size: 12px; color: var(--dim); align-items: center;
}
.cat { color: var(--accent); }
.due { color: var(--warn); }
.overdue .due { color: var(--danger); font-weight: 600; }
.prio-high { color: var(--danger); }
.spin {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--warn);
  animation: spin .8s linear infinite; vertical-align: -1px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.card-body { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 10px; }
.card-body p { color: var(--dim); font-size: 13.5px; margin-bottom: 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
.card-body p.transcript { color: var(--text); }
.card-body img { max-width: 100%; border-radius: 10px; margin-bottom: 8px; }
.card-body audio { width: 100%; margin-bottom: 8px; }
.card-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* capture bar */
.capture {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 6;
  max-width: 680px; margin: 0 auto;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, var(--bg) 30%);
}
.composer {
  display: flex; align-items: flex-end; gap: 6px;
  background: var(--bg3); border: 1px solid var(--line); border-radius: 22px;
  padding: 7px 8px;
}
#input {
  flex: 1; background: none; border: none; resize: none; color: var(--text);
  font: inherit; padding: 6px 4px; max-height: 130px; outline: none;
}
.icon-btn {
  flex: none; width: 38px; height: 38px; border-radius: 50%;
  background: none; border: none; color: var(--dim); cursor: pointer;
  display: grid; place-items: center;
}
.icon-btn svg { width: 21px; height: 21px; }
.icon-btn:active { background: var(--bg2); }
.icon-btn.send { color: #06251a; background: var(--accent); }
.icon-btn.send:disabled { background: var(--line); color: var(--dim); }

.rec-ui {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg3); border: 1px solid var(--danger); border-radius: 22px;
  padding: 9px 12px;
}
.rec-pulse {
  width: 10px; height: 10px; border-radius: 50%; background: var(--danger);
  animation: pulse 1.1s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: .25; } }
#rec-time { font-variant-numeric: tabular-nums; font-weight: 600; }
.rec-label { color: var(--dim); flex: 1; font-size: 13px; }

/* image preview */
.img-preview {
  position: fixed; bottom: 76px; left: 0; right: 0; z-index: 6;
  max-width: 680px; margin: 0 auto; padding: 12px;
  background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius);
}
.img-preview img { max-width: 100%; max-height: 40vh; border-radius: 10px; display: block; margin: 0 auto 10px; }
.img-preview input {
  width: 100%; background: var(--bg3); border: 1px solid var(--line); border-radius: 10px;
  color: var(--text); font: inherit; padding: 9px 12px; margin-bottom: 10px; outline: none;
}

/* buttons, overlays */
.btn {
  font: inherit; font-weight: 560; border-radius: 10px; cursor: pointer;
  padding: 8px 16px; border: 1px solid var(--line); background: var(--bg3); color: var(--text);
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #06251a; }
.btn.ghost { background: none; }
.btn.small { padding: 4px 10px; font-size: 12.5px; }
.btn.danger { color: var(--danger); }
.btn.wide { width: 100%; }
.row { display: flex; gap: 8px; justify-content: flex-end; }

.overlay {
  position: fixed; inset: 0; z-index: 10; background: rgba(4, 6, 8, .82);
  display: grid; place-items: center; padding: 20px;
}
.panel {
  width: 100%; max-width: 380px; background: var(--bg2);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 22px;
}
.panel h2 { font-size: 17px; margin-bottom: 8px; letter-spacing: .03em; }
.panel p { color: var(--dim); font-size: 13.5px; margin-bottom: 14px; }
.panel label { display: block; font-size: 12.5px; color: var(--dim); margin-bottom: 10px; }
.panel input, .panel select {
  width: 100%; margin-top: 4px; background: var(--bg3); border: 1px solid var(--line);
  border-radius: 10px; color: var(--text); font: inherit; padding: 9px 12px; outline: none;
}
.panel input:focus, .panel select:focus { border-color: var(--accent-dim); }
.panel .row { margin-top: 6px; }
.err { color: var(--danger) !important; }

.toast {
  position: fixed; bottom: 96px; left: 50%; transform: translateX(-50%); z-index: 20;
  background: var(--bg3); border: 1px solid var(--line); color: var(--text);
  padding: 9px 16px; border-radius: 999px; font-size: 13.5px; white-space: nowrap;
}
