/* 會議錄音筆記：乾淨、留白多、圓角卡片、細邊框；重點色只有紅色（錄音相關）＋灰階 */
:root {
  --bg: #FAFAF9;
  --surface: #FFFFFF;
  --surface-2: #F2F2F0;
  --line: #E4E4E1;
  --text: #1C1C1E;
  --muted: #6A6A70;
  --red: #E0352B;
  --red-ink: #C42A21;
  --red-soft: #FCEBEA;
  --on-red: #FFFFFF;
  --focus: #1C1C1E;
  --r-lg: 18px;
  --r-md: 12px;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111113;
    --surface: #1B1B1E;
    --surface-2: #242428;
    --line: #2F2F34;
    --text: #F2F2F3;
    --muted: #A2A2AA;
    --red: #FF4D42;
    --red-ink: #FF6A61;
    --red-soft: #3A1D1C;
    --on-red: #FFFFFF;
    --focus: #F2F2F3;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
[hidden] { display: none !important; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.muted { color: var(--muted); }
.center { text-align: center; }
.small { font-size: 15px; }
.err { color: var(--red-ink); margin: 0; }

.ic { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic.sm { width: 18px; height: 18px; }
.ic.xl { width: 44px; height: 44px; stroke-width: 1.4; }

/* ---------- 按鈕 ---------- */
.btn {
  min-height: 48px; padding: 10px 18px; border-radius: var(--r-md);
  border: 1px solid var(--line); background: var(--surface); font-size: 16px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn.primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn.danger { background: var(--red); color: var(--on-red); border-color: var(--red); }
.btn.block { width: 100%; }
.btn.big { min-height: 60px; font-size: 18px; font-weight: 600; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent;
  display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.icon-btn.sm { width: 36px; height: 36px; }
.icon-btn.solid { background: var(--text); color: var(--bg); width: 48px; height: 48px; }
.pill-btn {
  min-height: 40px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); font-size: 15px; flex: none;
}
.link { border: 0; background: none; color: inherit; font-weight: 600; display: inline-flex; align-items: center; gap: 2px; min-height: 40px; padding: 0 4px; }

/* ---------- 通行碼 ---------- */
.auth { min-height: 100%; display: flex; align-items: center; justify-content: center;
  padding: calc(24px + var(--sat)) calc(20px + var(--sar)) calc(24px + var(--sab)) calc(20px + var(--sal)); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 32px 24px; }
.auth-logo { width: 64px; height: 64px; border-radius: 50%; background: var(--red); color: var(--on-red); display: flex; align-items: center; justify-content: center; margin-bottom: 16px; }
.auth-logo .ic { width: 32px; height: 32px; }
.auth h1 { font-size: 24px; margin: 0 0 6px; }
.auth p { margin: 0 0 20px; }
#auth-form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; }
.field > span { font-weight: 600; }
.field input, .field textarea, .search input, .ask-form input, .title-input {
  width: 100%; min-height: 48px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); font-size: 16px; outline: none;
}
.field input:focus, .field textarea:focus, .ask-form input:focus { border-color: var(--text); }
.field textarea { resize: vertical; line-height: 1.6; }

/* ---------- 版面 ---------- */
.shell { height: 100%; display: flex; }
.pane { height: 100%; min-width: 0; display: flex; flex-direction: column; }
.list-pane { flex: 1; }
.main-pane { flex: 1; display: none; }
body[data-view="main"] .list-pane { display: none; }
body[data-view="main"] .main-pane { display: flex; }
@media (min-width: 900px) {
  .list-pane { flex: 0 0 380px; display: flex !important; border-right: 1px solid var(--line); }
  .main-pane { display: flex !important; }
  .scr.rec .back, .scr.meeting .back { visibility: hidden; width: 8px; }
}
.scr { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.scr.blank { align-items: center; justify-content: center; gap: 12px; color: var(--muted); }
@media (max-width: 899px) { .scr.blank { display: none !important; } }

.bar {
  display: flex; align-items: center; gap: 8px; min-height: 60px;
  padding: calc(8px + var(--sat)) calc(12px + var(--sar)) 8px calc(12px + var(--sal));
}
.bar-title { font-size: 24px; margin: 0 0 0 6px; flex: 1; letter-spacing: .5px; }

/* ---------- 清單 ---------- */
.list-scroll { flex: 1; overflow-y: auto; padding: 0 calc(16px + var(--sar)) 24px calc(16px + var(--sal)); -webkit-overflow-scrolling: touch; }
.search { display: flex; align-items: center; gap: 8px; position: relative; margin: 4px 0 14px; }
.search .ic { position: absolute; left: 14px; color: var(--muted); }
.search input { padding-left: 46px; background: var(--surface-2); border-color: transparent; }
.mlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.mcard {
  display: block; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 14px 16px; min-height: 72px;
}
.mcard[aria-current="true"] { border-color: var(--text); }
.mcard-top { display: flex; align-items: flex-start; gap: 10px; }
.mcard-title { flex: 1; font-weight: 600; font-size: 17px; line-height: 1.45; overflow-wrap: anywhere; }
.mcard-meta { color: var(--muted); font-size: 15px; margin-top: 4px; }
.mcard-preview { color: var(--muted); font-size: 15px; margin-top: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pill { flex: none; font-size: 15px; line-height: 1; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.pill.rec { color: var(--red-ink); border-color: var(--red); background: var(--red-soft); }
.pill.done { color: var(--text); }
.empty { text-align: center; padding: 56px 16px; color: var(--muted); }
.empty p { margin: 8px 0 0; }
.empty p:first-of-type { color: var(--text); font-weight: 600; margin-top: 14px; }
.recbar {
  display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 14px; margin-bottom: 12px;
  border: 1px solid var(--red); background: var(--red-soft); color: var(--red-ink); border-radius: var(--r-md);
}
.recbar b { flex: 1; }
.notice { display: flex; align-items: center; gap: 10px; padding: 10px 6px 10px 14px; margin-bottom: 12px;
  border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-md); }
.notice span { flex: 1; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--red); flex: none; animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .dot { animation: none; } }

.dock { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 0 calc(14px + var(--sab)); border-top: 1px solid var(--line); background: var(--bg); }
.rec-btn { width: 76px; height: 76px; border-radius: 50%; border: 3px solid var(--red); background: var(--surface); padding: 0; display: flex; align-items: center; justify-content: center; }
.rec-core { width: 56px; height: 56px; border-radius: 50%; background: var(--red); display: block; }
.rec-btn.active .rec-core { width: 28px; height: 28px; border-radius: 6px; }
.dock-label { font-size: 15px; color: var(--muted); }

/* ---------- 錄音中 ---------- */
.rec-state { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 600; color: var(--red-ink); }
.rec-state.paused { color: var(--muted); }
.rec-state.paused .dot { background: var(--muted); animation: none; }
.rec-state.interrupted .dot { animation: blink .6s infinite; }
.rec-body { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 12px; padding: 8px calc(16px + var(--sar)) 12px calc(16px + var(--sal)); width: 100%; max-width: 760px; margin: 0 auto; }
.timer { font-size: 60px; line-height: 1.1; font-weight: 300; text-align: center; letter-spacing: 1px; margin-top: 8px; }
.wave { width: 100%; height: 96px; display: block; }
.banner { padding: 12px 14px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); }
.banner.warn { border-color: var(--red); background: var(--red-soft); color: var(--red-ink); }
.up-status { margin: 0; font-size: 15px; text-align: center; min-height: 1.6em; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.live { flex: 1; min-height: 120px; overflow-y: auto; padding: 14px 16px; }
.live-empty { margin: 0; }
.tlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.tline { display: grid; grid-template-columns: 4.2em 1fr; gap: 8px; align-items: baseline; }
.tline .t { color: var(--muted); font-size: 15px; }
.tline .x { overflow-wrap: anywhere; }
button.tline { width: 100%; text-align: left; border: 0; background: none; padding: 6px 8px; margin: 0 -8px; border-radius: 10px; min-height: 44px; }
button.tline:hover { background: var(--surface-2); }
button.tline.now { background: var(--surface-2); }
.tnote { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 15px; padding: 8px 12px; border: 1px dashed var(--line); border-radius: 10px; }
.tnote.mark { color: var(--text); border-style: solid; }
.tnote.mark .ic { color: var(--red); }
.tnote.fail { color: var(--red-ink); border-color: var(--red); border-style: solid; flex-wrap: wrap; }
.tnote.fail span { flex: 1; min-width: 10em; }
.rec-foot { display: flex; align-items: center; justify-content: space-around; padding: 10px calc(12px + var(--sar)) calc(14px + var(--sab)) calc(12px + var(--sal)); border-top: 1px solid var(--line); }
.foot-btn { width: 96px; min-height: 64px; border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 15px; border-radius: var(--r-md); }
.foot-btn:active { background: var(--surface-2); }
.stop-btn { width: 76px; height: 76px; border-radius: 50%; border: 3px solid var(--red); background: var(--surface); display: flex; align-items: center; justify-content: center; padding: 0; }
.stop-core { width: 28px; height: 28px; border-radius: 6px; background: var(--red); }
.stopping { position: absolute; inset: 0; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 24px; text-align: center; z-index: 5; }
.scr.rec { position: relative; }
.spinner { width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--red); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 會議頁 ---------- */
.title-input { flex: 1; min-width: 0; font-size: 19px; font-weight: 600; border-color: transparent; background: transparent; padding: 8px 10px; }
.title-input:focus { border-color: var(--line); background: var(--surface); }
.m-meta { margin: -4px 0 8px; padding: 0 calc(22px + var(--sar)) 0 calc(22px + var(--sal)); font-size: 15px; }
@media (min-width: 900px) { .m-meta { padding-left: 30px; } }
.tabs { display: flex; gap: 4px; margin: 0 calc(16px + var(--sar)) 0 calc(16px + var(--sal)); padding: 4px; background: var(--surface-2); border-radius: var(--r-md); }
.tab { flex: 1; min-height: 44px; border: 0; background: transparent; border-radius: 9px; font-size: 16px; color: var(--muted); }
.tab[aria-selected="true"] { background: var(--surface); color: var(--text); font-weight: 600; border: 1px solid var(--line); }
.m-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 16px calc(16px + var(--sar)) 24px calc(16px + var(--sal)); -webkit-overflow-scrolling: touch; }
.tabpanel { max-width: 760px; margin: 0 auto; }
.sec { margin: 0 0 22px; }
.sec h3 { font-size: 15px; color: var(--muted); font-weight: 600; margin: 0 0 8px; letter-spacing: .5px; }
.sec p { margin: 0; }
.sec ul { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; }
.lead { font-size: 17px; line-height: 1.75; }
.todo { display: grid; gap: 8px; list-style: none; padding: 0 !important; }
.todo li { border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 14px; background: var(--surface); }
.todo .who { font-size: 15px; color: var(--muted); }
.kv { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; }
.kv .v { font-weight: 600; text-align: right; }
.kv .tm { font-size: 15px; color: var(--muted); }
.row-btns { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.row-btns .btn { flex: 1 1 160px; }
.state-box { text-align: center; padding: 32px 16px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.state-box p { margin: 0 0 14px; }
.state-box .btn { min-width: 160px; }

/* 問 AI */
.chat { display: grid; gap: 12px; }
.bubble { max-width: 88%; padding: 10px 14px; border-radius: 16px; overflow-wrap: anywhere; white-space: pre-wrap; }
.bubble.user { justify-self: end; background: var(--text); color: var(--bg); border-bottom-right-radius: 6px; }
.bubble.assistant { justify-self: start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.bubble.error { justify-self: start; background: var(--red-soft); color: var(--red-ink); border: 1px solid var(--red); }
.bubble.wait { color: var(--muted); }
.tchip { display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); border-radius: 999px; padding: 1px 10px; margin: 0 2px; font-size: 15px; min-height: 30px; vertical-align: baseline; }
.tchip .ic { width: 14px; height: 14px; }
.quick { display: grid; gap: 8px; margin: 4px 0 16px; }
.quick button { text-align: left; min-height: 48px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.quick.compact { display: flex; flex-wrap: wrap; }
.quick.compact button { min-height: 44px; padding: 8px 14px; border-radius: 999px; font-size: 15px; }
.ask-form { display: flex; gap: 8px; align-items: center; padding: 8px calc(16px + var(--sar)) 8px calc(16px + var(--sal)); border-top: 1px solid var(--line); }
.ask-form input { flex: 1; min-width: 0; }
.ask-form.in-sheet { padding: 12px 0 0; border: 0; }

/* 播放列 */
.player { display: flex; align-items: center; gap: 10px; padding: 10px calc(14px + var(--sar)) calc(10px + var(--sab)) calc(14px + var(--sal)); border-top: 1px solid var(--line); background: var(--bg); }
.pl-time { font-size: 15px; color: var(--muted); min-width: 3.2em; text-align: center; }
.pl-range { flex: 1; min-width: 0; accent-color: var(--red); height: 32px; }
#pl-rate { min-width: 56px; }

/* ---------- 抽屜、確認框、提示 ---------- */
.sheet-back { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 20; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; background: var(--bg); border-top: 1px solid var(--line);
  border-radius: 20px 20px 0 0; padding: 8px calc(18px + var(--sar)) calc(18px + var(--sab)) calc(18px + var(--sal));
  display: flex; flex-direction: column; gap: 12px; max-height: 88vh; overflow-y: auto;
}
.sheet.tall { height: 80vh; overflow: hidden; }
.sheet-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet-head h2 { font-size: 20px; margin: 0; }
.sheet .field small { font-size: 15px; }
.sheet > p { margin: 0; }
@media (min-width: 900px) {
  .sheet { left: 50%; right: auto; width: 520px; transform: translateX(-50%); bottom: 24px; border-radius: 20px; border: 1px solid var(--line); }
}
.modal { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 24px 20px 18px; }
.modal-card h2 { margin: 0 0 8px; font-size: 20px; }
.modal-card p { margin: 0 0 20px; white-space: pre-line; }
.modal-actions { display: flex; gap: 10px; }
.modal-actions .btn { flex: 1; }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(170px + var(--sab)); z-index: 40;
  background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 999px; max-width: calc(100% - 32px); text-align: center;
}
