/* Dashboard rescriere-ro. Valorile vin din scalele Refactoring UI (skill-ul refactoringux): spațiere, tipografie,
   culori HSL în trepte 100–900, cinci umbre. Nu se inventează valori în afara scalelor. */
:root {
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px; --space-6: 32px;
  --space-7: 48px; --space-8: 64px;
  --text-xs: 12px; --text-sm: 14px; --text-base: 16px; --text-lg: 18px; --text-xl: 20px; --text-2xl: 24px; --text-3xl: 30px;
  --leading-snug: 1.25; --leading-normal: 1.5;

  --grey-100: hsl(210, 36%, 96%); --grey-200: hsl(212, 33%, 89%); --grey-300: hsl(211, 27%, 84%);
  --grey-400: hsl(209, 23%, 60%); --grey-500: hsl(210, 22%, 49%); --grey-600: hsl(209, 28%, 39%);
  --grey-700: hsl(209, 34%, 30%); --grey-800: hsl(211, 39%, 23%); --grey-900: hsl(209, 61%, 16%);
  --primary-100: hsl(205, 92%, 92%); --primary-200: hsl(205, 97%, 85%); --primary-300: hsl(205, 90%, 76%);
  --primary-400: hsl(206, 82%, 58%); --primary-500: hsl(208, 88%, 38%); --primary-600: hsl(209, 88%, 33%);
  --primary-700: hsl(211, 88%, 28%); --primary-900: hsl(215, 88%, 18%);
  --red-100: hsl(360, 100%, 95%); --red-500: hsl(360, 67%, 44%); --red-800: hsl(360, 85%, 25%);
  --yellow-100: hsl(49, 100%, 92%); --yellow-500: hsl(42, 100%, 29%); --yellow-800: hsl(38, 100%, 19%);
  --green-100: hsl(152, 68%, 92%); --green-500: hsl(154, 85%, 24%); --green-800: hsl(156, 100%, 13%);

  --shadow-1: 0 1px 3px hsla(0, 0%, 0%, .2); --shadow-2: 0 4px 6px hsla(0, 0%, 0%, .2);
  --shadow-3: 0 5px 15px hsla(0, 0%, 0%, .2);
  --radius: 6px; --radius-full: 9999px;
  --latime-meniu: 288px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --surface: var(--grey-100); --surface-raised: #fff; --surface-sunken: var(--grey-200);
  --border: var(--grey-300); --border-strong: var(--grey-500);
  --text-primary: var(--grey-900); --text-secondary: var(--grey-700); --text-tertiary: var(--grey-600);
  --action: var(--primary-500); --action-hover: var(--primary-600); --action-text: #fff;
  --link: var(--primary-600);
  --tint-albastru: var(--primary-100); --text-albastru: var(--primary-900);
}
@media (prefers-color-scheme: dark) {
  :root {
    --surface: var(--grey-900); --surface-raised: var(--grey-800); --surface-sunken: hsl(209, 61%, 12%);
    --border: var(--grey-700); --border-strong: var(--grey-400);
    --text-primary: var(--grey-200); --text-secondary: var(--grey-300); --text-tertiary: hsl(209, 23%, 66%);
    --action: var(--primary-400); --action-hover: var(--primary-300); --action-text: var(--grey-900);
    --link: var(--primary-300);
    --shadow-1: 0 1px 3px hsla(0, 0%, 0%, .4); --shadow-2: 0 4px 6px hsla(0, 0%, 0%, .4);
    --shadow-3: 0 5px 15px hsla(0, 0%, 0%, .45);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font); font-size: var(--text-base); line-height: var(--leading-normal);
  color: var(--text-primary); background: var(--surface); -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p { margin: 0; }
a { color: var(--link); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- cadrul: meniu fix în stânga, conținut în dreapta ---------- */
.cadru { display: grid; grid-template-columns: var(--latime-meniu) minmax(0, 1fr); min-height: 100vh; }
.meniu {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: var(--space-5);
  padding: var(--space-5) var(--space-4); background: var(--surface-raised); border-right: 1px solid var(--border);
}
.marca { display: flex; align-items: center; gap: var(--space-3); font-size: var(--text-lg); font-weight: 600; }
.marca-centru { justify-content: center; }
.marca-semn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: var(--radius);
  background: var(--action); color: var(--action-text); font-size: var(--text-base); font-weight: 600;
}
.meniu-sectiune { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.meniu-titlu, .eticheta-sectiune {
  font-size: var(--text-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-tertiary);
}
.meniu-titlu { padding: 0 var(--space-2); }
.lista-articole { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.lista-articole a {
  display: flex; gap: var(--space-2); padding: var(--space-2); border-radius: var(--radius);
  color: var(--text-secondary); text-decoration: none; font-size: var(--text-sm);
}
.lista-articole a:hover { background: var(--surface); color: var(--text-primary); }
.lista-articole a.activ { background: var(--tint-albastru); color: var(--text-albastru); }
.lista-articole .gol { padding: var(--space-2); font-size: var(--text-sm); color: var(--text-tertiary); }
.lista-articole .text { min-width: 0; }
.lista-articole .titlu { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lista-articole .meta { display: block; font-size: var(--text-xs); color: var(--text-tertiary); }
.punct { flex: none; width: 8px; height: 8px; margin-top: 7px; border-radius: 50%; background: var(--grey-400); }
.punct.in_lucru { background: var(--primary-400); } .punct.eroare, .punct.respins { background: var(--red-500); }
.punct.finalizat { background: var(--green-500); } .punct.asteapta { background: var(--yellow-500); }
.meniu-jos { display: flex; flex-direction: column; gap: var(--space-1); padding-top: var(--space-4); border-top: 1px solid var(--border); }
.meniu-jos form { margin: 0; }
.meniu-link {
  display: block; width: 100%; padding: var(--space-2); border: 0; border-radius: var(--radius); background: none;
  font: inherit; font-size: var(--text-sm); text-align: left; color: var(--text-secondary); text-decoration: none; cursor: pointer;
}
.meniu-link:hover, .meniu-link.activ { background: var(--surface); color: var(--text-primary); }
.meniu-utilizator { padding: var(--space-2); font-size: var(--text-xs); color: var(--text-tertiary); overflow-wrap: anywhere; }

.continut { min-width: 0; padding: var(--space-6) var(--space-7) 0; }
.continut:focus { outline: none; }
.pagina { max-width: 1120px; display: flex; flex-direction: column; gap: var(--space-5); padding-bottom: var(--space-7); }
.antet-pagina { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: var(--space-4); }
.antet-pagina h1 { font-size: var(--text-2xl); line-height: var(--leading-snug); font-weight: 600; }
.subtitlu { margin-top: var(--space-1); font-size: var(--text-sm); color: var(--text-secondary); }
.se-incarca { color: var(--text-tertiary); padding: var(--space-6) 0; }

/* ---------- carduri, butoane, câmpuri ---------- */
.card { background: var(--surface-raised); border-radius: var(--radius); box-shadow: var(--shadow-1); padding: var(--space-5); }
.card > h2 { font-size: var(--text-lg); font-weight: 600; margin-bottom: var(--space-4); }
.card > .subtitlu:first-of-type { margin-top: calc(-1 * var(--space-3)); margin-bottom: var(--space-4); }
h3 { font-size: var(--text-base); font-weight: 600; }
.stiva { display: flex; flex-direction: column; gap: var(--space-4); }
.stiva-mica { display: flex; flex-direction: column; gap: var(--space-2); }
.rand { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-4); border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface-raised); color: var(--text-primary); box-shadow: var(--shadow-1);
  font: inherit; font-size: var(--text-sm); font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--surface); }
.btn:active { box-shadow: none; }
.btn-primar { background: var(--action); border-color: var(--action); color: var(--action-text); }
.btn-primar:hover { background: var(--action-hover); border-color: var(--action-hover); }
.btn-link { border: 0; box-shadow: none; background: none; color: var(--link); padding: var(--space-2); }
.btn-link:hover { background: none; text-decoration: underline; }
.btn-pericol { color: var(--red-500); }
.btn-mare { padding: var(--space-3) var(--space-5); font-size: var(--text-base); }
.btn-lat { width: 100%; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

.camp { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.camp > span { font-size: var(--text-sm); font-weight: 600; color: var(--text-secondary); }
.camp > small { font-size: var(--text-xs); color: var(--text-tertiary); }
input[type=text], input[type=email], input[type=password], input[type=number], input:not([type]), select, textarea {
  width: 100%; padding: var(--space-2) var(--space-3); border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface-raised); color: var(--text-primary); font: inherit; font-size: var(--text-sm);
}
input:disabled { opacity: .6; }
textarea { line-height: 1.6; resize: vertical; }
textarea.text-articol { min-height: 360px; font-size: var(--text-base); }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible, summary:focus-visible, .meniu-link:focus-visible {
  outline: 2px solid var(--primary-400); outline-offset: 1px;
}
.grila { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--space-4); }
.bifa { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); color: var(--text-secondary); }

/* ---------- mesaje și etichete ---------- */
.alerta { padding: var(--space-3) var(--space-4); border-radius: var(--radius); font-size: var(--text-sm); }
.alerta-eroare { background: var(--red-100); color: var(--red-800); }
.alerta-info { background: var(--primary-100); color: var(--primary-900); }
.alerta-ok { background: var(--green-100); color: var(--green-800); }
.alerta-atentie { background: var(--yellow-100); color: var(--yellow-800); }
.alerta a { color: inherit; font-weight: 600; }
.alerta ul { margin: var(--space-2) 0 0; padding-left: var(--space-5); }
.eticheta {
  display: inline-flex; align-items: center; padding: 2px var(--space-2); border-radius: var(--radius-full);
  background: var(--grey-200); color: var(--grey-800); font-size: var(--text-xs); font-weight: 600; white-space: nowrap;
}
.eticheta.verde { background: var(--green-100); color: var(--green-800); }
.eticheta.galben { background: var(--yellow-100); color: var(--yellow-800); }
.eticheta.rosu { background: var(--red-100); color: var(--red-800); }
.eticheta.albastru { background: var(--primary-100); color: var(--primary-900); }
.cod { padding: 1px 6px; border-radius: 4px; background: var(--surface-sunken); font-family: var(--mono); font-size: var(--text-xs); }
.secundar { color: var(--text-secondary); }
.tertiar { color: var(--text-tertiary); font-size: var(--text-sm); }
.mic { font-size: var(--text-sm); }

.rezumat-optiuni { cursor: pointer; font-weight: 600; }
.optiuni-corp { margin-top: var(--space-4); }

/* ---------- etapele articolului ---------- */
.pasi { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--space-2); }
.pas { display: flex; flex-direction: column; gap: var(--space-2); font-size: var(--text-xs); color: var(--text-tertiary); }
.pas-bara { height: 4px; border-radius: 2px; background: var(--grey-300); }
.pas.gata .pas-bara { background: var(--green-500); }
.pas.urmeaza .pas-bara { background: var(--primary-300); }
.pas.in_lucru .pas-bara { background: var(--primary-400); }
.pas.eroare .pas-bara { background: var(--red-500); }
.pas-numar { font-weight: 600; color: var(--text-secondary); }
.pas-nume { line-height: 1.35; color: var(--text-secondary); }
.pas.viitoare .pas-nume, .pas.viitoare .pas-numar { color: var(--text-tertiary); }

.etapa { background: var(--surface-raised); border-radius: var(--radius); box-shadow: var(--shadow-1); }
.etapa > summary {
  list-style: none; display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4) var(--space-5); cursor: pointer;
}
.etapa > summary::-webkit-details-marker { display: none; }
.etapa-numar {
  flex: none; display: inline-grid; place-items: center; min-width: 32px; height: 32px; padding: 0 var(--space-2);
  border-radius: var(--radius-full); background: var(--green-100); color: var(--green-800); font-size: var(--text-xs); font-weight: 600;
}
.etapa-titlu { flex: 1; font-weight: 600; }
.etapa-sumar { font-size: var(--text-sm); color: var(--text-tertiary); }
.sageata { color: var(--text-tertiary); transition: transform .15s; }
.etapa[open] .sageata { transform: rotate(90deg); }
.etapa-corp { display: flex; flex-direction: column; gap: var(--space-5); padding: var(--space-5); border-top: 1px solid var(--border); }
.bloc-sectiune { display: flex; flex-direction: column; gap: var(--space-3); padding-bottom: var(--space-5); border-bottom: 1px solid var(--border); }
.bloc-sectiune:last-child { padding-bottom: 0; border-bottom: 0; }
.statistici { display: flex; flex-wrap: wrap; gap: var(--space-6); }
.stat-valoare { font-size: var(--text-2xl); font-weight: 600; line-height: var(--leading-snug); }
.stat-eticheta { font-size: var(--text-sm); color: var(--text-secondary); }
.rezumat { max-width: 44em; font-size: var(--text-lg); line-height: 1.6; }
.definitii { display: grid; grid-template-columns: max-content 1fr; gap: var(--space-2) var(--space-5); margin: 0; font-size: var(--text-sm); }
.definitii dt { color: var(--text-tertiary); }
.definitii dd { margin: 0; }

.lista { margin: 0; padding-left: var(--space-5); display: flex; flex-direction: column; gap: var(--space-2); font-size: var(--text-sm); }
.lista-simpla { list-style: none; padding-left: 0; }
.lista li { max-width: 60em; }
.fragment { font-style: italic; }
.etichete { display: flex; flex-wrap: wrap; gap: var(--space-2); }

.doua-coloane { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-4); }
.text-bloc {
  max-height: 560px; overflow: auto; padding: var(--space-4); border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); font-size: var(--text-sm); line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere;
}
.text-bloc.final { max-height: none; font-size: var(--text-base); background: var(--surface-raised); }

.tabel { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.tabel th {
  padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--border); text-align: left;
  font-size: var(--text-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-tertiary);
}
.tabel td { padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--border); vertical-align: top; }
.tabel .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tabel-scroll { overflow-x: auto; }

.progres { display: flex; align-items: flex-start; gap: var(--space-3); }
.rotita {
  flex: none; width: 20px; height: 20px; margin-top: 2px; border: 3px solid var(--primary-200);
  border-top-color: var(--primary-500); border-radius: 50%; animation: rotire .8s linear infinite;
}
@keyframes rotire { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .rotita { animation-duration: 3s; } }

.bara-actiune {
  position: sticky; bottom: 0; z-index: 1; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: var(--space-4); padding: var(--space-4) var(--space-5); background: var(--surface-raised);
  border-radius: var(--radius) var(--radius) 0 0; box-shadow: var(--shadow-3);
}
.bara-actiune .urmeaza-titlu { font-weight: 600; }
.bara-actiune .urmeaza-detaliu { font-size: var(--text-sm); color: var(--text-secondary); }

/* ---------- setări ---------- */
.rol { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: var(--space-4); padding: var(--space-4) 0; border-bottom: 1px solid var(--border); }
.rol:first-of-type { padding-top: 0; }
.rol:last-of-type { border-bottom: 0; padding-bottom: 0; }
.rol-nume { font-weight: 600; }
.rol-descriere { font-size: var(--text-sm); color: var(--text-secondary); }
.rol-campuri { display: grid; grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr)); gap: var(--space-3); align-items: start; }
.model-info { grid-column: 1 / -1; font-size: var(--text-xs); color: var(--text-tertiary); }

/* ---------- login ---------- */
.pagina-login { min-height: 100vh; display: grid; place-items: center; padding: var(--space-4); }
.login { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: var(--space-5); }
.login-card { display: flex; flex-direction: column; gap: var(--space-4); padding: var(--space-6); box-shadow: var(--shadow-3); }
.login-card h1 { font-size: var(--text-xl); font-weight: 600; }

/* ---------- ecrane înguste ---------- */
@media (max-width: 960px) {
  .cadru { grid-template-columns: 1fr; }
  .meniu { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--border); }
  .lista-articole { max-height: 240px; }
  .continut { padding: var(--space-5) var(--space-4) 0; }
  .doua-coloane { grid-template-columns: 1fr; }
  .pasi { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .rol { grid-template-columns: 1fr; }
  .rol-campuri { grid-template-columns: 1fr 1fr; }
  .antet-pagina h1 { font-size: var(--text-xl); }
  .bara-actiune { position: static; border-radius: var(--radius); box-shadow: var(--shadow-1); }
}
