/* =====================================================================
   BIZ Depozit 2 – Web UI kit   sb-ui.css   v0.7 – 22.10.2026
   Stil "Modern compact" pentru modulele WEB deschise din BIZ Depozit 2
   (Delphi + WebView2). Independent de BIZ Check (terminal).

   STRUCTURA UNUI ECRAN
     .sb-page
       .sb-titlebar      titlu + max. 2 butoane text + ⟳ ⋯ ⚙ ✕
       .sb-msgbar        (optional) avertisment/eroare la nivel de document
       .sb-tabs          (optional) tab-uri
       .sb-content
         .sb-filterbar   filtre + actiuni legate de date
         .sb-grid-wrap   grid  (sau .sb-split cu grid + .sb-side)

   REGULI
   - Bara de titlu: maximum 2 butoane cu text (principal + Anuleaza).
     Restul: ⟳ Reciteste, ⋯ meniu (actiuni rare), ⚙ setari afisare, ✕ inchide.
   - Fara bara de actiuni jos si fara status bar (le are fereastra Delphi).
   - Anuleaza si Sterge = rosu (.is-danger / .sb-btn-danger).
   - Un document = un rand in grid. Textul lung se trunchiaza (…),
     tooltip-ul cu textul complet il pune sb-ui.js automat.
   - Needitabil: atribut readonly (fundal galben foarte pal).
   - Erorile pe camp apar ca tooltip, NU sub camp (layout-ul nu se misca).
   - Font si marime: din setarile BIZ Depozit 2 (sb-ui.js), suprascrise din ⚙.
     Toate dimensiunile deriva din --sb-fs.
   - Prefix sb- pe toate clasele.
   ===================================================================== */

/* ---------- 1. Tokens ---------- */
:root {
  --sb-font: "Segoe UI", Tahoma, Arial, sans-serif;
  --sb-font-mono: Consolas, "Courier New", monospace;
  --sb-fs: 10pt;
  --sb-fs-sm: calc(var(--sb-fs) * 0.9);
  --sb-fs-lg: calc(var(--sb-fs) * 1.15);

  --sb-ctl-h: calc(var(--sb-fs) * 2.15);     /* input, select, buton  (~29px la 10pt) */
  --sb-row-h: calc(var(--sb-fs) * 2.25);     /* rand grid             (~30px la 10pt) */
  --sb-tb-h: calc(var(--sb-fs) * 2.8);       /* bara de titlu         (~38px la 10pt) */
  --sb-gap: 10px;
  --sb-gap-sm: 5px;
  --sb-radius: 3px;
  --sb-radius-card: 4px;

  /* text – contrast apropiat de Delphi */
  --sb-text: #1a1a1a;
  --sb-text-2: #333333;        /* etichete */
  --sb-text-muted: #4d4d4d;    /* secundar */

  /* suprafete si chenare */
  --sb-page: #f3f5f7;
  --sb-surface: #ffffff;
  --sb-subtle: #eef1f4;        /* header grid, rand total */
  --sb-border: #c5cdd4;        /* panouri */
  --sb-border-ctl: #8c99a5;    /* controale */
  --sb-line: #e3e7eb;          /* linii intre randuri */

  /* accent = banda teal din BIZ Depozit 2 */
  --sb-accent: #1d4a5a;
  --sb-accent-hover: #163a47;
  --sb-accent-soft: #e6eff2;

  /* selectie / focus – ca in Delphi */
  --sb-select: #0078d7;
  --sb-select-bg: #e5f1fb;
  --sb-hover-bg: #f2f7fb;
  --sb-focus: #0078d7;

  /* dezactivat */
  --sb-disabled-bg: #eef1f4;
  --sb-disabled-text: #7a858f;
  --sb-disabled-border: #d5dbe1;

  /* needitabil */
  --sb-ro-bg: #fffbe6;
  --sb-ro-border: #d9cf9e;

  /* stari */
  /* fundal pal + text inchis (contrast text/fundal >= 9:1) */
  --sb-danger: #c62828;  --sb-danger-hover: #a51f1f; --sb-danger-bg: #fde2e2; --sb-danger-text: #6b0b0b; --sb-danger-line: #f0a8a8;
  --sb-warn: #f08c00;    --sb-warn-bg: #fef1d6;      --sb-warn-text: #1a1a1a;   --sb-warn-line: #f5c26b;
  --sb-ok: #2e7d32;      --sb-ok-bg: #dff5e3;        --sb-ok-text: #124d1d;     --sb-ok-line: #9fd3a8;
  --sb-info: #0b5a8a;    --sb-info-bg: #e5f1fb;      --sb-info-text: #0a3558;   --sb-info-line: #a9cbe8;
  --sb-row-anulat-text: #7a858f;
  --sb-changed-bg: #fff1d0;     /* rand modificat, nesalvat */

  /* PALETA DE STARE (din backlog, ajustata pentru lizibilitate: text/fundal >= 4.5:1)
     Folosire: celula intreaga colorata  <td class="sb-st st-green">Confirmat</td>
               sau badge                 <span class="sb-badge st-green">Confirmat</span>   */
  --sb-st-green-bg: #c6efce;  --sb-st-green-text: #0b5a1c;   /* finalizat / confirmat / rezolvat */
  --sb-st-yellow-bg: #ffeb9c; --sb-st-yellow-text: #1a1a1a;  /* in lucru / neconfirmat */
  --sb-st-blue-bg: #0b6bb8;   --sb-st-blue-text: #ffffff;    /* planificat / programat */
  --sb-st-mint-bg: #b4ebcf;   --sb-st-mint-text: #0b4f3a;    /* in verificare / testare */
  --sb-st-red-bg: #d13438;    --sb-st-red-text: #ffffff;     /* de rezolvat / blocat / eroare */
  --sb-st-grey-bg: #e3e6e9;   --sb-st-grey-text: #3d3d3d;    /* anulat / inactiv */
}
html[data-ro="neutral"] { --sb-ro-bg: #f2f4f6; --sb-ro-border: #c5cdd4; }

/* ---------- 2. Baza si layout ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: var(--sb-font); font-size: var(--sb-fs); color: var(--sb-text); background: var(--sb-page); line-height: 1.4; }
:focus-visible { outline: 2px solid var(--sb-focus); outline-offset: 1px; }
[hidden] { display: none !important; }

.sb-page { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.sb-content { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: var(--sb-gap); padding: var(--sb-gap) 14px 14px; overflow: auto; }
.sb-split { display: flex; gap: var(--sb-gap); flex: 1; min-height: 0; flex-wrap: wrap; }
.sb-split > .sb-main { flex: 999 1 600px; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.sb-split > .sb-side { flex: 1 1 360px; min-width: 0; overflow: auto; }

/* ---------- 3. Bara de titlu ---------- */
.sb-titlebar {
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  min-height: var(--sb-tb-h); padding: 4px 8px 4px 16px;
  background: var(--sb-accent); color: #fff;
}
.sb-tb-title { font-weight: 700; font-size: var(--sb-fs-lg); letter-spacing: .02em; text-transform: uppercase; margin-right: 10px; white-space: nowrap; }
.sb-tb-dirty { color: #ffd27a; font-weight: 600; font-size: var(--sb-fs-sm); white-space: nowrap; }
.sb-tb-dirty::before { content: "● "; }
.sb-tb-spacer { flex: 1; }
.sb-tb-sep { width: 1px; height: 20px; background: rgba(255,255,255,.3); margin: 0 6px; }
.sb-tb-btn {
  font: inherit; font-weight: 600; height: var(--sb-ctl-h); padding: 0 12px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: var(--sb-radius); background: transparent; color: #fff;
  cursor: pointer; white-space: nowrap;
}
.sb-tb-btn:hover { background: rgba(255,255,255,.15); }
.sb-tb-btn:disabled { color: rgba(255,255,255,.45); background: transparent; cursor: not-allowed; }
.sb-tb-btn svg { width: 1.2em; height: 1.2em; flex: none; }
.sb-tb-btn.is-primary:not(:disabled) { background: #fff; color: var(--sb-accent); }
.sb-tb-btn.is-primary:not(:disabled):hover { background: var(--sb-accent-soft); }
.sb-tb-btn.is-danger:not(:disabled) { background: var(--sb-danger); color: #fff; }
.sb-tb-btn.is-danger:not(:disabled):hover { background: var(--sb-danger-hover); }
.sb-tb-ico { width: var(--sb-ctl-h); padding: 0; }
/* bulina cu numarul de modificari, in interiorul butonului Salveaza */
.sb-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.6em; height: 1.6em; padding: 0 .4em; margin-left: 2px;
  border-radius: .8em; background: var(--sb-danger); color: #fff;
  font-size: var(--sb-fs-sm); font-weight: 700; line-height: 1;
}
.sb-tb-ico[aria-expanded="true"] { background: rgba(255,255,255,.22); }

/* ---------- 4. Popover / meniu (⋯ si ⚙) ---------- */
.sb-pop-wrap { position: relative; display: inline-flex; }
.sb-pop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 40;
  min-width: 240px; padding: 6px;
  background: var(--sb-surface); color: var(--sb-text);
  border: 1px solid var(--sb-border); border-radius: var(--sb-radius-card);
  box-shadow: 0 6px 18px rgba(0,0,0,.18); font-weight: 400;
}
.sb-pop-head { font-size: var(--sb-fs-sm); font-weight: 600; color: var(--sb-text-2); padding: 6px 10px 4px; }
.sb-pop-row { display: flex; align-items: center; gap: 8px; padding: 4px 10px; }
.sb-pop-row > .sb-pop-label { width: 64px; color: var(--sb-text-2); }
.sb-pop-sep { border: 0; border-top: 1px solid var(--sb-line); margin: 6px 0; }
.sb-pop-item {
  font: inherit; display: flex; align-items: center; gap: 8px; width: 100%;
  height: var(--sb-ctl-h); padding: 0 10px; border: 0; border-radius: var(--sb-radius);
  background: none; color: inherit; text-align: left; cursor: pointer; white-space: nowrap;
}
.sb-pop-item:hover, .sb-pop-item:focus-visible { background: var(--sb-hover-bg); }
.sb-pop-item.is-danger { color: var(--sb-danger); }

/* ---------- 5. Tab-uri ---------- */
.sb-tabs { display: flex; gap: 22px; padding: 0 16px; background: var(--sb-surface); border-bottom: 1px solid var(--sb-border); flex-wrap: wrap; }
.sb-tabs > button { font: inherit; color: var(--sb-text-2); background: none; border: 0; border-bottom: 3px solid transparent; padding: 8px 0 7px; cursor: pointer; }
.sb-tabs > button:hover { color: var(--sb-text); }
.sb-tabs > button[aria-selected="true"] { color: var(--sb-accent); border-bottom-color: var(--sb-accent); font-weight: 600; }

/* ---------- 6. Bara de filtre ---------- */
.sb-filterbar { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: flex-end; }
/* .sb-panel = filtre + grid intr-un singur chenar: filtrele "apartin" datelor pe care le filtreaza */
.sb-panel { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--sb-surface); border: 1px solid var(--sb-border); border-radius: var(--sb-radius-card); overflow: hidden; }
.sb-panel > .sb-filterbar { padding: 8px 10px 10px; border-bottom: 1px solid var(--sb-border); }
.sb-panel > .sb-grid-wrap { border: 0; border-radius: 0; }
.sb-filterbar .sb-spacer { flex: 1; }

/* ---------- 7. Butoane ---------- */
.sb-btn {
  font: inherit; cursor: pointer; white-space: nowrap;
  height: var(--sb-ctl-h); padding: 0 12px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  color: var(--sb-text); background: var(--sb-surface);
  border: 1px solid var(--sb-border-ctl); border-radius: var(--sb-radius);
}
.sb-btn:hover { border-color: var(--sb-accent); color: var(--sb-accent); }
.sb-btn:active { background: var(--sb-accent-soft); }
.sb-btn-primary { background: var(--sb-accent); border-color: var(--sb-accent); color: #fff; font-weight: 600; }
.sb-btn-primary:hover { background: var(--sb-accent-hover); border-color: var(--sb-accent-hover); color: #fff; }
.sb-btn-danger { color: var(--sb-danger); border-color: #d99a9a; }
.sb-btn-danger:hover { background: var(--sb-danger); border-color: var(--sb-danger); color: #fff; }
.sb-btn-ghost { border-color: transparent; background: transparent; }
.sb-btn-icon { width: var(--sb-ctl-h); padding: 0; }
.sb-btn:disabled { background: var(--sb-disabled-bg); color: var(--sb-disabled-text); border-color: var(--sb-disabled-border); cursor: not-allowed; font-weight: 400; }
.sb-btn svg { width: 1.15em; height: 1.15em; flex: none; }

/* ---------- 8. Formular ---------- */
.sb-form { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: flex-end; }
.sb-field { position: relative; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
/* etichetele au acelasi stil ca header-ul de grid: acelasi rol (numele unui camp) */
.sb-field > label, .sb-field > .sb-label { font-size: var(--sb-fs-sm); font-weight: 600; color: var(--sb-text); white-space: nowrap; }
/* latimi in em: se scaleaza cu fontul; dimensionate dupa continut, nu "cat incape" */
.sb-field.w-xs { width: 6em; }    /* Nr. NIR, cantitati */
.sb-field.w-s  { width: 8em; }    /* Nr. document, data */
.sb-field.w-m  { width: 11em; }   /* dropdown scurt (Stare) */
.sb-field.w-l  { width: 14em; }   /* text: furnizor, producator */
.sb-field.w-xl { width: 22em; }
.sb-field.grow { flex: 1 1 14em; }
/* interval de date: doua campuri compacte pe un rand */
.sb-range { display: flex; align-items: center; gap: 4px; }
.sb-range > input:not([type="checkbox"]) { width: 7.4em !important; }
/* comutator % : bifat = contine, nebifat = incepe cu (ca in Delphi) */
.sb-match { font-weight: 600; }

.sb-input, .sb-select, .sb-textarea,
.sb-field input:not([type="checkbox"]):not([type="radio"]), .sb-field select, .sb-field textarea {
  font: inherit; color: var(--sb-text); width: 100%;
  height: var(--sb-ctl-h); padding: 0 8px;
  background: var(--sb-surface); border: 1px solid var(--sb-border-ctl); border-radius: var(--sb-radius);
}
.sb-textarea, .sb-field textarea { height: auto; padding: 6px 8px; resize: vertical; }
.sb-num, .sb-field input.sb-num { text-align: right; font-variant-numeric: tabular-nums; }
.sb-input:focus, .sb-select:focus, .sb-textarea:focus,
.sb-field input:focus, .sb-field select:focus, .sb-field textarea:focus { outline: none; border-color: var(--sb-focus); box-shadow: 0 0 0 1px var(--sb-focus); }
input[readonly], textarea[readonly], .sb-ro { background: var(--sb-ro-bg) !important; border-color: var(--sb-ro-border) !important; color: var(--sb-text); }
input:disabled, select:disabled, textarea:disabled { background: var(--sb-disabled-bg); color: var(--sb-disabled-text); border-color: var(--sb-disabled-border); }

.sb-search { display: flex; align-items: center; gap: 6px; height: var(--sb-ctl-h); padding: 0 8px; background: var(--sb-surface); border: 1px solid var(--sb-border-ctl); border-radius: var(--sb-radius); }
.sb-search:focus-within { border-color: var(--sb-focus); box-shadow: 0 0 0 1px var(--sb-focus); }
.sb-search input { font: inherit; border: 0; outline: none; width: 100%; background: transparent; color: var(--sb-text); }
.sb-search svg { width: 1.1em; height: 1.1em; flex: none; color: var(--sb-text-muted); }
.sb-field .sb-search input:not([type="checkbox"]):not([type="radio"]) { height: auto; padding: 0; border: 0; box-shadow: none; background: transparent; }

.sb-check { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; min-height: var(--sb-ctl-h); }
.sb-check input { margin: 0; width: 1.15em; height: 1.15em; accent-color: var(--sb-accent); }

/* Validare: chenar + icon in camp, mesajul ca tooltip suprapus (hover/focus). */
[aria-invalid="true"], .sb-invalid {
  border-color: var(--sb-danger) !important; box-shadow: 0 0 0 1px var(--sb-danger);
  padding-right: 2em !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='10' fill='%23c62828'/%3E%3Cpath d='M12 7v6M12 16.5v.5' stroke='%23fff' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important; background-position: right .5em center !important; background-size: 1.1em !important;
}
.sb-warn-field { border-color: var(--sb-warn) !important; box-shadow: 0 0 0 1px var(--sb-warn); }
.sb-tip {
  position: absolute; left: 0; top: calc(100% + 6px); z-index: 30;
  max-width: 300px; width: max-content; padding: 5px 9px; border-radius: var(--sb-radius);
  background: #6b0b0b; color: #fff; font-size: var(--sb-fs-sm); line-height: 1.3;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
  visibility: hidden; opacity: 0; transition: opacity .12s; pointer-events: none;
}
.sb-tip::before { content: ""; position: absolute; left: 12px; top: -5px; border: 5px solid transparent; border-top: 0; border-bottom-color: #6b0b0b; }
.sb-tip.is-warn { background: #333333; } .sb-tip.is-warn::before { border-bottom-color: #333333; }
.sb-field:focus-within > .sb-tip, .sb-field:hover > .sb-tip { visibility: visible; opacity: 1; }

/* ---------- 9. Grid ---------- */
.sb-grid-wrap { flex: 1; min-height: 0; overflow: auto; background: var(--sb-surface); border: 1px solid var(--sb-border); border-radius: var(--sb-radius-card); }
table.sb-grid { width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; }
.sb-grid th, .sb-grid td {
  height: var(--sb-row-h); padding: 0 8px;
  border-bottom: 1px solid var(--sb-line); border-right: 1px solid var(--sb-line);   /* linii de coloana, ca in Delphi */
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;   /* un rand, trunchiat */
  text-align: left; vertical-align: middle; background: var(--sb-surface);
}
.sb-grid thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--sb-subtle); color: var(--sb-text); font-size: var(--sb-fs-sm); font-weight: 600;
  border-bottom: 2px solid var(--sb-border); cursor: default;
  white-space: normal; line-height: 1.2; padding-top: 4px; padding-bottom: 4px; vertical-align: bottom;  /* header pe 2 randuri la coloanele inguste (ca in Delphi) */
}
.sb-grid thead th[aria-sort] { cursor: pointer; }
.sb-grid thead th[aria-sort="ascending"]::after { content: " ▲"; font-size: .75em; }
.sb-grid thead th[aria-sort="descending"]::after { content: " ▼"; font-size: .75em; }
/* totalul sta mereu la baza gridului: tabelul umple inaltimea, iar un rand gol (.sb-filler) preia spatiul liber */
table.sb-grid.has-footer { height: 100%; }
.sb-grid tr.sb-filler td { height: auto; padding: 0; border-bottom: 0; background: transparent !important; }
.sb-grid tbody tr.sb-filler:hover td { background: transparent; }
.sb-grid tfoot td { position: sticky; bottom: 0; z-index: 2; background: var(--sb-subtle); border-top: 2px solid var(--sb-border); border-bottom: 0; font-weight: 600; }
.sb-grid .num { text-align: right; }
.sb-grid .center { text-align: center; }
.sb-grid .mono { font-family: var(--sb-font-mono); }
.sb-grid .strong { font-weight: 600; }

.sb-grid tbody tr { cursor: default; }
.sb-grid tbody tr:hover td { background: var(--sb-hover-bg); }
.sb-grid tbody tr[aria-selected="true"] td { background: var(--sb-select-bg); }
.sb-grid tbody tr[aria-selected="true"] td:first-child { box-shadow: inset 3px 0 0 var(--sb-select); }
.sb-grid tbody tr.is-anulat td { color: var(--sb-row-anulat-text); text-decoration: line-through; }
.sb-grid tbody tr.sb-group-row td { background: var(--sb-subtle); color: var(--sb-accent); font-weight: 600; cursor: pointer; }
.sb-grid tbody tr.sb-group-row td .sb-muted { font-weight: 400; }
/* starile pe celula raman vizibile si pe randul selectat / hover */
.sb-grid tbody tr td.is-danger { background: var(--sb-danger-bg); color: var(--sb-danger-text); font-weight: 600; }
.sb-grid tbody tr td.is-warn   { background: var(--sb-warn-bg);   color: var(--sb-warn-text);   font-weight: 600; }
.sb-grid tbody tr td.is-ok     { background: var(--sb-ok-bg);     color: var(--sb-ok-text);     font-weight: 600; }
.sb-grid tbody tr td.ro        { background: var(--sb-ro-bg); }
/* link in celula (ex. numar document) */
.sb-cell-link { font: inherit; font-weight: 600; color: var(--sb-accent); background: none; border: 0; padding: 0; cursor: pointer; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.sb-cell-link:hover { text-decoration: underline; }
.sb-grid tr.is-anulat .sb-cell-link { color: inherit; font-weight: 400; }
/* editare in celula */
.sb-grid td.edit { padding: 0; }
.sb-grid td.edit input { font: inherit; font-weight: 600; width: 100%; height: calc(var(--sb-row-h) - 1px); border: 0; padding: 0 10px; text-align: right; background: transparent; color: var(--sb-text); }
.sb-grid td.edit input { box-shadow: inset 0 0 0 1px var(--sb-border); }   /* se vede ca e camp editabil */
.sb-grid td.edit input:hover { box-shadow: inset 0 0 0 1px var(--sb-border-ctl); }
.sb-grid td.edit input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--sb-focus); background: #fff; }
.sb-grid td.edit.is-changed { box-shadow: inset 3px 0 0 var(--sb-ok); }
/* dropdown direct in celula (valori posibile definite de administrator) */
.sb-grid td.edit select { font: inherit; width: 100%; height: calc(var(--sb-row-h) - 1px); border: 0; padding: 0 6px; background: transparent; color: var(--sb-text); cursor: pointer; }
.sb-grid td.edit select:hover { box-shadow: inset 0 0 0 1px var(--sb-border-ctl); }
.sb-grid td.edit select:focus { outline: none; box-shadow: inset 0 0 0 2px var(--sb-focus); background: #fff; }
/* rand modificat, nesalvat: fundal + bara + valoarea initiala langa nume */
.sb-grid tbody tr.is-changed td { background: var(--sb-changed-bg); }
.sb-grid tbody tr.is-changed td:first-child { box-shadow: inset 4px 0 0 var(--sb-warn); }
.sb-grid tbody tr.is-changed .sb-row-name { font-weight: 600; }
.sb-changed-note { font-size: var(--sb-fs-sm); color: var(--sb-text-muted); margin-left: 6px; }
.sb-grid tbody tr.is-changed[aria-selected="true"] td { background: var(--sb-changed-bg); }
.sb-grid tbody tr.is-changed[aria-selected="true"] td:first-child { box-shadow: inset 4px 0 0 var(--sb-warn), inset 6px 0 0 var(--sb-select); }
.sb-grid tbody tr td.is-locked { background: var(--sb-disabled-bg); }
/* descriere mare in panoul lateral + lista valori posibile */
.sb-desc { font-size: var(--sb-fs-lg); line-height: 1.5; }
.sb-vals { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.sb-vals li { padding: 6px 10px; border: 1px solid var(--sb-line); border-radius: var(--sb-radius); }
.sb-vals li.is-current { border-color: var(--sb-accent); background: var(--sb-accent-soft); font-weight: 600; }
/* valoare blocata: vizibila, modificabila doar de administrator */
.sb-lock { display: inline-flex; align-items: center; gap: 6px; color: var(--sb-text-2); }
.sb-lock::before { content: ""; width: .95em; height: .95em; flex: none; background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234d4d4d' stroke-width='2.2'%3E%3Crect x='5' y='11' width='14' height='10' rx='1.5'/%3E%3Cpath d='M8 11V8a4 4 0 0 1 8 0v3'/%3E%3C/svg%3E"); }
.sb-grid td.edit input[aria-invalid="true"] { box-shadow: inset 0 0 0 2px var(--sb-danger) !important; background-image: none !important; padding-right: 10px !important; }

/* ---------- 10. Panou lateral / card ---------- */
.sb-card { background: var(--sb-surface); border: 1px solid var(--sb-border); border-radius: var(--sb-radius-card); }
.sb-card-header { display: flex; flex-direction: column; gap: 2px; padding: 10px 16px; border-bottom: 1px solid var(--sb-border); }
.sb-card-title { font-weight: 600; font-size: var(--sb-fs-lg); }
.sb-card-sub { font-size: var(--sb-fs-sm); color: var(--sb-text-muted); }
.sb-card-body { display: flex; flex-direction: column; gap: 12px; padding: 12px 16px; }
.sb-section-title { font-size: var(--sb-fs-sm); font-weight: 600; color: var(--sb-text-2); }

/* ---------- 11. Badge-uri ---------- */
/* stare document (in grid sau langa titlu); click = filtru doar daca e <button> */
.sb-badge { display: inline-flex; align-items: center; height: 1.55em; padding: 0 .55em; border: 0; border-radius: 3px; font: inherit; font-size: var(--sb-fs-sm); font-weight: 600; background: var(--sb-subtle); color: var(--sb-text-2); white-space: nowrap; }
.sb-badge.is-info   { background: var(--sb-info-bg);   color: var(--sb-info-text); }
.sb-badge.is-ok     { background: var(--sb-ok-bg);     color: var(--sb-ok-text); }
.sb-badge.is-warn   { background: var(--sb-warn-bg);   color: var(--sb-warn-text); }
.sb-badge.is-danger { background: var(--sb-danger-bg); color: var(--sb-danger-text); }
.sb-grid tr.is-anulat .sb-badge { text-decoration: none; }

/* ---------- 11b. Stare: celula colorata (ca in backlog / Excel) ---------- */
.sb-grid td.sb-st { text-align: center; font-weight: 600; text-decoration: none !important; }
.sb-grid tbody tr td.st-green,  .sb-badge.st-green  { background: var(--sb-st-green-bg);  color: var(--sb-st-green-text); }
.sb-grid tbody tr td.st-yellow, .sb-badge.st-yellow { background: var(--sb-st-yellow-bg); color: var(--sb-st-yellow-text); }
.sb-grid tbody tr td.st-blue,   .sb-badge.st-blue   { background: var(--sb-st-blue-bg);   color: var(--sb-st-blue-text); }
.sb-grid tbody tr td.st-mint,   .sb-badge.st-mint   { background: var(--sb-st-mint-bg);   color: var(--sb-st-mint-text); }
.sb-grid tbody tr td.st-red,    .sb-badge.st-red    { background: var(--sb-st-red-bg);    color: var(--sb-st-red-text); }
.sb-grid tbody tr td.st-grey,   .sb-badge.st-grey   { background: var(--sb-st-grey-bg);   color: var(--sb-st-grey-text); }
/* pe randul selectat, celula de stare isi pastreaza culoarea; marcajul de selectie ramane pe prima coloana */
/* badge de stare (recomandat in liste): latime fixa, ca sa se alinieze pe coloana */
.sb-badge.sb-st-badge { min-width: 7.6em; justify-content: center; }
.sb-grid tr.is-anulat .sb-badge { text-decoration: none; }
/* index e-Factura prezent: text + bifa verde */
.sb-efact { display: inline-flex; align-items: center; gap: 5px; }
.sb-efact::before { content: ""; width: .9em; height: .9em; flex: none; background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='11' fill='%232e7d32'/%3E%3Cpath d='M7 12.5l3 3 7-7' stroke='%23fff' stroke-width='2.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }

/* ---------- 11c. Coloane fixate la scroll orizontal ---------- */
/* <th|td class="is-frozen" style="left:Xpx">; ultima coloana fixata primeste si .is-frozen-last */
.sb-grid .is-frozen { position: sticky; z-index: 1; }
.sb-grid thead .is-frozen, .sb-grid tfoot .is-frozen { z-index: 3; }
.sb-grid .is-frozen-last { box-shadow: 2px 0 0 var(--sb-border); }
.sb-grid tbody tr[aria-selected="true"] td.is-frozen:first-child { box-shadow: inset 3px 0 0 var(--sb-select); }

/* ---------- 12. Mesaje ---------- */
/* .sb-msgbar – sub bara de titlu; avertismente/erori la nivel de document */
/* icon + culoare: tipul mesajului nu depinde doar de culoare */
.sb-msgbar { display: flex; align-items: center; gap: 8px; padding: 5px 14px; border-bottom: 1px solid; border-left: 4px solid; }
.sb-msgbar::before { content: ""; width: 1.15em; height: 1.15em; flex: none; background: center / contain no-repeat; }
.sb-msgbar.is-info  { background: var(--sb-info-bg);   border-color: var(--sb-info-line);   border-left-color: var(--sb-info);   color: var(--sb-info-text); }
.sb-msgbar.is-warn  { background: var(--sb-warn-bg);   border-color: var(--sb-warn-line);   border-left-color: var(--sb-warn);   color: var(--sb-warn-text); }
.sb-msgbar.is-error { background: var(--sb-danger-bg); border-color: var(--sb-danger-line); border-left-color: var(--sb-danger); color: var(--sb-danger-text); }
.sb-msgbar.is-ok    { background: var(--sb-ok-bg);     border-color: var(--sb-ok-line);     border-left-color: var(--sb-ok);     color: var(--sb-ok-text); }
.sb-msgbar.is-info::before  { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='10' fill='%230b5a8a'/%3E%3Cpath d='M12 11v6M12 7.5v.5' stroke='%23fff' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E"); }
.sb-msgbar.is-warn::before  { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.5 23 21.5H1z' fill='%23f08c00'/%3E%3Cpath d='M12 9.5v5.5M12 18v.5' stroke='%23fff' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E"); }
.sb-msgbar.is-error::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='10' fill='%23c62828'/%3E%3Cpath d='M8.5 8.5l7 7M15.5 8.5l-7 7' stroke='%23fff' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E"); }
.sb-msgbar.is-ok::before    { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='10' fill='%232e7d32'/%3E%3Cpath d='M7.5 12.5l3 3 6-6.5' stroke='%23fff' stroke-width='2.4' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.sb-msgbar .sb-msg-text { flex: 1; min-width: 0; }
.sb-msgbar .sb-link { font: inherit; color: inherit; font-weight: 600; text-decoration: underline; background: none; border: 0; padding: 0; cursor: pointer; }
.sb-msgbar .sb-close { font: inherit; font-size: 1.2em; color: inherit; background: none; border: 0; cursor: pointer; width: 1.6em; height: 1.6em; border-radius: var(--sb-radius); }
.sb-msgbar .sb-close:hover { background: rgba(0,0,0,.07); }
/* .sb-msg – mesaj in interiorul unui panou */
.sb-msg { padding: 8px 10px; border: 1px solid; border-left-width: 4px; border-radius: var(--sb-radius); }
.sb-msg.is-info  { background: var(--sb-info-bg);   border-color: var(--sb-info-line);   border-left-color: var(--sb-info);   color: var(--sb-info-text); }
.sb-msg.is-warn  { background: var(--sb-changed-bg); border-color: var(--sb-warn-line);  border-left-color: var(--sb-warn);   color: var(--sb-warn-text); }
.sb-msg.is-error { background: var(--sb-danger-bg); border-color: var(--sb-danger-line); border-left-color: var(--sb-danger); color: var(--sb-danger-text); }
.sb-msg .sb-btn-ghost { color: inherit; }
/* .sb-toast – dreapta jos, dispare dupa 4s; confirmari */
.sb-toast-host { position: fixed; right: 16px; bottom: 16px; z-index: 50; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.sb-toast { pointer-events: auto; display: flex; align-items: center; gap: 8px; min-width: 220px; max-width: 360px; padding: 8px 12px; border-radius: var(--sb-radius-card); background: #1a1a1a; color: #fff; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.sb-toast::before { content: ""; width: .6em; height: .6em; border-radius: 50%; flex: none; background: #6fb3ea; }
.sb-toast.is-ok::before { background: #5cc46a; }
.sb-toast.is-error::before { background: #ef6b6b; }

/* ---------- 12b. Dialog (confirmari) ---------- */
.sb-dialog-back { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(20, 28, 34, .45); }
.sb-dialog { width: min(520px, 100%); max-height: calc(100% - 32px); display: flex; flex-direction: column; background: var(--sb-surface); border-radius: var(--sb-radius-card); box-shadow: 0 12px 32px rgba(0,0,0,.3); }
.sb-dialog-head { padding: 12px 16px; font-weight: 700; font-size: var(--sb-fs-lg); color: #fff; background: var(--sb-accent); border-radius: var(--sb-radius-card) var(--sb-radius-card) 0 0; }
.sb-dialog-body { padding: 14px 16px; overflow: auto; line-height: 1.5; }
.sb-dialog-foot { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; padding: 10px 16px; border-top: 1px solid var(--sb-border); }
.sb-changes { margin: 8px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.sb-changes li { padding: 6px 10px; border-left: 4px solid var(--sb-warn); background: var(--sb-changed-bg); border-radius: var(--sb-radius); }
.sb-changes .sb-old { color: var(--sb-text-muted); text-decoration: line-through; }

/* ---------- 13. Utilitare ---------- */
.sb-row { display: flex; gap: var(--sb-gap); align-items: center; flex-wrap: wrap; }
.sb-muted { color: var(--sb-text-muted); }
.sb-strong { font-weight: 600; }
.sb-sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) { .sb-tip { transition: none; } }
@media print {
  .sb-titlebar, .sb-msgbar, .sb-tabs, .sb-filterbar { display: none; }
  body { background: #fff; }
  .sb-grid-wrap { overflow: visible; border: 0; }
  .sb-grid thead th, .sb-grid tfoot td { position: static; }
}

/* ---- Adaugiri EmbeddedWebHost ------------------------------------------------------------ */
/* Bara de sesiune expirata a layout-ului _SBase (inlocuieste continutul paginii). */
.sb-session-lost { margin: var(--sb-gap); }
/* Comutatorul % si alte elemente ascunse cu atributul hidden. */
[hidden] { display: none !important; }

/* .sb-modal - fereastra peste pagina (Script SQL, Verificare utilizare, Cautare firma). */
.sb-modal-backdrop { position: fixed; inset: 0; background: rgba(26, 26, 26, .35); display: flex; align-items: center; justify-content: center; z-index: 50; }
.sb-modal { background: var(--sb-surface); border: 1px solid var(--sb-border); border-radius: var(--sb-radius-card); box-shadow: 0 12px 32px rgba(0, 0, 0, .25); width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
.sb-modal-wide { width: min(1100px, calc(100vw - 32px)); height: calc(100vh - 64px); }
.sb-modal-head { display: flex; align-items: center; gap: var(--sb-gap); padding: 8px 12px; background: var(--sb-accent); color: #fff; font-weight: 700; border-radius: var(--sb-radius-card) var(--sb-radius-card) 0 0; }
.sb-modal-head .sb-close { margin-left: auto; color: #fff; }
.sb-modal-body { flex: 1 1 auto; min-height: 0; overflow: auto; padding: var(--sb-gap); display: flex; flex-direction: column; gap: var(--sb-gap); }
.sb-modal-foot { display: flex; align-items: center; gap: var(--sb-gap); padding: 8px 12px; border-top: 1px solid var(--sb-line); background: var(--sb-subtle); }
.sb-modal-foot .sb-spacer { flex: 1 1 auto; }
/* butonul × din antet: ca .sb-close din bara de mesaje, pe fondul accent */
.sb-modal-head .sb-close { font: inherit; font-size: 1.3em; line-height: 1; background: none; border: 0; cursor: pointer; width: 1.6em; height: 1.6em; border-radius: var(--sb-radius); }
.sb-modal-head .sb-close:hover, .sb-modal-head .sb-close:focus-visible { background: rgba(255, 255, 255, .18); outline: none; }
