:root {
  --bg: #F1F2F4; --surface: #FFFFFF; --ink: #14161A; --muted: #5A5F68; --line: #DFE2E6;
  --accent: #1c5cab; --accent-ink: #FFFFFF; --ok: #0B7A45; --warn: #8A4B00; --error: #A12727;
  --error-bg: #FBE0E0; --chip: #F1F2F4; --top: #14161A; --top-ink: #FFFFFF;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111317; --surface: #1A1D22; --ink: #E8EAED; --muted: #A0A6AF; --line: #2C3038;
    --accent: #5B9BEA; --accent-ink: #0B0D10; --ok: #4CC38A; --warn: #F0B35B; --error: #F08A8A;
    --error-bg: #3A1F22; --chip: #23272E; --top: #0B0D10; --top-ink: #E8EAED;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent); }
h1 { font-size: 24px; line-height: 1.25; margin: 0 0 8px; }
h2 { font-size: 16px; margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; margin: 4px 0; }
code { font: 14px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; }

/* auth pages */
body.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 28px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; margin-bottom: 18px; }
.stack { display: flex; flex-direction: column; gap: 14px; margin-top: 12px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
input { min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; font-weight: 400; }
input:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
button, .button { min-height: 44px; padding: 0 16px; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.primary { background: var(--accent); color: var(--accent-ink); border: 0; }
.secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.ghost { background: transparent; color: var(--top-ink); border: 1px solid rgba(255,255,255,0.25); }
.link { background: none; border: 0; color: var(--muted); font-weight: 400; padding: 0; min-height: 36px; margin-top: 8px; }
.wide { width: 100%; margin-top: 8px; }
button:disabled { opacity: 0.6; cursor: default; }
.error { background: var(--error-bg); color: var(--error); padding: 10px 12px; border-radius: 8px; font-weight: 600; }
.status { min-height: 1.5em; font-size: 14px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); margin: 8px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.steps { padding-left: 20px; margin: 12px 0; }
.secret { word-break: break-all; background: var(--chip); padding: 2px 6px; border-radius: 4px; }
.qr { display: block; margin: 8px auto; background: #FFFFFF; border-radius: 8px; }
.codes { columns: 2; padding-left: 24px; margin: 16px 0 20px; }
.codes li { margin: 4px 0; }

/* app */
body.app { min-height: 100vh; }
.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; padding: 10px 24px; background: var(--top); color: var(--top-ink); }
.topbar .brand { margin: 0; }
.topbar nav { display: flex; flex-wrap: wrap; gap: 4px; }
.topbar nav a, .topbar nav span { display: inline-flex; align-items: center; min-height: 40px; padding: 0 12px; border-radius: 6px; font-size: 14px; text-decoration: none; color: var(--top-ink); }
.topbar nav a[aria-current="page"] { background: var(--surface); color: var(--ink); font-weight: 600; }
.topbar nav .soon { color: #8C929B; }
.topbar .right { margin-left: auto; }
.page { max-width: 1280px; margin: 0 auto; padding: 24px 16px 48px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; margin-top: 20px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px; }
.list { list-style: none; padding: 0; margin: 0 0 12px; }
.list li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.ok { color: var(--ok); }
.warn { color: var(--warn); }
@media (max-width: 600px) { .card { padding: 20px; } .topbar { padding: 10px 16px; } .codes { columns: 1; } }

/* topbar links */
a.brand { color: inherit; text-decoration: none; }
.topbar .right { display: flex; align-items: center; gap: 8px; }
.ghost-link { color: var(--top-ink); text-decoration: none; padding: 0 12px; min-height: 40px; display: inline-flex; align-items: center; border-radius: 6px; font-size: 14px; }
.ghost-link[aria-current="page"] { background: var(--surface); color: var(--ink); font-weight: 600; }

/* tasks page */
.head { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-bottom: 16px; }
.head h1 { margin: 0; }
.head .counters { margin-left: auto; }
.counters { display: flex; flex-wrap: wrap; gap: 8px; }
.counter { display: flex; align-items: baseline; gap: 6px; padding: 8px 12px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; }
.counter b { font-size: 16px; }
.counter.bad b { color: var(--error); }
.warn { color: var(--warn); }
.banner { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; justify-content: space-between; padding: 12px 14px; margin-bottom: 12px; border-radius: 10px; background: #FDEBD3; color: #5C3300; }
@media (prefers-color-scheme: dark) { .banner { background: #3A2A14; color: #F5D9B0; } }
.groups { display: flex; flex-direction: column; gap: 18px; }
.group h2 { font-size: 15px; margin: 0 0 8px; color: var(--muted); }
.group-overdue h2 { color: var(--error); }
.tasks { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.task { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); transition: opacity 0.2s; }
.task:last-child { border-bottom: 0; }
.task.leaving { opacity: 0.4; }
.done { flex: none; width: 26px; height: 26px; min-height: 26px; padding: 0; border-radius: 50%; border: 2px solid var(--muted); background: transparent; }
.done:hover { border-color: var(--ok); background: rgba(11,122,69,0.12); }
.task.overdue .done { border-color: var(--error); }
.task .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }

/* Пульт компании: заглушки разделов, список команды */
.stub { max-width: 640px; }
.stub .stage { display: inline-block; margin-top: 8px; padding: 2px 10px; border-radius: 999px; background: var(--chip); color: var(--muted); font-size: 13px; font-weight: 600; }
.who-card { display: flex; flex-direction: column; gap: 4px; }
table.members { width: 100%; border-collapse: collapse; font-size: 14px; }
table.members th, table.members td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.members th { color: var(--muted); font-weight: 600; font-size: 13px; }
.tablewrap { overflow-x: auto; }
