:root {
  --bg: #0E0F11;
  --panel: #17191C;
  --panel-2: #1F2226;
  --line: #2A2E33;
  --text: #F3F5F4;
  --muted: #9AA1A6;
  --lime: #C6F432;
  --on-lime: #141a00;
  --coral: #FF7A66;
  --blue: #7FB2FF;
  --violet: #C59BFF;
  --amber: #F5C451;
  --cyan: #5FD8E8;
  --radius: 22px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 500 14px/1.45 Manrope, system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: var(--lime); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-family: Unbounded, Manrope, sans-serif; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 22px; }
h2 { font-size: 15px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.lime { color: var(--lime); }
.coral { color: var(--coral); }
svg.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ── Каркас ─────────────────────────────────────────────── */
.shell { display: flex; min-height: 100vh; }
.side { width: 248px; flex: none; background: var(--panel); padding: 20px 14px; display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; }
.brand-mark { width: 38px; height: 38px; border-radius: 13px; background: var(--lime); color: var(--on-lime); display: grid; place-items: center; overflow: hidden; }
.brand-name { font: 600 16px Unbounded, sans-serif; }
.company { position: relative; margin-bottom: 10px; }
.company-btn { width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; background: var(--panel-2); border-radius: 16px; padding: 10px 12px; }
.company-btn:hover { background: #262a2f; }
.company-btn .grow { min-width: 0; flex: 1; }
.company-btn b { display: block; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.company-btn small { color: var(--muted); font-size: 12px; }
.company-menu { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 6px); background: var(--panel-2); border: 1px solid var(--line); border-radius: 16px; padding: 6px; box-shadow: 0 18px 40px rgba(0,0,0,.5); }
.company-menu button { width: 100%; text-align: left; padding: 9px 10px; border-radius: 11px; display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.company-menu button:hover { background: #2a2e34; }
.company-menu small { color: var(--muted); font-size: 12px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav button { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 11px 12px; border-radius: 14px; color: var(--muted); font-weight: 600; }
.nav button:hover { color: var(--text); background: var(--panel-2); }
.nav button.on { color: var(--on-lime); background: var(--lime); font-weight: 800; }
.side-foot { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.avatar { width: 36px; height: 36px; border-radius: 12px; background: var(--panel-2); display: grid; place-items: center; font-weight: 800; flex: none; }
.side-foot .grow { min-width: 0; flex: 1; }
.side-foot b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-foot small { color: var(--muted); font-size: 12px; }
.icon-btn { width: 36px; height: 36px; border-radius: 12px; display: inline-grid; place-items: center; color: var(--muted); flex: none; }
.icon-btn:hover { color: var(--text); background: var(--panel-2); }
.icon-btn.danger:hover { color: var(--coral); }
.main { flex: 1; min-width: 0; padding: 26px 30px 60px; }
.top { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 22px; }
.top h1 { margin-right: auto; }

/* ── Кнопки и поля ──────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px; border-radius: 14px; background: var(--panel-2); font-weight: 700; white-space: nowrap; }
.btn:hover { background: #2a2e34; }
.btn.primary { background: var(--lime); color: var(--on-lime); font-weight: 800; }
.btn.primary:hover { background: #d2fb4d; }
.btn.danger { background: #2c1a17; color: var(--coral); }
.btn.sm { height: 34px; padding: 0 12px; border-radius: 11px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; color: var(--muted); font-weight: 600; }
.field .hint { font-size: 12px; color: var(--muted); }
input[type=text], input[type=tel], input[type=password], input[type=number], input[type=date], input[type=datetime-local], select, textarea {
  width: 100%; height: 44px; background: var(--panel-2); border: 1px solid transparent; border-radius: 13px; padding: 0 13px; outline: none; color-scheme: dark; }
textarea { height: 84px; padding: 10px 13px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--lime); }
input[type=range] { width: 100%; accent-color: var(--lime); }
.row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form { display: flex; flex-direction: column; gap: 14px; }
.form-error { color: var(--coral); font-size: 13px; min-height: 18px; }

/* ── Период ─────────────────────────────────────────────── */
.period { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--panel); border-radius: 14px; padding: 4px; gap: 2px; }
.seg button { height: 34px; padding: 0 13px; border-radius: 11px; color: var(--muted); font-weight: 700; font-size: 13px; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.period-label { min-width: 150px; text-align: center; font-weight: 800; }
.period .icon-btn { background: var(--panel); }
.period input[type=date] { width: 150px; height: 42px; background: var(--panel); }

/* ── Карточки ───────────────────────────────────────────── */
.card { background: var(--panel); border-radius: var(--radius); padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.grid { display: grid; gap: 16px; }
.metrics { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.metric { background: var(--panel); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 8px; text-align: left; border: 1px solid transparent; }
button.metric:hover { border-color: var(--line); }
.metric.hero { background: var(--lime); color: var(--on-lime); }
.metric.hero .muted { color: rgba(20,26,0,.66); }
.metric-label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; }
.dot { width: 9px; height: 9px; border-radius: 5px; flex: none; }
.metric-value { font: 600 24px/1.1 Unbounded, sans-serif; letter-spacing: -0.02em; white-space: nowrap; }
.metric-value small { font: 600 12px Manrope, sans-serif; margin-left: 6px; opacity: .7; letter-spacing: 0; }
.delta { font-size: 12px; font-weight: 700; }
.two { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
.two.wide-left { grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr); }
.two-eq { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); font-weight: 600; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-tip { position: absolute; pointer-events: none; background: #050606; border: 1px solid var(--line); border-radius: 12px; padding: 9px 11px; font-size: 12px; white-space: nowrap; transform: translate(-50%, -100%); z-index: 5; display: none; }
.chart-tip b { display: block; margin-bottom: 4px; }
.chart-tip div { display: flex; justify-content: space-between; gap: 14px; }
.stack { display: flex; height: 12px; gap: 3px; margin-bottom: 14px; }
.stack i { border-radius: 6px; min-width: 4px; }
.cat-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.cat-row:first-of-type { border-top: 0; }
.cat-row .grow { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.cat-row .pct { color: var(--muted); font-size: 12px; width: 42px; text-align: right; }
.cat-row b { width: 110px; text-align: right; }
.empty { color: var(--muted); padding: 26px 0; text-align: center; }

/* ── Таблицы ────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 0 12px 10px; white-space: nowrap; }
td { padding: 12px; border-top: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
td.wrap { white-space: normal; min-width: 160px; }
td small { font-size: 12px; }
td.r, th.r { text-align: right; }
td.actions { white-space: nowrap; text-align: right; width: 1%; }
tr:hover td { background: rgba(255,255,255,.015); }
tfoot td { font-weight: 800; }
.who { display: flex; align-items: center; gap: 10px; }
.who b { display: block; }
.who small { color: var(--muted); font-size: 12px; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 13px; font-size: 12px; font-weight: 700; background: var(--panel-2); color: var(--muted); white-space: nowrap; }
.pill.on { background: #26300a; color: var(--lime); }
.pill.warn { background: #2e2710; color: var(--amber); }
.pill.off { background: #2c1a17; color: var(--coral); }
.tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.tab { height: 40px; padding: 0 16px; border-radius: 20px; background: var(--panel); color: var(--muted); font-weight: 700; display: inline-flex; align-items: center; gap: 8px; }
.tab.on { background: var(--text); color: #111; }

/* ── Филиалы ────────────────────────────────────────────── */
.branches { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.branch-map { height: 180px; border-radius: 16px; overflow: hidden; background: var(--panel-2); margin-bottom: 14px; }
.map { height: 300px; border-radius: 16px; overflow: hidden; background: var(--panel-2); }
.leaflet-container { background: #1a1d20; font: inherit; }
.leaflet-tile { filter: brightness(.72) saturate(.5) contrast(1.1); }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; font-size: 13px; }
.kv span { color: var(--muted); }

/* ── Окна ───────────────────────────────────────────────── */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.66); display: grid; place-items: center; padding: 20px; z-index: 1000; overflow-y: auto; }
.modal { width: 100%; max-width: 520px; background: var(--panel); border-radius: 26px; padding: 24px; border: 1px solid var(--line); }
.modal.wide { max-width: 720px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
#toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); background: var(--text); color: #111; font-weight: 700; padding: 12px 18px; border-radius: 14px; z-index: 2000; display: none; box-shadow: 0 12px 30px rgba(0,0,0,.5); }
#toast.err { background: var(--coral); }

/* ── Вход ───────────────────────────────────────────────── */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth-card { width: 100%; max-width: 400px; background: var(--panel); border-radius: 28px; padding: 30px; }
.auth-card h1 { margin: 18px 0 6px; }
.auth-card p { color: var(--muted); margin: 0 0 20px; }
.auth-switch { margin-top: 16px; text-align: center; color: var(--muted); }
.auth-switch button { color: var(--lime); font-weight: 700; }

@media (max-width: 1180px) { .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); } .two, .two.wide-left { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .side { width: auto; height: auto; position: static; }
  .nav { flex-direction: row; overflow-x: auto; }
  .nav button { width: auto; white-space: nowrap; }
  .side-foot { margin-top: 10px; }
  .main { padding: 18px 14px 50px; }
  .metrics, .two-eq, .row { grid-template-columns: minmax(0, 1fr); }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ── Колокольчик ────────────────────────────────────────── */
.bell { position: relative; }
.bell i { position: absolute; top: 2px; right: 0; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--coral); color: #2A0E08; font: 800 10px/17px Manrope, sans-serif; text-align: center; }
.bell i[hidden] { display: none; }
.kv span svg.ic { vertical-align: -4px; margin-right: 4px; }

/* ── Подписка-билет ─────────────────────────────────────── */
.ticket { position: relative; background: var(--lime); color: var(--on-lime); border-radius: 28px; padding: 26px 28px 24px; }
.ticket-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.ticket-title { font: 600 20px Unbounded, Manrope, sans-serif; letter-spacing: -0.01em; }
.ticket-sub { color: rgba(20,26,0,.72); margin-top: 4px; }
.ticket-pill { flex: none; background: var(--on-lime); color: var(--lime); font-weight: 800; font-size: 13px; padding: 8px 14px; border-radius: 16px; white-space: nowrap; }
.ticket-pill.bad { color: var(--coral); }
.ticket-row { display: flex; justify-content: space-between; gap: 12px; margin-top: 22px; color: rgba(20,26,0,.72); }
.ticket-row b { color: var(--on-lime); }
.ticket-cut { position: relative; margin: 20px -28px; border-top: 2px dashed rgba(20,26,0,.4); }
.ticket-cut::before, .ticket-cut::after { content: ''; position: absolute; top: -15px; width: 28px; height: 28px; border-radius: 50%; background: var(--bg); }
.ticket-cut::before { left: -14px; }
.ticket-cut::after { right: -14px; }
.ticket-total { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-weight: 800; }
.ticket-total b { font: 600 34px Unbounded, Manrope, sans-serif; letter-spacing: -0.02em; }
.ticket-how { margin-top: 16px; padding-top: 14px; border-top: 1px solid rgba(20,26,0,.2); color: #232C00; white-space: pre-wrap; }
.card .ticket-cut::before, .card .ticket-cut::after { background: var(--panel); }

/* ── Меню, склад, касса ─────────────────────────────────── */
.nav .nav-link { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 14px; color: var(--lime); font-weight: 700; margin-top: 6px; border: 1px dashed #3a4a12; }
.nav .nav-link:hover { background: var(--panel-2); text-decoration: none; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chip { height: 34px; padding: 0 14px; border-radius: 17px; background: var(--panel); color: var(--muted); font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.chip.on { background: var(--text); color: #111; }
.metrics.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metrics.six { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.bar-row { display: flex; align-items: center; gap: 12px; padding: 7px 0; }
.bar-row .name { width: 180px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-row .track { flex: 1; height: 8px; border-radius: 4px; background: var(--panel-2); overflow: hidden; }
.bar-row .track i { display: block; height: 8px; border-radius: 4px; }
.bar-row b { width: 110px; text-align: right; }
.abc { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 8px; font-weight: 800; font-size: 12px; }
.abc.A { background: #26300a; color: var(--lime); } .abc.B { background: #2e2710; color: var(--amber); } .abc.C { background: #2c1a17; color: var(--coral); }
.lines-table td { padding: 6px 8px; } .lines-table input, .lines-table select { height: 38px; }
.lines-table th { padding: 0 8px 8px; }
tr.click { cursor: pointer; }
.fc-ok { color: var(--lime); } .fc-warn { color: var(--amber); } .fc-bad { color: var(--coral); }
.hours { display: flex; align-items: flex-end; gap: 3px; height: 120px; }
.hours div { flex: 1; background: var(--lime); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; }
.hours-labels { display: flex; gap: 3px; margin-top: 6px; } .hours-labels span { flex: 1; text-align: center; font-size: 10px; color: var(--muted); }
@media (max-width: 1180px) { .metrics.four, .metrics.six { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 860px) { .metrics.four, .metrics.six { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
