/* ==========================================================================
   Bitolia 2 — Comparator Oferte Fațadă & Repartitor Cote Indivize
   Design system autonom (fără CDN) — funcționează 100% offline.
   ========================================================================== */

:root {
  --slate-50:#f8fafc;  --slate-100:#f1f5f9; --slate-200:#e2e8f0; --slate-300:#cbd5e1;
  --slate-400:#94a3b8; --slate-500:#64748b; --slate-600:#475569; --slate-700:#334155;
  --slate-800:#1e293b; --slate-900:#0f172a; --slate-950:#020617;

  --blue-50:#eff6ff;   --blue-100:#dbeafe;  --blue-200:#bfdbfe;  --blue-500:#3b82f6;
  --blue-600:#2563eb;  --blue-700:#1d4ed8;  --blue-800:#1e40af;  --blue-900:#1e3a8a;

  --emerald-50:#ecfdf5; --emerald-100:#d1fae5; --emerald-200:#a7f3d0;
  --emerald-600:#059669; --emerald-700:#047857; --emerald-800:#065f46;

  --amber-50:#fffbeb;  --amber-100:#fef3c7; --amber-200:#fde68a; --amber-600:#d97706;
  --amber-700:#b45309; --amber-800:#92400e;

  --red-50:#fef2f2;    --red-100:#fee2e2;    --red-200:#fecaca;   --red-600:#dc2626;
  --red-700:#b91c1c;

  --radius:.75rem;
  --shadow-sm:0 1px 2px rgba(15,23,42,.06);
  --shadow:0 1px 3px rgba(15,23,42,.08), 0 1px 2px rgba(15,23,42,.04);
  --shadow-md:0 4px 12px rgba(15,23,42,.08);
  --shadow-lg:0 12px 32px rgba(15,23,42,.14);

  --font: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', 'SF Mono', Consolas, 'Courier New', monospace;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--slate-800);
  background: var(--slate-100);
  -webkit-font-smoothing: antialiased;
}

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.nowrap { white-space: nowrap; }

/* ----------------------------- Layout ----------------------------- */
.wrap { max-width: 1400px; margin: 0 auto; padding: 0 20px; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.row-wrap { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.grow { flex: 1 1 auto; min-width: 0; }

/* ----------------------------- Header ----------------------------- */
.app-header {
  background: linear-gradient(100deg, var(--slate-900) 0%, var(--blue-950, #172554) 50%, var(--slate-900) 100%);
  color: #fff; box-shadow: var(--shadow-md); position: sticky; top: 0; z-index: 40;
}
.app-header .wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px 20px;
  padding-top: 14px;
  padding-bottom: 14px;
}
.app-header .brand { grid-column: 1; grid-row: 1; min-width: 0; }
.app-header .tabs { grid-column: 1 / -1; grid-row: 2; justify-self: start; max-width: 100%; overflow-x: auto; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 12px; background: var(--blue-600);
  display: grid; place-items: center; box-shadow: 0 4px 12px rgba(37,99,235,.35); flex: none;
}
.brand-mark svg { width: 22px; height: 22px; }
.brand h1 { margin: 0; font-size: clamp(15px, 2.4vw, 17px); font-weight: 700; letter-spacing: -.01em; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.brand p { margin: 2px 0 0; font-size: 12px; color: var(--slate-300); }
.badge-sector {
  font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px;
  background: rgba(59,130,246,.2); color: var(--blue-200); border: 1px solid rgba(147,197,253,.3);
}
.header-meta { display: flex; flex-wrap: wrap; gap: 18px; font-size: 12px; color: var(--slate-300); }
.header-meta b { color: #fff; }
.header-meta .ok { color: #6ee7b7; font-weight: 700; }

/* ----------------------------- Tabs ----------------------------- */
.tabs {
  display: flex; gap: 4px; padding: 4px; max-width: 100%;
  background: rgba(15,23,42,.55); border: 1px solid rgba(148,163,184,.25); border-radius: 12px;
  overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: thin;
}
.tab-btn {
  display: flex; align-items: center; gap: 8px; padding: 9px 16px; border: 0; border-radius: 9px;
  background: transparent; color: var(--slate-300); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  white-space: nowrap; flex: none;
  transition: background .15s, color .15s;
}
.tab-btn:hover { color: #fff; background: rgba(148,163,184,.12); }
.tab-btn.active { background: var(--blue-600); color: #fff; box-shadow: 0 2px 8px rgba(37,99,235,.4); }
.tab-btn svg { width: 15px; height: 15px; }

/* ----------------------------- Info bar ----------------------------- */
.infobar { background: #fff; border-bottom: 1px solid var(--slate-200); padding: 10px 0; font-size: 12px; color: var(--slate-600); }
.infobar .wrap { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.infobar b { color: var(--slate-800); }
.pill { font-weight: 700; padding: 2px 8px; border-radius: 6px; background: var(--emerald-50); color: var(--emerald-700); border: 1px solid var(--emerald-200); }
.pill.bad { background: var(--red-50); color: var(--red-700); border-color: var(--red-200); }

/* ----------------------------- Card ----------------------------- */
.card { background: #fff; border: 1px solid var(--slate-200); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-head { padding: 16px 20px; border-bottom: 1px solid var(--slate-100); display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; font-size: 15px; font-weight: 700; color: var(--slate-900); display: flex; align-items: center; gap: 8px; }
.card-head h3 { font-size: 14px; }
.card-head p { margin: 3px 0 0; font-size: 12px; color: var(--slate-500); }
.card-body { padding: 20px; }
.card-body.tight { padding: 14px 20px; }
.accent { color: var(--blue-600); }
.accent-em { color: var(--emerald-600); }
.accent-am { color: var(--amber-600); }
.accent-rd { color: var(--red-600); }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 18px; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr)); gap: 14px; }

/* ----------------------------- Buttons ----------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 15px; border-radius: 10px; border: 1px solid transparent;
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn svg { width: 15px; height: 15px; flex: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--blue-600); color: #fff; box-shadow: 0 2px 8px rgba(37,99,235,.28); }
.btn-primary:hover:not(:disabled) { background: var(--blue-700); }
.btn-dark { background: var(--slate-800); color: #fff; }
.btn-dark:hover:not(:disabled) { background: var(--slate-700); }
.btn-em { background: var(--emerald-600); color: #fff; }
.btn-em:hover:not(:disabled) { background: var(--emerald-700); }
.btn-outline { background: #fff; border-color: var(--slate-300); color: var(--slate-700); }
.btn-outline:hover:not(:disabled) { border-color: var(--blue-500); color: var(--blue-600); background: var(--blue-50); }
.btn-ghost { background: transparent; color: var(--slate-600); }
.btn-ghost:hover:not(:disabled) { background: var(--slate-100); color: var(--slate-900); }
.btn-danger { background: #fff; border-color: var(--red-200); color: var(--red-600); }
.btn-danger:hover:not(:disabled) { background: var(--red-50); border-color: var(--red-600); }
.btn-sm { padding: 6px 11px; font-size: 12px; border-radius: 8px; }
.btn-icon { padding: 7px; border-radius: 8px; background: transparent; border: 0; color: var(--slate-400); cursor: pointer; }
.btn-icon:hover { background: var(--slate-100); color: var(--slate-700); }
.btn-icon.danger:hover { background: var(--red-50); color: var(--red-600); }
.btn-block { width: 100%; }

/* ----------------------------- Forms ----------------------------- */
.field { display: block; }
.field > label, .lbl {
  display: block; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--slate-600); margin-bottom: 5px;
}
.input, .select, textarea.input {
  width: 100%; padding: 9px 11px; font: inherit; font-size: 13px; color: var(--slate-800);
  background: #fff; border: 1px solid var(--slate-300); border-radius: 9px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, textarea.input:focus { border-color: var(--blue-500); box-shadow: 0 0 0 3px var(--blue-100); }
.input.num { text-align: right; font-family: var(--mono); }
.input-sm { padding: 6px 9px; font-size: 12px; }
.select { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5'><path d='M6 9l6 6 6-6'/></svg>"); background-repeat: no-repeat; background-position: right 9px center; background-size: 14px; padding-right: 30px; }
.input-2x { border-width: 2px; }
.hint { font-size: 11px; color: var(--slate-500); margin-top: 4px; }
.hint strong { color: var(--slate-700); }

/* ----------------------------- Offer cards ----------------------------- */
.offer-card {
  background: #fff; border: 2px solid var(--slate-200); border-radius: var(--radius);
  padding: 18px; display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s;
}
.offer-card:hover { border-color: var(--slate-300); box-shadow: var(--shadow-md); }
.offer-card.selected { border-color: var(--blue-600); box-shadow: 0 0 0 4px var(--blue-50), var(--shadow-md); }
.offer-card.winner { border-color: var(--emerald-500); box-shadow: 0 0 0 4px var(--emerald-50), var(--shadow-md); }
.offer-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.offer-name { font-size: 15px; font-weight: 800; color: var(--slate-900); margin: 2px 0 0; line-height: 1.25; }
.offer-cui { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--slate-500); }

.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 700; white-space: nowrap; border: 1px solid transparent;
}
.chip svg { width: 12px; height: 12px; }
.chip-blue   { background: var(--blue-50); color: var(--blue-700); border-color: var(--blue-200); }
.chip-em     { background: var(--emerald-50); color: var(--emerald-700); border-color: var(--emerald-200); }
.chip-am     { background: var(--amber-50); color: var(--amber-700); border-color: var(--amber-200); }
.chip-rd     { background: var(--red-50); color: var(--red-700); border-color: var(--red-200); }
.chip-slate  { background: var(--slate-100); color: var(--slate-600); border-color: var(--slate-200); }

.price-box { background: var(--slate-50); border: 1px solid var(--slate-100); border-radius: 10px; padding: 12px 14px; }
.price-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 12px; color: var(--slate-500); }
.price-row + .price-row { margin-top: 5px; }
.price-row b { color: var(--slate-800); font-family: var(--mono); font-weight: 700; }
.price-row.total { margin-top: 9px; padding-top: 9px; border-top: 1px solid var(--slate-200); }
.price-row.total span { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--slate-700); }
.price-row.total b { font-size: 18px; font-weight: 800; }
.price-row.best b { color: var(--emerald-700); }

.mini-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mini-stat { padding: 9px 11px; border-radius: 9px; border: 1px solid var(--slate-100); background: var(--slate-50); }
.mini-stat span { display: block; font-size: 10px; text-transform: uppercase; font-weight: 700; letter-spacing: .03em; }
.mini-stat b { font-family: var(--mono); font-size: 13px; font-weight: 700; color: var(--slate-800); }
.mini-stat.mat span { color: var(--amber-700); }
.mini-stat.mano span { color: var(--blue-700); }

.offer-meta { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--slate-600); border-top: 1px solid var(--slate-100); padding-top: 12px; }
.offer-meta div { display: flex; align-items: center; gap: 7px; }
.offer-meta svg { width: 13px; height: 13px; color: var(--slate-400); flex: none; }
.offer-meta b { color: var(--slate-800); }
.offer-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; border-top: 1px solid var(--slate-100); padding-top: 12px; }
.offer-note { font-size: 11px; color: var(--slate-500); font-style: italic; line-height: 1.45; }

/* ----------------------------- Tables ----------------------------- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.table-scroll > table.data { min-width: 620px; }
table.data { width: 100%; border-collapse: collapse; font-size: clamp(12px, 1.6vw, 12.5px); }
table.data thead th {
  background: var(--slate-50); color: var(--slate-600); font-size: 10.5px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .04em; text-align: left; padding: 10px 12px;
  border-bottom: 2px solid var(--slate-200); white-space: nowrap; vertical-align: bottom;
}
table.data thead th .sub { display: block; font-size: 9px; font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--slate-400); line-height: 1.25; margin-top: 2px; }
table.data tbody td { padding: 9px 12px; border-bottom: 1px solid var(--slate-100); vertical-align: top; }
table.data tbody tr:hover { background: var(--slate-50); }
table.data tbody tr.cat-row td { background: var(--slate-100); font-weight: 800; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--slate-600); }
table.data tfoot td { padding: 11px 12px; border-top: 2px solid var(--slate-300); font-weight: 800; background: var(--slate-50); }
table.data td.num, table.data th.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cell-user { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.audit-detail { min-width: 160px; }
table.data td.ctr, table.data th.ctr { text-align: center; }
.col-offer { min-width: 190px; }
.row-muted td { opacity: .55; }

.status {
  display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 800;
  padding: 2px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: .03em;
}
.status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-inclus  { background: var(--emerald-50); color: var(--emerald-700); }
.status-exclus  { background: var(--red-50); color: var(--red-700); }
.status-rezerva { background: var(--amber-50); color: var(--amber-700); }
.status-neclar  { background: var(--slate-100); color: var(--slate-600); }

.cell-line { display: flex; flex-direction: column; gap: 3px; }
.cell-line .meta { font-size: 10px; color: var(--slate-400); font-family: var(--mono); }
.cell-line .total { font-weight: 700; color: var(--slate-900); font-family: var(--mono); font-size: 13px; }

/* ----------------------------- Alerts ----------------------------- */
.alert { display: flex; gap: 11px; padding: 13px 15px; border-radius: 10px; font-size: 12.5px; border: 1px solid; align-items: flex-start; }
.alert svg { width: 17px; height: 17px; flex: none; margin-top: 1px; }
.alert-warn { background: var(--amber-50); border-color: var(--amber-200); color: var(--amber-800); }
.alert-info { background: var(--blue-50); border-color: var(--blue-200); color: var(--blue-900); }
.alert-ok   { background: var(--emerald-50); border-color: var(--emerald-200); color: var(--emerald-800); }
.alert-err  { background: var(--red-50); border-color: var(--red-200); color: var(--red-700); }
.alert b { font-weight: 800; }
.alert ul { margin: 6px 0 0; padding-left: 18px; }
.alert li + li { margin-top: 3px; }

/* ----------------------------- Stat badges (repartizare) ----------------------------- */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.stat {
  padding: 13px 15px; border-radius: 10px; border: 1px solid var(--slate-200); background: #fff;
}
.stat span { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; font-weight: 700; color: var(--slate-500); margin-bottom: 3px; }
.stat b { font-family: var(--mono); font-size: 17px; font-weight: 800; color: var(--slate-900); }
.stat.em { background: var(--emerald-50); border-color: var(--emerald-200); }
.stat.em span { color: var(--emerald-700); }
.stat.em b { color: var(--emerald-800); }
.stat.blue { background: var(--blue-600); border-color: var(--blue-600); box-shadow: 0 4px 12px rgba(37,99,235,.25); }
.stat.blue span { color: var(--blue-100); }
.stat.blue b { color: #fff; }

/* ----------------------------- Official payment list ----------------------------- */
.doc-head {
  padding: 20px 22px; border-bottom: 1px solid var(--slate-300); background: var(--slate-50);
  display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; flex-wrap: wrap;
}
.doc-head h2 { margin: 0; font-size: 15px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--slate-900); }
.doc-head .meta { font-size: 11.5px; color: var(--slate-600); margin-top: 4px; }
.doc-head h3 { margin: 10px 0 0; font-size: 13.5px; font-weight: 800; color: var(--blue-900); }
.doc-head .meta-box {
  text-align: right; font-size: 11.5px; background: #fff; padding: 11px 14px; border-radius: 10px;
  border: 1px solid var(--slate-300); box-shadow: var(--shadow-sm); min-width: 230px;
}
.doc-foot { padding: 16px 22px; background: var(--slate-50); border-top: 1px solid var(--slate-200); font-size: 11.5px; color: var(--slate-600); display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.doc-foot .sign { text-align: right; }
.doc-foot .sign b { color: var(--slate-800); }

.col-depozit { background: var(--emerald-50); }
.col-ramas { background: var(--blue-50); }
.col-rata { background: var(--amber-50); }
tfoot .col-depozit { background: var(--emerald-100); color: var(--emerald-800); }
tfoot .col-ramas { background: var(--blue-100); color: var(--blue-900); }
tfoot .col-rata { background: var(--amber-100); color: var(--amber-800); }

/* ----------------------------- Modal ----------------------------- */
.modal {
  position: fixed; inset: 0; z-index: 60; background: rgba(15,23,42,.6); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 20px; overflow-y: auto;
}
.modal-box {
  background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); width: 100%; max-width: 900px;
  max-height: 92vh; overflow-y: auto; padding: 24px 26px;
}
.modal-box.sm { max-width: 520px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--slate-100); }
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 700; color: var(--slate-900); display: flex; align-items: center; gap: 9px; }
.modal-body { padding-top: 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding-top: 18px; margin-top: 18px; border-top: 1px solid var(--slate-100); }

/* ----------------------------- Article rows (editor) ----------------------------- */
.art-row { background: var(--slate-50); border: 1px solid var(--slate-200); border-radius: 10px; padding: 12px 14px; }
.art-row + .art-row { margin-top: 10px; }
.art-row .head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.art-row .head b { font-size: 12.5px; color: var(--slate-800); }
.art-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 9px; align-items: end; }
.art-fields.st-4 { grid-template-columns: 118px 1fr 1fr 1.25fr 2.1fr; }
.art-fields.st-3 { grid-template-columns: 150px 1fr 1fr 1fr; }

/* ----------------------------- Compact payment list ----------------------------- */
#plataCard table.data { font-size: 12px; }
#plataCard table.data thead th { padding: 8px 8px; }
#plataCard table.data tbody td { padding: 8px 8px; }
#plataCard table.data tfoot td { padding: 9px 8px; }

/* ----------------------------- Misc ----------------------------- */
.kv { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; padding: 5px 0; border-bottom: 1px dashed var(--slate-200); }
.kv:last-child { border-bottom: 0; }
.kv span { color: var(--slate-500); }
.kv b { color: var(--slate-800); font-family: var(--mono); }
.divider { height: 1px; background: var(--slate-200); margin: 16px 0; }
.empty { text-align: center; padding: 40px 20px; color: var(--slate-400); font-size: 13px; }
.empty svg { width: 34px; height: 34px; opacity: .5; margin-bottom: 8px; }
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 90;
  background: var(--slate-900); color: #fff; padding: 12px 20px; border-radius: 10px;
  font-size: 13px; font-weight: 600; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 9px;
  animation: toastIn .2s ease;
}
.toast svg { width: 16px; height: 16px; }
.toast.ok svg { color: #34d399; }
.toast.err svg { color: #fca5a5; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

.progress { height: 6px; border-radius: 999px; background: var(--slate-200); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--emerald-500, #10b981); border-radius: 999px; }

.filelist { font-size: 12px; color: var(--slate-600); }
.filelist li { margin-bottom: 4px; }
code.k { background: var(--slate-100); padding: 1px 6px; border-radius: 5px; font-family: var(--mono); font-size: 11.5px; color: var(--slate-700); }

/* ==========================================================================
   PRINT
   ========================================================================== */
.print-only { display: none; }
#printArea { display: none; }

@media print {
  @page { size: A4 portrait; margin: 10mm 9mm; }
  body { background: #fff; font-size: 9.5pt; }
  /* Tot ce nu e aria de tipărire se ascunde. */
  body > *:not(#printArea) { display: none !important; }
  #printArea { display: block !important; }
  .no-print, .app-header, .infobar, .screen-only { display: none !important; }
  .print-only { display: block !important; }
  .card { border: 0; box-shadow: none; border-radius: 0; }
  .doc-head { background: #fff !important; padding: 0 0 8px; border-bottom: 2px solid #333; }
  .doc-head h2 { font-size: 12.5pt; }
  .doc-head h3 { font-size: 11pt; margin-top: 6px; }
  .doc-head .meta { font-size: 8pt; }
  .doc-head .meta-box { box-shadow: none; border: 1px solid #999; padding: 6px 9px; font-size: 8.5pt; min-width: 0; }
  table.data { font-size: 8.5pt; }
  table.data thead th { background: #eee !important; color: #000 !important; border-bottom: 1.5px solid #333; padding: 4px 6px; }
  table.data thead th .sub { font-size: 7px; }
  table.data tbody td { padding: 3px 6px; border-bottom: 1px solid #ccc; }
  table.data tbody tr { page-break-inside: avoid; }
  table.data tfoot td { background: #eee !important; border-top: 1.5px solid #333; padding: 5px 6px; }
  .col-depozit, .col-ramas, .col-rata, tfoot .col-depozit, tfoot .col-ramas, tfoot .col-rata { background: #f4f4f4 !important; }
  /* Document oficial: monocrom, cu umbre de coloană pentru lizibilitate */
  table.data tbody td, table.data tfoot td { color: #000 !important; }
  table.data tbody td b, table.data tfoot td b { color: #000 !important; }
  .doc-foot { background: #fff !important; padding: 8px 0 0; border-top: 1px solid #999; font-size: 8pt; page-break-inside: avoid; }
  .doc-foot p { margin: 0 0 2px; }
  .page-break { page-break-before: always; }
  .avoid-break { page-break-inside: avoid; }
}

@media print {
  body.print-deviz { @page { size: A4 landscape; } }
}

/* ==========================================================================
   Autentificare și cont curent
   ========================================================================== */

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
  background:
    radial-gradient(1100px 520px at 50% -10%, #1e3a8a 0%, transparent 62%),
    linear-gradient(160deg, var(--slate-900) 0%, #0b1220 100%);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  padding: 32px 28px 24px;
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.auth-mark {
  width: 52px;
  height: 52px;
  margin: 0 auto 16px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: linear-gradient(150deg, var(--blue-600), var(--blue-800));
  box-shadow: 0 6px 16px rgba(37, 99, 235, .35);
}
.auth-mark svg { width: 26px; height: 26px; }

.auth-card h1 {
  margin: 0 0 6px;
  font-size: 17px;
  line-height: 1.35;
  font-weight: 800;
  letter-spacing: -.01em;
  color: var(--slate-900);
}

.auth-sub { margin: 0 0 22px; font-size: 12px; color: var(--slate-500); }

.auth-fields { display: flex; flex-direction: column; gap: 5px; text-align: left; }
.auth-fields .lbl { margin-top: 7px; }
.auth-fields .input { padding: 10px 12px; }

.auth-error {
  min-height: 18px;
  margin: 8px 0 2px;
  font-size: 12px;
  font-weight: 600;
  color: var(--red-600);
}

.auth-foot { margin: 18px 0 0; font-size: 11px; line-height: 1.5; color: var(--slate-400); }

/* Contul curent, în header */
.user-box {
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 8px;
}
.user-box .chip {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: rgba(148, 163, 184, .16) !important;
  border-color: rgba(148, 163, 184, .3) !important;
  color: #e2e8f0 !important;
}
.user-box .btn {
  padding: 5px 11px;
  font-size: 11.5px;
  font-weight: 600;
  color: #e2e8f0;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(226, 232, 240, .3);
  border-radius: 8px;
}
.user-box .btn:hover { background: rgba(255, 255, 255, .18); color: #fff; }

/* Utilizator simplu: câmpurile sunt dezactivate, acțiunile de admin ascunse */
body.role-viewer input:disabled,
body.role-viewer select:disabled {
  background: var(--slate-50);
  color: var(--slate-600);
  cursor: not-allowed;
}

@media (max-width: 640px) {
  .auth-card { padding: 26px 20px 20px; }
  .user-box .chip { max-width: 130px; }
}

/* ==========================================================================
   Mobil — layout pe o coloană, taburi derulabile, tabele cu scroll tactil
   ========================================================================== */

@media (max-width: 720px) {
  .wrap { padding-left: 14px; padding-right: 14px; }

  /* Header: marca sus, contul dedesubt, taburile pe toată lățimea. */
  .app-header .wrap { grid-template-columns: 1fr; gap: 10px; padding-top: 12px; padding-bottom: 12px; }
  .app-header .brand { grid-column: 1; grid-row: 1; }
  .user-box { grid-column: 1; grid-row: 2; justify-self: end; }
  .app-header .tabs { grid-column: 1; grid-row: 3; justify-self: stretch; }
  .brand { gap: 10px; }
  .brand-mark { width: 36px; height: 36px; border-radius: 10px; }
  .brand h1 { font-size: clamp(14px, 4.4vw, 16px); line-height: 1.3; }
  .badge-sector { font-size: 10px; }
  .brand p { font-size: 11px; }
  .user-box .chip { max-width: 56vw; }
  .tab-btn { padding: 8px 13px; font-size: 12.5px; }

  /* Infobar: pe verticală, fără șiruri care dau pe dinafară. */
  .infobar .wrap { flex-direction: column; align-items: stretch; gap: 8px; }
  .infobar .row-wrap { gap: 6px 16px; }
  #ibIban { overflow-wrap: anywhere; font-family: var(--mono); font-size: 11.5px; }

  /* Carduri și butoane de acțiune. */
  .card-body { padding: 16px 14px; }
  .doc-head { flex-direction: column; }
  .doc-head .meta-box { min-width: 0; width: 100%; text-align: left; }
  .offer-card { padding: 15px 14px; }
  .price-row.total b { font-size: 16px; }
  .stat b { font-size: 15px; }
  .modal { padding: 12px; }
  .modal-box { padding: 18px 16px; border-radius: 14px; }
  .toast { max-width: 92vw; text-align: center; font-size: 12.5px; }

  /* Grilele nu forțează lățimi mai mari decât ecranul. */
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .grid-3, .grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); }
  /* Textele cu span fix din modale (ex. editare ofertă) nu creează coloane noi. */
  .grid-2 > *, .grid-3 > *, .grid-4 > * { grid-column: auto !important; max-width: 100%; min-width: 0; }
  .art-fields.st-4, .art-fields.st-3 { grid-template-columns: 1fr 1fr; }
}

/* Rânduri de parolă / credențiale din administrarea utilizatorilor. */
.pass-row, .cred-row { display: flex; gap: 8px; align-items: stretch; }
.pass-row .input, .cred-row .input { flex: 1 1 auto; min-width: 0; }
.pass-row .btn, .cred-row .btn { flex: none; }
@media (max-width: 480px) {
  .pass-row { flex-wrap: wrap; }
  .pass-row .input { flex: 1 1 100%; }
  .pass-row .btn { flex: 1 1 auto; }
}

@media print {
  #authScreen, .user-box, #tab-utilizatori { display: none !important; }
}
