:root {
  --bg: #f6f7f9; --panel: #ffffff; --text: #1b1f24; --muted: #66707c; --line: #e3e6ea;
  --accent: #3b6fd8; --accent-soft: #e6eefc; --ok: #1f8a4c; --warn: #b8730a; --bad: #c43b3b;
  --person: #3b6fd8; --org: #8a4fd0; --topic: #1f8a7a; --place: #c0701d; --project: #c43b7a;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121418; --panel: #1b1e23; --text: #e6e8eb; --muted: #9aa3ad; --line: #2b3038;
    --accent: #7aa2f7; --accent-soft: #23304a; --ok: #4cc38a; --warn: #e0a548; --bad: #ef6b6b;
    --person: #7aa2f7; --org: #b58cf0; --topic: #4cc3b0; --place: #e69a50; --project: #ef7aa8;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
code { background: var(--accent-soft); padding: 1px 5px; border-radius: 4px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: var(--accent); color: #fff; border: 0; border-radius: 8px; padding: 8px 14px; cursor: pointer; }
button.ghost { background: transparent; color: var(--accent); border: 1px solid var(--line); }
button.link { background: none; color: var(--muted); padding: 6px 0; text-align: left; }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%; }
textarea { min-height: 80px; resize: vertical; }
[hidden] { display: none !important; }

.login { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.login .card { width: min(380px, 100%); display: grid; gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.muted { color: var(--muted); }
.err { color: var(--bad); min-height: 1em; margin: 0; }

.shell { display: grid; grid-template-columns: 200px 1fr; min-height: 100%; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 2px; padding: 16px 12px; border-right: 1px solid var(--line); background: var(--panel); }
.brand { font-weight: 700; font-size: 17px; padding: 4px 10px 14px; }
.side a { padding: 8px 10px; border-radius: 8px; color: var(--text); }
.side a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.side .link { margin-top: auto; padding-left: 10px; }
main { padding: 20px 24px 60px; max-width: 1100px; width: 100%; }
h1 { font-size: 22px; margin: 0 0 14px; }
h2 { font-size: 16px; margin: 22px 0 8px; }

.bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.bar input { flex: 1 1 240px; width: auto; }
.chip { border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 999px; padding: 5px 12px; }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.list { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.day { padding: 8px 14px; font-size: 13px; color: var(--muted); background: var(--bg); border-bottom: 1px solid var(--line); }
.row { display: flex; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); align-items: flex-start; cursor: pointer; }
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--accent-soft); }
.row .main { flex: 1; min-width: 0; }
.row .title { font-weight: 600; }
.row .sub { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.row .side-info { color: var(--muted); font-size: 13px; white-space: nowrap; text-align: right; }
.av { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; background: var(--person); }
.dir { font-size: 12px; }
.dir.missed, .dir.rejected { color: var(--bad); }
.badge { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.badge.done { background: transparent; color: var(--ok); }
.badge.error { color: var(--bad); background: transparent; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { border-radius: 999px; padding: 3px 10px; font-size: 13px; border: 1px solid var(--line); color: var(--text); background: var(--panel); }
.tag::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--c, var(--muted)); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.summary { white-space: pre-wrap; }
.transcript { white-space: pre-wrap; font-size: 14px; max-height: 480px; overflow: auto; }
audio { width: 100%; margin: 6px 0; }

.task { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.task:last-child { border-bottom: 0; }
.task .main { flex: 1; }
.task .acts { display: flex; gap: 6px; flex-wrap: wrap; }
.task .acts button { padding: 4px 10px; font-size: 13px; }
.task.unconfirmed .title::after { content: " · предложена ИИ"; color: var(--warn); font-weight: 400; font-size: 12px; }
.overdue { color: var(--bad); }

.graph-wrap { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; height: calc(100vh - 140px); min-height: 400px; overflow: hidden; }
.graph-wrap canvas { width: 100%; height: 100%; display: block; cursor: grab; }
.legend { position: absolute; left: 12px; bottom: 10px; display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }

.answer { white-space: pre-wrap; }
.stat { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.stat .card b { display: block; font-size: 24px; }
.empty { padding: 30px; text-align: center; color: var(--muted); }

@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: sticky; height: auto; flex-direction: row; overflow-x: auto; padding: 8px; z-index: 2; }
  .brand, .side .link { display: none; }
  .side a { white-space: nowrap; }
  main { padding: 14px 16px 60px; }
  .grid2 { grid-template-columns: 1fr; }
  .graph-wrap { height: calc(100vh - 120px); }
}
