/* ============================================================================
   SIS Gateway — Birou · stil familia QGD (TIG / qmapstigari · redesign 13.06.2026)
   Temă dark-navy: fundal #1a1a2e, bară de sus #010409, accent #e94560, cap de
   tabel #0f3460, fără zebra, hover slab, cifre tabulare aliniate dreapta.
   Tokenii sunt copiați 1:1 din qmapstigari/public/style.css (familia QGD).
   Funcționalitatea NU se schimbă aici — doar înfățișarea. Zero biblioteci, zero CDN.
   ========================================================================== */

:root {
  /* paletă navy — identică TIG / QuApp / BB */
  --bg: #1a1a2e;
  --bg2: #16213e;
  --bg3: #0f3460;
  --card: #1e2a4a;
  --card2: #233150;
  --border: #2a3a5c;
  --text: #e8e8f0;
  --text2: #c4cbdf;
  --text3: #8b95ac;

  /* bară de sus (topbar QGD) */
  --bar: #010409;
  --bar-ink: #e6edf3;

  /* accent (identitatea QGD) */
  --accent: #e94560;
  --accent2: #ff6b6b;

  /* stări — verde/galben/roșu pentru sănătate și verdictele VERDE/ROȘU */
  --ok: #00d2a0;     --ok-bg: rgba(0, 210, 160, 0.14);   --ok-bd: rgba(0, 210, 160, 0.40);
  --warn: #ffd166;   --warn-bg: rgba(255, 209, 102, 0.14); --warn-bd: rgba(255, 209, 102, 0.40);
  --bad: #e74c3c;    --bad-bg: rgba(231, 76, 60, 0.16);   --bad-bd: rgba(231, 76, 60, 0.42);
  --info: #5f9df7;   --info-bg: rgba(95, 157, 247, 0.14); --info-bd: rgba(95, 157, 247, 0.40);
  --mut: #8b95ac;    --mut-bg: rgba(255, 255, 255, 0.06); --mut-bd: rgba(255, 255, 255, 0.14);

  --radius: 10px;
  --radius-s: 6px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
}

.hidden { display: none !important; }

h1, h2, h3 { line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: 1.45rem; }
h2 { font-size: 1.2rem; margin: 0 0 0.25rem; }
h3 { font-size: 1rem; margin: 1.4rem 0 0.5rem; color: var(--text); }

/* ============================== CONTROALE ============================== */

input, select, button {
  font: inherit;
  color: var(--text);
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  background: var(--bg2);
  margin: 0.15rem 0;
}
input:focus-visible, select:focus-visible, button:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(233, 69, 96, 0.25);
}
input::placeholder { color: var(--text3); }

button {
  background: var(--accent);
  color: #fff;
  border: none;
  font-weight: 600;
  cursor: pointer;
  transition: background 120ms ease, opacity 120ms ease, transform 80ms ease;
}
button:hover { background: var(--accent2); }
button:active { transform: translateY(1px); }
button:disabled { opacity: 0.5; cursor: default; transform: none; }

/* butoane secundare — contur, nu plin (acțiuni din tabele) */
table button,
.filtru button + button,
button.secundar {
  background: var(--card2);
  color: var(--text);
  border: 1px solid var(--border);
  font-weight: 600;
  padding: 0.3rem 0.6rem;
}
table button:hover, button.secundar:hover { background: var(--card); border-color: var(--accent); }

.err { color: var(--bad); min-height: 1.2em; }

/* ============================== LOGIN ============================== */

#login {
  max-width: 380px;
  margin: 11vh auto 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 1.8rem 1.7rem 1.5rem;
  text-align: center;
}
#login h1 { margin: 0.5rem 0 0.1rem; color: var(--accent); }
#login .sub-titlu { color: var(--text2); margin: 0 0 1.2rem; }
#login-form { display: flex; flex-direction: column; gap: 0.4rem; text-align: left; }
#login-form button { margin-top: 0.6rem; padding: 0.7rem; font-size: 15px; border-radius: 8px; }
.marca { display: inline-flex; align-items: center; gap: 0.55rem; color: var(--accent); }
.marca svg { display: block; }

/* ============================== BARA DE SUS ============================== */

header {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  background: var(--bar);
  color: var(--bar-ink);
  padding: 0 1rem;
  min-height: 48px;
  position: sticky;
  top: 0;
  z-index: 1100;
  border-bottom: 1px solid var(--border);
}
header .marca { color: var(--bar-ink); }
header .marca b { font-size: 1rem; letter-spacing: 0.01em; color: var(--accent); }
header .marca .sub-titlu { display: block; font-size: 0.7rem; color: var(--text3); margin-top: -2px; }

header nav { display: flex; gap: 0.1rem; align-self: stretch; flex-wrap: wrap; }
header nav button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: transparent;
  border: none;
  border-radius: 0;
  color: var(--text2);
  padding: 0 0.7rem;
  margin: 0;
  font-weight: 600;
  font-size: 0.85rem;
  position: relative;
}
header nav button svg { flex: none; opacity: 0.85; }
header nav button:hover { color: var(--bar-ink); background: rgba(255, 255, 255, 0.06); }
header nav button.activ { color: #fff; }
header nav button.activ::after {
  content: '';
  position: absolute;
  left: 0.55rem;
  right: 0.55rem;
  bottom: 0;
  height: 3px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
}

header #who { margin-left: auto; color: var(--text3); font-size: 0.85rem; white-space: nowrap; }
header #logout {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  color: var(--bar-ink);
  font-weight: 500;
  padding: 0.35rem 0.7rem;
  font-size: 0.8rem;
}
header #logout:hover { background: rgba(255, 255, 255, 0.15); }

/* ============================== CONȚINUT ============================== */

main { max-width: 1280px; margin: 0 auto; padding: 1.4rem 1.2rem 3rem; }

.tab { animation: aparitie 180ms ease-out; }
@keyframes aparitie {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .tab { animation: none; }
}

.cap-sectiune { margin-bottom: 1rem; }
.cap-sectiune h2 { color: var(--text); }
.cap-sectiune p { margin: 0.1rem 0 0; color: var(--text2); font-size: 0.9rem; max-width: 70ch; }

.hint { color: var(--text2); font-size: 0.9rem; }

.filtre, .filtru {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  margin: 0 0 0.9rem;
  flex-wrap: wrap;
}

/* ============================== TABELE (model TIG) ============================== */

/* containerele tabelelor: scroll orizontal pe ecrane mici și scroll intern pe
   tabelele lungi (antetul rămâne lipit de marginea de sus a containerului) */
#zeturi-tabel, #incasari-sumar, #incasari-detaliu, #rap-rezultat,
#loturi-tabel, #neg-tabel, #utilizatori-tabel { overflow: auto; max-height: 72vh; }

table {
  width: 100%;
  /* separate (nu collapse): cu thead sticky, collapse pictează rândurile prin antet (Chromium) */
  border-collapse: separate;
  border-spacing: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
th, td {
  padding: 0.45rem 0.6rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
  vertical-align: middle;
}
thead th {
  background: var(--bg3);
  color: var(--text);
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border-bottom: 2px solid var(--info);
  white-space: nowrap;
  position: sticky;
  top: 0;               /* față de containerul tabelului, nu de pagină */
  z-index: 5;
}
tbody tr:last-child td { border-bottom: none; }
/* fără zebra — diferențierea vine din hover slab */
tbody tr:hover td { background: rgba(255, 255, 255, 0.04); }

/* cifrele: tabulare, aliniate dreapta */
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.num { font-feature-settings: 'tnum'; }

/* sortare la click pe coloană */
th[data-sort] { cursor: pointer; user-select: none; }
th[data-sort]:hover { color: #fff; }
th[data-sort]::after { content: ' ↕'; color: var(--text3); font-size: 0.8em; }
th[data-sort].asc::after { content: ' ↑'; color: var(--accent); }
th[data-sort].desc::after { content: ' ↓'; color: var(--accent); }

/* bara tabelului: număr de rânduri + căutare */
.tabel-bara {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin: 0 0 0.45rem;
}
.tabel-bara .contor { color: var(--text2); font-size: 0.85rem; }
.tabel-bara input {
  min-width: 200px;
  background: var(--bg2);
  margin: 0;
}

/* ============================== INSIGNE DE STARE ============================== */

.badge {
  display: inline-block;
  padding: 0.12rem 0.55rem 0.16rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  border: 1px solid transparent;
}
.badge::before { content: '● '; font-size: 0.62em; vertical-align: 0.18em; }
.verde  { background: var(--ok-bg);   color: var(--ok);   border-color: var(--ok-bd); }
.galben { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-bd); }
.rosu   { background: var(--bad-bg);  color: var(--bad);  border-color: var(--bad-bd); }
.info   { background: var(--info-bg); color: var(--info); border-color: var(--info-bd); }
.gol    { background: var(--mut-bg);  color: var(--mut); border-color: var(--mut-bd); }

/* Banner fail-visible pe rapoarte: articole vandute fara clasa (nu intra in clasament). */
.rap-avertisment {
  margin: 8px 0 12px;
  padding: 10px 14px;
  border-radius: var(--radius-s);
  background: var(--warn-bg);
  color: var(--warn);
  border: 1px solid var(--warn-bd);
  font-weight: 600;
}

/* ============================== SĂNĂTATE ============================== */

.stare-mare {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 0 0 1.1rem;
}
.stare-mare .badge { font-size: 0.95rem; padding: 0.25rem 0.8rem 0.3rem; }

.componente {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0.6rem;
}
.comp {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  padding: 0.65rem 0.8rem;
}
.comp:hover { border-color: var(--accent); }
.comp b { font-size: 0.92rem; color: var(--text); }
.comp .detaliu { color: var(--text2); font-size: 0.82rem; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; align-self: center; }
.dot.verde { background: var(--ok); animation: puls 2.6s ease-in-out infinite; }
.dot.rosu { background: var(--bad); }
.dot.galben { background: var(--warn); }
@keyframes puls {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0, 210, 160, 0.45); }
  50% { box-shadow: 0 0 0 5px rgba(0, 210, 160, 0); }
}
@media (prefers-reduced-motion: reduce) { .dot.verde { animation: none; } }

/* ============================== ALERTE ============================== */

.alerte-lista > div {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--bad);
  border-radius: var(--radius-s);
  padding: 0.65rem 0.85rem;
  margin-bottom: 0.5rem;
}
.alerte-lista > div.invatare { border-left-color: var(--warn); }

/* ============================== DIVERSE ============================== */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  max-width: 460px;
  box-shadow: var(--shadow);
}
#user-form { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 1.1rem; }
#user-form h3 { margin: 0 0 0.4rem; }

#incasari-msg, #rap-msg, #lot-msg, #neg-msg, #user-msg {
  color: var(--text2);
  font-size: 0.88rem;
  padding-left: 0.3rem;
}

i { color: var(--text2); }

/* ============================== TELEFON ============================== */

@media (max-width: 760px) {
  header { gap: 0.6rem; padding: 0 0.6rem; flex-wrap: wrap; min-height: 0; padding-top: 0.4rem; }
  header .marca .sub-titlu { display: none; }
  header nav { order: 3; flex-basis: 100%; justify-content: space-between; gap: 0; }
  header nav button { padding: 0.55rem 0.5rem; }
  header nav .nav-text { display: none; }   /* doar iconițe pe telefon */
  header #who { display: none; }
  main { padding: 0.9rem 0.7rem 2.5rem; }
  .tabel-bara { flex-direction: column; align-items: stretch; }
  .tabel-bara input { min-width: 0; }
  #login { margin: 6vh 0.8rem 0; }
}

/* ============================== PANOU DE COMANDĂ (Task 5) ============================== */
.avert-insuf {
  background: var(--warn-bg); color: var(--warn);
  border: 1px solid var(--warn-bd); border-radius: var(--radius-s);
  padding: 0.6rem 0.8rem; margin-bottom: 0.9rem; font-size: 0.92rem;
}
.avert-insuf b { color: var(--warn); }
.avert-dormant {
  background: var(--bad-bg); color: var(--bad);
  border: 1px solid var(--bad-bd); border-radius: var(--radius-s);
  padding: 0.6rem 0.8rem; margin-bottom: 0.9rem; font-size: 0.92rem;
}
.avert-dormant b { color: var(--bad); }
.avert-dormant button { margin-left: 0.3rem; }
.cmd-cap { margin-bottom: 0.5rem; color: var(--text2); }
.cmd-tabel input.cmd-man { width: 4.5rem; text-align: right; margin: 0; }
.cmd-tabel input.cmd-motiv { width: 100%; min-width: 11rem; margin: 0; }
.cmd-tabel input.cmd-motiv:disabled { opacity: 0.35; }
tr.peste-max { background: var(--bad-bg); }
tr.peste-max input.cmd-motiv { border-color: var(--bad-bd); }
.rosu-num { color: var(--bad); font-weight: 700; }
.cmd-foot {
  display: flex; align-items: center; gap: 1rem; margin-top: 0.9rem; flex-wrap: wrap;
  position: sticky; bottom: 0; z-index: 2;
  padding: 0.7rem 0.9rem; background: var(--bg2);
  border: 1px solid var(--border); border-radius: var(--radius-s);
  box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.35);
}
.cmd-total { font-size: 1.02rem; }
.ok-msg { color: var(--ok); font-weight: 600; }

/* Bara săptămână + zile de livrare (Task 5) */
.cmd-bara { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
#cmd-saptamana { display: inline-flex; gap: 0.3rem; }
.cmd-sapt, .cmd-zi, .cmd-reg {
  background: var(--bg2); color: var(--text2); border: 1px solid var(--border);
  padding: 0.4rem 0.7rem; border-radius: var(--radius-s); font-weight: 600; cursor: pointer; margin: 0;
}
.cmd-sapt:hover, .cmd-zi:hover:not(:disabled), .cmd-reg:hover { border-color: var(--accent); color: var(--text); }
.cmd-sapt.activ, .cmd-zi.activ, .cmd-reg.activ { background: var(--accent); color: #fff; border-color: var(--accent); }
.cmd-zi:disabled { opacity: 0.35; cursor: default; }
.cmd-regiune { display: inline-flex; align-items: center; gap: 0.3rem; padding-right: 0.6rem; border-right: 1px solid var(--border); }
.cmd-zile { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; margin-bottom: 0.7rem; }
.cmd-zi-n { display: inline-block; margin-left: 0.4rem; background: rgba(255,255,255,0.12); border-radius: 999px; padding: 0 0.4rem; font-size: 0.78rem; }
.cmd-zi.activ .cmd-zi-n { background: rgba(255,255,255,0.28); }
.cmd-fara-zi { margin-left: 0.4rem; }
.cmd-livrare-cap { color: var(--text2); margin-bottom: 0.5rem; line-height: 1.4; }
.cmd-warn-txt { color: var(--warn); font-weight: 600; }

/* Master-detail: lista magazinelor zilei în stânga, panoul în dreapta. */
.cmd-md { display: flex; gap: 1rem; align-items: flex-start; }
.cmd-magazine { flex: 0 0 16rem; }
.cmd-detaliu { flex: 1; min-width: 0; }
.cmd-mag-cauta { width: 100%; margin: 0 0 0.4rem; }
.cmd-mag-lista { max-height: 70vh; overflow-y: auto; display: flex; flex-direction: column; gap: 2px;
  border: 1px solid var(--border); border-radius: var(--radius-s); padding: 4px; }
.cmd-mag-item { display: flex; align-items: center; gap: 0.45rem; width: 100%; text-align: left; margin: 0;
  padding: 0.4rem 0.55rem; background: var(--bg2); color: var(--text2); border: 1px solid transparent;
  border-radius: var(--radius-s); font-weight: 500; cursor: pointer; }
.cmd-mag-item:hover { background: var(--card2); color: var(--text); border-color: var(--border); }
.cmd-mag-item.activ { background: var(--bg3); color: #fff; border-color: var(--accent); }
.cmd-mag-cod { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 2.4rem; }
.cmd-mag-nume { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.9rem; }
.cmd-mag-nume i { color: var(--text3); font-style: normal; font-size: 0.78rem; }
.cmd-mag-stare { flex: 0 0 auto; font-weight: 700; }
.cmd-mag-stare.bif { color: var(--ok); }
.cmd-mag-stare.warn { color: var(--warn); }
/* Magazin comandat = bordură verde la stânga; fără zet recent = bordură galbenă. */
.cmd-mag-item.comandat { border-left: 3px solid var(--ok); background: var(--ok-bg); }
.cmd-mag-item.dormant { border-left: 3px solid var(--warn); }
.cmd-mag-item.comandat.activ { border-color: var(--accent); }
.cmd-ziasign { margin-left: 0.5rem; color: var(--text3); font-size: 0.85rem; white-space: nowrap; }
.cmd-ziasign select { padding: 0.2rem 0.4rem; margin: 0; }
.galben-num { color: var(--warn); font-weight: 700; }

/* Cap de tabel înghețat la scroll pe panou (cere Stefan): rămâne sub bara de sus. */
.cmd-tabel { overflow: visible; }
.cmd-tabel thead th { top: 48px; z-index: 6; }

/* Filtru pe clasă de articole + rezumat pe clase (Task 5). */
.cmd-clase { display: flex; gap: 0.35rem; align-items: center; margin-bottom: 0.6rem; flex-wrap: wrap; }
.cmd-clasa {
  background: var(--bg2); color: var(--text2); border: 1px solid var(--border);
  padding: 0.3rem 0.65rem; border-radius: var(--radius-s); font-weight: 600; cursor: pointer; margin: 0;
}
.cmd-clasa:hover { border-color: var(--accent); color: var(--text); }
.cmd-clasa.activ { background: var(--accent); color: #fff; border-color: var(--accent); }
.cmd-clase-rez { display: inline-flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }
.cmd-rez-chip { background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius-s); padding: 0.15rem 0.5rem; font-size: 0.85rem; font-variant-numeric: tabular-nums; }

/* ===== Setări comandă (Task 1) ===== */
#tab-setari .card { margin-bottom: 1rem; }
.set-grid { display: flex; flex-wrap: wrap; gap: 0.9rem; margin: 0.7rem 0; }
.set-camp { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.82rem; color: var(--text2); }
.set-camp input { width: 6.5rem; margin: 0; }
.set-bara { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin: 0.5rem 0 0.7rem; }
.set-cauta { margin: 0; min-width: 13rem; }
#set-zile table select, #set-raft input { margin: 0; }
#set-zile td:last-child { width: 9rem; }
.set-raft-add { margin-top: 0.7rem; align-items: center; }
.set-raft-add input { width: 5rem; }
.set-raft-add select { min-width: 14rem; }
#set-raft-sis { min-width: 20rem; margin-bottom: 0.3rem; }
.set-tabel-scroll { max-height: 22rem; overflow: auto; border-radius: var(--radius); }
.set-tabel-scroll table { box-shadow: none; }

/* Retur SIS — reutilizeaza layout-ul comenzii (.cmd-*); adaugiri minime. */
.verde-num { color: var(--ok); font-weight: 700; }
.ret-mag-val { flex: 0 0 auto; margin-left: auto; padding-right: 0.4rem; color: var(--muted); font-size: 0.82em; font-variant-numeric: tabular-nums; }
tr.ret-modif { background: rgba(110, 120, 200, 0.09); }
td input.ret-fin { width: 4.2rem; text-align: right; }

/* Retur: container de scroll cu capul de tabel inghetat (independent de inaltimea nav-ului). */
.ret-scroll { max-height: 62vh; overflow: auto; border-radius: var(--radius); }
.ret-scroll .cmd-tabel thead th { top: 0; }   /* sticky fata de container, nu de pagina */
.ret-explica { margin-top: 0.6rem; font-size: 0.9rem; }
.ret-explica summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.ret-explica ol { margin: 0.5rem 0 0.3rem 1.2rem; padding: 0; }
.ret-explica li { margin: 0.22rem 0; }

/* Setari retur (Pas 4): inputuri compacte in tabel. */
.set-retur-tabel input { width: 5rem; text-align: right; margin: 0; }

/* Buton de ajutor cu tooltip pe hover/focus (help contextual per fereastra/functie). */
.help {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.1rem; height: 1.1rem; padding: 0; margin-left: 0.35rem;
  border-radius: 50%; border: 1px solid var(--info); background: transparent;
  color: var(--info); font-size: 0.72rem; font-weight: 700; line-height: 1;
  cursor: help; vertical-align: middle; position: relative; flex: 0 0 auto;
}
.help:hover, .help:focus-visible { background: var(--info); color: #07121f; outline: none; }
.help::after {
  content: attr(data-help);
  position: absolute; left: 50%; top: calc(100% + 7px); transform: translateX(-50%);
  width: max-content; max-width: 19rem; white-space: normal; text-align: left;
  background: var(--bg3); color: var(--text); border: 1px solid var(--info);
  border-radius: var(--radius); padding: 0.5rem 0.65rem;
  font-size: 0.8rem; font-weight: 400; letter-spacing: normal; text-transform: none; line-height: 1.4;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4); z-index: 60;
  opacity: 0; visibility: hidden; transition: opacity 0.12s ease; pointer-events: none;
}
.help:hover::after, .help:focus-visible::after { opacity: 1; visibility: visible; }

/* ===================== Transferuri (Bucata 2) ===================== */
button.mic { padding: 0.25rem 0.6rem; font-size: 0.82rem; }
.tr-qr { margin: 0.6rem 0; padding: 0.5rem 0.7rem; background: var(--bg3); border: 1px dashed var(--info); border-radius: var(--radius); }
.tr-qr code { font-size: 1.05rem; font-weight: 700; color: var(--accent); letter-spacing: 0.04em; }
.tr-actiuni { display: flex; gap: 0.5rem; align-items: center; margin: 1rem 0 0.4rem; flex-wrap: wrap; }
.tr-actiuni input { flex: 1 1 16rem; }
.tr-json { margin: 0.3rem 0 0; padding: 0.5rem 0.6rem; background: var(--bg3); border-radius: var(--radius); font-size: 0.74rem; max-height: 16rem; overflow: auto; white-space: pre-wrap; word-break: break-word; }
.tr-mod { display: inline-flex; border: 1px solid var(--bd); border-radius: var(--radius); overflow: hidden; }
.tr-mod-b { border: none; border-radius: 0; padding: 0.4rem 0.95rem; background: transparent; color: var(--text2); font-weight: 600; }
.tr-mod-b:hover { background: var(--card); }
.tr-mod-b.activ { background: var(--accent); color: #0b1220; }

/* ============================== COMPARATIV (clase JTI + articole) ============================== */
/* Tabel lat -> container cu scroll propriu. Antetul lipit e mostenit din regula globala `thead th`. */
#cmp-articole, #cmp-clase { overflow: auto; max-height: 60vh; }
/* Rand REȚEA / TOTAL evidentiat. */
.cmp-total td { font-weight: 700; border-top: 2px solid var(--border); background: var(--mut-bg); }
/* Rand JTI evidentiat in rezumatul pe clase. */
.cmp-jti td { font-weight: 700; }
/* Rand "Concurență" = SUBTOTAL (suma BAT+KING+PMI) — marcat distinct de clasele de detaliu. */
.cmp-subtotal td { font-weight: 700; font-style: italic; border-top: 1px solid var(--border); }
/* Sub-titlu cota JTI. */
.cmp-subtitlu { font-size: 1.05rem; font-weight: 700; color: var(--ok); margin: 4px 0 10px; }

/* ============================== INCHIDERI DE ZI (Pas 3+4, coada EOD) ============================== */
/* Agent care N-A inchis dar are documente in asteptare — evidentiat (fail-visible). */
.inch-atentie td { background: var(--warn-bg); }
/* Randul de erori de sub agent: mereu vizibil, lipit de agentul lui (fara sortare pe tabel). */
.inch-erori td {
  border-left: 4px solid var(--bad);
  color: var(--bad);
  font-size: 0.88rem;
  padding-top: 0.3rem;
  padding-bottom: 0.45rem;
}
/* Mesaj de succes (folosit si de transferuri — clasa era referita din JS dar nedefinita). */
.ok-msg { color: var(--ok); min-height: 1.2em; }

/* Comutatorul de emitere (Valul 3): un rand per flux, nume + badge + actiuni admin. */
.emitere-rand { display: flex; align-items: center; gap: 0.6rem; padding: 0.28rem 0; flex-wrap: wrap; }
.emitere-nume { min-width: 10.5rem; font-weight: 600; }

/* ===================== Tab MARFA (monitorizare incarcari + retururi) ===================== */
/* Linie cu diferenta cerut-vs-predat (miezul monitorizarii): rosu = predat != cerut. */
.mf-dif td { background: var(--bad-bg); }
/* Linie ajustata la ridicare (lista agentului != ridicat): galben = de vazut, nu grav. */
.mf-warn td { background: var(--warn-bg); }
/* Cutia erorilor de emitere: sus, la vedere, nu ingropata in filtre. */
.mf-erori { margin: 8px 0 12px; padding: 10px 14px; border-radius: var(--radius-s); background: var(--bad-bg); border: 1px solid var(--bad-bd); }
.mf-erori .mf-eroare { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; padding: 0.3rem 0; }
.mf-erori code { color: var(--text2); }
#mf-sumar table { margin-bottom: 10px; }
#mf-sumar .zero { color: var(--text3); }

/* --- Credit & Deblocari (D12): randul unei cereri cu decizia inline --- */
.cr-cerere { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; padding: 0.4rem 0; border-bottom: 1px solid var(--bd); }
.cr-cerere:last-of-type { border-bottom: none; }
.cr-cerere input { flex: 1 1 13rem; margin: 0; }
.cr-motiv { color: var(--text2); font-style: italic; }

/* --- Negocieri: grila la vedere (feedback Stefan 03.07) --- */
/* Legenda grilei lunii: valorile care se aplica DUPA pragul de pachete — doar afisare. */
.ng-legenda { margin: 8px 0 10px; padding: 8px 12px; border-radius: var(--radius-s); background: var(--bg2, rgba(127,127,127,.08)); color: var(--text2); font-size: 0.92em; }
.ng-legenda .ng-prag { white-space: nowrap; }
/* Magazin fara nicio negociere pe luna incarcata (nou/inchis): estompat, nu "date lipsa". */
tr.ng-fara-date td { opacity: 0.55; }

/* Banda de totaluri a negocierilor (cerinta Stefan 03.07): cifrele lunii, la vedere. */
.ng-totaluri { margin: 8px 0 4px; padding: 8px 12px; border-radius: var(--radius-s); background: var(--bg3); border-left: 3px solid var(--accent); }
.ng-totaluri-partial { border-left-color: var(--warn, orange); }
/* Antet FREEZE la scroll in tabelul negocierilor: table generic are overflow:hidden
   (pt border-radius), care OMOARA position:sticky in interior — acelasi fix ca .cmd-tabel. */
#neg-tabel table { overflow: visible; }
