/*
  Кабинет владельца магазинов (merchant.<домен>). Рабочая панель: спокойная, деньги на первом месте.
  Скилл design-taste-frontend (только применимые к панели правила): один акцент (золото UC), холодные нейтрали,
  иконки Phosphor, карточки только у форм и графика, остальное разделено пустым местом и тонкими линиями.
  Скругления: карточки и модалки 14px, кнопки и поля 10px, бейджи и переключатели — полные.
  Движение: только отклик на наведение и нажатие; мерцание заглушек — при отсутствии reduced-motion.
*/

@font-face {
  font-family: "Onest"; src: url("/fonts/onest-cyrillic.woff2") format("woff2"); font-weight: 400 800; font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Onest"; src: url("/fonts/onest-latin.woff2") format("woff2"); font-weight: 400 800; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+2215;
}

:root {
  --accent: #e3a21a; --on-accent: #1d1503;
  --r-card: 14px; --r-ctl: 10px;
  --ease: cubic-bezier(.16, 1, .3, 1);
  color-scheme: light;
  --bg: #f5f6f8; --surface: #fcfcfd; --surface-2: #eef0f3; --line: #e2e5ea; --line-strong: #c8cdd5;
  --text: #15181e; --muted: #535b69; --faint: #6f7684;
  --ok: #0b7a4b; --warn: #8f5500; --err: #b42330;
  --accent-ink: #8a5d00;            /* акцент как текст на светлом фоне: контраст ≥ 4.5 */
  --accent-soft: #fbf1db;
  --bar: #e3a21a; --bar-hi: #b47c06;
  --shadow: 0 1px 2px rgba(21, 24, 30, .05);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e1013; --surface: #15181d; --surface-2: #1c2026; --line: #262a32; --line-strong: #3a404b;
    --text: #eceef2; --muted: #a2a8b4; --faint: #7f8693;
    --ok: #46c98d; --warn: #efb24a; --err: #ff7d87;
    --accent-ink: #f0b232; --accent-soft: #2a2213;
    --bar: #b8861f; --bar-hi: #f0b232;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1013; --surface: #15181d; --surface-2: #1c2026; --line: #262a32; --line-strong: #3a404b;
  --text: #eceef2; --muted: #a2a8b4; --faint: #7f8693;
  --ok: #46c98d; --warn: #efb24a; --err: #ff7d87;
  --accent-ink: #f0b232; --accent-soft: #2a2213;
  --bar: #b8861f; --bar-hi: #f0b232;
  --shadow: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 "Onest", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 28px; line-height: 1.15; font-weight: 700; letter-spacing: -.02em; }
h2 { font-size: 17px; line-height: 1.3; font-weight: 650; letter-spacing: -.01em; }
a { color: inherit; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.hint { font-size: 13px; color: var(--muted); }
.ph, .ph-fill { font-size: 20px; line-height: 1; flex: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }

/* ---------- Каркас: боковое меню на компьютере, нижняя панель на телефоне ---------- */
.app { min-height: 100dvh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.app.bare { grid-template-columns: minmax(0, 1fr); }
.side { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: 24px; padding: 20px 14px;
  border-right: 1px solid var(--line); background: var(--surface); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; font-size: 15px; padding: 0 8px; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); font-size: 11.5px; font-weight: 800; letter-spacing: .02em; flex: none; }
.nav { display: grid; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 0 12px; border-radius: var(--r-ctl); text-decoration: none; color: var(--muted); font-weight: 600; font-size: 14.5px; transition: background-color .15s, color .15s; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--text); }
.nav a[aria-current="page"] .ph { color: var(--accent-ink); }
.nav .count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.side-foot { margin-top: auto; display: grid; gap: 2px; padding-top: 14px; border-top: 1px solid var(--line); }
.side-foot .btn { justify-content: flex-start; color: var(--muted); }
.side-foot .btn:hover { color: var(--text); }
.me { padding: 4px 12px 10px; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me b { display: block; color: var(--text); font-size: 14px; }
.mobile-top { display: none; }
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; padding: 0; border: 0; background: none; display: contents; }
  .side > .brand, .side-foot { display: none; }
  .mobile-top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; height: 56px; padding: 0 16px;
    background: color-mix(in oklab, var(--bg) 90%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
  .mobile-top[hidden] { display: none; }
  .mobile-top .brand { padding: 0; }
  .nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; grid-template-columns: repeat(4, 1fr); gap: 0;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); }
  .nav a { flex-direction: column; justify-content: center; gap: 3px; min-height: 52px; padding: 0 4px; font-size: 11.5px; position: relative; }
  .nav a .ph { font-size: 22px; }
  .nav a[aria-current="page"] { background: none; color: var(--accent-ink); }
  .nav .count { position: absolute; top: 4px; left: calc(50% + 6px); min-width: 18px; height: 18px; font-size: 11px; }
  .main { padding-bottom: 104px !important; }
}

.main { width: 100%; max-width: 1120px; padding: 36px 40px 64px; display: grid; gap: 40px; outline: none; align-content: start; }
@media (max-width: 860px) { .main { padding: 20px 16px 40px; gap: 32px; } }
.section { display: grid; gap: 16px; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-head { display: grid; gap: 6px; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; font-weight: 600; }
.crumbs a:hover { color: var(--text); }
.crumbs .ph { font-size: 14px; }

/* ---------- Требует внимания: готовые действия ---------- */
.todo { display: grid; gap: 10px; }
.todo-item { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--r-card); border: 1px solid var(--line); background: var(--surface); }
.todo-item .ico { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--surface-2); color: var(--muted); }
.todo-item.warn .ico { background: color-mix(in oklab, var(--warn) 14%, transparent); color: var(--warn); }
.todo-item.ok .ico { background: var(--accent-soft); color: var(--accent-ink); }
.todo-item.err .ico { background: color-mix(in oklab, var(--err) 12%, transparent); color: var(--err); }
.todo-item .t { flex: 1; min-width: 0; }
.todo-item .t b { display: block; font-size: 15px; }
.todo-item .t span { font-size: 13.5px; color: var(--muted); }
@media (max-width: 560px) { .todo-item { flex-wrap: wrap; } .todo-item .btn { width: 100%; } }
/* ---------- Кнопки и поля ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 16px; border-radius: var(--r-ctl);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font: inherit; font-weight: 650; font-size: 14.5px;
  cursor: pointer; text-decoration: none; white-space: nowrap; transition: background-color .15s, border-color .15s, transform .1s; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
.btn .ph { font-size: 18px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: color-mix(in oklab, var(--accent) 90%, black); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-icon { width: 42px; padding: 0; }
.btn-lg { min-height: 48px; padding: 0 20px; font-size: 15.5px; }
.btn-sm { min-height: 38px; padding: 0 12px; font-size: 14px; }
.field { display: grid; gap: 7px; }
.field label { font-size: 13.5px; font-weight: 650; }
.input { width: 100%; min-height: 46px; padding: 10px 13px; border-radius: var(--r-ctl); border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--text); font: inherit; font-size: 16px; }
.input::placeholder { color: var(--faint); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 24%, transparent); }
.input[aria-invalid="true"] { border-color: var(--err); }
.input[disabled] { opacity: .6; }
.group { display: flex; }
.group > * { border-radius: 0; }
.group > :first-child { border-radius: var(--r-ctl) 0 0 var(--r-ctl); }
.group > :last-child { border-radius: 0 var(--r-ctl) var(--r-ctl) 0; }
.group > * + * { margin-left: -1px; }
.group .addon { display: grid; place-items: center; padding: 0 13px; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--muted); font-weight: 600; }
.group .input { flex: 1; min-width: 0; }
.code-input { letter-spacing: .45em; font-size: 24px; text-align: center; }
.error-text { display: flex; gap: 6px; align-items: center; color: var(--err); font-size: 13.5px; }
.error-text .ph { font-size: 16px; }

/* ---------- Поверхности ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: 20px; box-shadow: var(--shadow); display: grid; gap: 16px; align-content: start; }
.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12.5px; font-weight: 650; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge .ph, .badge .ph-fill { font-size: 14px; }
.badge.ok { color: var(--ok); background: color-mix(in oklab, var(--ok) 12%, transparent); }
.badge.warn { color: var(--warn); background: color-mix(in oklab, var(--warn) 14%, transparent); }
.badge.err { color: var(--err); background: color-mix(in oklab, var(--err) 12%, transparent); }
.badge.plain { background: transparent; border: 1px solid var(--line-strong); }
.segmented { display: inline-grid; grid-auto-flow: column; padding: 3px; gap: 2px; border-radius: 999px; background: var(--surface-2); }
.segmented button { min-height: 32px; padding: 0 14px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font: inherit; font-weight: 600; font-size: 13.5px; cursor: pointer; }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-ctl); background: var(--surface-2); color: var(--muted); font-size: 14px; }
.note.warn { background: color-mix(in oklab, var(--warn) 11%, transparent); color: var(--text); }
.note .ph { margin-top: 1px; font-size: 18px; }

/* ---------- Деньги: главная сумма слева, остальное списком справа ---------- */
.money { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 48px; align-items: center; }
.money-main { display: grid; gap: 10px; justify-items: start; padding: 28px; border-radius: var(--r-card); background: var(--accent-soft); border: 1px solid color-mix(in oklab, var(--accent) 30%, var(--line)); }
.money-main .label { font-size: 14px; font-weight: 600; color: var(--muted); }
.money-main .big { font-size: 46px; line-height: 1; font-weight: 750; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.money-main .sub { color: var(--muted); font-variant-numeric: tabular-nums; }
.money-main .btn { margin-top: 8px; }
.money-side { display: grid; }
.money-side .row { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 16px 0; }
.money-side .row + .row { border-top: 1px solid var(--line); }
.money-side .row span { color: var(--muted); }
.money-side .row b { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.money-side .row small { display: block; color: var(--faint); font-size: 12.5px; margin-top: 2px; }
@media (max-width: 760px) { .money { grid-template-columns: 1fr; gap: 8px; } .money-main { padding: 22px; } .money-main .big { font-size: 40px; } }

/* ---------- Магазины: строки одного списка ---------- */
.shop-list { border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); overflow: hidden; }
.shop-row { display: grid; grid-template-columns: minmax(0, 1.6fr) auto repeat(3, minmax(90px, .55fr)) 20px; gap: 20px; align-items: center;
  padding: 16px 20px; text-decoration: none; transition: background-color .15s; }
.shop-row + .shop-row { border-top: 1px solid var(--line); }
.shop-row:hover { background: var(--surface-2); }
.shop-name { display: flex; align-items: center; gap: 12px; min-width: 0; }
.initials { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--surface-2); border: 1px solid var(--line); font-weight: 700; color: var(--muted); }
.shop-name b { display: block; font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shop-name .hint { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-mini span { display: block; font-size: 12px; color: var(--muted); }
.stat-mini b { font-variant-numeric: tabular-nums; font-size: 15px; }
.shop-row .cta { grid-column: 3 / 6; display: flex; align-items: center; gap: 8px; color: var(--accent-ink); font-weight: 650; font-size: 14px; }
.shop-row > .ph { color: var(--faint); }
@media (max-width: 760px) {
  .shop-row { grid-template-columns: 1fr auto; gap: 12px 14px; padding: 16px; }
  .shop-row > .badge { justify-self: end; }
  .shop-row .stat-mini, .shop-row .cta { grid-column: span 1; }
  .shop-row .stats-wrap { grid-column: 1 / -1; }
  .shop-row > .ph { display: none; }
}
.stats-wrap { display: contents; }
@media (max-width: 760px) { .stats-wrap { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; } .stats-wrap .cta { grid-column: 1 / -1; } }

/* ---------- Продажи: показатели одной строкой ---------- */
.stats-line { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stats-line > div { padding: 4px 24px; display: grid; gap: 4px; }
.stats-line > div:first-child { padding-left: 0; }
.stats-line > div + div { border-left: 1px solid var(--line); }
.stats-line span { font-size: 13px; color: var(--muted); font-weight: 600; }
.stats-line b { font-size: 26px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
@media (max-width: 760px) {
  .stats-line { grid-template-columns: 1fr 1fr; gap: 16px 0; }
  .stats-line > div:nth-child(3) { border-left: 0; padding-left: 0; }
}
.sales-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 32px; align-items: start; }
@media (max-width: 900px) { .sales-grid { grid-template-columns: 1fr; } }
.top-list { display: grid; gap: 14px; padding-top: 4px; }
.top-list .item { display: grid; grid-template-columns: 24px 1fr auto; gap: 10px; align-items: baseline; }
.top-list .rank { color: var(--faint); font-variant-numeric: tabular-nums; font-weight: 600; }
.top-list .sub { color: var(--muted); font-size: 13px; }
.top-list b { font-variant-numeric: tabular-nums; }

/* ---------- График: одна серия, тонкие столбики, скруглённый верх 4px, зазор 2px ---------- */
.bars { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 2px; align-items: end; height: 170px; }
.bar { height: 100%; display: flex; align-items: flex-end; border: 0; padding: 0; background: none; cursor: pointer; }
.bar span { width: 100%; height: max(2px, var(--h)); border-radius: 4px 4px 0 0; background: var(--bar); transition: background-color .15s; }
.bar.on span, .bar:hover span { background: var(--bar-hi); }
.bar-axis { display: flex; justify-content: space-between; font-size: 12px; color: var(--faint); border-top: 1px solid var(--line); padding-top: 6px; }
.bar-tip { font-size: 14px; min-height: 21px; font-variant-numeric: tabular-nums; }

/* ---------- Магазин: контент слева, управление справа ---------- */
.shop-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 32px; align-items: start; }
.shop-side { display: grid; gap: 16px; }
@media (max-width: 960px) { .shop-grid { grid-template-columns: 1fr; } }
.kv { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; font-size: 14.5px; }
.kv b { font-variant-numeric: tabular-nums; }
.prices { display: grid; gap: 8px; padding: 12px 14px; border-radius: var(--r-ctl); background: var(--surface-2); }
.empty-state { display: grid; gap: 12px; justify-items: start; padding: 28px; border: 1px dashed var(--line-strong); border-radius: var(--r-card); }
.empty-state .ph { font-size: 32px; color: var(--accent-ink); }

/* ---------- Таблица выплат ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 13px 16px; text-align: left; vertical-align: top; }
thead th { font-size: 12.5px; color: var(--muted); font-weight: 650; border-bottom: 1px solid var(--line); }
tbody tr + tr td { border-top: 1px solid var(--line); }
td.num, th.num { text-align: right; }
.cell-sub { font-size: 12.5px; color: var(--muted); word-break: break-all; }
.empty { padding: 32px 16px; text-align: center; color: var(--muted); }
.steps { display: grid; gap: 14px; }
.steps div { display: grid; grid-template-columns: 24px 1fr; gap: 12px; color: var(--muted); font-size: 14.5px; }
.steps .ph { color: var(--accent-ink); }

/* ---------- Вход ---------- */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: min(400px, 100%); gap: 18px; padding: 28px; }
.auth-card .brand { margin-bottom: 4px; }
.auth-card h1 { font-size: 24px; }

/* ---------- Модалка и всплывашки ---------- */
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(9, 11, 15, .55); display: grid; place-items: center; padding: 16px; }
.modal { width: min(440px, 100%); max-height: 90dvh; overflow: auto; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; max-width: calc(100% - 32px);
  padding: 11px 16px; border-radius: var(--r-ctl); background: var(--text); color: var(--bg); font-weight: 600; font-size: 14px; box-shadow: 0 8px 24px rgba(9, 11, 15, .25); }
.toast.err { background: var(--err); color: #fff; }
@media (max-width: 760px) { .toast { bottom: 92px; } }
.skeleton { border-radius: var(--r-card); background: linear-gradient(90deg, var(--surface), var(--surface-2), var(--surface)); background-size: 200% 100%; min-height: 120px; }
@media (prefers-reduced-motion: no-preference) {
  .skeleton { animation: shimmer 1.2s linear infinite; }
  .scrim { animation: fade .18s var(--ease); }
}
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes fade { from { opacity: 0; } }

/* Продажи внутри страницы магазина: колонка уже, график и топ друг под другом, суммы не переносятся */
.stats-line b { white-space: nowrap; }
.shop-grid .sales-grid { grid-template-columns: 1fr; }
.shop-grid .stats-line b { font-size: 22px; }
@media (min-width: 761px) and (max-width: 1240px) { .shop-grid .stats-line { grid-template-columns: 1fr 1fr; gap: 16px 0; } .shop-grid .stats-line > div:nth-child(3) { border-left: 0; padding-left: 0; } }