:root {
  --indigo: #3f51b5;
  --indigo-dark: #303f9f;
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #eceef5;
  --text: #1a1a1a;
  --muted: #6b7280;
  --red: #e53935;
  --border: #e2e4ec;
  --safe-top: env(safe-area-inset-top);
  --safe-bottom: env(safe-area-inset-bottom);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  overscroll-behavior: none;
}
#app { min-height: 100%; display: flex; flex-direction: column; }

/* ---- 通用 ---- */
.appbar {
  background: var(--indigo);
  color: #fff;
  padding: calc(var(--safe-top) + 12px) 16px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 18px;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 1px 4px rgba(0,0,0,.12);
}
.appbar .icon-btn { color: #fff; }
.appbar .spacer { flex: 1; }
.icon-btn {
  background: none; border: 0; padding: 6px; cursor: pointer;
  color: var(--indigo); font-size: 22px; line-height: 1; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:active { background: rgba(0,0,0,.06); }
.content { flex: 1; padding: 16px; padding-bottom: calc(90px + var(--safe-bottom)); }
.muted { color: var(--muted); }
.center-empty {
  text-align: center; color: var(--muted); margin-top: 22vh; padding: 0 32px; line-height: 1.7;
}
.center-empty .big { font-size: 46px; margin-bottom: 12px; }

/* ---- 底部導覽 ---- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  padding-bottom: var(--safe-bottom);
  z-index: 10;
}
.tabbar button {
  flex: 1; background: none; border: 0; padding: 8px 0 10px;
  color: var(--muted); font-size: 11px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.tabbar button.active { color: var(--indigo); }
.tabbar button .ic { font-size: 22px; }

/* ---- 會議列表 ---- */
.meeting-card {
  background: var(--surface);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  cursor: pointer;
  display: flex; align-items: center; gap: 12px;
}
.meeting-card:active { background: #fafafe; }
.meeting-card .body { flex: 1; min-width: 0; }
.meeting-card .title { font-weight: 600; font-size: 15px; margin-bottom: 3px; }
.meeting-card .meta { font-size: 12.5px; color: var(--muted); }
.badge {
  font-size: 11px; padding: 2px 8px; border-radius: 999px; font-weight: 600;
  white-space: nowrap;
}
.badge.ready { background: #e6f4ea; color: #1b7a3d; }
.badge.pending, .badge.transcribing { background: #fff4e5; color: #b26a00; }
.badge.failed { background: #fdecea; color: #c0392b; }
.chev { color: #c0c4d0; font-size: 20px; }

/* ---- FAB ---- */
.fab {
  position: fixed; right: 20px; bottom: calc(76px + var(--safe-bottom));
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--indigo); color: #fff; border: 0;
  font-size: 30px; cursor: pointer;
  box-shadow: 0 4px 14px rgba(63,81,181,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 11;
}
.fab:active { background: var(--indigo-dark); }

/* ---- 錄音頁 ---- */
.rec-wrap { display: flex; flex-direction: column; height: 100%; padding: 16px; }
.rec-status { display: flex; align-items: center; gap: 8px; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: #bbb; }
.rec-dot.on { background: var(--red); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .3; } }
.rec-time { margin-left: auto; font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; }
.level-bar {
  height: 8px; border-radius: 4px; background: #d7d9e3; overflow: hidden; margin: 14px 0;
}
.level-bar > div { height: 100%; width: 0; background: var(--indigo); transition: width .08s linear; }
.caption-box {
  flex: 1; background: var(--surface-2); border-radius: 14px; padding: 14px;
  overflow-y: auto; line-height: 1.7; font-size: 15px;
  display: flex; flex-direction: column;
}
.caption-box .seg { margin-bottom: 8px; }
.caption-box .live { color: var(--muted); }
.caption-box .hint { color: var(--muted); margin: auto; text-align: center; }
.rec-btn-row { display: flex; justify-content: center; padding: 22px 0 10px; }
.rec-btn {
  width: 92px; height: 92px; border-radius: 50%;
  border: 3px solid rgba(229,57,53,.55); background: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.rec-btn .inner { width: 72px; height: 72px; border-radius: 50%; background: var(--red); transition: all .15s; }
.rec-btn.recording .inner { width: 34px; height: 34px; border-radius: 7px; }
.rec-btn:disabled { opacity: .6; }
.spinner {
  width: 30px; height: 30px; border: 3px solid rgba(63,81,181,.25);
  border-top-color: var(--indigo); border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- 詳情頁 ---- */
.section { background: var(--surface); border-radius: 14px; padding: 16px; margin-bottom: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.section h3 { margin: 0 0 10px; font-size: 14px; color: var(--indigo); display: flex; align-items: center; gap: 6px; }
.section p { margin: 0; line-height: 1.7; }
.detail-meta { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.li { padding: 7px 0; border-bottom: 1px solid var(--border); line-height: 1.6; }
.li:last-child { border-bottom: 0; }
.li .owner { display: inline-block; background: var(--surface-2); border-radius: 6px; padding: 1px 7px; font-size: 12px; margin-right: 6px; color: var(--indigo-dark); font-weight: 600; }
.li .due { font-size: 12px; color: var(--red); margin-left: 6px; }
.seg-line { padding: 6px 0; line-height: 1.6; border-bottom: 1px dashed var(--border); }
.seg-line:last-child { border-bottom: 0; }
.seg-line .t { font-size: 11px; color: var(--muted); margin-right: 8px; font-variant-numeric: tabular-nums; }
.btn-row { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.btn {
  flex: 1; min-width: 120px; padding: 12px; border-radius: 10px; border: 0; cursor: pointer;
  font-size: 14px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 6px;
}
.btn.primary { background: var(--indigo); color: #fff; }
.btn.primary:active { background: var(--indigo-dark); }
.btn.ghost { background: var(--surface); color: var(--indigo); border: 1px solid var(--border); }
.btn.danger { background: #fff; color: var(--red); border: 1px solid #f2c6c4; }
audio { width: 100%; margin-top: 4px; }

/* ---- Toast / Dialog ---- */
.toast {
  position: fixed; left: 50%; bottom: calc(96px + var(--safe-bottom)); transform: translateX(-50%);
  background: #333; color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 13px;
  z-index: 100; opacity: 0; transition: opacity .25s; pointer-events: none; max-width: 88%;
}
.toast.show { opacity: .95; }
.dialog-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 90;
  display: flex; align-items: center; justify-content: center; padding: 28px;
}
.dialog {
  background: #fff; border-radius: 16px; padding: 20px; max-width: 340px; width: 100%;
}
.dialog h4 { margin: 0 0 10px; font-size: 17px; }
.dialog p { margin: 0 0 18px; line-height: 1.6; color: #333; font-size: 14px; }
.dialog .actions { display: flex; justify-content: flex-end; gap: 10px; }
.dialog .actions button { background: none; border: 0; color: var(--indigo); font-weight: 600; padding: 8px 12px; cursor: pointer; font-size: 14px; border-radius: 8px; }
.dialog .actions button.filled { background: var(--indigo); color: #fff; }

.info-list .row { display: flex; justify-content: space-between; align-items: center; padding: 13px 0; border-bottom: 1px solid var(--border); }
.info-list .row .sub { font-size: 11.5px; color: var(--muted); margin-left: 6px; }
.info-note { font-size: 12.5px; color: var(--muted); line-height: 1.7; padding: 14px 2px; }

/* ---- 隱私權卡片(中英雙語) ---- */
.privacy { border-radius: 16px; overflow: hidden; box-shadow: 0 2px 10px rgba(63,81,181,.10); margin-bottom: 14px; background: var(--surface); }
.privacy-head { background: linear-gradient(135deg, var(--indigo), #5c6bc0); color: #fff; padding: 18px; }
.privacy-head .t1 { font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.privacy-head .t2 { font-size: 12px; opacity: .88; margin-top: 3px; letter-spacing: .4px; }
.privacy-body { padding: 4px 18px; }
.pitem { display: flex; gap: 13px; padding: 15px 0; border-bottom: 1px solid var(--border); }
.pitem:last-child { border-bottom: 0; }
.pitem .pic {
  font-size: 18px; flex-shrink: 0; width: 34px; height: 34px; border-radius: 10px;
  background: var(--surface-2); display: flex; align-items: center; justify-content: center;
}
.pitem .zh { font-size: 14px; line-height: 1.65; color: var(--text); }
.pitem .zh b { color: var(--indigo-dark); }
.pitem .en { font-size: 12px; line-height: 1.55; color: var(--muted); margin-top: 5px; }
.pitem.exc { background: #fffdf3; border-radius: 12px; padding: 14px; margin: 4px 0; border: 1px solid #f5e6b8; }
.pitem.exc .pic { background: #fdf0cf; }
.privacy-foot { font-size: 11px; color: var(--muted); line-height: 1.65; padding: 12px 18px 16px; background: var(--surface-2); }
.privacy-foot .en { display: block; margin-top: 4px; opacity: .85; }

/* ---- 語言切換 ---- */
.lang-seg { display: flex; gap: 8px; }
.lang-seg button {
  flex: 1; padding: 11px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 14px; font-weight: 600; cursor: pointer;
}
.lang-seg button.active { background: var(--indigo); color: #fff; border-color: var(--indigo); }
.lang-seg button:active { opacity: .85; }
