/* Цінник — дизайн-система
   Чорнильно-синій для інтерфейсу, жовтий «цінник» лише там, де мова про ціну.
   Unbounded — заголовки, Geologica — усе інше, цифри табличні. */
:root {
  --bg: #f3f5f8;
  --panel: #ffffff;
  --ink: #15233f;
  --text: #1b2437;
  --muted: #64708a;
  --line: #dce1e9;
  --soft: #eef1f6;
  --tag: #ffd43b;
  --tag-ink: #2a2100;
  --primary: #15233f;
  --primary-ink: #ffffff;
  --ok: #17803d; --ok-soft: #e2f3e7;
  --err: #c2261d; --err-soft: #fbe6e4;
  --warn-soft: #fff6d6;
  --down: #17803d; --up: #c2261d;
  --c-prices: #2f6fde; --c-products: #17803d; --c-export: #b7791f;
  --radius: 10px;
  --font: "Geologica", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Unbounded", "Geologica", system-ui, sans-serif;
  --code: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1524; --panel: #161f33; --ink: #e8edf6; --text: #dfe5f0; --muted: #8c97ae; --line: #27324a; --soft: #1c2740;
    --primary: #ffd43b; --primary-ink: #2a2100;
    --ok: #4cc777; --ok-soft: #173123; --err: #ff7a70; --err-soft: #3a1d1c; --warn-soft: #362f17;
    --down: #4cc777; --up: #ff7a70; --c-prices: #6fa0ff; --c-products: #4cc777; --c-export: #e6b14f;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.55 var(--font); font-variant-numeric: tabular-nums; }
a { color: inherit; text-underline-offset: 3px; }
a:hover { color: var(--c-prices); }
:focus-visible { outline: 2px solid var(--c-prices); outline-offset: 2px; }
.muted { color: var(--muted); } .small { font-size: 13px; } .code { font-family: var(--code); font-size: 13px; }
.num { text-align: right; white-space: nowrap; }
h1, h2, h3 { color: var(--ink); line-height: 1.25; }
h1 { font: 600 26px/1.2 var(--display); letter-spacing: -0.01em; margin: 0 0 6px; }
h2 { font-size: 17px; margin: 0 0 12px; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* кнопки */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink); font: 500 14px var(--font); cursor: pointer;
  text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--ink); color: var(--ink); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { filter: brightness(1.12); color: var(--primary-ink); }
.btn.tag { background: var(--tag); border-color: var(--tag); color: var(--tag-ink); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn.lg { padding: 13px 22px; font-size: 16px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.danger:hover { border-color: var(--err); color: var(--err); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.link-btn { background: none; border: 0; padding: 0; color: var(--c-prices); cursor: pointer; font: inherit; font-size: 13px; }
.link-btn:hover { text-decoration: underline; }
form.inline-form { display: inline; margin: 0; }

/* форми */
label { display: block; font-size: 13px; font-weight: 600; margin: 0 0 6px; color: var(--ink); }
.field { margin-bottom: 14px; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 4px; font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=date], input[type=url], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--text); font: inherit; }
textarea { min-height: 90px; font: 13px/1.5 var(--code); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--c-prices); outline-offset: -1px; border-color: transparent; }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; font-size: 14px; margin: 8px 0; cursor: pointer; color: var(--text); }
.check input { margin-top: 3px; accent-color: var(--ink); }
.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline > input, .inline > select { width: auto; }

/* блоки */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.stack > * + * { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: 1fr 1fr; } .g3 { grid-template-columns: repeat(3, 1fr); } .g-side { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 900px) { .g2, .g3, .g-side { grid-template-columns: 1fr; } }
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.flash { padding: 11px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.flash.ok { background: var(--ok-soft); color: var(--ok); } .flash.error { background: var(--err-soft); color: var(--err); }
.flash.warn { background: var(--warn-soft); color: var(--text); }
.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty b { color: var(--ink); display: block; font-size: 16px; margin-bottom: 6px; }
.row-line { padding: 8px 0; border-bottom: 1px solid var(--line); } .row-line:last-child { border-bottom: 0; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
@media (max-width: 760px) { .kpis { grid-template-columns: 1fr 1fr; } }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi b { display: block; font: 600 24px/1.2 var(--font); color: var(--ink); }
.kpi span { color: var(--muted); font-size: 13px; }

/* таблиці */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12.5px; font-weight: 500; color: var(--muted); white-space: nowrap; background: var(--panel); }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; }
.card table th, .card table td { padding-left: 0; }
.prod { display: flex; align-items: center; gap: 10px; min-width: 240px; }
.prod img { width: 38px; height: 38px; object-fit: contain; background: #fff; border-radius: 6px; flex: none; border: 1px solid var(--line); }
.prod a { text-decoration: none; font-weight: 500; color: var(--ink); }

/* ціна: жовтий цінник — єдиний яскравий елемент інтерфейсу */
.price { display: inline-block; background: var(--tag); color: var(--tag-ink); font-weight: 600; padding: 1px 7px; border-radius: 4px 9px 9px 4px; white-space: nowrap; }
.delta-down { color: var(--down); } .delta-up { color: var(--up); }

/* значки */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--soft); color: var(--muted); }
.b-ok { background: var(--ok-soft); color: var(--ok); } .b-error { background: var(--err-soft); color: var(--err); }
.b-running, .b-queued, .b-cancel { background: var(--warn-soft); color: var(--text); }
.b-edit { background: #ece6ff; color: #5b3fc4; }
.b-rx { background: #ffe4e4; color: #b42318; } .b-staff { background: #e6f0ff; color: #1d4ed8; } .b-rxm { background: #fff1d6; color: #9a5b00; }
.st-new { background: #e4edff; color: #2457b8; } .st-in_progress { background: var(--warn-soft); color: #8a5a00; }
.st-review { background: #ece6ff; color: #5b3fc4; } .st-ready { background: var(--ok-soft); color: var(--ok); }
.st-exported { background: #dff3f5; color: #0b6b78; } .st-skip { background: var(--soft); color: var(--muted); }
@media (prefers-color-scheme: dark) {
  .b-edit, .st-review { background: #2a2244; color: #b6a4ff; } .b-rx { background: #3d1c1c; color: #ff9b9b; } .b-staff { background: #1c2b4a; color: #8fb3ff; } .b-rxm { background: #3a2c12; color: #f5c46b; } .st-new { background: #1c2b4a; color: #8fb3ff; }
  .st-in_progress { color: #ffd166; } .st-exported { background: #12343a; color: #6fd6e3; }
}
.chips { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.chip { font-size: 12px; background: var(--soft); border-radius: 6px; padding: 1px 7px; }
.issue { display: inline-block; font-size: 12px; background: var(--warn-soft); border-radius: 6px; padding: 1px 7px; margin: 1px 4px 1px 0; }
.qbar { display: inline-block; width: 60px; height: 6px; background: var(--soft); border-radius: 3px; overflow: hidden; vertical-align: middle; margin-right: 4px; }
.qbar i { display: block; height: 100%; } .q-good { background: var(--ok); } .q-mid { background: #e0a100; } .q-bad { background: var(--err); }
.meter { height: 6px; background: var(--soft); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.meter i { display: block; height: 100%; background: var(--ink); } .meter i.full { background: var(--err); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tabs a { padding: 9px 12px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-size: 14px; }
.tabs a.on { color: var(--ink); border-color: var(--ink); font-weight: 500; }
.pager { display: flex; gap: 6px; justify-content: center; margin-top: 16px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.filters select, .filters input[type=search] { width: auto; }
.bulkbar { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; margin-bottom: 8px; }

/* ===== кабінет: бічна панель ===== */
.cab { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 18px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .logo { margin: 0 6px 18px; }
.side a.nav { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; text-decoration: none; color: var(--muted); font-size: 14.5px; }
.side a.nav:hover { background: var(--soft); color: var(--ink); }
.side a.nav.on { background: var(--soft); color: var(--ink); font-weight: 500; }
.side .sep { height: 1px; background: var(--line); margin: 10px 6px; }
.dot { width: 8px; height: 8px; border-radius: 2px; flex: none; background: var(--line); }
.dot.prices { background: var(--c-prices); } .dot.products { background: var(--c-products); } .dot.export { background: var(--c-export); }
.planbox { margin-top: auto; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; font-size: 13px; }
.planbox b { color: var(--ink); }
.cab-main { padding: 26px 28px 60px; min-width: 0; }
.cab-top { display: none; }
@media (max-width: 900px) {
  .cab { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; padding: 8px 10px; border-right: 0; border-bottom: 1px solid var(--line); gap: 2px; }
  .side a.nav { padding: 6px 9px; font-size: 14px; }
  .side .logo, .side .sep, .planbox { display: none; }
  .cab-main { padding: 18px 16px 48px; }
  .cab-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
  .cab-top-r { display: flex; align-items: center; gap: 12px; }
  .cab-top .badge { text-decoration: none; }
}
/* елементи сітки не розтягуються ширшими за колонку через довгий вміст */
.grid > *, .stack > *, .mods > * { min-width: 0; }
/* телефон: широкі таблиці в картках прокручуються самі, а не всю сторінку; поля форм стискаються */
@media (max-width: 760px) {
  .card > table, .card .tbl { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .card > table td, .card > table th { white-space: nowrap; }
  .card > table td.wrap { white-space: normal; min-width: 180px; }
  select, input, textarea { max-width: 100%; min-width: 0; }
  .inline > * { min-width: 0; }
  .hide-sm { display: none; }
}

/* логотип: форма цінника з отвором */
.logo { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: var(--ink); font: 600 17px var(--display); }
.logo i { width: 26px; height: 18px; background: var(--tag); border-radius: 3px 9px 9px 3px; position: relative; flex: none; }
.logo i::after { content: ""; position: absolute; right: 5px; top: 6px; width: 6px; height: 6px; border-radius: 50%; background: var(--panel); }

/* рядок «що зараз збирається» — над вмістом сторінки, нічого не перекриває */
.live { background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--c-prices); border-radius: var(--radius);
  padding: 9px 14px; font-size: 13.5px; display: none; margin-bottom: 14px; }
.live div + div { margin-top: 4px; }
.live.show { display: block; }
.pulse { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c-prices); margin-right: 6px; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }

/* модулі на огляді */
.mods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
@media (max-width: 900px) { .mods { grid-template-columns: 1fr; } }
.mod { display: block; text-decoration: none; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; border-left: 4px solid var(--line); }
.mod:hover { color: inherit; border-color: var(--muted); }
.mod.prices { border-left-color: var(--c-prices); } .mod.products { border-left-color: var(--c-products); } .mod.export { border-left-color: var(--c-export); }
.mod h3 { margin: 0; font-size: 15px; } .mod .big { font: 600 28px/1.25 var(--font); color: var(--ink); margin-top: 6px; }
.mod .foot { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.stbar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; gap: 2px; margin-bottom: 10px; }
.stbar i { display: block; min-width: 4px; }
.legend { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; text-decoration: none; }

/* картка товару */
.sticky { position: sticky; top: 16px; }
.spec-edit td, .spec-edit th { padding: 4px 4px 4px 0; } .spec-edit input { padding: 6px 8px; font-size: 14px; }
.thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.thumbs a { display: block; aspect-ratio: 1; background: #fff; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.thumbs img { width: 100%; height: 100%; object-fit: contain; }
.thumbs a.broken { background: repeating-linear-gradient(45deg, var(--soft), var(--soft) 6px, var(--panel) 6px, var(--panel) 12px); }
.thumbs a.broken img { display: none; }
summary { cursor: pointer; font-weight: 600; color: var(--ink); }
.chart-box { position: relative; height: 320px; }

/* вибір варіантів (експорт, тарифи) */
.opt-list { display: grid; gap: 8px; }
.opt { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; font-weight: 400; font-size: 14px; margin: 0; color: var(--text); }
.opt:hover { border-color: var(--muted); }
.opt:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.opt input { margin-top: 3px; accent-color: var(--ink); }
.opt b { color: var(--ink); }
.scopes { display: grid; gap: 8px; grid-template-columns: repeat(3, 1fr); }
@media (max-width: 800px) { .scopes { grid-template-columns: 1fr; } }
.checklist { display: grid; gap: 0; max-height: 230px; overflow: auto; } .checklist.cols { grid-template-columns: 1fr 1fr; }
.count-box { margin-top: 12px; padding: 10px 12px; background: var(--soft); border-radius: 8px; font-size: 14px; }
.count-box span { font-weight: 600; font-size: 18px; color: var(--ink); }

/* ===== авторизація ===== */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-box { width: 100%; max-width: 400px; }
.auth-box .card { padding: 28px; }
.auth-box h1 { font-size: 22px; margin-bottom: 18px; }
.auth-box .logo { margin-bottom: 22px; }
.auth-foot { text-align: center; margin-top: 16px; font-size: 14px; color: var(--muted); }

/* ===== тарифи (кабінет і лендинг) ===== */
.period { display: inline-flex; background: var(--soft); border-radius: 999px; padding: 4px; gap: 2px; }
.period label { margin: 0; padding: 6px 14px; border-radius: 999px; cursor: pointer; font-weight: 500; font-size: 14px; color: var(--muted); }
.period input { position: absolute; opacity: 0; pointer-events: none; }
.period label:has(input:checked) { background: var(--panel); color: var(--ink); box-shadow: 0 1px 3px rgba(21,35,63,.12); }
.period label small { color: var(--ok); font-weight: 600; }
.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 16px; }
@media (max-width: 900px) { .plans { grid-template-columns: 1fr; } }
.plan { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 22px; display: flex; flex-direction: column; }
.plan.current { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.plan h3 { margin: 0; font: 600 18px var(--display); }
.plan .sum { margin: 14px 0 4px; font: 600 32px/1 var(--font); color: var(--ink); }
.plan .sum small { font-size: 14px; font-weight: 400; color: var(--muted); }
.plan ul { list-style: none; padding: 0; margin: 14px 0 18px; display: grid; gap: 7px; font-size: 14px; }
.plan li { padding-left: 20px; position: relative; }
.plan li::before { content: ""; position: absolute; left: 2px; top: 8px; width: 9px; height: 5px; border-left: 2px solid var(--ok); border-bottom: 2px solid var(--ok); transform: rotate(-45deg); }
.plan form, .plan > .btn { margin-top: auto; }

/* джерело даних: hotline / Rozetka */
.site { display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: .02em; padding: 1px 6px; border-radius: 4px;
  vertical-align: 1px; margin-right: 6px; border: 1px solid var(--line); color: var(--muted); background: var(--panel); white-space: nowrap; }
.site-rozetka { color: #0b8a47; border-color: rgba(11,138,71,.35); }
.site-hotline { color: #c2410c; border-color: rgba(194,65,12,.35); }
.site-feed { color: #2f6fb3; border-color: rgba(47,111,179,.35); }
.matrix th.c, .matrix td.c { text-align: center; width: 1%; white-space: nowrap; }
.matrix .yes { color: var(--ok); font-weight: 700; }
.acc-switch { width: 100%; margin-bottom: 8px; }
