/* Meeting Notetaker — mobile-first, dark, big tap targets. */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f0f14;
  --bg-2: #17171f;
  --bg-3: #1f1f2a;
  --border: #2c2c3a;
  --text: #ececf1;
  --muted: #9a9aad;
  --accent: #7c3aed;
  --accent-2: #a78bfa;
  --danger: #ef4444;
  --ok: #22c55e;
  --warn: #f59e0b;
  --radius: 14px;
}

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100%;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 10px;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px 12px;
  background: rgba(15,15,20,0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 18px; font-weight: 700; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn {
  background: var(--bg-3); color: var(--text); border: 1px solid var(--border);
  width: 42px; height: 42px; border-radius: 12px; font-size: 19px;
  display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0;
}
.icon-btn:active { background: var(--border); }

.view { padding: 16px 16px calc(env(safe-area-inset-bottom, 0px) + 32px); max-width: 640px; margin: 0 auto; }

.hidden { display: none !important; }

/* ---------- Buttons ---------- */
.btn {
  display: block; width: 100%;
  background: var(--accent); color: #fff; border: none;
  padding: 15px 18px; border-radius: var(--radius);
  font-size: 16px; font-weight: 600; cursor: pointer; text-align: center;
}
.btn:active { filter: brightness(1.15); }
.btn:disabled { opacity: 0.5; }
.btn.secondary { background: var(--bg-3); color: var(--text); border: 1px solid var(--border); }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn.small { width: auto; display: inline-block; padding: 9px 14px; font-size: 14px; border-radius: 10px; }
.btn-row { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.btn-row .btn { flex: 1; min-width: 120px; }

/* ---------- Record ---------- */
.record-hero { display: flex; flex-direction: column; align-items: center; padding: 34px 0 10px; }
.rec-btn {
  width: 150px; height: 150px; border-radius: 50%;
  border: 5px solid var(--accent);
  background: radial-gradient(circle at 35% 30%, #8b5cf6, #5B21B6);
  color: #fff; font-size: 18px; font-weight: 700; cursor: pointer;
  box-shadow: 0 8px 40px rgba(124, 58, 237, 0.45);
}
.rec-btn:active { transform: scale(0.97); }
.rec-btn.recording {
  border-color: var(--danger);
  background: radial-gradient(circle at 35% 30%, #f87171, #b91c1c);
  animation: pulse 1.6s ease-in-out infinite;
  box-shadow: 0 8px 40px rgba(239, 68, 68, 0.45);
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.5); }
  50% { box-shadow: 0 0 0 22px rgba(239,68,68,0); }
}
.timer { font-size: 42px; font-variant-numeric: tabular-nums; font-weight: 300; margin: 20px 0 6px; letter-spacing: 2px; }
.rec-status { color: var(--muted); font-size: 14px; min-height: 20px; }

/* ---------- Live (chunked) transcript while recording ---------- */
.live-box {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius);
  margin: 14px 0 4px; overflow: hidden;
}
.live-head {
  padding: 10px 14px 6px; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.2px; color: var(--muted);
}
.live-body {
  padding: 2px 14px 12px; font-size: 14px; line-height: 1.55; color: #d6d6e0;
  max-height: 34vh; overflow-y: auto; overflow-wrap: anywhere; white-space: pre-wrap;
}
.lt-done { color: #d6d6e0; }
.lt-proc {
  display: block; color: var(--accent-2); font-size: 12.5px; font-style: italic;
  animation: ltpulse 1.4s ease-in-out infinite; margin-top: 4px;
}
@keyframes ltpulse { 0%, 100% { opacity: 0.45; } 50% { opacity: 1; } }
.lt-chip {
  display: inline-block; margin: 6px 4px 2px 0; padding: 6px 12px;
  background: rgba(239,68,68,0.12); border: 1px solid var(--danger); color: #fca5a5;
  border-radius: 999px; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.lt-chip:active { background: rgba(239,68,68,0.25); }
.lt-note {
  color: var(--warn); font-size: 12.5px; margin: 10px 0 0; line-height: 1.45;
}
.warn-note {
  background: rgba(245,158,11,0.08); border: 1px solid var(--warn); color: #fcd34d;
  border-radius: var(--radius); padding: 10px 12px; font-size: 13px;
}

/* ---------- Cards / lists ---------- */
.section-label {
  font-size: 12px; text-transform: uppercase; letter-spacing: 1.4px;
  color: var(--muted); margin: 26px 0 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: space-between;
}
.card {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 10px; cursor: pointer;
}
.card:active { background: var(--bg-3); }
.card .title { font-weight: 600; font-size: 15px; margin-bottom: 3px; overflow-wrap: anywhere; }
.card .meta { color: var(--muted); font-size: 13px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.empty { color: var(--muted); font-size: 14px; text-align: center; padding: 18px 6px; }

.badge {
  display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px;
  border-radius: 999px; background: var(--bg-3); border: 1px solid var(--border); color: var(--muted);
}
.badge.ok { color: var(--ok); border-color: var(--ok); }
.badge.warn { color: var(--warn); border-color: var(--warn); }
.badge.err { color: var(--danger); border-color: var(--danger); }
.badge.accent { color: var(--accent-2); border-color: var(--accent); }

/* ---------- Forms ---------- */
label.field { display: block; margin-bottom: 14px; }
label.field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
input[type="text"], input[type="password"], select, textarea {
  width: 100%; background: var(--bg-2); border: 1px solid var(--border);
  color: var(--text); border-radius: 12px; padding: 13px 14px; font-size: 16px;
  font-family: inherit;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }

/* ---------- Meeting detail ---------- */
.detail-h { font-size: 21px; font-weight: 700; margin: 4px 0 6px; overflow-wrap: anywhere; }
.detail-meta { color: var(--muted); font-size: 13px; margin-bottom: 14px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.out-section { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 12px; overflow: hidden; }
.out-section > .sec-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; font-weight: 700; font-size: 14px; cursor: pointer; user-select: none;
}
.out-section > .sec-head .copy { font-size: 12px; color: var(--accent-2); background: none; border: none; cursor: pointer; padding: 6px 8px; font-weight: 600; }
.out-section > .sec-body { padding: 0 14px 14px; font-size: 14.5px; line-height: 1.55; }
.out-section ul { padding-left: 20px; }
.out-section li { margin-bottom: 7px; }
.out-section p { margin-bottom: 8px; }
.transcript-body { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 45vh; overflow-y: auto; color: #d6d6e0; }
.prd-body { white-space: pre-wrap; overflow-wrap: anywhere; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; max-height: 55vh; overflow-y: auto; }

.owner { color: var(--accent-2); font-weight: 700; }
.due { color: var(--warn); font-size: 12.5px; }

.progress-box {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; text-align: center; margin: 14px 0;
}
.spinner {
  width: 28px; height: 28px; margin: 0 auto 12px;
  border: 3px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.progress-box .step { font-size: 14px; color: var(--muted); }

.error-box {
  background: rgba(239,68,68,0.08); border: 1px solid var(--danger);
  color: #fca5a5; border-radius: var(--radius); padding: 12px 14px;
  font-size: 13.5px; margin: 12px 0; overflow-wrap: anywhere;
}

audio { width: 100%; margin: 10px 0; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: calc(env(safe-area-inset-bottom, 0px) + 24px);
  left: 50%; transform: translateX(-50%);
  background: var(--bg-3); border: 1px solid var(--border); color: var(--text);
  padding: 11px 20px; border-radius: 999px; font-size: 14px; z-index: 100;
  max-width: 88vw; text-align: center; box-shadow: 0 6px 24px rgba(0,0,0,0.5);
}

.note { color: var(--muted); font-size: 13px; line-height: 1.5; margin: 10px 0; }
a { color: var(--accent-2); }

/* ---------- Lock screen ---------- */
.lock-screen {
  position: fixed; inset: 0; z-index: 1000;
  background: radial-gradient(1200px 600px at 50% -10%, #1d1330 0%, var(--bg) 60%);
  display: flex; align-items: center; justify-content: center;
  padding: 24px 20px calc(env(safe-area-inset-bottom, 0px) + 24px);
  overflow-y: auto;
}
.lock-card { width: 100%; max-width: 400px; text-align: center; }
.lock-icon { font-size: 46px; margin-bottom: 12px; }
.lock-title { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.lock-sub { color: var(--muted); font-size: 14px; margin-bottom: 24px; }
.lock-input-row { position: relative; margin-bottom: 12px; }
.lock-input-row input { padding-right: 54px; font-size: 17px; }
.lock-eye {
  position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--muted); font-size: 19px;
  padding: 9px 11px; cursor: pointer; line-height: 1;
}
.lock-eye:active { color: var(--text); }
.lock-btn { font-size: 17px; padding: 16px 18px; }
.lock-error {
  color: #fca5a5; background: rgba(239,68,68,0.08); border: 1px solid var(--danger);
  border-radius: 10px; padding: 10px 12px; font-size: 13.5px; margin-bottom: 12px;
  overflow-wrap: anywhere; text-align: left;
}
.lock-note { margin-top: 18px; }
body.locked .topbar, body.locked .view { display: none; }
