.app { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; border-right: 1px solid var(--line); background: var(--card); padding: 18px 14px; display: flex; flex-direction: column; gap: 22px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; color: var(--ink); text-decoration: none; padding: 4px 8px; }
.logo i { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; }
.logo i::after { content: ""; width: 11px; height: 11px; border: 3px solid #fff; border-radius: 50%; }
.tabs { display: flex; flex-direction: column; gap: 4px; }
.tabs button { display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 0 12px; border: 0; border-radius: 10px; background: none; color: var(--ink-2); font: 500 15px inherit; font-family: inherit; cursor: pointer; text-align: left; }
.tabs button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.tabs button:hover { background: var(--bg); }
.tabs button.on { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.badge { margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; background: var(--bad); color: #fff; font-size: 12px; display: grid; place-items: center; }
.badge:empty { display: none; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; padding: 0 8px; }
.org b { display: block; font-size: 14px; }
.org span { font-size: 13px; color: var(--muted); }

.main { padding: 0 28px 48px; min-width: 0; }
.bar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(8px); }
.bar-l, .bar-r { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.upd { font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 8px; }
.upd::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.btn.sm { min-height: 38px; font-size: 14px; padding: 0 14px; }
.seg { display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: none; min-height: 34px; padding: 0 14px; border-radius: 7px; font: 600 14px inherit; font-family: inherit; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--ink); color: var(--card); }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink-2); cursor: pointer; }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#sound .wave { display: none; } #sound[aria-pressed="true"] .wave { display: block; } #sound[aria-pressed="true"] .mute { display: none; }
#sound[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }

.view { display: none; } .view.on { display: block; }
.brief { font-size: clamp(22px, 2.6vw, 30px); font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; margin: 10px 0 18px; max-width: 34ch; }
.brief em { font-style: normal; color: var(--bad); }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi { padding: 18px 20px; }
.kpi .l { font-size: 13px; color: var(--muted); font-weight: 600; }
.kpi .v { font-size: 42px; font-weight: 300; letter-spacing: -0.03em; line-height: 1.1; margin: 4px 0 2px; }
.kpi .v small { font-size: 16px; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.kpi .d { font-size: 13px; color: var(--muted); }
.kpi .d b.up { color: var(--bad); } .kpi .d b.down { color: var(--ok); }

.cols { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.card-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 18px 20px 12px; flex-wrap: wrap; }
.card-h h2, h2.h { margin: 0; font-size: 19px; }
.card-h .muted, .people-h .muted { font-size: 13px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--card); color: var(--ink-2); min-height: 32px; padding: 0 12px; border-radius: 999px; font: 600 13px inherit; font-family: inherit; cursor: pointer; }
.chip.on { background: var(--ink); color: var(--card); border-color: var(--ink); }
.chip .n { opacity: .65; margin-left: 4px; }

.row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px 20px; border-top: 1px solid var(--line); cursor: pointer; }
.row:hover { background: var(--bg); }
.row.new { animation: flash 2.4s ease-out; }
@keyframes flash { 0% { background: var(--bad-soft); } 100% { background: transparent; } }
.av { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px; color: #fff; flex: none; }
.row .nm { font-weight: 700; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row .meta { font-size: 13px; color: var(--muted); }
.row .why { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.row .go { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.tag-new { font-size: 11px; font-weight: 800; color: var(--bad); border: 1px solid var(--bad); border-radius: 6px; padding: 0 5px; }
.tag-ok { font-size: 11px; font-weight: 700; color: var(--ok); border: 1px solid var(--ok); border-radius: 6px; padding: 0 5px; }
.more { display: block; width: 100%; min-height: 46px; border: 0; border-top: 1px solid var(--line); background: none; color: var(--accent); font: 600 14px inherit; font-family: inherit; cursor: pointer; border-radius: 0 0 var(--radius) var(--radius); }
#people-more { border: 1px solid var(--line); border-radius: 12px; margin-top: 12px; background: var(--card); }
.empty { padding: 28px 20px; color: var(--muted); border-top: 1px solid var(--line); }

.rail { display: flex; flex-direction: column; gap: 16px; }
.pad { padding: 18px 20px; }
.pad h3 { margin: 0 0 2px; font-size: 16px; }
.sm { font-size: 13px; }
.stack { display: flex; height: 14px; border-radius: 7px; overflow: hidden; margin: 14px 0 12px; gap: 2px; }
.stack i { display: block; height: 100%; }
.legend { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; font-size: 14px; }
.legend span { display: flex; align-items: center; gap: 8px; color: var(--ink-2); }
.legend span::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.legend b { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
table.mini { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 10px; font-variant-numeric: tabular-nums; }
table.mini th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; padding: 4px 0; }
table.mini td { padding: 7px 0; border-top: 1px solid var(--line); }
table.mini td:not(:first-child), table.mini th:not(:first-child) { text-align: right; }
.cam-line { display: flex; justify-content: space-between; font-size: 14px; padding: 6px 0; }
.cam-line + .cam-line { border-top: 1px solid var(--line); }

/* people */
.people-h { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin: 10px 0 14px; flex-wrap: wrap; }
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.filters input[type=search], .filters select { min-height: 40px; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 10px; padding: 0 12px; font: 15px inherit; font-family: inherit; }
.filters input[type=search] { flex: 1 1 240px; min-width: 0; }
table.ppl { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
table.ppl th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.ppl td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.ppl tr { cursor: pointer; } table.ppl tbody tr:hover { background: var(--bg); }
table.ppl .p { display: flex; gap: 10px; align-items: center; min-width: 180px; }
table.ppl .p .av { width: 32px; height: 32px; font-size: 12px; }
table.ppl .p small { display: block; color: var(--muted); font-size: 12px; }
.mbar { display: flex; align-items: center; gap: 8px; min-width: 110px; }
.mbar i { flex: 1; height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden; position: relative; }
.mbar i b { position: absolute; inset: 0 auto 0 0; background: var(--c); border-radius: 3px; }
.mbar.over span { color: var(--bad); font-weight: 700; }
.mbar span { min-width: 52px; text-align: right; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; padding: 12px; }
.pcard { border: 1px solid var(--line); border-radius: 12px; padding: 14px; cursor: pointer; background: var(--card); }
.pcard:hover { border-color: var(--line-2); }
.pcard .top { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.pcard .top small { display: block; color: var(--muted); font-size: 12px; }
.pcard .mini-tl { margin: 8px 0 10px; }
.pcard .kv2 { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; font-size: 13px; }
.pcard .kv2 span { color: var(--muted); } .pcard .kv2 b.over { color: var(--bad); }

/* timeline */
.tl { display: flex; height: 16px; border-radius: 4px; overflow: hidden; }
.tl i { flex: 1; }
.mini-tl.tl { height: 8px; }
.tl-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 4px; font-variant-numeric: tabular-nums; }

/* live */
.live-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.cam { overflow: hidden; position: relative; cursor: pointer; }
.cam video { width: 100%; aspect-ratio: 16/9; object-fit: cover; background: #000; }
.cam .lab { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; font-size: 14px; }
.cam .lab b { font-weight: 700; }
.live-dot { position: absolute; top: 10px; right: 10px; background: rgba(0,0,0,.6); color: #fff; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 6px; display: flex; gap: 6px; align-items: center; }
.live-dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #EF4444; }
.cam.big { grid-column: 1 / -1; }

/* settings */
.set-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px; align-items: start; }
.limits { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; }
.lim { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.lim label { font-weight: 600; } .lim small { display: block; color: var(--muted); font-weight: 400; font-size: 13px; }
.lim .inp { display: flex; align-items: center; gap: 6px; }
.lim input { width: 78px; min-height: 40px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--card); color: var(--ink); text-align: right; padding: 0 10px; font: 600 15px inherit; font-family: inherit; }
.preview { margin: 16px 0; padding: 12px 14px; border-radius: 10px; background: var(--accent-soft); font-size: 14px; }
.row-btns { display: flex; gap: 8px; }
.kv { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.kv span { color: var(--muted); }
.tog { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; font-size: 15px; cursor: pointer; }
.tog input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; margin: 1px 0 0; }
.tog small { display: block; }

/* drawer */
.scrim { position: fixed; inset: 0; background: rgba(17,24,39,.35); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: var(--card); border-left: 1px solid var(--line); z-index: 50; transform: translateX(100%); transition: transform .22s ease; display: flex; flex-direction: column; }
.drawer.on { transform: none; }
.drawer-h { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); gap: 12px; }
.who { display: flex; gap: 12px; align-items: center; }
.who b { font-size: 18px; display: block; } .who small { color: var(--muted); font-size: 13px; }
.drawer-b { flex: 1; overflow: auto; padding: 18px 20px 24px; }
.drawer-b h4 { margin: 22px 0 10px; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.drawer-f { display: flex; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); }
.drawer-f .btn { flex: 1; }
.tot { display: grid; grid-template-columns: 110px 1fr 90px; gap: 10px; align-items: center; padding: 7px 0; font-size: 14px; font-variant-numeric: tabular-nums; }
.tot .bar { height: 8px; background: var(--bg); border-radius: 4px; position: relative; }
.tot .bar b { position: absolute; inset: 0 auto 0 0; border-radius: 4px; background: var(--c); }
.tot .bar u { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); border-radius: 1px; }
.tot .v { text-align: right; } .tot.over .v { color: var(--bad); font-weight: 700; }
.ev { display: grid; grid-template-columns: 92px 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; font-variant-numeric: tabular-nums; }
.ev .t { color: var(--muted); }
.ev button { min-height: 34px; font-size: 13px; }
.proof { margin-top: 10px; border-radius: 10px; overflow: hidden; background: #000; }
.proof video { width: 100%; }
.proof-cap { font-size: 12px; color: var(--muted); margin: 6px 0 0; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 40px); opacity: 0; background: var(--ink); color: var(--card); padding: 12px 16px; border-radius: 12px; font-size: 14px; z-index: 60; display: flex; gap: 14px; align-items: center; transition: all .2s ease; pointer-events: none; max-width: calc(100vw - 32px); }
.toast.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { background: none; border: 0; color: var(--accent-2); font: 700 14px inherit; font-family: inherit; cursor: pointer; min-height: 32px; }

@media (max-width: 1100px) { .cols { grid-template-columns: 1fr; } .set-grid { grid-template-columns: 1fr; } }
@media (max-width: 820px) {
  body { font-size: 15px; }
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto; z-index: 30; flex-direction: row; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); }
  .side .logo, .side-foot { display: none; }
  .tabs { flex-direction: row; width: 100%; justify-content: space-around; }
  .tabs button { flex-direction: column; gap: 2px; min-height: 52px; font-size: 12px; padding: 0 6px; flex: 1; justify-content: center; position: relative; }
  .tabs button.on { background: none; }
  .badge { position: absolute; top: 2px; right: calc(50% - 22px); min-width: 18px; height: 18px; font-size: 11px; }
  .main { padding: 0 16px 96px; }
  .bar { flex-wrap: wrap; }
  #next-upd { display: none; }
  .bar { align-items: flex-start; flex-wrap: nowrap; }
  .bar-l { flex-direction: column; align-items: flex-start; gap: 6px; }
  #view-seg { display: none; }
  .kpi { padding: 14px 16px; }
  .kpi .v small { font-size: 13px; display: block; }
  .brief { font-size: 21px; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpis .kpi:first-child { grid-column: 1 / -1; }
  .kpi .v { font-size: 30px; }
  .row { grid-template-columns: 36px minmax(0, 1fr); padding: 12px 16px; }
  .row .go { display: none; }
  .av { width: 36px; height: 36px; }
  .live-grid { grid-template-columns: 1fr; }
  .drawer-f { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
}
