:root {
  --bg: #120e0b; --panel: #1c1611; --panel-2: #241c15; --line: rgba(232, 196, 124, .14); --line-2: rgba(232, 196, 124, .28);
  --text: #f1e6cf; --muted: #a8977b; --gold: #e8c47c; --red: #d0442b; --red-2: #b5321f; --green: #6fbf73; --blue: #6aa7e6; --amber: #f0b44a;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; }
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }

/* ── вход ── */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(ellipse at 50% 30%, #3a1d12, var(--bg) 60%); }
.login-box { width: min(380px, 100%); padding: 32px 28px; border-radius: 14px; background: var(--panel); box-shadow: inset 0 0 0 1px var(--line-2), 0 30px 80px rgba(0, 0, 0, .6); }
.login-box h1 { margin: 0 0 4px; font-size: 24px; color: var(--gold); }
.login-box p { margin: 0 0 20px; color: var(--muted); font-size: 14px; }
.login-box label { display: block; margin: 12px 0 6px; font-size: 13px; color: var(--muted); }
.login-box .btn { width: 100%; margin-top: 20px; }
.code-input { font-size: 28px !important; letter-spacing: .4em; text-align: center; font-variant-numeric: tabular-nums; }

/* ── каркас ── */
.shell { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; padding: 18px 12px; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.side-brand { padding: 4px 10px 16px; font-weight: 700; color: var(--gold); font-size: 17px; }
.side-brand small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.side a { display: flex; justify-content: space-between; align-items: center; padding: 9px 12px; border-radius: 8px; color: var(--text); }
.side a:hover { background: var(--panel-2); text-decoration: none; }
.side a.on { background: rgba(232, 196, 124, .14); color: var(--gold); }
.side .badge { min-width: 22px; padding: 0 7px; border-radius: 11px; background: var(--red-2); color: #fff; font-size: 12px; text-align: center; }
.side-foot { margin-top: auto; padding: 10px 12px; font-size: 13px; color: var(--muted); }
.side-foot button { margin-top: 8px; }
.main { padding: 26px 30px 60px; min-width: 0; }
.main h1 { margin: 0 0 18px; font-size: 24px; }
.menu-btn { display: none; }

/* ── элементы ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border: 0; border-radius: 8px; background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--line-2); cursor: pointer; white-space: nowrap; }
.btn:hover { background: #2e241b; }
.btn.primary { background: var(--red-2); box-shadow: none; color: #fff; }
.btn.primary:hover { background: var(--red); }
.btn.gold { background: var(--gold); color: #1a120c; box-shadow: none; }
.btn.danger { color: #ffb4a6; box-shadow: inset 0 0 0 1px rgba(208, 68, 43, .6); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
input, select, textarea { width: 100%; padding: 9px 11px; border-radius: 8px; border: 0; background: #0f0b08; box-shadow: inset 0 0 0 1px var(--line-2); }
textarea { min-height: 90px; resize: vertical; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1; min-width: 180px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.card { padding: 14px 16px; border-radius: var(--radius); background: var(--panel); box-shadow: inset 0 0 0 1px var(--line); }
.card .k { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.card .v { font-size: 26px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.card .v.warn { color: var(--amber); }
.panel { padding: 16px 18px; border-radius: var(--radius); background: var(--panel); box-shadow: inset 0 0 0 1px var(--line); margin-bottom: 16px; }
.panel h2 { margin: 0 0 12px; font-size: 16px; color: var(--gold); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; padding: 8px 10px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr.click { cursor: pointer; }
tr.click:hover td { background: rgba(232, 196, 124, .05); }
.table-wrap { overflow-x: auto; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--line-2); white-space: nowrap; }
.tag.red { background: rgba(208, 68, 43, .2); color: #ffb4a6; box-shadow: none; }
.tag.green { background: rgba(111, 191, 115, .18); color: #a9e0ab; box-shadow: none; }
.tag.amber { background: rgba(240, 180, 74, .18); color: #ffd58e; box-shadow: none; }
.tag.blue { background: rgba(106, 167, 230, .18); color: #b5d4f5; box-shadow: none; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--green); margin-right: 6px; }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs .btn.on { background: var(--gold); color: #1a120c; box-shadow: none; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 16px; }
.item { padding: 10px 0; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.empty { padding: 20px; text-align: center; color: var(--muted); }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 12px; }

/* ── график ── */
.chart { width: 100%; height: 150px; display: block; }
.chart rect { fill: var(--gold); opacity: .85; }
.chart rect.alt { fill: var(--blue); }
.chart rect.red { fill: var(--red); }
.chart text { fill: var(--muted); font-size: 10px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ── окно ── */
dialog { width: min(480px, calc(100% - 24px)); padding: 22px; border: 0; border-radius: 14px; background: var(--panel); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2), 0 30px 80px rgba(0, 0, 0, .7); }
dialog::backdrop { background: rgba(0, 0, 0, .6); }
dialog h3 { margin: 0 0 14px; color: var(--gold); }
dialog label { display: block; margin: 10px 0 5px; font-size: 13px; color: var(--muted); }
dialog .row { margin-top: 18px; justify-content: flex-end; }

#toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 50; }
.toast { padding: 10px 14px; border-radius: 8px; background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--line-2), 0 10px 30px rgba(0, 0, 0, .5); max-width: 360px; }
.toast.bad { box-shadow: inset 0 0 0 1px rgba(208, 68, 43, .7); }
.toast.good { box-shadow: inset 0 0 0 1px rgba(111, 191, 115, .6); }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 40; left: 0; top: 0; width: 240px; transform: translateX(-100%); transition: transform .25s; }
  .side.open { transform: none; box-shadow: 0 0 60px rgba(0, 0, 0, .8); }
  .menu-btn { display: inline-flex; margin-bottom: 12px; }
  .main { padding: 16px; }
  .kv { grid-template-columns: 1fr; }
}
