/* Casa Utilă — dashboard app.casautila.ro
   Sistem vizual: suprafețe neutre, accent portocaliu Casa Utilă (#ff660c) numai pentru
   elemente de interfață; datele folosesc paleta validată (albastru pentru o singură serie). */

:root {
  color-scheme: light;
  --brand: #ff660c;
  --brand-ink: #191919;          /* text pe portocaliu: 6,6:1 */
  --brand-soft: #fff1e8;
  --page: #f6f5f3;
  --surface: #ffffff;
  --surface-2: #faf9f7;
  --ink: #191919;
  --ink-2: #5c5c5c;              /* 6,6:1 pe alb */
  --ink-3: #767676;              /* 4,5:1 pe alb, doar text mic secundar */
  --line: #e7e5e2;
  --line-strong: #c9c6c1;
  --grid: #ebebeb;
  --axis: #c2c2c2;
  --focus: #1757ac;
  --series-1: #257de0;
  --series-2: #f47230;
  --series-3: #00b894;
  --series-4: #f2a600;
  --series-wash: rgba(37, 125, 224, 0.10);
  --muted-mark: #c9ced6;
  --good: #006c10;
  --good-mark: #0aac23;
  --warn: #8a5a00;
  --warn-mark: #fbb315;
  --bad: #b3261e;
  --bad-mark: #dc3c3d;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(25, 25, 25, 0.06), 0 1px 1px rgba(25, 25, 25, 0.04);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --max: 1280px;
}

*, *::before, *::after { box-sizing: border-box; }
/* scroll-padding: elementul care primește focus (Tab / Shift+Tab, ancore) nu ajunge sub bara fixă de sus
   (64 px minim + chenar + spațiu de respiro) */
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--page);
  overflow-wrap: anywhere;
}
img, svg { max-width: 100%; }
a { color: #1757ac; text-underline-offset: 2px; }
a:hover { color: #0e3d7e; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { line-height: 1.25; margin: 0; overflow-wrap: break-word; }
h1 { font-size: 1.6rem; font-weight: 650; letter-spacing: -0.01em; }
h2 { font-size: 1.1rem; font-weight: 650; }
h3 { font-size: 0.95rem; font-weight: 650; }
p { margin: 0 0 0.75rem; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link { position: absolute; left: 12px; top: -48px; background: var(--ink); color: #fff; padding: 10px 14px; border-radius: var(--radius-sm); z-index: 50; }
.skip-link:focus { top: 12px; color: #fff; }

/* ---------------------------------------------------------------- antet */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar__inner { max-width: var(--max); margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 12px; min-height: 64px; }
.account .btn { padding: 0 12px; }
@media (max-width: 1360px) { .brand__tag { display: none; } }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); flex: 0 0 auto; min-height: 44px; }
.brand img { display: block; height: 36px; width: auto; }
.brand__tag { font-size: 0.78rem; color: var(--ink-2); border-left: 1px solid var(--line); padding-left: 12px; line-height: 1.2; }
.nav { flex: 1 1 auto; min-width: 0; }
.nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2px; }
.nav a {
  display: flex; align-items: center; min-height: 44px; padding: 0 10px; white-space: nowrap; border-radius: var(--radius-sm);
  color: var(--ink-2); text-decoration: none; font-weight: 550; font-size: 0.92rem; position: relative;
}
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); }
.nav a[aria-current="page"]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 4px; height: 3px; border-radius: 2px; background: var(--brand); }
.account { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; }
.account form { margin: 0; }
.menu-toggle { display: none; }

@media (max-width: 1180px) {
  .topbar__inner { flex-wrap: wrap; }
  .menu-toggle {
    display: inline-flex; align-items: center; gap: 8px; margin-left: auto; min-height: 44px; min-width: 44px;
    padding: 0 14px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface);
    font: inherit; font-weight: 600; color: var(--ink); cursor: pointer;
  }
  .nav, .account { display: none; flex-basis: 100%; }
  .topbar.is-open .nav, .topbar.is-open .account { display: block; }
  .topbar.is-open .account { display: flex; padding: 8px 0 4px; border-top: 1px solid var(--line); }
  .nav ul { flex-direction: column; padding: 6px 0; }
  .nav a[aria-current="page"]::after { left: 0; right: auto; top: 10px; bottom: 10px; width: 3px; height: auto; }
}
@media (max-width: 520px) {
  .brand__tag { display: none; }
  .brand img { height: 30px; }
}

/* ---------------------------------------------------------------- conținut */
.page { max-width: var(--max); margin: 0 auto; padding: 24px 20px 64px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; margin-bottom: 18px; }
.page-head p { color: var(--ink-2); margin: 6px 0 0; max-width: 70ch; }
.freshness { font-size: 0.85rem; color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 4px 14px; }
.freshness strong { color: var(--ink); font-weight: 600; }

.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; margin: 0 0 18px; padding: 0; border: 0; }
.filters label, .field label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--ink-2); margin-bottom: 4px; }
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); overflow: hidden; }
.seg a, .seg button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; padding: 0 14px;
  color: var(--ink-2); text-decoration: none; font: inherit; font-size: 0.9rem; font-weight: 550; background: none; border: 0;
  border-right: 1px solid var(--line); cursor: pointer;
}
.seg a:last-child, .seg button:last-child { border-right: 0; }
.seg a:hover { background: var(--surface-2); color: var(--ink); }
.seg a[aria-current="true"] { background: var(--ink); color: #fff; }
.input, select.input {
  min-height: 44px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); font: inherit; color: var(--ink); max-width: 100%;
}
.input:focus { border-color: var(--focus); }
input[type="search"].input { min-width: 0; width: 280px; }
/* min-width:0 + lățime 100%: o listă cu o opțiune lungă (ex. numele unui concurent) nu mai lărgește pagina */
@media (max-width: 520px) {
  input[type="search"].input { width: 100%; }
  .filters > * { flex: 1 1 100%; min-width: 0; }
  .filters select.input { width: 100%; }
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px;
  border-radius: var(--radius-sm); border: 1px solid transparent; font: inherit; font-weight: 650; cursor: pointer;
  text-decoration: none; background: var(--brand); color: var(--brand-ink);
}
.btn:hover { background: #ff7a2e; color: var(--brand-ink); }
.btn--ghost { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.btn--ghost:hover { background: var(--surface-2); color: var(--ink); }

.grid { display: grid; gap: 16px; }
.grid--kpi { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); margin-bottom: 16px; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid--2 { grid-template-columns: minmax(0, 1fr); } }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; min-width: 0; }
.card + .card { margin-top: 16px; }
.grid > .card + .card { margin-top: 0; }
.card__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; margin-bottom: 12px; }
.card__head p { color: var(--ink-2); font-size: 0.87rem; margin: 2px 0 0; }
/* link simplu în antetul unui card (ex. „Produsele categoriei”): țintă de 44 px */
.card__head > a:not(.btn) { display: inline-flex; align-items: center; min-height: 44px; }
.card__foot { margin-top: 12px; font-size: 0.85rem; color: var(--ink-2); }

.kpi__label { font-size: 0.85rem; color: var(--ink-2); font-weight: 550; }
.kpi__value { font-size: 2rem; font-weight: 650; line-height: 1.15; margin: 4px 0 2px; letter-spacing: -0.01em; }
.kpi__value--hero { font-size: 3rem; }
.kpi__sub { font-size: 0.85rem; color: var(--ink-2); }
.delta { font-weight: 650; white-space: nowrap; }
.delta--up { color: var(--good); }
.delta--down { color: var(--bad); }
.delta--flat { color: var(--ink-2); }

.note { border-left: 3px solid var(--line-strong); background: var(--surface-2); padding: 10px 14px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--ink-2); font-size: 0.88rem; margin: 0 0 16px; }
.note--info { border-left-color: var(--series-1); }
.note--warn { border-left-color: var(--warn-mark); }
.note strong { color: var(--ink); }
.empty { text-align: center; padding: 36px 16px; color: var(--ink-2); }
.empty h3 { color: var(--ink); margin-bottom: 6px; font-size: 1rem; }

.status { display: inline-flex; align-items: center; gap: 6px; font-size: 0.85rem; font-weight: 600; white-space: nowrap; }
.status::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--ink-3); flex: 0 0 auto; }
.status--good::before { background: var(--good-mark); }
.status--warn::before { background: var(--warn-mark); }
.status--bad::before { background: var(--bad-mark); }
.status--good { color: var(--good); }
.status--warn { color: var(--warn); }
.status--bad { color: var(--bad); }

.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); white-space: nowrap; }
.pill--brand { background: var(--brand-soft); border-color: #ffd3b8; color: #7a2e00; }

/* ---------------------------------------------------------------- tabele */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.table-wrap:focus-visible { outline-offset: 0; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.9rem; background: var(--surface); }
table.data th, table.data td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
/* Antetele se pot rupe pe două rânduri, numai între cuvinte: tabelele largi încap astfel pe desktop
   fără ca o coloană să rămână ascunsă la dreapta (29.11.2026). */
table.data thead th { font-size: 0.78rem; font-weight: 650; color: var(--ink-2); background: var(--surface-2); white-space: normal; overflow-wrap: normal; word-break: normal; position: sticky; top: 0; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data thead th.num { white-space: normal; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover td { background: #fcfbfa; }
table.data .prod { display: flex; align-items: center; gap: 10px; min-width: 220px; }
table.data .prod img { width: 44px; height: 44px; object-fit: contain; border-radius: 4px; background: var(--surface-2); flex: 0 0 auto; }
table.data .prod a { font-weight: 550; }
table.data .prod small { display: block; color: var(--ink-3); font-size: 0.78rem; }
/* titlul sortabil umple toată celula: țintă de cel puțin 44 px, fără zone moarte în jur */
th a.sort { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; min-height: 44px; }
table.data thead th > a.sort { display: flex; min-height: 44px; margin: -10px -12px; padding: 0 12px; }
table.data thead th.num > a.sort { justify-content: flex-end; }
table.data thead th > a.sort:focus-visible { outline-offset: -3px; }
th a.sort[aria-current="true"] { color: var(--ink); }
th a.sort .arrow { font-size: 0.7rem; }

.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; font-size: 0.88rem; color: var(--ink-2); }
.pager nav { display: flex; gap: 6px; }

details.table-view { margin-top: 10px; }
details.table-view summary { cursor: pointer; font-size: 0.85rem; font-weight: 600; color: var(--ink-2); min-height: 44px; display: inline-flex; align-items: center; }
details.table-view summary:hover { color: var(--ink); }

/* ---------------------------------------------------------------- grafice */
.chart { position: relative; width: 100%; min-height: 220px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font-family: var(--font); fill: var(--ink-2); font-size: 12px; }
.chart .grid-line { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .axis-line { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.chart .tick { font-variant-numeric: tabular-nums; }
.chart .value-label { fill: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.chart .bar { fill: var(--series-1); }
.chart .bar--muted { fill: var(--muted-mark); }
.chart .hit { fill: transparent; cursor: default; }
/* barele și valorile nu prind indicatorul: mouse-ul sau degetul pe bară ajung la zona .hit de sub ea */
.chart .bar, .chart .value-label { pointer-events: none; }
.chart .hit:hover + .bar, .chart .hit:focus + .bar { fill: #1b64be; }
.chart .hit:focus { outline: none; }
.chart .hit:focus-visible { stroke: var(--focus); stroke-width: 2; }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { stroke: var(--surface); stroke-width: 2; }
.chart .crosshair { stroke: var(--line-strong); stroke-width: 1; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.85rem; color: var(--ink-2); margin: 0 0 8px; padding: 0; list-style: none; }
.chart-legend li { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend .key { width: 16px; height: 3px; border-radius: 2px; display: inline-block; }
.chart-legend .key--rect { height: 10px; width: 10px; border-radius: 2px; }
.s1 { background: var(--series-1); } .s2 { background: var(--series-2); } .s3 { background: var(--series-3); } .s4 { background: var(--series-4); }

.tooltip {
  position: absolute; z-index: 30; pointer-events: none; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); box-shadow: 0 4px 16px rgba(25, 25, 25, 0.12); border-radius: var(--radius-sm);
  padding: 8px 10px; font-size: 0.83rem; min-width: 140px; max-width: 280px;
}
.tooltip[hidden] { display: none; }
.tooltip .tt-title { color: var(--ink-2); font-size: 0.78rem; margin-bottom: 4px; }
.tooltip .tt-row { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.tooltip .tt-row strong { font-variant-numeric: tabular-nums; }
.tooltip .tt-key { width: 12px; height: 3px; border-radius: 2px; display: inline-block; margin-right: 6px; }
.tooltip .tt-name { color: var(--ink-2); }

/* eticheta „Cel mai vândut” — același aspect ca pe cardurile din magazin (store-module/module-labels.html).
   Atenție, numele modificatorului e invers față de magazin: aici .label-preview simplu = locul 1
   (în magazin .cu-best--top), iar .label-preview--top = locurile 2–3 (în magazin .cu-best).
   Plin (#ff660c) numai pentru locul 1 neegalat („Cel mai vândut”); la egalitate pe locul 1 se folosește varianta deschisă.
   Locul 1: #252a2a pe #ff660c = 4,96:1; locurile 2–3: #252a2a pe #fff3e9 = 13,3:1. */
.label-preview {
  display: inline-block; box-sizing: border-box; max-width: 100%;
  padding: 3px 8px; border: 1px solid #ff660c; border-radius: 6px; background: #ff660c; color: #252a2a;
  font-size: 11px; font-weight: 700; line-height: 1.35; letter-spacing: .01em; white-space: nowrap;
}
.label-preview--top { background: #fff3e9; color: #252a2a; border-color: #ff660c; }
@media (forced-colors: active) {
  .label-preview { border: 1px solid CanvasText; }
}

/* ---------------------------------------------------------------- autentificare */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth .card { width: 100%; max-width: 400px; padding: 28px; }
.auth .brand { margin-bottom: 18px; }
.field { margin-bottom: 14px; }
.field .input { width: 100%; }
.form-error { background: #fdecea; color: #8c1d18; border: 1px solid #f5c2bd; border-radius: var(--radius-sm); padding: 10px 12px; font-size: 0.9rem; margin-bottom: 14px; }
.form-ok { background: #e8f5ea; color: #0b5d17; border: 1px solid #bfe3c5; border-radius: var(--radius-sm); padding: 10px 12px; font-size: 0.9rem; margin-bottom: 14px; }

.footer { max-width: var(--max); margin: 0 auto; padding: 0 20px 32px; color: var(--ink-3); font-size: 0.8rem; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }

@media (max-width: 520px) {
  .page { padding: 16px 12px 48px; }
  .card { padding: 14px; }
  .kpi__value { font-size: 1.7rem; }
  .kpi__value--hero { font-size: 2.4rem; }
  h1 { font-size: 1.35rem; }
}
@media print {
  .topbar, .filters, .footer, details.table-view summary { display: none; }
  .card { box-shadow: none; break-inside: avoid; }
}
@media (forced-colors: active) {
  .chart .bar { fill: CanvasText; }
  .nav a[aria-current="page"]::after { background: CanvasText; }
}
.card--narrow { max-width: 520px; }

/* ---------------------------------------------------------------- corecții globale (integrare 29.11) */
.table-wrap { position: relative; }
table.data th, table.data td { overflow-wrap: normal; word-break: normal; }
.flash-list { margin: 0 0 16px; }

/* Casa Utilă — adăugiri pentru Prezentare, Cele mai vândute și Perioade (prefix an-).
   Folosesc numai variabilele din app.css; se unesc în app.css de către responsabilul temei. */

.an-freshness { margin: -6px 0 16px; }
.an-gap { margin-top: 16px; margin-bottom: 16px; }
.an-note-p { margin: 0 0 6px; }
.an-note-p:last-child, .an-sources p:last-child { margin-bottom: 0; }
.an-sources p { margin: 0 0 6px; }

.empty .an-empty-title { color: var(--ink); margin-bottom: 6px; font-size: 1rem; }
.empty p:last-child { margin-bottom: 0; }

/* text secundar sub o valoare din tabel */
.an-cell-note { display: block; color: var(--ink-3); font-size: 0.78rem; }

/* filtre: eticheta pentru grupul de perioade (nu e un câmp de formular) */
.filters .an-legend { display: block; font-size: 0.8rem; font-weight: 600; color: var(--ink-2); margin-bottom: 4px; }
.an-filters > div { min-width: 0; max-width: 100%; }
.an-select-wide { width: 26rem; max-width: 100%; }
.an-actions { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 520px) {
  .an-filters select.input { width: 100%; }
  .an-actions .btn { flex: 1 1 auto; }
}

/* clasament */
table.data th.an-col-active { color: var(--ink); }
table.data td.an-col-active { font-weight: 650; }
table.data .an-noimg { width: 44px; height: 44px; border-radius: 4px; background: var(--surface-2); flex: 0 0 auto; display: inline-block; }
table.data .an-chip { margin-top: 4px; white-space: normal; }
table.data tr.an-row-current td { background: var(--brand-soft); }

/* products — pagini Produse, Detaliu produs, Etichete. Toate regulile sunt limitate la clase proprii. */

/* --- Produse: filtre */
.products-filters__search { flex: 1 1 280px; min-width: 0; }
.products-filters__search input[type="search"].input { width: 100%; }
.products-filters select.input { max-width: 320px; }
@media (max-width: 520px) {
  .products-filters select.input { width: 100%; max-width: none; }
  .products-filters .btn { width: 100%; }
}
.products-empty__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 12px 0 0; }

/* --- Produse: tabel */
.products-table .prod .pill,
.products-table .prod .status { margin-top: 4px; margin-right: 4px; }
.products-table td:nth-child(2) { min-width: 120px; }

/* --- Detaliu produs: antet */
.product-back { margin: 0 0 10px; font-size: 0.9rem; }
.product-back a { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; }
.product-head { align-items: center; justify-content: flex-start; }
.product-head__img {
  width: 96px; height: 96px; object-fit: contain; flex: 0 0 auto;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.product-head__text { flex: 1 1 320px; min-width: 0; }
.product-head__text h1 { font-size: 1.4rem; }
.product-head__price { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.product-head__price strong { font-size: 1.15rem; color: var(--ink); }
.product-head__price del { color: var(--ink-3); }
.product-pair { margin-top: 16px; margin-bottom: 16px; }
.product-muted { display: block; color: var(--ink-3); font-size: 0.78rem; }
@media (max-width: 520px) {
  .product-head__img { width: 72px; height: 72px; }
  .product-head__text h1 { font-size: 1.2rem; }
  .product-head > .btn { width: 100%; }
}

/* --- Etichete */
.labels-top { margin-bottom: 20px; }
.labels-recompute { margin: 4px 0 0; }
.labels-rule { margin: 0; padding-left: 1.2em; }
.labels-rule li { margin-bottom: 8px; }
.labels-rule .label-preview { white-space: normal; }
.labels-section > h2 { margin: 0 0 4px; }
.labels-section > .kpi__sub { margin: 0 0 12px; }
.labels-section .grid { margin-bottom: 16px; }
.labels-table .label-preview { margin-top: 6px; white-space: normal; }
.labels-table .prod { min-width: 200px; }
.labels-without { margin-top: 0; }
.labels-section + .card { margin-top: 0; }
.product-history td:first-child { white-space: nowrap; }

/* Builder „prices”: pagina Prețuri concurenți (.cu-prices) și pagina Administrare (.cu-admin).
   Se adaugă la sfârșitul app.css. Folosește numai variabilele existente din :root. */

/* body are overflow-wrap:anywhere, care face ca lățimea minimă a fiecărei coloane de tabel să fie
   de un singur caracter: pe mobil coloanele se strâng literă cu literă în loc ca tabelul să se
   deruleze în .table-wrap. În tabelele acestor pagini cuvintele rămân întregi. */
.cu-prices table.data th,
.cu-prices table.data td,
.cu-admin table.data th,
.cu-admin table.data td { overflow-wrap: normal; word-break: normal; }

/* lățimi minime pentru coloanele cu text, ca tabelele să rămână lizibile când se derulează */
.cu-cell { min-width: 11rem; }
.cu-wide { min-width: 14rem; }
.cu-label { min-width: 9.5rem; }
.cu-nowrap { white-space: nowrap; }

/* linkurile din tabele: țintă de atingere de cel puțin 44 px înălțime */
.cu-price-link { display: inline-flex; align-items: center; min-height: 44px; }

/* mai multe pagini ale aceluiași produs la același concurent */
.cu-cell hr { border: 0; border-top: 1px solid var(--line); margin: 8px 0; }

.cu-prices .empty h2 { margin-bottom: 10px; }
.cu-prices .empty p { max-width: 60ch; margin-left: auto; margin-right: auto; }

.cu-admin code {
  font-size: 0.85rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px;
  padding: 2px 6px; white-space: nowrap; color: var(--ink);
}
.cu-admin h3.card__foot { margin-bottom: 4px; color: var(--ink); font-size: 0.95rem; }

/* avertisment: catalogul nu a mai fost citit de peste o zi și jumătate (base.html) */
.stale-note { color: var(--ink); }
.stale-note strong { display: block; }

/* detalii tehnice pliate (Administrare) */
details.tech-details { margin-top: 2px; }
details.tech-details summary { cursor: pointer; font-size: 0.85rem; font-weight: 600; color: var(--ink-2); min-height: 44px; display: inline-flex; align-items: center; }
details.tech-details summary:hover { color: var(--ink); }
details.tech-details summary::after { content: "▸"; margin-left: 6px; font-size: 0.75rem; }
details.tech-details[open] summary::after { content: "▾"; }
details.tech-details p { margin: 0 0 6px; overflow-wrap: anywhere; }
.cu-admin details.tech-details .table-wrap { margin-top: 4px; }

/* Tabelul „Actualizările zilnice” din Administrare: pe ecranele înguste fiecare rând devine un card,
   cu eticheta coloanei în stânga (data-label), ca rezultatul să se vadă fără derulare orizontală. */
@media (max-width: 640px) {
  .table-wrap--stack { overflow-x: visible; border: 0; border-radius: 0; }
  .data--stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  table.data.data--stack, .data--stack tbody, .data--stack tr { display: block; width: 100%; }
  .data--stack tr { border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 10px; background: var(--surface); }
  table.data.data--stack th[scope="row"] { display: block; min-width: 0; padding: 12px 12px 8px; text-align: left; white-space: normal; }
  table.data.data--stack td { display: block; position: relative; min-width: 0;
      padding: 8px 12px 8px calc(40% + 12px); text-align: left; white-space: normal; }
  table.data.data--stack tr > :last-child { border-bottom: 0; }
  /* eticheta e poziționată absolut: celula trebuie să aibă loc pentru o etichetă pe două rânduri */
  table.data.data--stack td { min-height: calc(2 * 1.35 * .8125rem + 16px); }
  table.data.data--stack td::before { content: attr(data-label); position: absolute; left: 12px; top: 8px; width: calc(40% - 12px);
      color: var(--ink-2); font-size: .8125rem; font-weight: 600; line-height: 1.35; }
}

/* Tabelul „Prețuri pe produse” (29.11.2026): diferența imediat după prețul nostru, celule compacte
   (prețul e linkul spre pagina concurentului), iar pe ecrane înguste fiecare produs devine un card.
   Cu mai mult de 3 magazine (data--stack-wide) cardurile apar până la 1100 px, ca niciun magazin să nu
   rămână ascuns într-o derulare orizontală. Regulile pentru carduri repetă intenționat blocul
   .data--stack de mai sus, pentru pragul mai mare. */
.cu-prices-table .cu-cell { min-width: 6.5rem; }
.cu-prices-table td.cu-wide { min-width: 12rem; }
.cu-prices-table .prod { min-width: 0; }
.cu-prices-table .cu-price-link { min-height: 44px; }
@media (max-width: 640px) {
  table.data.data--stack td:not([data-label]) { padding: 12px 12px 8px; min-height: 0; }
  table.data.data--stack td:not([data-label])::before { content: none; }
  table.data.data--stack td.cu-none { display: none; }
}
@media (max-width: 1100px) {
  .table-wrap--stack-wide { overflow-x: visible; border: 0; border-radius: 0; }
  .data--stack-wide thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  table.data.data--stack-wide, .data--stack-wide tbody, .data--stack-wide tr { display: block; width: 100%; }
  .data--stack-wide tr { border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 10px; background: var(--surface); }
  table.data.data--stack-wide td { display: block; position: relative; min-width: 0;
      padding: 8px 12px 8px calc(40% + 12px); text-align: left; white-space: normal;
      min-height: calc(2 * 1.35 * .8125rem + 16px); }
  table.data.data--stack-wide th[scope="row"] { display: block; min-width: 0; padding: 12px 12px 8px; text-align: left; white-space: normal; }
  table.data.data--stack-wide tr > :last-child { border-bottom: 0; }
  table.data.data--stack-wide td::before { content: attr(data-label); position: absolute; left: 12px; top: 8px; width: calc(40% - 12px);
      color: var(--ink-2); font-size: .8125rem; font-weight: 600; line-height: 1.35; }
  table.data.data--stack-wide td:not([data-label]) { padding: 12px 12px 8px; min-height: 0; }
  table.data.data--stack-wide td:not([data-label])::before { content: none; }
  table.data.data--stack-wide td.cu-none { display: none; }
}

/* „Pe magazine”: tabelul deschis ocupă tot rândul, ca să nu se strângă lângă grafic (browserele fără :has
   păstrează derularea în regiunea tabelului). Sub 1100 px tabelul e în carduri (data--stack-wide). */
.grid--2:has(details.table-view[open] .data--stack-wide) { grid-template-columns: 1fr; }
/* sub 1100 px, celule mai înguste: tabelele largi (Produse, Actualizările zilnice) încap pe tabletă */
@media (max-width: 1100px) {
  table.data th, table.data td { padding-left: 8px; padding-right: 8px; }
  /* linkul de sortare acoperă tot antetul: marginile negative urmează padding-ul celulei */
  table.data thead th > a.sort { margin: -10px -8px; padding: 0 8px; }
}
/* în carduri, „nowrap” din tabel nu se aplică: textul celulei se poate rupe lângă etichetă */
@media (max-width: 1100px) {
  table.data.data--stack-wide td.cu-nowrap { white-space: normal; }
}
/* coloana produsului puțin mai îngustă pe tabletă (Produse încape la 1024 px), iar pe telefon tabelele
   de etichete (3 coloane) încap fără derulare */
@media (max-width: 1100px) { table.data .prod { min-width: 190px; } }
@media (max-width: 640px) { table.data.labels-table .prod { min-width: 0; } }
@media (max-width: 1100px) { .products-table td:nth-child(2) { min-width: 100px; } }
@media (max-width: 400px) { table.data.labels-table .prod img { display: none; } }
/* pe tabletă cardurile stau câte două pe rând; în carduri, textul linkurilor (44 px înălțime pentru
   atingere) stă sus, aliniat cu eticheta */
@media (min-width: 641px) and (max-width: 1100px) {
  .data--stack-wide tbody { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; align-items: start; }
  .data--stack-wide tr { margin-bottom: 0; }
}
@media (max-width: 640px) { table.data.data--stack .cu-price-link { align-items: flex-start; } }
@media (max-width: 1100px) { table.data.data--stack-wide .cu-price-link { align-items: flex-start; } }
/* în carduri, stările lungi („mai ieftin cu … lei (…%)”) se pot rupe pe rânduri */
@media (max-width: 640px) { table.data.data--stack .status { white-space: normal; } }
@media (max-width: 1100px) { table.data.data--stack-wide .status { white-space: normal; } }
/* în carduri, coloana produsului/magazinului nu mai are lățime minimă de tabel */
@media (max-width: 640px) { table.data.data--stack td:not([data-label]) .prod { min-width: 0; } }
@media (max-width: 1100px) { table.data.data--stack-wide td:not([data-label]) .prod { min-width: 0; } }
