:root {
  --bg: #F5F6F8; --card: #FFFFFF; --line: #E3E6EB; --line2: #F0F2F5; --field: #D5D9E0;
  --text: #15181D; --muted: #5B6270; --muted2: #3A404B;
  --accent: #3354D1; --accent-d: #2541A8; --accent-bg: #EAEFFE; --accent-line: #C9D4FB;
  --good: #1E7B4F; --good-bg: #E7F5EE; --good-t: #17633F;
  --warn-bg: #FFF1E0; --warn-t: #8A3B00; --bad: #B42318; --lead: #C2550A;
  --head: "Manrope", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); } a:hover { color: var(--accent-d); }
button { font: inherit; cursor: pointer; }
h1, h2 { font-family: var(--head); margin: 0; }
h1 { font-size: 28px; font-weight: 700; } h2 { font-size: 18px; }
.boot { padding: 48px; color: var(--muted); }
.muted { color: var(--muted); } .small { font-size: 12px; } .s13 { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }

/* вход */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login { width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 32px; display: flex; flex-direction: column; gap: 16px; }
.logo { font-family: var(--head); font-weight: 700; font-size: 22px; }
label.f { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; }
input.in { font: inherit; font-size: 15px; padding: 10px 12px; min-height: 44px; border: 1px solid var(--field); border-radius: 8px; background: #fff; color: var(--text); }
input.in:focus { outline: 2px solid var(--accent-line); border-color: var(--accent); }
.btn { font-weight: 600; min-height: 44px; padding: 0 20px; border: 0; border-radius: 8px; background: var(--accent); color: #fff; }
.btn:hover { background: var(--accent-d); } .btn:disabled { opacity: .6; cursor: default; }
.btn2 { font-weight: 500; min-height: 40px; padding: 0 14px; border: 1px solid var(--field); border-radius: 8px; background: #fff; color: var(--text); }
.err { color: var(--bad); font-size: 13px; min-height: 18px; }

/* каркас */
.shell { display: flex; min-height: 100vh; }
nav.side { flex: 0 0 232px; background: var(--card); border-right: 1px solid var(--line); padding: 24px 16px; display: flex; flex-direction: column; gap: 4px; }
nav.side .logo { padding: 0 12px 20px; font-size: 20px; }
nav.side a, nav.side span.soon { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-radius: 8px; color: var(--text); text-decoration: none; }
nav.side a.on { background: var(--accent-bg); color: var(--accent-d); font-weight: 600; }
nav.side a:hover:not(.on) { background: var(--line2); }
nav.side span.soon { color: var(--muted); }
nav.side span.soon em { font-style: normal; font-size: 11px; background: var(--line2); padding: 2px 6px; border-radius: 6px; }
nav.side .grow { flex: 1 1 24px; }
nav.side .who { padding: 10px 12px; color: var(--muted); font-size: 13px; }
nav.side button.out { text-align: left; border: 0; background: none; padding: 10px 12px; color: var(--muted); border-radius: 8px; }
nav.side button.out:hover { background: var(--line2); }
main.page { flex: 1 1 auto; min-width: 0; padding: 32px 40px 48px; display: flex; flex-direction: column; gap: 24px; max-width: 1240px; }
.head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.head .t { display: flex; flex-direction: column; gap: 4px; }

.seg { display: flex; flex-wrap: wrap; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 4px; align-items: center; }
.seg button { border: 0; border-radius: 7px; padding: 8px 14px; min-height: 36px; font-size: 13px; background: transparent; color: var(--text); }
.seg button.on { background: var(--accent); color: #fff; font-weight: 600; }
.seg input[type=date] { font: inherit; font-size: 13px; border: 1px solid var(--field); border-radius: 7px; padding: 6px 8px; min-height: 36px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; }
.kpi .l { color: var(--muted); font-size: 13px; }
.kpi .v { font-family: var(--head); font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi .n { color: var(--muted); font-size: 12px; }
.kpi.hl { background: var(--accent-bg); border-color: var(--accent-line); }
.kpi.hl .l, .kpi.hl .n { color: var(--accent-d); } .kpi.hl .l { font-weight: 600; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 20px 24px; display: flex; flex-direction: column; gap: 14px; }
.card .ch { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; }

.frow { display: grid; grid-template-columns: minmax(120px, 200px) minmax(0, 1fr) 80px 72px; align-items: center; gap: 12px; }
.frow .nm { font-weight: 500; }
.frow .track { background: var(--line2); border-radius: 6px; height: 28px; overflow: hidden; }
.frow .bar { height: 100%; border-radius: 6px; background: var(--accent); }
.frow .bar.pay { background: var(--good); }
.frow .c { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.frow .p { text-align: right; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }

.legend { display: flex; gap: 16px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; background: var(--accent-line); }
.legend i.ln { width: 14px; height: 3px; border-radius: 2px; background: var(--lead); }
svg.chart { width: 100%; height: 220px; display: block; }
.axis { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }

.tbl-wrap { overflow-x: auto; }
table.t { width: 100%; min-width: 760px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
table.t th { color: var(--muted); font-size: 12px; font-weight: 500; text-align: right; padding: 8px 6px; border-bottom: 1px solid var(--line); }
table.t td { text-align: right; padding: 12px 6px; border-bottom: 1px solid var(--line2); }
table.t th:first-child, table.t td:first-child { text-align: left; }
table.t td:first-child { font-weight: 500; }
table.t tr.total td { font-weight: 700; border-bottom: 0; }
.pos { color: var(--good); font-weight: 600; } .neg { color: var(--bad); font-weight: 600; }

.srcs { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.src { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.src .top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.src .nm { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.badge { width: 36px; height: 36px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; background: var(--accent-bg); color: var(--accent-d); }
.pill { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.pill.ok { background: var(--good-bg); color: var(--good-t); }
.pill.warn { background: var(--warn-bg); color: var(--warn-t); }
.pill.off { background: var(--line2); color: var(--muted2); }
.empty { color: var(--muted); padding: 24px 0; }

@media (max-width: 860px) {
  .shell { flex-direction: column; }
  nav.side { flex: none; border-right: 0; border-bottom: 1px solid var(--line); flex-direction: row; flex-wrap: wrap; padding: 12px; gap: 4px; }
  nav.side .logo { width: 100%; padding: 0 12px 8px; }
  nav.side .grow, nav.side .who { display: none; }
  main.page { padding: 20px 16px 40px; }
  .frow { grid-template-columns: minmax(90px, 140px) minmax(0, 1fr) 56px 56px; gap: 8px; }
  .card { padding: 16px; }
}
