:root {
  --bg: #f6f6f3; --card: #ffffff; --fg: #1c1c1a; --muted: #6c6b66; --line: #e2e1db;
  --accent: #1f5fbf; --accent-fg: #fff; --rec: #c62828; --ok: #2e7d32; --warn: #b26a00;
  --en: #5b5a55; --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #151514; --card: #1d1d1b; --fg: #ecebe6; --muted: #9b9a94; --line: #2f2f2c;
          --accent: #5b9cf5; --accent-fg: #0d1117; --rec: #ef5350; --ok: #66bb6a; --warn: #ffb74d; --en: #aeada6; }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--fg); }
h1 { font-size: 17px; margin: 0; font-weight: 650; }
h2 { font-size: 14px; margin: 0 0 8px; font-weight: 650; }
.muted { color: var(--muted); } .small { font-size: 13px; } .grow { flex: 1; }
.error { color: var(--rec); min-height: 1.4em; margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; width: 100%; }
textarea { resize: vertical; }
button { border: 1px solid var(--line); background: var(--card); border-radius: 8px; padding: 8px 14px; cursor: pointer; white-space: nowrap; }
button.primary { background: var(--accent); color: var(--accent-fg); border-color: transparent; font-weight: 600; }
button.primary.recording { background: var(--rec); }
button.ghost, summary.ghost { background: transparent; border-color: transparent; }
button.small { padding: 4px 10px; }
button:disabled { opacity: .5; cursor: default; }
.danger-text { color: var(--rec); }
.check { display: flex; align-items: center; gap: 6px; width: auto; white-space: nowrap; }
.check input { width: auto; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.row { display: flex; gap: 8px; justify-content: flex-end; }

a.button { display: inline-block; color: inherit; text-decoration: none; border: 1px solid var(--line); border-radius: 8px; padding: 8px 14px; }
a.button.ghost { border-color: transparent; }
a.button.small { padding: 4px 10px; font-size: 14px; }
.settings { display: grid; gap: 12px; max-width: 640px; }
.settings label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.settings label input, .settings label select { color: var(--fg); font-size: 15px; }
.settings .two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.key-ok { color: var(--ok); } .key-missing { color: var(--warn); }
.key-missing code, .muted code { color: var(--fg); background: var(--bg); padding: 1px 6px; border-radius: 4px; user-select: all; }
.test-result { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px; white-space: pre-wrap; font-size: 13px; margin: 0; }
@media (max-width: 600px) { .settings .two { grid-template-columns: 1fr; } }
.center { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.login { width: min(360px, 100%); display: grid; gap: 12px; }
.login label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }

.bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
       padding: 10px 16px; background: var(--bg); border-bottom: 1px solid var(--line); }
.bar .title { min-width: 0; }
.bar .title h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page { max-width: 900px; margin: 0 auto; padding: 16px; display: grid; gap: 16px; }
.new-meeting { display: grid; grid-template-columns: 2fr 1fr auto; gap: 8px; align-items: center; }
.new-meeting input[name=title] { grid-column: 1 / -1; }
.meetings { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.meetings li { display: flex; gap: 12px; align-items: center; padding: 12px 14px; cursor: pointer; }
.meetings li:hover { border-color: var(--accent); }
.meetings .when { margin-left: auto; text-align: right; }

.pill { font-size: 12px; padding: 3px 10px; border-radius: 99px; border: 1px solid var(--line); }
.pill.live { color: var(--ok); border-color: currentColor; }
.pill.waiting { color: var(--warn); border-color: currentColor; }
.menu { position: relative; }
.menu summary { list-style: none; cursor: pointer; padding: 8px 12px; border-radius: 8px; }
.menu summary::-webkit-details-marker { display: none; }
.menu-items { position: absolute; right: 0; top: 110%; background: var(--card); border: 1px solid var(--line);
              border-radius: var(--radius); padding: 6px; display: grid; min-width: 220px; z-index: 10; }
.menu-items button { border: 0; text-align: left; background: transparent; }
.menu-items button:hover { background: var(--bg); }

.tabs { display: none; }
.meeting { display: grid; grid-template-columns: minmax(0, 1fr) 380px; height: calc(100vh - 58px); }
.transcript { overflow-y: auto; padding: 12px 20px 40px; border-right: 1px solid var(--line); }
.side { display: grid; grid-template-rows: 1fr auto; min-height: 0; }
.panel { padding: 14px 16px; min-height: 0; }
.ask { display: grid; grid-template-rows: auto 1fr auto; overflow: hidden; border-bottom: 1px solid var(--line); }
.answers { overflow-y: auto; display: grid; gap: 10px; align-content: start; padding-bottom: 8px; }
.qa { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; background: var(--card); }
.qa .q { font-weight: 600; margin-bottom: 4px; }
.qa .a { white-space: pre-wrap; }
.ask-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; }
.notes textarea { height: 180px; }
.lines { display: grid; gap: 2px; }
.line { padding: 8px 0; border-bottom: 1px solid var(--line); }
.line .meta { font-size: 12px; color: var(--muted); display: flex; gap: 8px; align-items: baseline; }
.line .who { color: var(--accent); font-weight: 600; cursor: pointer; background: none; border: 0; padding: 0; font-size: 12px; }
.line .who:hover { text-decoration: underline; }
.line .text { font-size: 16px; }
.line .en { color: var(--en); font-size: 14px; }
.empty { text-align: center; margin-top: 40px; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--fg); color: var(--bg);
         padding: 8px 16px; border-radius: 99px; font-size: 14px; max-width: calc(100vw - 32px); }
dialog { border: 0; padding: 0; background: transparent; width: min(420px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(0,0,0,.4); }
dialog .card { display: grid; gap: 12px; }

@media (max-width: 800px) {
  .new-meeting { grid-template-columns: 1fr; }
  .bar { padding: 8px 12px; }
  .bar .check.small { order: 10; }
  .tabs { display: flex; border-bottom: 1px solid var(--line); }
  .tabs button { flex: 1; border: 0; border-radius: 0; background: transparent; padding: 10px; color: var(--muted); }
  .tabs button.on { color: var(--fg); box-shadow: inset 0 -2px 0 var(--accent); }
  .meeting { display: block; height: auto; }
  .side { display: block; }
  .panel { display: none; }
  .panel.on { display: block; }
  .transcript { border: 0; padding: 8px 12px 80px; }
  .ask.on { display: grid; height: calc(100vh - 110px); }
  .notes textarea { height: 60vh; }
}
