/* Panda Kids — продажи.
   Цвет площадки ведёт весь экран: в кабинете Kaspi панель красная, в Wildberries —
   фиолетовая, в Ozon — синяя. Так с первого взгляда видно, чей магазин открыт.
   «Все вместе» и оформление — нейтральные, цвета компании. */
:root {
  --bg: #F3F3F0;
  --surface: #FFFFFF;
  --ink: #1B1F24;
  --muted: #5F666E;
  --line: #DCDDD8;
  --ok: #2E7D4F;
  --ok-soft: #E2EFE6;
  --warn: #9A6412;
  --warn-soft: #F6ECD8;
  --danger: #B23A26;
  --kaspi: #E8402F;
  --wb: #9B1FA8;
  --ozon: #005BFF;
  --brand: #22303C;
  --on-pc: #FFFFFF;
  --radius-s: 8px;
  --radius-m: 14px;
  --font: "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14171B; --surface: #1C2025; --ink: #ECEEE9; --muted: #A0A7AE; --line: #2F353B;
    --ok: #5DBB84; --ok-soft: #1F3528; --warn: #E0A84A; --warn-soft: #3A2E18; --danger: #EE7A63;
    --kaspi: #F0503F; --wb: #B54BC2; --ozon: #3D7DFF; --brand: #3A4A58; color-scheme: dark;
  }
}

/* цвет текущей площадки */
:root { --pc: var(--brand); }
:root[data-platform="kaspi"] { --pc: var(--kaspi); }
:root[data-platform="wb"] { --pc: var(--wb); }
:root[data-platform="ozon"] { --pc: var(--ozon); }
:root {
  --tint: color-mix(in srgb, var(--pc) 6%, var(--bg));
  --rail-bg: color-mix(in srgb, var(--pc) 13%, var(--bg));
  --pc-soft: color-mix(in srgb, var(--pc) 14%, var(--surface));
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--tint); color: var(--ink); font-family: var(--font);
  font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased;
  transition: background-color .35s ease;
}
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--pc); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- логотипы ---------- */
.logos { display: flex; align-items: center; gap: 8px; }
.logos img { height: 34px; max-width: 110px; object-fit: contain; border-radius: 6px; }
.logos .plus { width: 1px; height: 26px; background: var(--line); }

/* ---------- вход ---------- */
.gate { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.gate form, .gate .box { width: min(380px, 100%); display: grid; gap: 14px; }
.gate .logos img { height: 52px; max-width: 150px; }
.gate h1 { font-size: 26px; line-height: 1.15; margin: 6px 0 0; font-weight: 700; letter-spacing: -0.01em; }
.gate p { margin: 0; color: var(--muted); }

label.field { display: grid; gap: 6px; font-weight: 500; font-size: 14px; }
label.field small { font-weight: 400; color: var(--muted); }
input[type=text], input[type=password], select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-s);
  background: var(--surface);
}
input:focus { border-color: var(--pc); outline: none; box-shadow: 0 0 0 3px var(--pc-soft); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px; border-radius: var(--radius-s); border: 1px solid var(--line);
  background: var(--surface); cursor: pointer; font-weight: 500; white-space: nowrap; text-decoration: none;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--pc); color: var(--on-pc); border-color: var(--pc); transition: background-color .35s ease; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.quiet { border-color: transparent; background: transparent; color: var(--muted); }
.btn.quiet:hover { color: var(--ink); }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: .5; cursor: default; }
.err { color: var(--danger); font-size: 14px; min-height: 1.5em; }

/* ---------- каркас ---------- */
.shell { display: grid; grid-template-columns: 268px 1fr; min-height: 100%; }
.rail {
  background: var(--rail-bg); padding: 18px 12px; display: flex; flex-direction: column; gap: 18px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; transition: background-color .35s ease;
}
.brand { display: grid; gap: 8px; padding: 2px 8px 0; text-decoration: none; }
.brand b { font-size: 15px; line-height: 1.25; }

.nav-all, .cab, .nav-plain {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 8px 10px; border-radius: var(--radius-s); text-decoration: none; border: 0; background: none; cursor: pointer;
}
.nav-all { font-weight: 600; }
.nav-all:hover, .cab:hover, .nav-plain:hover { background: color-mix(in srgb, var(--surface) 70%, transparent); }
.nav-all[aria-current], .cab[aria-current], .nav-plain[aria-current] { background: var(--surface); font-weight: 600; }

.group h2 { font-size: 13px; font-weight: 600; color: var(--muted); margin: 0 0 4px; padding: 0 10px; }
.group ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.cab .stripe { width: 4px; align-self: stretch; border-radius: 2px; background: var(--cc); flex: none; }
.cab .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cab.hidden-cab .nm { color: var(--muted); text-decoration: line-through; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; border: 1.5px solid var(--muted); }
.dot.on { background: var(--ok); border-color: var(--ok); }
.rail-foot { margin-top: auto; display: grid; gap: 2px; }
.rail-foot .who { color: var(--muted); font-size: 13px; padding: 6px 10px 0; }
.rail-foot .btn { justify-content: flex-start; padding-left: 10px; }

.main { min-width: 0; padding: 24px 32px 64px; }

/* шапка кабинета — цветная плашка площадки */
.hero {
  background: var(--pc); color: var(--on-pc); border-radius: var(--radius-m);
  padding: 22px 26px 20px; display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; transition: background-color .35s ease;
}
.hero .kind { font-size: 14px; font-weight: 600; opacity: .85; }
.hero h1 { font-size: 32px; line-height: 1.1; margin: 4px 0 0; font-weight: 700; letter-spacing: -0.015em; }
.hero p { margin: 8px 0 0; opacity: .85; max-width: 62ch; }
.hero .btn { background: transparent; color: var(--on-pc); border-color: color-mix(in srgb, var(--on-pc) 45%, transparent); }
.hero .btn:hover { border-color: var(--on-pc); }
.hero form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.hero input[type=text] { width: min(360px, 100%); font-size: 20px; font-weight: 600; background: var(--surface); color: var(--ink); }
.hero .btn.solid { background: var(--surface); color: var(--ink); border-color: var(--surface); }

.tabs { display: flex; gap: 2px; margin: 18px 0 22px; overflow-x: auto; }
.tabs a {
  padding: 8px 14px; text-decoration: none; color: var(--muted); font-weight: 500; white-space: nowrap;
  border-radius: 99px;
}
.tabs a:hover { color: var(--ink); background: var(--pc-soft); }
.tabs a[aria-current] { color: var(--on-pc); background: var(--pc); }

/* ---------- содержимое ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 22px; }
.spaced { margin-top: 22px; }
.empty { max-width: 600px; }
.empty h3 { margin: 0 0 6px; font-size: 18px; }
.empty p { margin: 0 0 14px; color: var(--muted); }

table.grid { width: 100%; border-collapse: collapse; }
table.grid th { text-align: left; font-size: 13px; font-weight: 600; color: var(--muted); padding: 0 12px 10px; }
table.grid td { padding: 12px; border-top: 1px solid var(--line); vertical-align: middle; }
table.grid td.r, table.grid th.r { text-align: right; }
table.grid a { text-decoration: none; font-weight: 500; }
table.grid a:hover { text-decoration: underline; }
.tw { overflow-x: auto; }
.tag { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--cc); margin-right: 8px; }
.tag::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--cc); }
.status { font-size: 13px; padding: 2px 8px; border-radius: 99px; white-space: nowrap; text-decoration: none; }
.status.on { background: var(--ok-soft); color: var(--ok); }
.status.off { background: var(--warn-soft); color: var(--warn); }
.dash { color: var(--muted); }
.note { color: var(--muted); font-size: 14px; margin: 14px 0 0; max-width: 70ch; }

.settings { display: grid; gap: 18px; max-width: 660px; }
.settings h3 { margin: 0 0 4px; font-size: 17px; }
.settings .row { display: flex; gap: 8px; align-items: flex-end; margin-top: 16px; }
.settings .row label.field { flex: 1; }
.keyline { font-size: 13px; color: var(--muted); margin: 0; }
.settings .row + .keyline { margin-top: 6px; }
.keyline b { color: var(--ok); font-weight: 600; }

.slots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.slot { border: 1px dashed var(--line); border-radius: var(--radius-s); padding: 14px; display: grid; gap: 10px; justify-items: start; }
.slot .pic { height: 64px; width: 100%; display: grid; place-items: center start; }
.slot .pic img { max-height: 64px; max-width: 100%; object-fit: contain; }
.slot .pic span { color: var(--muted); font-size: 14px; }
.slot .acts { display: flex; gap: 6px; flex-wrap: wrap; }

dialog { border: 1px solid var(--line); border-radius: var(--radius-m); padding: 22px; width: min(420px, calc(100% - 32px));
  background: var(--surface); color: var(--ink); }
dialog::backdrop { background: rgb(0 0 0 / .35); }
dialog form { display: grid; gap: 14px; }
dialog h3 { margin: 0; font-size: 18px; }
dialog .acts { display: flex; justify-content: flex-end; gap: 8px; }

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--bg);
  padding: 10px 16px; border-radius: var(--radius-s); font-size: 14px; max-width: calc(100% - 32px); z-index: 50;
}

.menu-btn { display: none; }

/* ---------- телефон ---------- */
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: 20; transform: translateX(-100%);
    transition: transform .2s ease, background-color .35s ease; box-shadow: 0 0 0 100vmax transparent; }
  .shell.open .rail { transform: none; box-shadow: 0 0 0 100vmax rgb(0 0 0 / .35); }
  .main { padding: 14px 16px 48px; }
  .menu-btn { display: inline-flex; margin-bottom: 12px; }
  .hero { padding: 18px; }
  .hero h1 { font-size: 25px; }
  .settings .row { flex-direction: column; align-items: stretch; }
  .slots { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
