/* WB Pilot — система оформления. Ориентир: rta-moscow.com (docs/00, раздел 16).
   Белые поверхности, чёрные цифры, серые разделители, розовый — акцент бренда
   и выделение выбранного. Семантические цвета — свои, не из референса. */

/* Manrope, переменное начертание 200–800, SIL OFL 1.1 (лицензия — static/fonts/OFL.txt). Файлы с Google Fonts, 30.09.2026. */
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 200 800; font-display: swap; src: url("/static/fonts/Manrope-cyrillic-ext.woff2") format("woff2"); unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 200 800; font-display: swap; src: url("/static/fonts/Manrope-cyrillic.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 200 800; font-display: swap; src: url("/static/fonts/Manrope-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 200 800; font-display: swap; src: url("/static/fonts/Manrope-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --bg: #ffffff; --surface: #ffffff; --surface-muted: #f1f1f1; --surface-soft: #f7f7f7;
  --text: #000000; --text-secondary: #666666; --text-tertiary: #8a8a8a;
  --border: #e2e2e2; --border-strong: #000000;
  --accent: #fc3a79; --accent-strong: #ff125f; --accent-soft: #fde8ef;
  --ok: #1b7f3b; --ok-soft: #e6f4ea; --warn: #9a5b00; --warn-soft: #fff4e0; --danger: #c81e1e; --danger-soft: #fde8e8;
  --info: #2a4d9b; --info-soft: #e8eefb;
  --radius-card: 22px; --radius-input: 30px; --radius-pill: 999px;
  --shadow: 0 1px 2px rgba(0,0,0,.04);
  --font: "Manrope", Arial, sans-serif;
  --sidebar: 240px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.45; color: var(--text); background: var(--bg); }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 32px; line-height: 1.15; }
h2 { font-size: 22px; }
h3 { font-size: 17px; }
p { margin: 0 0 12px; }
a { color: inherit; }
.muted { color: var(--text-secondary); }
.tiny { font-size: 13px; color: var(--text-secondary); }
.num, td.num, th.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* -- каркас -------------------------------------------------------------- */
.env-banner { background: var(--warn-soft); color: var(--warn); padding: 8px 16px; font-weight: 600; text-align: center; font-size: 14px; }
.layout { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar { border-right: 1px solid var(--border); padding: 20px 16px; position: sticky; top: 0; height: 100vh; overflow: auto;
  background: linear-gradient(180deg, rgba(252,58,121,.10) 0%, rgba(180,140,255,.08) 22%, rgba(255,255,255,0) 40%), var(--bg); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 20px; padding: 4px 8px 18px; }
.brand-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a { display: block; padding: 10px 14px; border-radius: var(--radius-pill); text-decoration: none; color: var(--text); font-weight: 500; }
.nav a:hover { background: var(--surface-muted); }
.nav a.active { background: var(--text); color: #fff; }
.nav a:focus-visible, .btn:focus-visible, .tile:focus-visible, input:focus-visible, select:focus-visible, .switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
.sidebar-foot { margin-top: 24px; font-size: 13px; color: var(--text-secondary); padding: 0 8px; }
.content { padding: 24px 32px 48px; min-width: 0; }
.topbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.topbar-left { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.footer { color: var(--text-secondary); font-size: 13px; padding: 24px 0 0; }

/* -- кнопки --------------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 20px; min-height: 42px; font: inherit; font-weight: 600; font-size: 15px;
  border-radius: var(--radius-pill); border: 1.5px solid var(--text); background: #fff; color: var(--text); cursor: pointer; text-decoration: none; transition: background .12s, transform .06s; }
.btn:hover { background: var(--surface-muted); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--text); color: #fff; }
.btn-primary:hover { background: #222; }
.btn-neutral { background: var(--surface-muted); border-color: var(--surface-muted); }
.btn-neutral:hover { background: #e6e6e6; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn-danger { background: #fff; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-small { padding: 6px 14px; min-height: 34px; font-size: 14px; }
.btn[disabled], .btn.is-busy { opacity: .55; cursor: not-allowed; }
.btn-group { display: flex; flex-wrap: wrap; gap: 8px; }

/* -- поля ---------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field-label { font-weight: 500; font-size: 14px; }
.field .hint { font-size: 13px; color: var(--text-secondary); }
.field .error-text { font-size: 13px; color: var(--danger); font-weight: 600; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input, input[type="text"], input[type="number"], input[type="password"], input[type="time"], input[type="date"], input[type="search"], select, textarea {
  width: 100%; padding: 11px 16px; font: inherit; font-size: 16px; color: var(--text); background: #fff; border: 1.5px solid var(--border); border-radius: var(--radius-input); min-height: 46px; }
.input-wrap .unit { position: absolute; right: 16px; color: var(--text-secondary); font-size: 14px; pointer-events: none; background: #fff; padding-left: 6px; }
.input-wrap input { padding-right: 84px; }
input[type="number"] { -moz-appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button, input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input:hover, select:hover { border-color: #c8c8c8; }
input.is-invalid, select.is-invalid { border-color: var(--danger); }
select { appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8'><path d='M1 1l5 5 5-5' fill='none' stroke='%23000' stroke-width='1.6'/></svg>"); background-repeat: no-repeat; background-position: right 16px center; padding-right: 40px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 24px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 15px; }
.check input { width: 18px; height: 18px; margin: 3px 0 0; accent-color: var(--text); }

/* переключатель */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track { width: 44px; height: 26px; border-radius: 13px; background: #d6d6d6; position: relative; transition: background .15s; flex: none; }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + .switch-track { background: var(--text); }
.switch input:checked + .switch-track::after { transform: translateX(18px); }
.switch input:disabled + .switch-track { opacity: .4; }

/* дни недели */
.days { display: flex; flex-wrap: wrap; gap: 6px; }
.days label { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; padding: 8px 12px; border-radius: var(--radius-pill); border: 1.5px solid var(--border); cursor: pointer; font-weight: 600; font-size: 14px; }
.days input { position: absolute; opacity: 0; width: 0; height: 0; }
.days input:checked + span { color: #fff; }
.days label:has(input:checked) { background: var(--text); border-color: var(--text); color: #fff; }
.days label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

/* -- плитки редактора ------------------------------------------------------ */
.tiles { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
.tile { flex: 1 1 160px; min-height: 64px; padding: 12px 18px; border-radius: 18px; border: 1.5px solid var(--border); background: #fff; cursor: pointer; text-align: left; font: inherit; }
.tile b { display: block; font-size: 16px; }
.tile small { display: block; color: var(--text-secondary); font-size: 13px; }
.tile:hover { border-color: #bdbdbd; }
.tile.active { border-color: var(--accent); background: var(--accent-soft); }
.tile.has-error { border-color: var(--danger); }
.tile-body { width: 100%; }
.editor-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); }

/* -- карточки и сетки ----------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 20px 22px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 12px; }
.grid { display: grid; gap: 16px; }
.grid-metrics { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.metric { background: var(--surface-soft); border-radius: 18px; padding: 14px 16px; }
.metric .label { font-size: 13px; color: var(--text-secondary); }
.metric .value { font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; margin-top: 2px; }
.metric .sub { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 14px; }
.kv dt { color: var(--text-secondary); margin: 0; }
.kv dd { margin: 0; }

/* -- статусы и сообщения -------------------------------------------------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: var(--radius-pill); font-size: 13px; font-weight: 600; background: var(--surface-muted); color: var(--text); white-space: nowrap; }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; opacity: .8; }
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-danger { background: var(--danger-soft); color: var(--danger); }
.pill-info { background: var(--info-soft); color: var(--info); }
.pill-accent { background: var(--accent-soft); color: var(--accent-strong); }
.pill-muted { color: var(--text-secondary); }
.alert { border-radius: 16px; padding: 12px 16px; border: 1px solid var(--border); background: var(--surface-soft); }
.alert b { margin-right: 4px; }
.alert-ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.alert-warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.alert-danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.alert-info { background: var(--info-soft); border-color: transparent; color: var(--info); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: #fff; padding: 12px 18px; border-radius: var(--radius-pill); font-weight: 600; z-index: 20; max-width: min(90vw, 560px); }
.toast-danger { background: var(--danger); }

/* -- таблицы --------------------------------------------------------------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--border); border-radius: 18px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
th { font-weight: 600; font-size: 13px; color: var(--text-secondary); background: var(--surface-soft); position: sticky; top: 0; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafafa; }
tr.clickable { cursor: pointer; }
td .name { font-weight: 600; }
td .sub { display: block; font-size: 12px; color: var(--text-secondary); }
tfoot td { font-weight: 600; background: var(--surface-soft); }

/* -- график ----------------------------------------------------------------- */
.chart { width: 100%; height: auto; display: block; }
.chart .bar { fill: var(--text); }
.chart .bar-empty { fill: #d9d9d9; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; }
.chart .dot { fill: var(--accent); }
.chart text { font-family: var(--font); font-size: 11px; fill: var(--text-secondary); }
.chart .axis { stroke: var(--border); }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--text-secondary); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }

/* -- страница входа --------------------------------------------------------- */
.login { max-width: 420px; margin: 64px auto; padding: 0 16px; }
.login h1 { margin-bottom: 4px; }
.login form label { display: block; margin-top: 16px; font-weight: 500; }
.login form input { margin-top: 6px; }
.login .btn { margin-top: 24px; }
.error { color: var(--danger); font-weight: 600; }

/* -- компоненты (страница-витрина) ------------------------------------------- */
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { width: 120px; border-radius: 14px; border: 1px solid var(--border); overflow: hidden; font-size: 12px; }
.swatch i { display: block; height: 48px; }
.swatch span { display: block; padding: 6px 8px; }

/* -- адаптивность ------------------------------------------------------------ */
@media (max-width: 1023px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--border); padding: 14px 16px 10px; }
  .nav { flex-direction: row; overflow-x: auto; gap: 6px; padding-bottom: 4px; scrollbar-width: none; }
  .nav a { white-space: nowrap; padding: 8px 14px; }
  .sidebar-foot { display: none; }
  .content { padding: 18px 16px 40px; }
  h1 { font-size: 28px; }
}
@media (max-width: 767px) {
  h1 { font-size: 26px; }
  .tiles { gap: 6px; }
  .tile { flex: 1 1 90px; min-height: auto; padding: 10px 10px; border-radius: 14px; }
  .tile b { font-size: 14px; }
  .tile small { display: none; }
  .form-grid, .grid-2 { grid-template-columns: 1fr; }
  .card { padding: 16px; border-radius: 18px; }
  .metric .value { font-size: 22px; }
  .topbar { flex-direction: column; align-items: stretch; }
  .topbar-left > * { flex: 1 1 auto; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
