:root {
  --bg: #f5f6f8; --card: #fff; --text: #1d2330; --muted: #6b7385; --line: #e3e6ec;
  --accent: #1f6feb; --pos: #1a7f37; --neg: #cf222e; --warn: #9a6700; --warn-bg: #fff8c5; --est: #8250df;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
header.top { background: #111827; color: #fff; display: flex; align-items: center; gap: 24px; padding: 0 24px; height: 52px; flex-wrap: wrap; }
header.top .brand { font-weight: 700; }
header.top nav a { color: #cbd5e1; margin-right: 18px; }
header.top nav a.active, header.top nav a:hover { color: #fff; text-decoration: none; }
header.top .right { margin-left: auto; }
header.top .right a { color: #94a3b8; }
main { max-width: 1280px; margin: 0 auto; padding: 24px; }
h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 16px; margin: 28px 0 10px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.grid { display: grid; gap: 16px; }
.grid.k4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.k2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1000px) { .grid.k4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid.k2 { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .grid.k4 { grid-template-columns: 1fr; } main { padding: 16px; } }
.kpi .label { color: var(--muted); font-size: 13px; }
.kpi .big { font-size: 28px; font-weight: 700; margin: 4px 0 2px; }
.kpi .sub { color: var(--muted); font-size: 12px; }
.kpi table { width: 100%; margin-top: 10px; font-size: 13px; }
.kpi td { padding: 2px 0; }
.kpi td.r { text-align: right; }
.pos { color: var(--pos); } .neg { color: var(--neg); } .muted { color: var(--muted); }
.est { color: var(--est); }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; background: #eef1f5; color: var(--muted); }
.badge.ok { background: #dafbe1; color: var(--pos); } .badge.err { background: #ffebe9; color: var(--neg); }
.badge.warn { background: var(--warn-bg); color: var(--warn); } .badge.est { background: #fbefff; color: var(--est); }
.notice { background: var(--warn-bg); border: 1px solid #eac54f; padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
.notice.info { background: #ddf4ff; border-color: #54aeff; }
table.data { width: 100%; border-collapse: collapse; background: var(--card); }
table.data th, table.data td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
table.data th { font-size: 12px; color: var(--muted); font-weight: 600; background: #fafbfc; }
table.data td.r, table.data th.r { text-align: right; white-space: nowrap; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
input, select, textarea, button { font: inherit; }
input[type=text], input[type=number], input[type=date], input[type=password], input[type=search], select {
  padding: 6px 8px; border: 1px solid #cdd3dd; border-radius: 6px; background: #fff; width: 100%; }
button, .btn { display: inline-block; padding: 7px 14px; border-radius: 6px; border: 1px solid #cdd3dd; background: #fff; cursor: pointer; color: var(--text); }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.danger { color: var(--neg); }
button:hover, .btn:hover { filter: brightness(0.96); text-decoration: none; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.form-grid label, label.f { display: block; font-size: 12px; color: var(--muted); }
.search-big { display: flex; gap: 8px; max-width: 640px; }
.search-big input { font-size: 16px; padding: 10px 12px; }
.prod-cell { position: relative; min-width: 240px; }
.prod-cell .chosen { font-size: 12px; margin-top: 3px; }
.ac { position: absolute; z-index: 20; top: 100%; left: 0; right: 0; background: #fff; border: 1px solid #cdd3dd; border-radius: 6px; box-shadow: 0 6px 20px rgba(0,0,0,.12); max-height: 280px; overflow-y: auto; }
.ac div { padding: 6px 8px; cursor: pointer; font-size: 13px; }
.ac div:hover { background: #eef4ff; }
tr.deleted td { opacity: .35; text-decoration: line-through; }
.copy { cursor: pointer; border: 0; background: none; padding: 0 4px; color: var(--accent); }
.chart-box { position: relative; height: 280px; }
.small { font-size: 12px; }
pre { white-space: pre-wrap; font-size: 12px; background: #f6f8fa; padding: 10px; border-radius: 6px; max-height: 400px; overflow: auto; }
details summary { cursor: pointer; color: var(--muted); }
