/* NOVUS Знижки — base theme. No inline styles anywhere (CSP: style-src 'self'). */
:root {
  --bg: #f6f7f9; --surface: #fff; --text: #1b1f24; --muted: #5c6670; --line: #dde2e8;
  --brand: #1f4e78; --accent: #fa4b67; --warn-bg: #fff4e5; --warn: #8a4b00; --info-bg: #eaf2fb;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111418; --surface: #1a1f25; --text: #e7ebef; --muted: #9aa5b1; --line: #2b323a;
    --brand: #6ea8de; --accent: #ff6b84; --warn-bg: #3a2a12; --warn: #f3c27a; --info-bg: #182636;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--brand); }
h1 { font-size: 1.5rem; margin: 0 0 1rem; display: flex; align-items: center; gap: .5rem; }

.top { display: flex; align-items: center; gap: 1rem; padding: .6rem 1rem; background: var(--surface);
  border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .4rem; font-weight: 600; text-decoration: none; color: var(--text); }
.switcher { position: relative; }
.switcher summary { cursor: pointer; padding: .3rem .6rem; border: 1px solid var(--line); border-radius: 8px; list-style: none; }
.switcher ul { position: absolute; z-index: 10; margin: .3rem 0 0; padding: .3rem 0; list-style: none; min-width: 16rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.switcher li a { display: block; padding: .4rem .8rem; text-decoration: none; color: var(--text); }
.switcher li a[aria-current] { font-weight: 600; color: var(--brand); }
.switcher-single { color: var(--muted); }
.logout { margin-left: auto; }
button { font: inherit; cursor: pointer; border: 0; border-radius: 8px; padding: .55rem 1rem; background: var(--brand); color: #fff; }
button.link { background: none; color: var(--brand); padding: 0; }

.page { max-width: 1100px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; }
.login-card { width: 100%; max-width: 22rem; display: grid; gap: .9rem; }
label { display: grid; gap: .25rem; font-size: .9rem; color: var(--muted); }
input { font: inherit; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); }
.error { margin: 0; padding: .5rem .7rem; border-radius: 8px; background: var(--warn-bg); color: var(--warn); }
.notice { padding: .6rem .8rem; border-radius: 8px; background: var(--info-bg); }
.notice.warn { background: var(--warn-bg); color: var(--warn); }
.muted { color: var(--muted); }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1.2rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; }
@media (max-width: 600px) { .facts { grid-template-columns: 1fr; } .facts dd { margin-bottom: .5rem; } }

/* stage 2: sync status, runs table */
.sync { margin: 0 0 1rem; }
.sync-line { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.sync-line progress { width: 12rem; height: .6rem; accent-color: var(--brand); }
.sync-msg { margin: .4rem 0 0; color: var(--muted); }
.banner { margin-bottom: .7rem; }
.banner code, .notice code { font-size: .85em; }
button.small { padding: .3rem .7rem; font-size: .9rem; }
button:disabled { opacity: .5; cursor: not-allowed; }
.small-link { font-size: .9rem; }
form.inline { display: inline; margin-left: .5rem; }
.table-wrap { overflow-x: auto; }
table.runs { width: 100%; border-collapse: collapse; background: var(--surface); font-size: .92rem; }
table.runs th, table.runs td { padding: .45rem .6rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.runs th { color: var(--muted); font-weight: 600; white-space: nowrap; }
tr.st-suspect td, tr.st-rejected td, tr.st-failed td { background: var(--warn-bg); }
tr.st-skipped td, tr.st-interrupted td { color: var(--muted); }
.tag { font-size: .75rem; padding: .05rem .35rem; border-radius: 4px; background: var(--info-bg); }
form.accept { display: flex; gap: .4rem; margin-top: .3rem; flex-wrap: wrap; }
form.accept input { padding: .3rem .5rem; }

/* stage 3: showcase */
.tabs { display: flex; gap: .3rem; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin: 0 0 1rem; }
.tabs a { padding: .5rem .8rem; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a[aria-current] { color: var(--text); border-bottom-color: var(--brand); font-weight: 600; }
.tabs .count { font-size: .8rem; padding: 0 .4rem; border-radius: 999px; background: var(--info-bg); color: var(--text); }
.filters { display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: end; margin-bottom: .8rem; }
.filters label { min-width: 7rem; }
.filters .f-search { flex: 1 1 14rem; }
.filters input[type=number] { width: 7rem; }
.filters select { font: inherit; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); }
.filters .f-check { display: flex; align-items: center; gap: .4rem; min-width: auto; color: var(--text); }
.toolbar { display: flex; flex-wrap: wrap; gap: .6rem 1.2rem; align-items: center; margin-bottom: 1rem; font-size: .92rem; }
.views a { margin-right: .5rem; color: var(--muted); }
.views a[aria-current] { color: var(--text); font-weight: 600; text-decoration: none; }
.empty { padding: 2rem 1rem; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }

.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: .9rem; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.card.item { padding: .7rem; display: flex; flex-direction: column; gap: .3rem; }
.item .photo { position: relative; aspect-ratio: 1; background: var(--bg); border-radius: 8px; overflow: hidden; }
.item .photo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.item .badge { position: absolute; top: .4rem; left: .4rem; }
.item .badge.new { left: auto; right: .4rem; background: var(--brand); }
.badge { display: inline-block; padding: .1rem .45rem; border-radius: 6px; background: var(--accent); color: #fff; font-weight: 700; font-size: .85rem; }
.item h3 { font-size: .95rem; font-weight: 500; margin: .2rem 0 0; line-height: 1.3; }
.prices { margin: 0; }
.old { text-decoration: line-through; color: var(--muted); }
.new { font-weight: 700; }
.item .reason { margin: 0; font-size: .85rem; color: var(--warn); }
.item .dates { margin: 0; font-size: .85rem; }
.labels { margin: 0; display: flex; flex-wrap: wrap; gap: .25rem; }
.labels span { font-size: .75rem; padding: .05rem .4rem; border-radius: 4px; background: var(--info-bg); }

table.items { width: 100%; border-collapse: collapse; background: var(--surface); font-size: .92rem; }
table.items th, table.items td { padding: .4rem .6rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
table.items th { color: var(--muted); font-weight: 600; white-space: nowrap; }
table.items td.thumb img { width: 48px; height: 48px; object-fit: contain; display: block; }
.only-mobile { display: none; }
.pager { display: flex; gap: 1rem; justify-content: center; align-items: center; margin: 1.5rem 0; }

@media (max-width: 767px) {
  .view-table { display: none; }          /* phones always get cards (spec §8) */
  .only-mobile { display: grid; }
  .cards { grid-template-columns: 1fr; gap: .6rem; }
  .filters label { min-width: 45%; }
  .filters input[type=number] { width: 100%; }
}
.filters details.more { flex-basis: 100%; }
.filters details.more summary { cursor: pointer; color: var(--brand); font-size: .92rem; width: max-content; }
.filters .more-body { display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: end; margin-top: .6rem; }

/* stage 4: product page, chart, account */
.account-link { margin-left: auto; font-size: .92rem; }
.account-link + .logout { margin-left: .8rem; }
.item h3 a { color: inherit; text-decoration: none; }
.item h3 a:hover { text-decoration: underline; }
.product { display: grid; grid-template-columns: minmax(0, 360px) 1fr; gap: 1.5rem; align-items: start; }
.product-photo img { width: 100%; height: auto; border-radius: var(--radius); background: var(--surface); }
.prices.big { font-size: 1.3rem; display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
h2 { font-size: 1.15rem; margin: 2rem 0 .7rem; }
svg.chart { width: 100%; max-width: 720px; height: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
svg.chart .axis { stroke: var(--line); stroke-width: 1; }
svg.chart .grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 4 4; }
svg.chart .tick { fill: var(--muted); font-size: 11px; }
svg.chart polyline { fill: none; stroke-width: 2.5; stroke-linejoin: round; }
svg.chart .promo { stroke: var(--accent); }
svg.chart .regular { stroke: var(--muted); stroke-dasharray: 6 4; stroke-width: 1.5; }
svg.chart .dot { fill: var(--accent); }
.legend { font-size: .85rem; color: var(--muted); display: flex; gap: .4rem; align-items: center; }
.key { display: inline-block; width: 1.5rem; height: 0; border-top: 3px solid var(--accent); }
.key.regular { border-top: 2px dashed var(--muted); margin-left: .8rem; }
.events { padding-left: 1.1rem; }
.events li { margin: .25rem 0; }
.stack { display: grid; gap: .7rem; }
.narrow { max-width: 26rem; }
button.secondary { background: var(--surface); color: var(--text); border: 1px solid var(--line); }
@media (max-width: 767px) { .product { grid-template-columns: 1fr; } }
.saving { margin: 0; font-size: .88rem; color: var(--accent); font-weight: 600; }
