/* Сода — темний інтерфейс у стилі Bohitech */
:root {
  --night-1: #020c22; --night-2: #0b073b; --night-3: #11417b;
  --accent: #2F5BFF; --accent-hi: #4a72ff;
  --bohi-1: #5BE0FF; --bohi-2: #2F5BFF; --bohi-3: #E05BD6;
  --ink: #eef2ff; --ink-2: #b9c3e6; --ink-3: #8390bd;
  --surface: rgba(255,255,255,.045); --surface-2: rgba(255,255,255,.075);
  --line: rgba(255,255,255,.10); --line-2: rgba(255,255,255,.18);
  --ok: #3ddc97; --warn: #ffb547; --bad: #ff6b7a; --info: #5BE0FF; --violet: #b89bff;
  --r-s: 10px; --r-m: 16px; --r-l: 24px;
  --tap: 46px; --row-pad: 12px;
  --font: "Manrope", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --display: "Unbounded", var(--font);
}
html { font-size: 16px; }
html[data-font="1"] { font-size: 17.5px; }
html[data-font="2"] { font-size: 19px; }
html[data-font="3"] { font-size: 21px; }
html[data-density="compact"] { --row-pad: 7px; }

* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100vh; color: var(--ink); font-family: var(--font); line-height: 1.45;
  background: var(--night-1);
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(135deg, var(--night-1) 0%, var(--night-2) 55%, var(--night-3) 100%);
}
a { color: #9fb6ff; text-decoration: none; }
a:hover { color: #fff; }
h1, h2, h3 { margin: 0 0 .6rem; line-height: 1.2; }
h1 { font-size: 1.55rem; font-weight: 800; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; font-weight: 800; }
h3 { font-size: 1rem; font-weight: 700; color: var(--ink-2); }
.mono { font-family: var(--mono); font-size: .92em; }
.muted { color: var(--ink-3); }
.small { font-size: .86rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.num { font-variant-numeric: tabular-nums; font-weight: 700; text-align: right; white-space: nowrap; }

/* ---------- каркас */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; padding: 22px 14px; display: flex; flex-direction: column; gap: 4px;
  border-right: 1px solid var(--line); background: rgba(2,12,34,.55); backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 10px 18px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center;
  font-family: var(--display); font-weight: 700; font-size: 15px; color: #fff;
  background: radial-gradient(circle at 30% 25%, #3f6bff, #1a2f9a 70%);
  box-shadow: 0 0 0 1px rgba(91,224,255,.35), 0 0 18px -4px rgba(91,224,255,.6);
}
.brand-name { font-family: var(--display); font-weight: 600; font-size: 1.05rem; letter-spacing: .02em; }
.brand-sub { font-size: .72rem; color: var(--ink-3); }
.nav a {
  display: flex; align-items: center; gap: 10px; min-height: var(--tap); padding: 0 12px;
  border-radius: var(--r-s); color: var(--ink-2); font-weight: 600;
}
.nav a:hover { background: var(--surface); color: var(--ink); }
.nav a.on { background: var(--surface-2); color: #fff; box-shadow: inset 2px 0 0 var(--bohi-1); }
.nav .ico { width: 20px; text-align: center; opacity: .85; }
.side .spacer { flex: 1; }
.side .who { padding: 10px 12px; font-size: .82rem; color: var(--ink-3); }

.main { padding: 22px 28px 60px; max-width: 1400px; width: 100%; min-width: 0; }
.topbar { display: flex; gap: 12px; align-items: center; margin-bottom: 22px; }
.topbar form { flex: 1; }
.search {
  width: 100%; height: 50px; padding: 0 18px 0 46px; border-radius: 999px; font: inherit; font-size: 1rem;
  color: var(--ink); background: rgba(255,255,255,.06) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='none' stroke='%238390bd' stroke-width='2'%3E%3Ccircle cx='9' cy='9' r='6'/%3E%3Cpath d='m14 14 4 4'/%3E%3C/svg%3E") no-repeat 16px center;
  border: 1px solid var(--line);
}
.search:focus { outline: none; border-color: transparent;
  box-shadow: 0 0 0 2px var(--bohi-2), 0 0 22px -6px var(--bohi-1); }

/* ---------- картки й сітки */
.grid { display: grid; gap: 16px; }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 20px 22px;
  position: relative;
}
.card + .card { margin-top: 16px; }
.grid > .card + .card { margin-top: 0; }
.stat .label { color: var(--ink-3); font-size: .82rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.stat .value { font-size: 1.9rem; font-weight: 800; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .value small { font-size: .9rem; color: var(--ink-3); font-weight: 600; }
.edge::before {
  content: ""; position: absolute; inset: 0 22px auto; height: 1px;
  background: linear-gradient(90deg, transparent, var(--bohi-1), var(--bohi-2), var(--bohi-3), transparent);
  opacity: .7;
}
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 26px 0 12px; }
.section-head h2 { margin: 0; }

/* ---------- таблиці */
.table-wrap { overflow-x: auto; border-radius: var(--r-m); border: 1px solid var(--line); background: var(--surface); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: var(--row-pad) 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 700;
     background: rgba(255,255,255,.03); position: sticky; top: 0; }
th a { color: inherit; }
tr:last-child td { border-bottom: 0; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: rgba(255,255,255,.045); }
td .sub { display: block; color: var(--ink-3); font-size: .8rem; }

/* ---------- статуси */
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px;
  font-size: .78rem; font-weight: 700; white-space: nowrap; background: rgba(255,255,255,.08); color: var(--ink-2);
}
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.st-expected { color: var(--info); background: rgba(91,224,255,.10); }
.st-service { color: var(--warn); background: rgba(255,181,71,.12); }
.st-stock { color: var(--ok); background: rgba(61,220,151,.12); }
.st-reserved { color: var(--violet); background: rgba(184,155,255,.13); }
.st-transit { color: #8fb0ff; background: rgba(47,91,255,.18); }
.st-sold { color: var(--ink-3); }
.st-repair { color: #ff9b5c; background: rgba(255,155,92,.12); }
.st-writeoff { color: var(--bad); background: rgba(255,107,122,.12); }
.chip.flag { color: var(--warn); background: rgba(255,181,71,.10); }
.chip.flag::before { display: none; }

/* ---------- кнопки й поля */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap);
  padding: 0 20px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface-2);
  color: var(--ink); font: inherit; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: rgba(255,255,255,.12); color: #fff; }
.btn.primary { background: var(--accent); border-color: transparent; color: #fff;
  box-shadow: 0 8px 24px -10px rgba(47,91,255,.9); }
.btn.primary:hover { background: var(--accent-hi); }
.btn.small { min-height: 36px; padding: 0 14px; font-size: .86rem; }
.btn.danger { color: var(--bad); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

label { display: block; font-size: .84rem; font-weight: 700; color: var(--ink-2); margin-bottom: 6px; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=file],
input:not([type]), select, textarea {
  width: 100%; min-height: var(--tap); padding: 10px 14px; border-radius: var(--r-s); font: inherit;
  color: var(--ink); background: rgba(2,12,34,.55); border: 1px solid var(--line-2);
}
textarea { min-height: 80px; resize: vertical; }
select option { background: #0b1240; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--bohi-2);
  box-shadow: 0 0 0 3px rgba(47,91,255,.28); }
input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--accent); vertical-align: middle; }
.field { margin-bottom: 14px; }
.field .help { font-size: .78rem; color: var(--ink-3); margin-top: 4px; }
.field .err, .errorlist { color: var(--bad); font-size: .84rem; margin: 4px 0 0; padding: 0; list-style: none; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 16px; }
.check-list label, .check { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--ink);
  min-height: 40px; margin: 0; }
.check-list ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 18px; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.filters select { width: auto; min-width: 150px; max-width: 100%; }
.pill {
  display: inline-flex; align-items: center; min-height: 38px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--ink-2); font-weight: 600; font-size: .88rem;
}
.pill.on { background: var(--surface-2); color: #fff; border-color: var(--line-2); }

.msgs { list-style: none; margin: 0 0 16px; padding: 0; }
.msgs li { padding: 12px 16px; border-radius: var(--r-s); margin-bottom: 8px; font-weight: 600;
  background: rgba(61,220,151,.12); color: #a8f3d0; }
.msgs li.error { background: rgba(255,107,122,.13); color: #ffc2c9; }

.pager { display: flex; gap: 8px; align-items: center; justify-content: center; margin-top: 16px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; }
.kv dt { color: var(--ink-3); font-size: .86rem; }
.kv dd { margin: 0; font-weight: 600; }
.history li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.history { list-style: none; margin: 0; padding: 0; }
.history .ch { font-size: .84rem; color: var(--ink-2); }
.history .ch b { color: var(--ink); font-weight: 600; }
.empty { padding: 30px; text-align: center; color: var(--ink-3); }

/* ---------- вхід */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth .card { width: 100%; max-width: 420px; padding: 32px; }
.auth .brand { justify-content: center; padding-bottom: 24px; }
.auth .brand-mark { width: 48px; height: 48px; font-size: 20px; border-radius: 15px; }
.auth .brand-name { font-size: 1.4rem; }
.qr { background: #fff; border-radius: var(--r-m); padding: 10px; width: 220px; margin: 8px auto 14px; display: block; }
.code-input { font-family: var(--mono) !important; font-size: 1.6rem !important; letter-spacing: .4em; text-align: center; }

.show-m { display: none; }
/* ---------- телефон */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: sticky; top: 0; z-index: 5; height: auto; flex-direction: row; overflow-x: auto; padding: 8px 10px;
    border-right: 0; border-bottom: 1px solid var(--line); }
  .brand, .side .spacer, .side .who { display: none; }
  .nav { display: flex; gap: 4px; }
  .nav a { white-space: nowrap; }
  .nav a.on { box-shadow: inset 0 -2px 0 var(--bohi-1); }
  .main { padding: 16px; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3, .g2 { grid-template-columns: 1fr; }
  .hide-m { display: none; }
  .show-m { display: inline; }
  .num { font-size: .95em; }
}
