:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #16181d;
  --muted: #6b7280;
  --line: #e5e7eb;
  --brand: #2d6cdf;
  --brand-ink: #ffffff;
  --ok: #167c4a;
  --ok-bg: #e6f5ec;
  --warn: #8a6100;
  --warn-bg: #fdf3d8;
  --err: #a1231f;
  --err-bg: #fbeae9;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101216; --panel: #171a20; --ink: #e8eaee; --muted: #9aa3b2; --line: #262a33;
    --brand: #4f8bff; --ok: #6ee7a8; --ok-bg: #12291e; --warn: #f5c86b; --warn-bg: #2a2313;
    --err: #ff9a94; --err-bg: #2b1616; --shadow: none;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex; align-items: center; gap: 24px; padding: 12px 24px;
  background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 700; font-size: 17px; color: var(--ink); }
.topbar nav { display: flex; gap: 18px; }
.topbar nav a { color: var(--muted); padding: 4px 2px; border-bottom: 2px solid transparent; }
.topbar nav a.active { color: var(--ink); border-bottom-color: var(--brand); }
.pills { margin-left: auto; display: flex; gap: 8px; }
.pill { font-size: 12px; padding: 3px 10px; border-radius: 999px; background: var(--ok-bg); color: var(--ok); white-space: nowrap; }
.pill.warn { background: var(--warn-bg); color: var(--warn); }

main { max-width: 1160px; margin: 24px auto 64px; padding: 0 20px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; box-shadow: var(--shadow); }
.panel h1 { font-size: 18px; margin: 0 0 14px; }
.panel h1.tight { margin-bottom: 6px; }
.panel h2 { font-size: 15px; margin: 0 0 12px; }
.panel h3 { font-size: 14px; margin: 18px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.count { color: var(--muted); font-weight: 400; font-size: 14px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.row { display: flex; gap: 8px; align-items: center; }
.right { text-align: right; }
.hidden { display: none !important; }
.crumbs { margin-bottom: 12px; font-size: 14px; }

/* формы */
.grid-form { display: grid; grid-template-columns: repeat(12, 1fr); gap: 12px; }
.grid-form > label, .grid-form > fieldset { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
.col-2 { grid-column: span 2; } .col-4 { grid-column: span 4; }
.col-6 { grid-column: span 6; } .col-12 { grid-column: span 12; }
input, select, textarea, .search {
  font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; padding: 9px 11px; width: 100%;
}
input:focus, select:focus, textarea:focus, .search:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { padding: 0 0 6px; font-size: 13px; color: var(--muted); }
.row-end { display: flex; justify-content: flex-end; align-items: center; gap: 12px; }
.search { margin-bottom: 12px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line);
  background: var(--panel); color: var(--ink); padding: 9px 15px; border-radius: 9px;
  font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--brand); text-decoration: none; }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { background: transparent; }
.btn.tiny { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }
.btn.big { padding: 11px 20px; font-size: 15px; }
.btn.danger:hover { border-color: var(--err); color: var(--err); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.file { cursor: pointer; }

/* чипы участников */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.vertical { flex-direction: column; max-height: 260px; overflow: auto; }
.chip { display: inline-flex; flex-direction: row; align-items: center; gap: 7px; border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 12px; cursor: pointer; font-size: 13px; color: var(--ink); }
.chip input { width: auto; margin: 0; }
.chip em { color: var(--muted); font-style: normal; font-size: 12px; }
.chip:has(input:checked) { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 10%, transparent); }

/* карточки встреч */
.cards { display: flex; flex-direction: column; gap: 10px; }
.card { display: flex; align-items: center; gap: 16px; justify-content: space-between;
  border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.card.live { border-color: var(--brand); }
.card-title { font-weight: 600; font-size: 15px; color: var(--ink); }
.card-actions { display: flex; align-items: center; gap: 8px; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; margin-top: 4px; }
.dot { opacity: .5; }
.excerpt { margin: 8px 0 0; color: var(--muted); font-size: 13.5px; }
.avatars { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.avatar { font-size: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; color: var(--muted); }
.badge { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; color: var(--muted); }
.badge.live { border-color: var(--brand); color: var(--brand); }
.tag { font-size: 12px; border-radius: 6px; padding: 2px 8px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); }
.tag.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.tag.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.tag.err { background: var(--err-bg); color: var(--err); border-color: transparent; }
.tag.external { background: var(--warn-bg); color: var(--warn); border-color: transparent; }

/* карточка встречи */
.meeting-head { display: flex; gap: 20px; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.agenda { margin: 10px 0 0; white-space: pre-wrap; }
.two-col { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, 1fr); gap: 20px; align-items: start; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } .grid-form > * { grid-column: 1 / -1 !important; } }

.pipeline { display: flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--muted);
  background: var(--bg); border-radius: 8px; padding: 8px 12px; margin-bottom: 14px; }
.dot-status { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.pipeline.s-ready .dot-status { background: var(--ok); }
.pipeline.s-error .dot-status { background: var(--err); }
.pipeline.s-downloading .dot-status, .pipeline.s-transcribing .dot-status,
.pipeline.s-analyzing .dot-status, .pipeline.s-waiting_recording .dot-status {
  background: var(--brand); animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .25; } }
.pipeline .err { color: var(--err); }
.status.s-ready { color: var(--ok); }
.status.s-error { color: var(--err); }

.summary { font-size: 15.5px; line-height: 1.65; white-space: pre-wrap; }
ul.bullets { margin: 0; padding-left: 20px; }
ul.bullets li { margin: 5px 0; }
ul.actions { list-style: none; margin: 0; padding: 0; }
ul.actions li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px;
  border-left: 3px solid var(--brand); background: var(--bg); border-radius: 0 8px 8px 0;
  padding: 9px 12px; margin-bottom: 7px; }
ul.actions .task { flex: 1 1 260px; }
ul.actions .owner { font-size: 12.5px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 1px 9px; }
ul.actions .due { font-size: 12.5px; color: var(--warn); }

video, audio { width: 100%; border-radius: 10px; background: #000; margin-bottom: 12px; }
ul.files { list-style: none; margin: 0 0 12px; padding: 0; }
ul.files li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
ul.files li:last-child { border-bottom: 0; }
.ftype { font-weight: 600; min-width: 82px; }
.upload { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

pre.transcript { max-height: 460px; overflow: auto; white-space: pre-wrap; word-break: break-word;
  background: var(--bg); border-radius: 8px; padding: 14px; font-size: 13px; line-height: 1.6;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; margin: 0; }
pre.code { background: var(--bg); border-radius: 8px; padding: 12px; overflow: auto; font-size: 13px; }
mark { background: #ffe58a; color: #241c00; }

ul.people-list, ul.events { list-style: none; margin: 0; padding: 0; }
ul.people-list li { padding: 8px 0; border-bottom: 1px solid var(--line); }
ul.people-list li:last-child { border-bottom: 0; }
ul.events li { display: flex; gap: 10px; padding: 6px 0; font-size: 13px; border-bottom: 1px dashed var(--line); }
ul.events li:last-child { border-bottom: 0; }
ul.events .when { color: var(--muted); white-space: nowrap; font-size: 12px; min-width: 118px; }
ul.events li.lvl-error span:last-child { color: var(--err); }
ul.events li.lvl-warn span:last-child { color: var(--warn); }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12.5px;
  text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tr.inactive { opacity: .5; }

.toast { position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 60px);
  background: var(--ink); color: var(--panel); padding: 11px 18px; border-radius: 10px;
  font-size: 14px; opacity: 0; transition: .25s; pointer-events: none; z-index: 50; max-width: 90vw; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--err); color: #fff; }
.danger-zone { border-color: color-mix(in srgb, var(--err) 30%, var(--line)); }

/* --- вход и смена пароля --- */
body.centered { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }
.auth-card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 28px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; }
.auth-brand { font-weight: 700; font-size: 17px; }
.auth-card h1 { font-size: 20px; margin: 0; }
.auth-card label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
.btn.full { width: 100%; justify-content: center; }
.center { text-align: center; }
.alert { border-radius: 9px; padding: 10px 13px; font-size: 13.5px; }
.alert.error { background: var(--err-bg); color: var(--err); }
.alert.warn { background: var(--warn-bg); color: var(--warn); }
.alert.ok { background: var(--ok-bg); color: var(--ok); }

/* --- шапка: кто вошёл --- */
.who { display: flex; align-items: center; gap: 10px; }
.whoami { color: var(--muted); font-size: 13px; white-space: nowrap; }
.whoami:hover { color: var(--ink); }
.pills { margin-left: auto; }
.nowrap { white-space: nowrap; }
.with-btn { display: flex; gap: 6px; align-items: center; }
.with-btn input { flex: 1; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }

.row.wrap { flex-wrap: wrap; }
details summary { cursor: pointer; font-size: 13px; margin-top: 10px; }
details p { margin-top: 8px; line-height: 1.7; }
