:root {
  --blue: #185FA5;
  --blue-dark: #0C447C;
  --blue-bg: #E6F1FB;
  --red: #A32D2D;
  --red-dot: #E24B4A;
  --green: #3B6D11;
  --text: #2C2C2A;
  --text-2: #5F5E5A;
  --text-3: #888780;
  --border: #E4E2DC;
  --bg: #F7F6F3;
  --card: #FFFFFF;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding-top: calc(12px + env(safe-area-inset-top));
}
.topbar-title { font-size: 17px; font-weight: 600; }
.chips { display: flex; gap: 6px; }
.chip {
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--text-2); white-space: nowrap;
}
.chip-ok { color: var(--green); border-color: #C0DD97; background: #EAF3DE; }
.chip-warn { color: #854F0B; border-color: #FAC775; background: #FAEEDA; }

/* ---------- 选项卡 ---------- */
.tabs {
  display: flex; background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky; top: calc(53px + env(safe-area-inset-top)); z-index: 19;
}
.tab {
  flex: 1; padding: 12px; border: none; background: none;
  font-size: 15px; color: var(--text-2); cursor: pointer;
  border-bottom: 2px solid transparent;
}
.tab.active { color: var(--blue); border-bottom-color: var(--blue); font-weight: 600; }

main { max-width: 760px; margin: 0 auto; padding: 16px; }
.view { display: none; }
.view.active { display: block; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; padding: 18px; margin-bottom: 16px;
}
.card h2 { font-size: 17px; margin-bottom: 10px; }
.hidden { display: none !important; }
.hint { font-size: 13px; color: var(--text-3); margin-bottom: 12px; }

input[type="text"] {
  width: 100%; padding: 12px 14px; font-size: 15px;
  border: 1px solid var(--border); border-radius: 10px;
  margin-bottom: 12px; background: #FBFBF9; color: var(--text);
}
input[type="text"]:focus { outline: 2px solid var(--blue-bg); border-color: var(--blue); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 12px 18px; font-size: 15px; border-radius: 10px;
  border: 1px solid transparent; cursor: pointer; font-weight: 500;
  transition: opacity .15s;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:not(:disabled):active { background: var(--blue-dark); }
.btn-danger { background: var(--red); color: #fff; }
.btn-secondary { background: var(--blue-bg); color: var(--blue-dark); border-color: #B5D4F4; }
.btn-ghost { background: none; color: var(--text-2); border-color: var(--border); }
.action-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }

/* ---------- 进行中 ---------- */
.live-head {
  display: flex; align-items: center; gap: 12px; margin-bottom: 14px;
}
.rec-indicator {
  display: flex; align-items: center; gap: 6px;
  color: var(--red); font-weight: 700; font-size: 13px; letter-spacing: 1px;
}
.rec-dot {
  width: 10px; height: 10px; border-radius: 50%; background: var(--red-dot);
  animation: blink 1.2s infinite;
}
@keyframes blink { 50% { opacity: .25; } }
.live-timer { font-variant-numeric: tabular-nums; font-size: 20px; font-weight: 600; }
.live-speakers { margin-left: auto; font-size: 12px; color: var(--text-2); }

.speaker-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.speaker-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 999px; font-size: 13px;
  border: 1px solid var(--border); background: #FBFBF9; cursor: pointer;
}
.speaker-chip .dot { width: 8px; height: 8px; border-radius: 50%; }
.speaker-chip input {
  border: none; background: none; font-size: 13px; width: 5.5em;
  padding: 0; margin: 0; outline: none; color: var(--text);
}

/* ---------- 转写流 ---------- */
.transcript {
  max-height: 46vh; overflow-y: auto; margin-bottom: 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.msg { display: flex; flex-direction: column; max-width: 88%; }
.msg .who { font-size: 12px; color: var(--text-2); margin-bottom: 2px; }
.msg .bubble {
  padding: 9px 13px; border-radius: 12px; border-top-left-radius: 4px;
  background: #F1EFE8; font-size: 14.5px; word-break: break-word;
}
.msg.draft .bubble { opacity: .55; }
.msg .bubble .cursor { display: inline-block; width: 2px; height: 1em;
  background: var(--text-3); margin-left: 2px; vertical-align: -2px;
  animation: blink 1s infinite; }

/* ---------- 纪要 ---------- */
.done-meta { font-size: 13px; color: var(--text-2); margin-bottom: 12px; }
.minutes {
  border: 1px solid var(--border); border-radius: 10px;
  padding: 16px; background: #FBFBF9; margin-top: 12px;
  font-size: 14.5px;
}
.minutes h1 { font-size: 19px; text-align: center; margin: 8px 0 14px; }
.minutes h2 { font-size: 16px; margin: 16px 0 8px; color: var(--blue-dark); }
.minutes ul { padding-left: 20px; margin: 6px 0; }
.minutes li { margin: 3px 0; }
.minutes p { margin: 6px 0; }
.minutes table { border-collapse: collapse; width: 100%; margin: 8px 0; font-size: 13.5px; }
.minutes th, .minutes td { border: 1px solid var(--border); padding: 6px 8px; text-align: left; }
.minutes th { background: var(--blue-bg); }

.raw-transcript { margin-top: 14px; }
.raw-transcript summary { font-size: 13px; color: var(--text-2); cursor: pointer; padding: 6px 0; }

.error-banner {
  background: #FCEBEB; color: var(--red); border: 1px solid #F7C1C1;
  border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px;
}

/* ---------- 历史 ---------- */
.history-item {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 16px; margin-bottom: 10px; cursor: pointer;
}
.history-item:active { background: #F1EFE8; }
.history-item .h-title { font-size: 15px; font-weight: 500; margin-bottom: 4px; }
.history-item .h-meta { font-size: 12px; color: var(--text-3); display: flex; gap: 10px; flex-wrap: wrap; }
.history-item .h-badge {
  font-size: 11px; padding: 1px 8px; border-radius: 999px;
}
.h-badge.rec { background: #FCEBEB; color: var(--red); }
.h-badge.done { background: #EAF3DE; color: var(--green); }
.h-badge.mid { background: #FAEEDA; color: #854F0B; }
.empty { text-align: center; color: var(--text-3); padding: 40px 0; font-size: 14px; }

/* ---------- 卡内提示块（演示模式说明） ---------- */
.notice {
  background: #EAF2FB;
  border: 1px solid #B9D3F0;
  border-radius: 8px;
  color: #14487F;
  font-size: 12.5px;
  line-height: 1.7;
  padding: 10px 12px;
  margin-bottom: 12px;
}

.notice-info {
  background: #EAF7EE;
  border-color: #B6E0C4;
  color: #17603A;
}

/* ---------- 顶部警告条（非 HTTPS 访问提示） ---------- */
.warn-banner {
  background: #FFF4E5;
  border-bottom: 1px solid #F5C77E;
  color: #8A5300;
  font-size: 13px;
  line-height: 1.6;
  padding: 10px 16px;
  text-align: center;
}
.warn-banner a { color: #185FA5; font-weight: 600; text-decoration: underline; }
.warn-banner.warn-error {
  background: #FDECEA;
  border-bottom: 1px solid #F3B4AE;
  color: #8C1D18;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: #2C2C2A; color: #fff; font-size: 13.5px;
  padding: 10px 18px; border-radius: 999px; z-index: 99;
  max-width: 86vw; text-align: center;
}

/* ---------- 打印 ---------- */
@media print {
  .topbar, .tabs, .action-row, .raw-transcript, #btn-new,
  .hint, #minutes-status, .toast { display: none !important; }
  body { background: #fff; }
  main { max-width: 100%; padding: 0; }
  .card { border: none; padding: 0; }
  .minutes { border: none; padding: 0; }
}
