/* Палитра: светлая «рабочая» база, чернильный индиго для текста,
   один сигнальный синий для действий, оранжевый — только для 🔥. */
:root {
  --bg: #F3F4F8; --surface: #FFFFFF; --ink: #1B1F3B; --muted: #646A86; --line: #DFE2EC;
  --action: #2F5BFF; --action-ink: #FFFFFF; --hot: #FF6A13; --hot-bg: #FFF1E8;
  --good: #128A4A; --good-bg: #E6F6EC; --bad: #C8323C; --bad-bg: #FCEBEC;
  --r-s: 6px; --r-m: 10px;
  --font: 'Onest', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); }
body { font-variant-numeric: tabular-nums; }
a { color: var(--action); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 26px; line-height: 1.2; font-weight: 700; margin: 0 0 16px; letter-spacing: -0.01em; }
h2 { font-size: 18px; font-weight: 600; margin: 24px 0 10px; }
h3 { font-size: 15px; font-weight: 600; margin: 16px 0 6px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
:focus-visible { outline: 2px solid var(--action); outline-offset: 2px; }

/* Каркас: боковое меню на десктопе, нижнее на телефоне */
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.nav { background: var(--ink); color: #fff; padding: 20px 12px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100vh; }
.nav .brand { font-weight: 700; font-size: 18px; padding: 0 10px 18px; }
.nav a { color: #C9CCE0; padding: 9px 10px; border-radius: var(--r-s); display: flex; justify-content: space-between; align-items: center; }
.nav a:hover { background: rgba(255,255,255,.08); text-decoration: none; color: #fff; }
.nav a.active { background: rgba(255,255,255,.14); color: #fff; }
.nav .count { background: var(--hot); color: #fff; font-size: 12px; border-radius: 99px; padding: 0 7px; }
.nav .me { margin-top: auto; padding: 10px; font-size: 13px; color: #9EA3C2; }
.main { padding: 28px 32px 80px; max-width: 1200px; width: 100%; }
@media (max-width: 720px) {
  .shell { grid-template-columns: 1fr; }
  .nav { position: fixed; bottom: 0; top: auto; height: auto; width: 100%; flex-direction: row; padding: 6px; z-index: 10; overflow-x: auto; }
  .nav .brand, .nav .me { display: none; }
  .nav a { flex: 1; justify-content: center; font-size: 13px; padding: 8px 6px; white-space: nowrap; }
  .main { padding: 18px 14px 90px; }
}

/* Элементы */
.btn { font: inherit; font-weight: 500; border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 8px 14px; border-radius: var(--r-s); cursor: pointer; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--action); color: var(--action-ink); border-color: var(--action); }
.btn.hot { background: var(--hot); color: #fff; border-color: var(--hot); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--action); padding-left: 6px; padding-right: 6px; }
.btn.small { padding: 4px 9px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.stack > * + * { margin-top: 10px; }
input, select, textarea { font: inherit; color: var(--ink); border: 1px solid var(--line); border-radius: var(--r-s); padding: 7px 10px; background: var(--surface); min-width: 0; }
textarea { width: 100%; min-height: 80px; resize: vertical; }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
label.field > input, label.field > select, label.field > textarea { color: var(--ink); font-size: 15px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: 18px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 99px; background: var(--bg); border: 1px solid var(--line); font-size: 13px; white-space: nowrap; }
.chip.hot { background: var(--hot-bg); border-color: #FFD2B5; color: #A43F00; }
.chip.good { background: var(--good-bg); border-color: #BFE6CE; color: var(--good); }
.chip.bad { background: var(--bad-bg); border-color: #F3C2C5; color: var(--bad); }
.chip.stale { color: var(--muted); }

/* Коэффициент — главный визуальный элемент: число + полоса заполнения */
.coef { display: inline-grid; grid-template-columns: auto 46px; align-items: center; gap: 6px; font-weight: 600; }
.coef .bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.coef .bar > i { display: block; height: 100%; background: var(--action); }
.coef.none { color: var(--muted); font-weight: 400; }

table.t { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); overflow: hidden; }
table.t th { text-align: left; font-weight: 500; color: var(--muted); font-size: 13px; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t th.sortable { cursor: pointer; user-select: none; }
table.t td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: #F8F9FC; }
.scroll-x { overflow-x: auto; }

.toast { position: fixed; right: 18px; bottom: 18px; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: var(--r-s); z-index: 50; max-width: 360px; }
.toast.error { background: var(--bad); }
.modal-bg { position: fixed; inset: 0; background: rgba(27,31,59,.45); display: grid; place-items: center; z-index: 40; padding: 14px; }
.modal { background: var(--surface); border-radius: var(--r-m); padding: 20px; width: min(520px, 100%); max-height: 90vh; overflow: auto; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login form { width: min(360px, 100%); }
.boot { padding: 40px; color: var(--muted); }
.empty { padding: 28px; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r-m); }

.thumb { width: 52px; height: 52px; border-radius: var(--r-s); object-fit: cover; background: var(--bg); border: 1px solid var(--line); flex: none; }
.gallery { display: flex; gap: 8px; flex-wrap: wrap; }
.gallery img { width: 140px; height: 140px; object-fit: cover; border-radius: var(--r-s); border: 1px solid var(--line); cursor: zoom-in; }
@media (prefers-reduced-motion: no-preference) { .toast { animation: rise .18s ease-out; } @keyframes rise { from { transform: translateY(8px); opacity: 0; } } }
