/* ============================================================================
   portal.css — rapoartele portalului (tablou de bord, comenzi, live, stoc, documente,
   fiscal, e-Factura). Deținut de W3 (redesign 2026-09-02, spec §2.1, §2.4 „grafice”, §2.5).

   Reguli moștenite din site.css: zero hex (numai var()), zero `text-transform: uppercase`,
   zero `box-shadow` (singura umbră din sistem e `.pop`). Clasele-contract folosite de
   `wwwroot/js/comenzi-live.js` (`.order-item`, `.order-summary`, `.order-lines`,
   `.live-status.st-*`, `.live-waiter.card`, `.live-table-board`, `.dash-empty`,
   `.line-voided`) rămân definite — JS-ul și markup-ul Razor se schimbă numai ÎN OGLINDĂ.
   ========================================================================== */

/* Învelișurile vechi (section.dash > .container) rămân neutre în rama de shell. */
.dash { padding: 0; }

/* ============================================================
   1. TABLOU DE BORD
   ============================================================ */

/* Banda KPI e `column-reverse` în site.css (markup: etichetă → valoare, vizual cifra întâi);
   linia de comparație (GW4) trebuie să cadă SUB etichetă ⇒ order:-1 pe axa inversată. */
.kpi .kpi-delta { order: -1; margin-top: 2px; }
/* Cu 2 sau 3 indicatori banda nu mai lasă o celulă goală în dreapta (grila are 4 coloane).
   Doar peste 760 px: sub fald site.css o pune deja pe două coloane, iar trei celule înguste
   ar rupe sumele una peste alta. */
@media (min-width: 761px) {
    .kpis:has(> .kpi:last-child:nth-child(2)) { grid-template-columns: repeat(2, 1fr); }
    .kpis:has(> .kpi:last-child:nth-child(3)) { grid-template-columns: repeat(3, 1fr); }
}

/* Rândul „grafic mare + panou îngust” (vânzări pe oră | cum se încasează). */
.dash-row { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; margin-bottom: 14px; align-items: start; }
/* Panourile perechi se opresc la înălțimea lor: un tabel scurt nu se întinde ca să-l ajungă pe cel lung. */
.dash-grid.dash-pair { align-items: start; }
@media (max-width: 1100px) { .dash-row { grid-template-columns: 1fr; } }
.dash-grid + .dash-grid { margin-top: 14px; }

/* Antetul unui panou: titlu la stânga, linkul de context la dreapta. */
.panel > .ph a { font-size: 13px; font-weight: 500; }

/* Prefixul mut al unui control de filtru („De la”, „Până la”) — eticheta intră ÎN cutie (A25). */
.toolbar .input .pre { white-space: nowrap; font-size: 13px; font-weight: 500; }

/* Tabelul unui panou curge până la marginile panoului (linia grea de 2 px ține toată lățimea). */
.panel > .table-bleed { margin: 6px -20px 0; }
.panel > .table-bleed:last-child { margin-bottom: -18px; }
.panel > .table-bleed > .table th:first-child, .panel > .table-bleed > .table td:first-child { padding-left: 20px; }
.panel > .table-bleed > .table th:last-child, .panel > .table-bleed > .table td:last-child { padding-right: 20px; }
.panel > .table-bleed > .table td { height: 40px; }
@media (max-width: 720px) {
    /* Panoul derulează pe orizontală sub 720 px (site.css) ⇒ marginile negative ar naște o bară de
       derulare de 40 px pe fiecare panou. Sub fald tabelul stă în padding-ul panoului. */
    .panel > .table-bleed { margin-left: 0; margin-right: 0; }
    .panel > .table-bleed > .table th:first-child, .panel > .table-bleed > .table td:first-child { padding-left: 0; }
    .panel > .table-bleed > .table th:last-child, .panel > .table-bleed > .table td:last-child { padding-right: 0; }
    /* Tabelul pliat în listă: înălțimea fixă de 40 px a celulelor (0,3,1) bătea resetarea din site.css și umfla fiecare
       rând de 2-3 ori (review vizual 1.0.140, #31). */
    .panel > .table-bleed > .table:has(td[data-col]) td { height: auto; }
}

/* ---- Graficul pe ore / pe zile: coloane pe pistă, gridlines punctate, vârful etichetat ---- */
.chart { padding: 22px 2px 0; }
.cols {
    position: relative; margin-left: 46px; height: 200px;
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px;
    align-items: end; border-bottom: 1px solid var(--line-2);
}
.cols .grid-y { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.cols .grid-y span { position: relative; border-top: 1px dashed var(--line); }
.cols .grid-y span::before {
    content: attr(data-l); position: absolute; left: -46px; top: -7px; width: 38px; text-align: right;
    font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums;
}
.col { position: relative; height: var(--v, 0%); min-height: 2px; background: var(--teal); border-radius: 3px 3px 0 0; }
/* Ora curentă = cerneală (singurul reper „acum” din grafic). */
.col.now { background: var(--ink); }
/* Vârful poartă valoarea deasupra — o singură cifră pe grafic, nu o etichetă pe fiecare coloană. */
.col.peak::after {
    content: attr(data-v); position: absolute; top: -21px; left: 50%; transform: translateX(-50%);
    font-size: 12px; font-weight: 600; color: var(--ink); white-space: nowrap; font-variant-numeric: tabular-nums;
}
.xl {
    margin-left: 46px; padding-top: 6px; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px;
    font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums;
}
.xl span { text-align: center; overflow: hidden; }

/* ---- Mixul de încasare: o bară stivuită + rândurile ei (procent + sumă) ---- */
.stack { display: flex; height: 14px; border-radius: 4px; overflow: hidden; background: var(--inset); margin: 2px 0 14px; }
.stack > i { display: block; width: var(--v, 0%); }
.stack > i.m-cash, .pay .sw.m-cash { background: var(--teal); }
.stack > i.m-card, .pay .sw.m-card { background: var(--ink); }
.stack > i.m-voucher, .pay .sw.m-voucher { background: var(--line-2); }
.stack > i.m-other, .pay .sw.m-other { background: var(--ink-3); }
.pay .row { display: grid; grid-template-columns: 12px 1fr auto auto; gap: 10px; align-items: center; height: 36px; border-top: 1px solid var(--line); font-size: 13.5px; }
.pay .row:first-child { border-top: 0; }
.pay .sw { width: 12px; height: 12px; border-radius: 3px; }
.pay .pct { min-width: 40px; text-align: right; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.pay .amt { min-width: 92px; text-align: right; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ============================================================
   2. COMENZI (lista de bonuri + liniile pliate)
   ============================================================ */

/* Cardul de expandare: rămâne cardul din listele de admin (Erori/Feedback îl folosesc), dar
   într-un rând de tabel (Comenzi, Live) e neutru — rama e a tabelului. */
.order-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); margin-top: 8px; overflow: hidden; }
.order-summary {
    display: flex; align-items: center; gap: 12px; position: relative; list-style: none; cursor: pointer;
    padding: 12px 40px 12px 14px; min-height: 44px; font-size: 14px; color: var(--ink);
}
.order-summary::-webkit-details-marker { display: none; }
.order-summary::after {
    content: ""; position: absolute; right: 18px; top: 50%; width: 7px; height: 7px; margin-top: -6px;
    border-right: 1.6px solid var(--ink-3); border-bottom: 1.6px solid var(--ink-3); transform: rotate(45deg);
}
.order-item[open] > .order-summary::after { transform: rotate(225deg); margin-top: -2px; }
.order-summary:hover { background: var(--surface-2); }
.order-lines { margin: 0; border-top: 1px solid var(--line); }
.order-lines td, .order-lines th { padding-left: 14px; padding-right: 14px; }
.order-lines tbody tr:hover td { background: transparent; }

/* Rândul-plic al liniilor (A22): un `details` cu afordanță scrisă („Vezi liniile”), pe toată
   lățimea tabelului, fără chenar propriu — chenarul e al rândului de bon de deasupra. */
.table tr.order-lines-row td { padding: 0 14px 10px; height: auto; border-bottom: 1px solid var(--line); }
.table tr.order-lines-row:hover td { background: transparent; }
tr.order-lines-row .order-item { border: 0; background: none; margin: 0; border-radius: 0; }
tr.order-lines-row .order-summary {
    display: inline-flex; padding: 6px 22px 6px 0; min-height: 0; gap: 8px;
    font-size: 13px; font-weight: 500; color: var(--teal-text);
}
tr.order-lines-row .order-summary:hover { background: transparent; text-decoration: underline; text-underline-offset: 3px; }
tr.order-lines-row .order-summary::after { right: 4px; border-color: var(--teal-text); }
tr.order-lines-row .order-lines { border-top: 0; margin-bottom: 6px; }
tr.order-lines-row .order-lines th { padding-left: 0; }
tr.order-lines-row .order-lines td:first-child, tr.order-lines-row .order-lines th:first-child { padding-left: 0; }
tr.order-lines-row .order-lines td:last-child, tr.order-lines-row .order-lines th:last-child { padding-right: 0; }
tr.order-lines-row .order-lines td { height: 36px; }

@media (max-width: 720px) {
    /* Rândul-plic nu intră în grila de listă a rândurilor de tabel (site.css §3.7). */
    .table:has(td[data-col]) tr.order-lines-row { display: block; padding: 0 14px 10px; }
    .table:has(td[data-col]) tr.order-lines-row td { display: block; padding: 0; border-bottom: 0; }
    tr.order-lines-row .order-lines { display: table; width: 100%; }
    tr.order-lines-row .order-lines thead { display: table-header-group; }
    tr.order-lines-row .order-lines tbody { display: table-row-group; }
    tr.order-lines-row .order-lines tr { display: table-row; padding: 0; border: 0; }
    tr.order-lines-row .order-lines td, tr.order-lines-row .order-lines th { display: table-cell; }
    tr.order-lines-row .order-lines td { border-bottom: 1px solid var(--line); }
}

/* ---- Lista de pe mobil: metadatele CURG, nu se suprapun -------------------- */
/* site.css așază FIECARE celulă „meta” a unui rând-listă în ACEEAȘI celulă de grilă
   (`grid-column: 1; grid-row: 2`), deci la două sau mai multe metadate ele se scriu una peste
   alta. Tabelele marcate cu `stack-meta` trec rândul pe flex: numele și suma pe linia 1, o
   ruptură de linie, apoi metadatele cu eticheta lor din `data-label`, starea după ele și
   acțiunile pe un rând propriu. Rezolvarea de fond ține de foaia sistemului — vezi nota W3. */
@media (max-width: 720px) {
    .table.stack-meta:has(td[data-col]) tr {
        display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px;
        padding: 12px 14px; border-bottom: 1px solid var(--line);
    }
    /* Ordinea vizuală: nume (1), sumă (2), ruptura de linie (3), metadate (4), stare (5), acțiuni (6).
       Ruptura e un pseudo-element de 100 % lățime — fără ea suma și primele metadate se
       îngrămădesc pe linia numelui și ies din ecran. */
    .table.stack-meta:has(td[data-col]) td[data-col] { order: 4; }
    .table.stack-meta:has(td[data-col]) td[data-col="prod"] { order: 1; flex: 1 1 0; min-width: 0; }
    .table.stack-meta:has(td[data-col]) td[data-col="pret"],
    .table.stack-meta:has(td[data-col]) td[data-col="total"],
    .table.stack-meta:has(td[data-col]) td[data-col="suma"] { order: 2; flex: 0 0 auto; }
    .table.stack-meta:has(td[data-col]) tr::after { content: ""; order: 3; flex: 0 0 100%; height: 0; }
    .table.stack-meta:has(td[data-col]) td[data-col="stare"] { order: 5; flex: 0 0 auto; }
    .table.stack-meta:has(td[data-col]) td[data-col="act"] { order: 6; flex: 1 0 100%; }
    /* Coloana „Nr.” nu are ce căuta într-o listă de carduri: numărul rândului nu spune nimic acolo. */
    .table.stack-meta:has(td[data-col]) td.nr, .table.stack-meta:has(td[data-col]) th.nr { display: none; }
    /* Rândul-plic al liniilor de bon rămâne bloc, nu intră în această grilă. */
    .table.stack-meta:has(td[data-col]) tr.order-lines-row::after { content: none; }
    /* Un tabel care DEVINE listă nu mai are nevoie de lățimea minimă de derulare a
       învelișului (site.css: .table-scroll > .table { min-width: 560px }) — cu ea, rândul
       de flex e mai lat decât ecranul și sumele ies din cadru, în derularea orizontală. */
    .table-scroll > .table.stack-meta:has(td[data-col]) { min-width: 0; }
    .table-scroll:has(> .table.stack-meta td[data-col]) { overflow-x: visible; }
    /* Metadatele curg pe linii separate, deci separatorul-virgulă din foaia sistemului ar ateriza
       la început de rând. În lista de carduri rămâne doar eticheta, iar spațiul le desparte.
       (Aceeași lungime de selector ca în site.css — altfel regula cu virgulă câștigă.) */
    .table.stack-meta td[data-col]:not([data-col="prod"]):not([data-col="pret"]):not([data-col="total"]):not([data-col="suma"]):not([data-col="stare"]):not([data-col="act"]) + td[data-col]:not([data-col="prod"]):not([data-col="pret"]):not([data-col="total"]):not([data-col="suma"]):not([data-col="stare"]):not([data-col="act"])::before { content: attr(data-label) " "; }
    /* Starea cu etichetă proprie (Rest, Diferență) o poartă și în listă. */
    .table.stack-meta:has(td[data-col]) td[data-col="stare"][data-label]::before { content: attr(data-label) " "; }
}

/* ============================================================
   3. COMENZI LIVE
   ============================================================ */

/* `.live-banner` moștenește `display:block` din rețeta de mesaj (site.css), care bate regula de agent
   `[hidden]` — fără asta bannerul GOL se vede ca o bandă galbenă pe pagina sănătoasă. */
.live-banner[hidden] { display: none; }
.live-fresh { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--ink-3); }
.live-fresh-item strong { color: var(--ink-2); font-weight: 600; font-variant-numeric: tabular-nums; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); display: inline-block; flex: none; }
.live-dot.warn { background: var(--warn); }
.live-dot.err { background: var(--danger); }
.live-h2 { margin: 26px 0 12px; font-size: 16px; font-weight: 700; }
/* Subtitlul mut din titlu e text de interfață: pe Inter, fără spațierea de titlu moștenită (review vizual 1.0.140, #42). */
.live-h2-sub { font-family: var(--font-text); font-size: 13px; font-weight: 400; letter-spacing: normal; word-spacing: normal; color: var(--ink-3); margin-left: 8px; }
.live-waiter { margin: 0 0 14px; padding: 16px 20px 14px; }
.live-waiter-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 6px; }
.live-waiter-head h3 { margin: 0; font-size: 16px; font-weight: 700; }
.live-waiter-head .live-count { font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.live-waiter-head .live-count strong { font-weight: 600; color: var(--ink); }
.live-waiter .order-item { border-color: var(--line); }
.live-order-summary { display: grid; grid-template-columns: 1fr 1fr 120px 90px; gap: 12px; }
.live-order-summary .num { text-align: right; font-variant-numeric: tabular-nums; }
.live-paid { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13px; color: var(--ink-3); }
.live-paid-row { white-space: nowrap; font-variant-numeric: tabular-nums; }
.live-table-board { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
@media (max-width: 860px) {
    .live-order-summary { grid-template-columns: 1fr auto; }
}

/* ============================================================
   4. RAPOARTE (stoc, documente, fiscal, e-Factura)
   ============================================================ */

/* Cifra care cere atenție (Diferență ≠ 0 pe închiderile de zi). */
.table td.num.danger, .num.danger { color: var(--danger-text); font-weight: 600; }
/* Nota de subsol a unei liste (de unde vin datele, când se actualizează). */
.foot-note { margin: 12px 2px 0; font-size: 13px; color: var(--ink-3); }
/* Coloana de cod/SKU dintr-un raport: mută, îngustă, cu cifre tabulare. */
.table td.code { color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ============================================================
   5. FISCALBRIDGE — pagina de cumpărare (spec 4 §6.1, 4 T28)
   ============================================================ */

/* Comutatorul lunar/anual: două butoane pe aceeași linie; cel activ e plin (cerneală), celălalt contur. */
.fb-interval { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 14px; }
.fb-interval .btn[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--ink-inv); }

/* Rândurile de module: nume + descriere + preț la stânga, cantitatea la dreapta, despărțite de rigle fine. */
.fb-plan-grid { border-top: 1px solid var(--line); }
.fb-plan-row {
    display: grid; grid-template-columns: 1fr 96px; gap: 14px; align-items: center;
    padding: 14px 0; border-bottom: 1px solid var(--line);
}
.fb-plan-row h3 { margin: 0 0 4px; font-size: 15px; font-weight: 700; }
.fb-plan-row p { margin: 0 0 4px; }
.fb-qty { width: 96px; text-align: right; font-variant-numeric: tabular-nums; }

/* Totalul se citește primul după listă: cerneală plină, cifre tabulare. */
.fb-total { margin: 14px 0 4px; font-size: 17px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }

/* ============================================================
   5b. FISCALBRIDGE — vânzările în cloud (spec 6 §6, 6 Task 31)
   ============================================================ */

/* Panourile „Pe zile”, „Cote TVA”, „Plăți” și „Case” se pliază pe telefon în carduri (`td[data-col]`, site.css):
   un tabel pliat nu mai are nevoie de lățimea minimă de derulare a învelișului (560 px), altfel cardul iese din
   panou și suma se taie la 375 px. */
/* Bifele locațiilor din Setări: una sub alta, cu aer între ele (nu lipite pe un rând). */
/* „Ultimul bon primit”: data și ora nu încap în cifra mare a unui indicator — se rup pe două rânduri, mai mici. */
.kpi-value.fbv-when { font-size: 22px; line-height: 1.25; white-space: normal; text-wrap: balance; }

.fbv-checks { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; margin: 4px 0 14px; }

@media (max-width: 720px) {
    .table-scroll > .table.fbv-fold:has(td[data-col]) { min-width: 0; }
    .table-scroll > .table.fbv-fold:has(td[data-col]) td:first-child { position: static; }
}

/* ============================================================
   6. FISCALBRIDGE — portalul licențelor (spec 5 §6.7, 5 T31)
   ============================================================ */

/* Drepturile licenței: textul pe primul rând, apoi folosirea caselor și contorul, înfășurate pe telefon. */
.fbr-rights { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; min-width: 0; }
.fbr-rights > span:first-child { flex: 1 1 100%; }
.fbr-rights > span { color: var(--ink-2); }
.fbr-rights .meter { flex: 0 0 auto; }

/* Locația calculatorului: selectul și „Salvează” pe un rând în celula tabelului; pe telefon se înfășoară. */
.fbr-location { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.fbr-location .select { flex: 1 1 140px; min-width: 0; }
