/* Tokenuri: culori, tipografie, spațiere. Modul întunecat respectă setarea telefonului. */
:root {
  --paper: #ffffff;
  --wash: #f1f3f6;
  --ink: #18202b;
  --ink-2: #4a5563;
  --ink-3: #6b7685;
  --line: #d9dee5;
  --tag: #ffd43b;
  --tag-ink: #18202b;
  --down: #0e7a4d;
  --down-wash: #e3f4ec;
  --up: #b42318;
  --focus: #1f5fd1;
  --warn: #9a6700;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --font-price: "Avenir Next Condensed", "Roboto Condensed", "sans-serif-condensed", "Arial Narrow", Bahnschrift,
    system-ui, sans-serif;
  --radius: 8px;
  --gutter: 16px;
  --max: 1100px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #12171e;
    --wash: #1a212b;
    --ink: #e8ecf1;
    --ink-2: #b2bcc8;
    --ink-3: #8c97a5;
    --line: #2c3542;
    --tag: #f5c518;
    --tag-ink: #12171e;
    --down: #45cf93;
    --down-wash: #163327;
    --up: #ff8a7f;
    --focus: #7aa7ff;
    --warn: #e3b341;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #12171e;
  --wash: #1a212b;
  --ink: #e8ecf1;
  --ink-2: #b2bcc8;
  --ink-3: #8c97a5;
  --line: #2c3542;
  --tag: #f5c518;
  --tag-ink: #12171e;
  --down: #45cf93;
  --down-wash: #163327;
  --up: #ff8a7f;
  --focus: #7aa7ff;
  --warn: #e3b341;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.5 var(--font-body);
  font-variant-numeric: tabular-nums;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5em; letter-spacing: -0.01em; text-wrap: balance; }
h1 { font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2.1rem); }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
.wrap {
  max-width: var(--max); margin: 0 auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
}
.muted { color: var(--ink-2); }
.small { font-size: 0.875rem; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--paper); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }

/* Un element ascuns rămâne ascuns, oricare i-ar fi clasa (de ex. un buton .btn cu atributul hidden) */
[hidden] { display: none !important; }

/* Antet */
.masthead { border-bottom: 1px solid var(--line); background: var(--paper); }
/* Rânduri flexibile: numele, meniul și căutarea trec pe rândul următor când nu încap, oricât de lung ar fi numele
   sau oricâte linkuri ar adăuga modulele în meniu. Meniul nu e strâns niciodată lângă nume (ar ieși peste căutare). */
.masthead .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; padding-top: 12px; padding-bottom: 12px; }
.wordmark {
  flex: 0 1 auto;
  min-width: 0;
  font-family: var(--font-price);
  font-stretch: condensed;
  font-weight: 800;
  font-size: 1.6rem;
  line-height: 1.1;
  letter-spacing: -0.01em;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.wordmark::before {
  content: "";
  flex: none;
  width: 18px; height: 22px;
  background: var(--tag);
  clip-path: polygon(50% 0, 100% 28%, 100% 100%, 0 100%, 0 28%);
  border-radius: 2px;
}
.wordmark-text { display: flex; flex-direction: column; min-width: 0; }
.wordmark-name { overflow-wrap: anywhere; }
.wordmark-tagline {
  font-family: var(--font-body); font-stretch: normal; font-weight: 500; font-size: 0.8rem; line-height: 1.3;
  letter-spacing: 0; color: var(--ink-2); margin-top: 2px;
}
.mainnav { order: 1; flex: 0 1 auto; margin-left: auto; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 2px 14px; font-size: 0.95rem; }
.mainnav a { text-decoration: none; color: var(--ink-2); padding: 6px 0; white-space: nowrap; }
.mainnav a:hover, .mainnav a[aria-current="page"] { color: var(--ink); text-decoration: underline; }
.search { order: 2; flex: 1 1 100%; min-width: 0; display: flex; }
.search input {
  flex: 1; min-width: 0; height: 46px; padding: 0 14px;
  font: inherit; color: var(--ink); background: var(--wash);
  border: 1px solid var(--line); border-right: 0; border-radius: var(--radius) 0 0 var(--radius);
}
.search input::placeholder { color: var(--ink-3); }
.search button {
  height: 46px; padding: 0 18px; font: inherit; font-weight: 600;
  background: var(--ink); color: var(--paper); border: 0; border-radius: 0 var(--radius) var(--radius) 0; cursor: pointer;
}
@media (min-width: 860px) {
  .mainnav { order: 0; gap: 2px 18px; }
  .search { order: 0; flex: 1 1 260px; max-width: 560px; }
}

main { padding: 20px 0 56px; }
section + section { margin-top: 40px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 8px; }
.section-head h2 { margin: 0; }

/* Eticheta de preț: elementul care dă identitatea site-ului. Folosită doar pentru cel mai bun preț. */
.tag {
  display: inline-flex; align-items: baseline; gap: 6px;
  background: var(--tag); color: var(--tag-ink);
  padding: 4px 14px 4px 22px;
  clip-path: polygon(12px 0, 100% 0, 100% 100%, 12px 100%, 0 50%);
  border-radius: 0 4px 4px 0;
  position: relative;
  font-family: var(--font-price); font-stretch: condensed; font-weight: 800;
}
.tag::before {
  content: ""; position: absolute; left: 9px; top: 50%; width: 6px; height: 6px; margin-top: -3px;
  border-radius: 50%; background: var(--paper);
}
.tag .from { font-family: var(--font-body); font-weight: 500; font-size: 0.8em; font-stretch: normal; }
.tag-lg { font-size: 2.1rem; line-height: 1.15; padding: 6px 18px 6px 28px; clip-path: polygon(16px 0, 100% 0, 100% 100%, 16px 100%, 0 50%); }
.tag-lg::before { left: 12px; width: 8px; height: 8px; margin-top: -4px; }
.price { font-family: var(--font-price); font-stretch: condensed; font-weight: 700; font-size: 1.2rem; white-space: nowrap; }
.drop { color: var(--down); font-weight: 600; }
.old { color: var(--ink-3); text-decoration: line-through; font-size: 0.9rem; }

/* Listă de produse (rânduri, nu carduri) */
.plist { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); column-gap: 28px; }
.prow { display: grid; grid-template-columns: 76px 1fr auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.prow .thumb { width: 76px; height: 76px; border-radius: 6px; background: #fff; border: 1px solid var(--line); overflow: hidden; display: grid; place-items: center; }
.prow .thumb img { width: 100%; height: 100%; object-fit: contain; }
.prow h3 { font-size: 0.98rem; font-weight: 600; margin: 0 0 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.prow h3 a { text-decoration: none; }
.prow h3 a::after { content: ""; position: absolute; inset: 0; }
.prow { position: relative; }
.prow .meta { font-size: 0.85rem; color: var(--ink-2); }
.prow .right { text-align: right; display: grid; gap: 2px; justify-items: end; }
.noimg { width: 100%; height: 100%; background: repeating-linear-gradient(135deg, var(--wash), var(--wash) 6px, transparent 6px, transparent 12px); }

/* Categorii */
.catlist { list-style: none; margin: 0; padding: 0; columns: 2 220px; column-gap: 28px; }
.catlist li { break-inside: avoid; padding: 7px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 8px; }
.catlist a { text-decoration: none; font-weight: 600; }
.catlist .n { color: var(--ink-3); font-size: 0.85rem; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0 0 16px; }
.chips a { display: inline-block; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; font-size: 0.9rem; }
.chips a[aria-current="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* Butoane */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: var(--radius);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  background: var(--ink); color: var(--paper); border: 1px solid var(--ink);
}
.btn:hover { filter: brightness(1.15); }
.btn-quiet { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-quiet:hover { border-color: var(--ink-2); filter: none; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 0.9rem; }
.btn-wide { width: 100%; }
.btn svg { width: 18px; height: 18px; flex: none; }

/* Pagina de produs */
.crumbs { font-size: 0.875rem; color: var(--ink-2); margin-bottom: 12px; }
.crumbs a { color: var(--ink-2); }
.crumbs span[aria-hidden] { margin: 0 6px; }
.product-top { display: grid; gap: 20px; }
.product-media { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); aspect-ratio: 1; display: grid; place-items: center; overflow: hidden; max-height: 420px; }
.product-media img { width: 100%; height: 100%; object-fit: contain; }
.buybox { display: grid; gap: 14px; align-content: start; }
.buybox .where { color: var(--ink-2); margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
@media (min-width: 760px) {
  .product-top { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 36px; }
}
.notice { background: var(--wash); border-left: 4px solid var(--tag); padding: 12px 14px; border-radius: 0 var(--radius) var(--radius) 0; margin-bottom: 16px; }

.offers { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.offer { display: grid; grid-template-columns: 1fr auto; gap: 6px 14px; padding: 14px 0; border-bottom: 1px solid var(--line); align-items: center; }
.offer .shop { font-weight: 700; }
.offer .facts { font-size: 0.85rem; color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 4px 12px; }
.offer .pricecol { text-align: right; }
.offer .btn { grid-column: 1 / -1; }
@media (min-width: 640px) {
  .offer { grid-template-columns: 1fr auto auto; }
  .offer .btn { grid-column: auto; }
}
.stock-in { color: var(--down); }
.stock-out { color: var(--up); }
.disclosure { font-size: 0.85rem; color: var(--ink-2); margin-top: 12px; max-width: 70ch; }

.history { display: grid; gap: 12px; }
.chart { width: 100%; height: auto; display: block; background: var(--wash); border-radius: var(--radius); }
.chart-line { fill: none; stroke: var(--ink); stroke-width: 2.5; stroke-linejoin: round; }
.chart-grid { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-min30 { stroke: var(--down); stroke-width: 1.5; stroke-dasharray: 6 5; vector-effect: non-scaling-stroke; }
.chart-dot { fill: var(--tag); stroke: var(--ink); stroke-width: 2; vector-effect: non-scaling-stroke; }
.chart-axis { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--ink-3); }
.facts-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; margin: 0; border-top: 1px solid var(--line); }
.facts-grid div { padding: 10px 0; border-bottom: 1px solid var(--line); }
.facts-grid dt { font-size: 0.8rem; color: var(--ink-2); }
.facts-grid dd { margin: 0; }
@media (min-width: 640px) { .facts-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.legend-min30 { display: inline-block; width: 18px; border-top: 2px dashed var(--down); vertical-align: middle; margin-right: 4px; }

details.more > summary { cursor: pointer; font-weight: 600; padding: 10px 0; }
.description { white-space: pre-line; color: var(--ink-2); max-width: 75ch; }

/* Vot */
.vote { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.vote button {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px;
  font: inherit; font-size: 0.9rem; color: var(--ink); background: transparent;
  border: 1px solid var(--line); border-radius: 999px; cursor: pointer;
}
.vote button svg { width: 18px; height: 18px; }
.vote button[aria-pressed="true"][data-value="1"] { background: var(--down-wash); border-color: var(--down); color: var(--down); }
.vote button[aria-pressed="true"][data-value="-1"] { border-color: var(--up); color: var(--up); }
.vote .vote-summary { font-size: 0.85rem; color: var(--ink-2); }
.vote-error { color: var(--up); font-size: 0.85rem; }

/* Distribuire */
details.share { position: relative; }
details.share > summary { list-style: none; }
details.share > summary::-webkit-details-marker { display: none; }
.share-panel {
  position: absolute; z-index: 5; top: calc(100% + 6px); left: 0; min-width: 240px;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 6px; display: grid; box-shadow: 0 8px 24px rgba(16, 24, 40, 0.14);
}
.share-panel a, .share-panel button {
  display: block; text-align: left; padding: 10px 12px; border-radius: 6px; text-decoration: none;
  font: inherit; color: var(--ink); background: none; border: 0; cursor: pointer;
}
.share-panel a:hover, .share-panel button:hover { background: var(--wash); }

/* Bară fixă cu oferta, doar pe telefon */
.stickybuy { display: none; }
@media (max-width: 759px) {
  .stickybuy {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 8;
    gap: 12px; align-items: center; justify-content: space-between;
    padding-block: 10px calc(10px + env(safe-area-inset-bottom, 0px));
    padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
    padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
    background: var(--paper); border-top: 1px solid var(--line);
  }
  .stickybuy .btn { flex: 1; max-width: 60%; }
  body.has-sticky { padding-bottom: 76px; }
}

/* Listări: filtre și paginare */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin: 8px 0 12px; }
.filters { border: 1px solid var(--line); border-radius: var(--radius); padding: 0 14px; margin-bottom: 12px; }
.filters > summary { cursor: pointer; padding: 12px 0; font-weight: 600; }
.filters form { display: grid; gap: 12px; padding-bottom: 14px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-items: end; }
label.field { display: grid; gap: 4px; font-size: 0.875rem; color: var(--ink-2); }
.field textarea {
  padding: 8px 10px; font: inherit; color: var(--ink); background: var(--paper); min-height: 96px; resize: vertical;
  border: 1px solid var(--line); border-radius: 6px; min-width: 0; width: 100%;
}
.field input, .field select, select.sort {
  height: 42px; padding: 0 10px; font: inherit; color: var(--ink); background: var(--paper);
  border: 1px solid var(--line); border-radius: 6px; min-width: 0;
}
.check { display: flex; gap: 8px; align-items: center; font-size: 0.95rem; min-height: 42px; }
.check input { width: 20px; height: 20px; }
.pager { display: flex; gap: 10px; justify-content: center; align-items: center; margin-top: 24px; }
.empty { padding: 32px 0; color: var(--ink-2); }

/* Clasament */
.rank { list-style: none; padding: 0; margin: 0; counter-reset: rank; }
.rank .prow { grid-template-columns: 32px 64px 1fr auto; }
.rank .prow .thumb { width: 64px; height: 64px; }
.rank .pos { font-family: var(--font-price); font-stretch: condensed; font-weight: 800; font-size: 1.4rem; color: var(--ink-3); text-align: center; }
.score { font-size: 0.85rem; color: var(--down); font-weight: 600; }

/* Pagini informative și subsol */
.prose { max-width: 70ch; }
.prose h2 { margin-top: 1.6em; }
.footer { border-top: 1px solid var(--line); background: var(--wash); padding: 28px 0 36px; font-size: 0.9rem; color: var(--ink-2); }
.footer nav { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-bottom: 12px; }
.footer p { max-width: 75ch; }

/* Mesaje */
.flash { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 8px; }
.flash li { padding: 10px 14px; border-radius: var(--radius); background: var(--wash); border-left: 4px solid var(--down); }
.flash li.error { border-left-color: var(--up); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
.spaced { margin-bottom: 16px; }

/* Conturi, favorite, alerte, credite, magazine partenere */
.narrow { max-width: 560px; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 20px; }
.panel h2 { margin: 0; }
.hp { position: absolute !important; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.fav-btn svg { fill: none; stroke: currentColor; stroke-width: 2; }
.fav-btn[aria-pressed="true"] { border-color: var(--up); color: var(--up); }
.fav-btn[aria-pressed="true"] svg { fill: currentColor; }
.alert-box { border: 1px solid var(--line); border-radius: var(--radius); padding: 0 14px; }
.alert-box > summary { cursor: pointer; padding: 12px 0; font-weight: 600; }
.alert-form { display: grid; gap: 10px; padding-bottom: 14px; }
.promo-label { display: inline-block; font-size: 0.75rem; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--wash); color: var(--ink-2); border: 1px solid var(--line); vertical-align: middle; }
.balance { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; }
.balance .amount { font-family: var(--font-price); font-stretch: condensed; font-weight: 800; font-size: 2.2rem; line-height: 1; }
.packages { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.package { display: grid; gap: 4px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; }
.package:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.package input { position: absolute; opacity: 0; pointer-events: none; }
.package strong { font-family: var(--font-price); font-stretch: condensed; font-size: 1.3rem; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; min-width: 0; height: 42px; padding: 0 10px; font: inherit; border: 1px solid var(--line); border-radius: 6px; background: var(--wash); color: var(--ink); }
.ledger { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.ledger td, .ledger th { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; }
.ledger td.num, .ledger th.num { text-align: right; font-variant-numeric: tabular-nums; }
.plus { color: var(--down); }
.minus { color: var(--up); }
.bank-box { display: grid; gap: 6px; }
.bank-box div { display: grid; grid-template-columns: minmax(110px, auto) 1fr; gap: 8px; }
.bank-box dt { color: var(--ink-2); }
.bank-box dd { margin: 0; font-weight: 600; word-break: break-all; }
.steps-list { padding-left: 1.2em; display: grid; gap: 6px; }
.table-scroll { overflow-x: auto; }
