:root {
  --fond: #f4f2ec;
  --card: #ffffff;
  --text: #1c2433;
  --text-slab: #5a6476;
  --bleumarin: #182a4a;
  --bleumarin-deschis: #2b4372;
  --pe-bleumarin: #ffffff;
  --auriu: #b8860b;
  --linie: #dcd8cd;
  --meniu-activ: #e8e3d4;
  --succes: #1d6b3a;
  --succes-fond: #e6f3ea;
  --eroare: #a32020;
  --eroare-fond: #fbe9e9;
  --pericol: #b42318;
  --pericol-hover: #8f1c12;
  --atentie-fond: #fdf4dc;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fond: #11161f;
    --card: #1a2130;
    --text: #e8e6e0;
    --text-slab: #a3abb9;
    --bleumarin: #8fb0e8;
    --bleumarin-deschis: #b3c9f0;
    --pe-bleumarin: #11161f;
    --auriu: #e0b545;
    --linie: #2e3748;
    --meniu-activ: #243049;
    --succes: #7fd19b;
    --succes-fond: #173023;
    --eroare: #ff9a9a;
    --eroare-fond: #3a1b1b;
    --pericol: #c92a2a;
    --pericol-hover: #e04444;
    --atentie-fond: #33290f;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
/* Fără asta, `display: flex/grid` din clasele de mai jos învinge atributul `hidden` și elementul
   „ascuns” rămâne vizibil (banda „Emailul nu e configurat” rămânea afișată după configurare). */
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--fond); color: var(--text);
  font: 15px/1.5 "Segoe UI", system-ui, -apple-system, sans-serif;
  display: flex; flex-direction: column;
}
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 1.35rem; color: var(--bleumarin); }
h2 { font-size: 1.35rem; margin-bottom: 0.4rem; }
h3 { font-size: 1.05rem; margin: 1.2rem 0 0.4rem; }
code { font-family: Consolas, ui-monospace, monospace; font-size: 0.92em; }

/* ---------------- antet ---------------- */
.antet {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: 0.75rem 1.25rem; background: var(--card); border-bottom: 3px solid var(--auriu); flex: none;
}
.marca { display: flex; align-items: center; gap: 0.7rem; }
.marca img { border-radius: 8px; }
.sub { margin: 0; color: var(--text-slab); font-size: 0.85rem; }
.verificare { display: flex; align-items: center; gap: 0.9rem; text-align: right; }
.verificare p { margin: 0; }
#stare-principala { font-weight: 600; }
.stare-mica { color: var(--text-slab); font-size: 0.85rem; }
.navigare { display: flex; gap: 0.4rem; flex: none; }
.navigare button { white-space: nowrap; }
@media (max-width: 1050px) {
  .antet { flex-wrap: wrap; gap: 0.5rem 1rem; }
  .verificare { flex: 1 1 100%; justify-content: space-between; text-align: left; }
}

/* ---------------- meniu + conținut ---------------- */
.cadru { flex: 1; display: flex; min-height: 0; }
.meniu {
  flex: none; width: 210px; padding: 1rem 0.6rem; background: var(--card);
  border-right: 1px solid var(--linie); display: flex; flex-direction: column; gap: 0.2rem; overflow-y: auto;
}
.meniu button, .mod-web .meniu a.legatura-cont {
  display: flex; justify-content: space-between; align-items: center; width: 100%; text-align: left;
  background: transparent; color: var(--text); border: none; border-left: 3px solid transparent;
  border-radius: 6px; padding: 0.6rem 0.75rem; font-weight: 600;
}
.meniu button:hover, .mod-web .meniu a.legatura-cont:hover { background: var(--fond); }
.meniu button[aria-current="page"] { background: var(--meniu-activ); border-left-color: var(--auriu); color: var(--bleumarin); }
.meniu button[data-pagina="despre"] { margin-top: auto; font-weight: 400; color: var(--text-slab); }
/* Sub „Despre”, jos în bara din stânga: cine a dezvoltat aplicația. */
.semnatura { margin: 0.1rem 0 0; padding: 0 0.75rem 0 calc(0.75rem + 3px); font-size: 0.75rem; color: var(--text-slab); line-height: 1.35; }
/* Butonul-legătură din semnătură trebuie să arate ca un link în text, nu ca un buton de meniu (.meniu button). */
.semnatura button.legatura { display: inline; width: auto; padding: 0; font-size: inherit; font-weight: 600; text-align: inherit;
  color: var(--text-slab); background: none; cursor: pointer; }
.semnatura button.legatura:hover { background: none; color: var(--bleumarin); }
.numar { font-size: 0.8rem; font-weight: 600; color: var(--text-slab); }
.numar:empty { display: none; }
.punct { width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--auriu); }

/* min-width: 0: altfel un tabel lat (rezultatele căutării) lărgește zona și fereastra derulează pe orizontală */
main { flex: 1; min-width: 0; overflow-y: auto; padding: 1.5rem 2rem 2rem; }
.pagina { max-width: 980px; }
.descriere { color: var(--text-slab); margin: 0 0 1.2rem; max-width: 44rem; }

@media (max-width: 760px) {
  .cadru { flex-direction: column; }
  .meniu { width: auto; flex-direction: row; flex-wrap: wrap; border-right: none; border-bottom: 1px solid var(--linie); padding: 0.4rem; }
  .meniu button, .mod-web .meniu a.legatura-cont { width: auto; border-left: none; border-bottom: 3px solid transparent; }
  .meniu button[aria-current="page"] { border-bottom-color: var(--auriu); }
  .meniu button[data-pagina="despre"] { margin-top: 0; }
  .semnatura { display: none; } /* fereastră îngustă: meniul e pe un rând; mențiunea rămâne în Despre */
  main { padding: 1rem; }
}

/* ---------------- elemente ---------------- */
button {
  font: inherit; cursor: pointer; border-radius: 7px; padding: 0.5rem 1rem;
  border: 1px solid var(--bleumarin); background: var(--bleumarin); color: var(--pe-bleumarin); font-weight: 600;
}
button:hover { background: var(--bleumarin-deschis); border-color: var(--bleumarin-deschis); }
button:disabled { opacity: 0.5; cursor: default; }
button.secundar { background: transparent; color: var(--bleumarin); }
button.secundar:hover { background: var(--meniu-activ); }
/* Acțiune distructivă (Elimină dosarul): roșu plin, cu text alb, în ambele teme. */
button.pericol { background: var(--pericol); border-color: var(--pericol); color: #ffffff; }
button.pericol:hover { background: var(--pericol-hover); border-color: var(--pericol-hover); }
button.legatura { background: none; border: none; padding: 0; color: var(--bleumarin); text-decoration: underline; font-weight: 600; border-radius: 2px; }
button.mic { padding: 0.25rem 0.65rem; font-size: 0.88rem; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid var(--auriu); outline-offset: 2px;
}

.formular { display: grid; gap: 0.9rem; max-width: 30rem; }
label { display: grid; gap: 0.3rem; font-weight: 600; }
.optional { font-weight: 400; color: var(--text-slab); font-size: 0.88rem; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--card);
  border: 1px solid var(--linie); border-radius: 7px; padding: 0.55rem 0.7rem;
}
textarea { width: 100%; font-family: Consolas, ui-monospace, monospace; }
.butoane { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 0.4rem; }
.pasi { padding-left: 1.3rem; display: grid; gap: 0.6rem; max-width: 46rem; margin: 0 0 1.2rem; }
.nota { color: var(--text-slab); font-size: 0.88rem; margin: 0.3rem 0 0; }

.mesaj { margin: 0.8rem 0 0; }
.mesaj.ok { color: var(--succes); }
.mesaj.eroare { color: var(--eroare); }
.mesaj:empty { display: none; }

.banda {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
  background: var(--atentie-fond); border: 1px solid var(--auriu); border-radius: 8px;
  padding: 0.6rem 1rem; margin-bottom: 1.3rem; max-width: 980px;
}
.banda p { margin: 0; }

.gol-mare { color: var(--text-slab); padding: 1.5rem; border: 1px dashed var(--linie); border-radius: 10px; text-align: center; max-width: 40rem; }
.gol-mare p { margin: 0 0 0.8rem; }
p.gol-mare { margin: 0; }

.tabel-container { overflow-x: auto; position: relative; } /* relative: ținta .ascuns-vizual (absolută) rămâne înăuntru, altfel fereastra derulează pe orizontală */
table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--linie); border-radius: 10px; }
th, td { text-align: left; padding: 0.65rem 0.8rem; border-bottom: 1px solid var(--linie); vertical-align: top; }
tr:last-child td { border-bottom: none; }
th { font-size: 0.82rem; color: var(--text-slab); font-weight: 600; }
td.numar-dosar { font-weight: 700; white-space: nowrap; }
td .nota-dosar { display: block; font-weight: 400; color: var(--text-slab); font-size: 0.88rem; white-space: normal; }
td .eroare-dosar { display: block; color: var(--eroare); font-size: 0.88rem; margin-top: 0.2rem; white-space: normal; }
td ul { margin: 0; padding: 0; list-style: none; }
td.actiuni { text-align: right; white-space: nowrap; }

.panou { display: grid; gap: 0.5rem; margin-top: 0.8rem; max-width: 40rem; }
.nota-bloc { margin-top: 1.6rem; max-width: 44rem; color: var(--text-slab); font-size: 0.92rem; }
.mai-multe { margin-top: 1.2rem; max-width: 44rem; border: 1px solid var(--linie); border-radius: 8px; padding: 0.6rem 0.9rem; background: var(--card); }
.mai-multe summary { cursor: pointer; font-weight: 600; color: var(--bleumarin); }

.istoric { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; max-width: 980px; }
.istoric > li { background: var(--card); border: 1px solid var(--linie); border-radius: 8px; padding: 0.75rem 0.9rem; }
.istoric .cap { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.istoric .titlu { font-weight: 700; }
.istoric .cand { color: var(--text-slab); font-size: 0.88rem; white-space: nowrap; }
.istoric ul { margin: 0.4rem 0 0; padding-left: 1.1rem; white-space: pre-line; }
.eticheta { display: inline-block; font-size: 0.8rem; font-weight: 600; border-radius: 99px; padding: 0.05rem 0.55rem; margin-top: 0.4rem; }
.eticheta.ok { background: var(--succes-fond); color: var(--succes); }
.eticheta.asteapta { background: var(--atentie-fond); color: var(--text); }
.eticheta.solutie-asteptata { background: var(--atentie-fond); color: var(--text); border: 1px solid var(--auriu); }
.eticheta.eroare { background: var(--eroare-fond); color: var(--eroare); }

.setare { padding: 1rem 0; border-bottom: 1px solid var(--linie); max-width: 44rem; }
.setare:first-of-type { padding-top: 0.4rem; }
.setare p { margin: 0; }
.bifa { display: flex; gap: 0.5rem; align-items: center; }
.selectie { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }

.ascuns-vizual { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------- fișa dosarului ---------------- */
.inapoi { margin-bottom: 0.8rem; display: inline-block; }
.instanta { background: var(--card); border: 1px solid var(--linie); border-radius: 10px; padding: 1rem 1.2rem 1.2rem; margin-bottom: 1.2rem; }
.instanta h3 { margin: 0 0 0.6rem; display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.instanta h4 { margin: 1.1rem 0 0.4rem; font-size: 0.95rem; color: var(--text-slab); }
.instanta table { border: none; }
.instanta th, .instanta td { padding: 0.5rem 0.6rem; }
.eticheta.stadiu { background: var(--meniu-activ); color: var(--bleumarin); font-size: 0.85rem; margin-top: 0; }
.date-generale { display: grid; grid-template-columns: max-content 1fr; gap: 0.25rem 1.2rem; margin: 0; }
.date-generale dt { color: var(--text-slab); }
.date-generale dd { margin: 0; }
tr.viitor td { background: var(--atentie-fond); }
td.nowrap { white-space: nowrap; }
td .eticheta { display: block; width: max-content; }
.solutie-completa { margin: 0.3rem 0 0; white-space: pre-line; }
details summary { cursor: pointer; color: var(--bleumarin); font-size: 0.88rem; margin-top: 0.2rem; }
.sursa { margin-top: 1.4rem; }

/* ---------------- căutare avansată ---------------- */
.file { display: flex; gap: 0.3rem; border-bottom: 1px solid var(--linie); margin-bottom: 1.2rem; max-width: 980px; }
.file button {
  background: transparent; color: var(--text-slab); border: none; border-bottom: 3px solid transparent;
  border-radius: 6px 6px 0 0; padding: 0.55rem 1rem;
}
.file button:hover { background: var(--meniu-activ); color: var(--text); }
.file button[aria-selected="true"] { color: var(--bleumarin); border-bottom-color: var(--auriu); }
.formular.lat { max-width: 46rem; }
.grila { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.9rem 1.2rem; }
.grila input { width: 100%; }
fieldset.interval { border: none; padding: 0; margin: 0; display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
fieldset.interval legend { font-weight: 600; padding: 0; margin-bottom: 0.3rem; }
.mai-multe .panou { max-width: none; }
.avertismente { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: 0.4rem; max-width: 980px; }
.avertismente li { background: var(--atentie-fond); border: 1px solid var(--auriu); border-radius: 8px; padding: 0.5rem 0.8rem; }
.filtre { display: flex; flex-wrap: wrap; gap: 0.7rem 1rem; margin: 1.2rem 0 0.6rem; align-items: end; }
.filtre label { font-size: 0.88rem; }
.filtre input[type="search"] { min-width: 16rem; }
.rand-rezumat { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin: 0.6rem 0; }
.rand-rezumat p { margin: 0; font-weight: 600; }
td.obiect { min-width: 7rem; }
td.col-parti { min-width: 11rem; }
td button.urmareste { display: block; margin-top: 0.4rem; }
ul.parti li { margin-bottom: 0.15rem; }
ul.parti strong { color: var(--bleumarin); }
ul.parti .calitate { color: var(--text-slab); font-size: 0.88rem; }
tr.partial td { color: var(--text-slab); }
.sedinta h3 { margin-bottom: 0.2rem; }
#pagina-cautare .pagina, #pagina-cautare { max-width: 1100px; }

/* ---------------- dosarele mele: număr de ordine, client, vedere pe clienți ---------------- */
th.col-nr, td.col-nr { width: 3.4rem; white-space: nowrap; color: var(--text-slab); font-weight: 600; }
.bara-dosare { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1rem; margin: 0 0 0.9rem; max-width: 980px; }
.bara-dosare .nota { margin: 0; flex-basis: 100%; }
.bara-dosare .nota:empty { display: none; }
.comutator { display: inline-flex; border: 1px solid var(--bleumarin); border-radius: 7px; overflow: hidden; }
.comutator button { border: none; border-radius: 0; background: transparent; color: var(--bleumarin); padding: 0.35rem 0.9rem; }
.comutator button + button { border-left: 1px solid var(--bleumarin); }
.comutator button[aria-pressed="true"] { background: var(--bleumarin); color: var(--pe-bleumarin); }
.comutator button[aria-pressed="true"]:hover { background: var(--bleumarin-deschis); }
.cautare-dosare input { min-width: 17rem; }
tr.grup td { background: var(--meniu-activ); padding: 0.5rem 0.8rem; color: var(--bleumarin); }
.nr-grup { margin-left: 0.7rem; font-weight: 400; color: var(--text-slab); font-size: 0.88rem; }
td .rand-client { display: block; font-weight: 400; font-size: 0.88rem; white-space: normal; margin-top: 0.1rem; }
.client-dosar { font-weight: 600; color: var(--text); }
button.legatura.mica { font-size: 0.82rem; font-weight: 500; white-space: nowrap; }
.editor-client { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; margin-top: 0.35rem; font-weight: 400; }
.editor-client input { padding: 0.3rem 0.5rem; min-width: 11rem; }

.mod-web [data-doar-desktop],
.mod-web .meniu :is([data-pagina="cautare"], [data-pagina="email"], [data-pagina="setari"]) { display: none; }
.mod-web .meniu a.legatura-cont { text-decoration: none; }
.mod-web #stare-surse { margin-top: 0; }

.dialog-lawalert {
  width: min(34rem, calc(100% - 2rem));
  max-height: calc(100% - 2rem);
  padding: clamp(1rem, 4vw, 1.75rem);
  border: 1px solid var(--linie);
  border-radius: 12px;
  background: var(--card);
  color: var(--text);
  overflow-wrap: anywhere;
}
.dialog-lawalert::backdrop { background: rgb(0 0 0 / 55%); }
.dialog-lawalert label { display: block; margin: 0.8rem 0; }
.dialog-lawalert input:not([type="checkbox"]) { display: block; width: 100%; }
.dialog-lawalert button { margin: 0.4rem 0.4rem 0 0; }
.dialog-lawalert ul { max-height: 32vh; overflow: auto; padding-inline-start: 1.5rem; }

@media (max-width: 760px) {
  .grila { grid-template-columns: 1fr; }
  .filtre input[type="search"] { min-width: 0; width: 100%; }
}
