/* ═══════════════════════════════════════════════════════════════
   UVT CONTRACT ENGINE — Design System v2
   Universitatea de Vest din Timișoara
   Brand: #033A89 · #2588E7 · #AED9F8
   ═══════════════════════════════════════════════════════════════ */

/* ─── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ─── Design Tokens ─────────────────────────────────────────── */
:root {
  /* Brand palette */
  --brand-navy:  #033A89;
  --brand-sky:   #2588E7;
  --brand-light: #AED9F8;

  /* Gradients */
  --gradient-brand:  linear-gradient(135deg, #033A89 0%, #2588E7 60%, #AED9F8 100%);
  --gradient-deep:   linear-gradient(160deg, #020E2A 0%, #033A89 40%, #1065C8 75%, #2588E7 100%);
  --gradient-btn:    linear-gradient(135deg, #033A89 0%, #2588E7 100%);
  --gradient-btn-hover: linear-gradient(135deg, #0448A8 0%, #1a7AD8 100%);
  /* Bara laterală — CÂTE UN gradient pe temă, nu unul comun.
     Un singur gradient pentru amândouă a fost un compromis care nu arăta bine nicăieri: dacă
     pornea de la bleumarinul paginii întunecate (#04122F), pe tema deschisă capătul de sus
     ajungea aproape negru și bara devenea grea; dacă urca la albastrul aprins (#0A4DB8), pe
     întuneric sărea din pagină.
     Aici e varianta pentru tema DESCHISĂ: o bandă de brand adâncă, dar vie — nimic aproape de
     negru sus, un albastru mai luminos jos. Varianta pentru întuneric e mai jos, în
     `html[data-theme="dark"]`.
     Tot ce scrie în bară e alb pe transparențe (nimic cu text închis), iar cea mai deschisă
     nuanță de aici, #1152B4, ține albul la 7.3:1 — peste pragul AA. */
  /* O SINGURA nuanta, nu un gradient. Bara are 100vh: pe un asemenea drum, orice gradient se
     citește ca doua culori lipite, nu ca o trecere — de aceea partea de sus si cea de jos
     pareau doua bare diferite. Plat, bara e o suprafata, si atat.
     Aceasta e nuanta pentru tema deschisa; cea pentru intuneric e in `html[data-theme="dark"]`.

     De ce #033A89 si nu #0A3E8F, cum era: #033A89 e chiar `--primary`, albastrul butoanelor si al
     umbrelor din toata aplicatia. Cu doua bleumarinuri apropiate, dar diferite, pe acelasi ecran,
     bara parea scoasa din alta paleta — mai vie si mai grea decat restul paginii. Un singur
     albastru, folosit peste tot, se aseaza. Albul pe el sta la ~11:1, deci peste pragul AA. */
  --gradient-sidebar: #033A89;

  /* Surfaces */
  --bg:             #EEF5FF;
  --surface:        #FFFFFF;
  --surface-2:      #E4EFFD;
  --surface-glass:  rgba(255,255,255,.75);

  /* Lines */
  --line:      #BDD5F5;
  --line-soft: #D5E8FA;

  /* Text */
  --ink:      #0A1628;
  --ink-soft: #2D4875;
  --muted:    #607EA5;

  /* Semantic primary (navy) */
  --primary:       #033A89;
  --primary-hover: #0448A8;
  --primary-ink:   #FFFFFF;

  /* Semantic accent (sky) */
  --accent:       #2588E7;
  --accent-hover: #1a7AD8;
  --accent-light: #AED9F8;
  --accent-ink:   #FFFFFF;

  /* Status */
  --success:       #0B6E35;
  --success-light: #D1FAE5;
  --danger:        #BE1530;
  --danger-light:  #FFE4E8;
  --warn:          #A05C14;
  --warning-light: #FEF3C7;

  /* Typography */
  --font-sans:  'Inter', 'Helvetica Neue', Arial, sans-serif;
  --font-serif: 'Inter', 'Helvetica Neue', Arial, sans-serif;
  --font-mono:  'JetBrains Mono', 'Fira Code', ui-monospace, monospace;

  /* Radius */
  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 18px;
  --radius-xl: 24px;

  /* Shadows */
  --shadow-xs: 0 1px 3px rgba(3,58,137,.07);
  --shadow-sm: 0 2px 8px rgba(3,58,137,.09);
  --shadow:    0 4px 20px rgba(3,58,137,.11), 0 1px 4px rgba(3,58,137,.06);
  --shadow-md: 0 8px 32px rgba(3,58,137,.14), 0 2px 8px rgba(3,58,137,.07);
  --shadow-lg: 0 16px 56px rgba(3,58,137,.18), 0 4px 16px rgba(3,58,137,.09);
  --shadow-btn: 0 4px 14px rgba(3,58,137,.32);
  --shadow-btn-hover: 0 6px 24px rgba(3,58,137,.48);
  --shadow-glow: 0 0 0 3px rgba(37,136,231,.22), 0 4px 20px rgba(37,136,231,.28);

  /* Sidebar */
  --sidebar-width: 250px;
}

/* ─── Dark Theme ─────────────────────────────────────────────── */
/* Tema întunecată, pe nuanțele paginii de autentificare (DESC).
   De ce: tema aleasă la login e tema cu care intri în platformă, deci albastrul trebuie să fie
   ACELAȘI albastru — înainte, login-ul era într-un bleumarin cald (#021A48 / #08235C) și
   aplicația într-unul aproape negru (#060F1E), iar trecerea de la o pagină la alta se vedea.
   Valorile de mai jos sunt chiar cele din paleta paginii de login:
     #021A48  fundalul de bază („brand.deep")
     #08235C  suprafața cardurilor („brand.cardDark")
     #062A6E  spălarea dintre ele, pentru panouri și benzi
   Se schimbă doar jetoanele, nu regulile: fiecare pagină care le folosește se mută odată cu ele. */
html[data-theme="dark"] {
  /* Bleumarin adânc: la jumătatea drumului între albastrul aproape negru de dinainte
     (#060F1E — totul se citea, dar nu semăna cu pagina de autentificare) și albastrul
     deschis al acesteia (#021A48 — semăna, dar suprafețele se apropiaseră prea mult
     între ele). Rămâne familia paginii de login, doar coborâtă în adâncime. */
  --bg:           #04122F;
  --surface:      #071B44;
  --surface-2:    #0A2255;
  --surface-glass:rgba(7,27,68,.84);
  --line:         #17407F;
  --line-soft:    #112F60;
  --ink:          #EAF2FF;
  --ink-soft:     #9FC0EA;
  --muted:        #7593BE;

  /* ATENȚIE — de ce se redefinesc și jetoanele de brand aici:
     `--primary` (#033A89) e un albastru ÎNCHIS, gândit ca text pe suprafețe albe. Pe întuneric,
     butoanele umplute cu linia temei („Deschide", „Vezi analiza globală", „Ghid de semnare")
     ajungeau text închis pe fundal albastru mediu — practic ilizibile. Pe dark, aceleași
     jetoane urcă în luminozitate: rolul lor rămâne („accentul" și „brandul"), dar acum se
     citesc pe fundal închis. `--accent` urcă doar puțin, ca liniile și conturile să nu țipe. */
  --primary:      #9DC4F5;
  /* Perechea lui: unde `--primary` e FUNDAL, textul de pe el trebuie să fie închis acum, nu alb
     (3 locuri: antetul de șablon, formularul de șablon, profilul). Așa, ambele folosiri rămân
     lizibile: `--primary` ca text pe întuneric, și `--primary` ca fundal cu text închis. */
  --primary-ink:  #06183C;

  /* Bara laterală pe întuneric: rămâne în familia paginii, doar cu un rest de urcare de sus în
     jos, cât să nu fie o suprafață plată. Nu mai are voie să urce la albastru aprins — lângă
     un fundal de #04122F asta o făcea să pară lipită dintr-o altă temă. Separarea de pagină o
     face muchia fină din dreapta (`--line-soft`), nu diferența de luminozitate. */
  /* Tot o singura nuanta, cu un pas peste fundalul paginii (#04122F): bara se citeste ca o
     suprafata a temei, nu ca o banda lipita din alta parte. Albul de pe ea sta la 15:1. */
  --gradient-sidebar: #08214C;
  /* `--accent` NU se atinge: e folosit ca FUNDAL pentru butoanele principale, cu text alb peste
     el (23 de locuri, `.btn.accent` și rudele). Luminat, textul alb de pe ele ar deveni ilizibil.
     Rămâne #2588e7 din tema deschisă, care e bun în ambele: și pe alb, și pe bleumarin. */
  --shadow-xs:    0 1px 3px rgba(0,0,0,.3);
  --shadow-sm:    0 2px 8px rgba(0,0,0,.4);
  --shadow:       0 4px 20px rgba(0,0,0,.5), 0 1px 4px rgba(0,0,0,.25);
  --shadow-md:    0 8px 32px rgba(0,0,0,.6), 0 2px 8px rgba(0,0,0,.3);
  --shadow-lg:    0 16px 56px rgba(0,0,0,.7), 0 4px 16px rgba(0,0,0,.35);
}

/* Fundalul temei întunecate respiră ca pe pagina de autentificare: un halou albastru cald în
   mijloc, peste un gradient vertical — nu o culoare plată.
   ATENȚIE la cum e prins: `background-attachment: fixed` pe <body> obligă browserul să
   REPICTEZE tot gradientul la fiecare cadru de derulare — pe pagini lungi se simte ca o
   platformă greoaie. Același efect vizual se obține cu un strat propriu, poziționat `fixed`,
   pe care browserul îl desenează o dată și apoi doar îl compune. */
html[data-theme="dark"] body { background: #04122F; }

html[data-theme="dark"] body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 42%,
      rgba(22, 78, 156, .20) 0%,
      rgba(12, 55, 122, .11) 28%,
      rgba(5, 38, 91, .04) 50%,
      transparent 70%),
    linear-gradient(180deg, #04122F 0%, #061838 48%, #04122F 100%);
}

/* ─── Base ───────────────────────────────────────────────────── */
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ─── Shell / Layout ─────────────────────────────────────────── */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
}

/* ─── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  background: var(--gradient-sidebar);
  /* O muchie fină la dreapta. Pe tema deschisă bara se distinge singură, prin contrast; pe
     întuneric, unde stă în aceeași familie cu pagina, muchia e singurul lucru care o separă.
     Culoarea vine din jetonul temei, deci se potrivește în ambele. */
  border-right: 1px solid var(--line-soft);
  width: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.sidebar::-webkit-scrollbar {
  display: none;
}

/* Brand */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}

.brand-mark {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: var(--gradient-brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -.04em;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(37,136,231,.4);
}

.brand-text { display: flex; flex-direction: column; gap: 1px; }

.brand-name {
  font-size: 14.5px;
  font-weight: 700;
  color: #FFFFFF;
  letter-spacing: -.02em;
}

.brand-sub {
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(174,217,248,.65);
}

/* Nav */
.nav-section-heading {
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: rgba(255,255,255,.32);
  padding: 20px 20px 8px;
  flex-shrink: 0;
}

.nav-section-heading-sub {
  padding: 14px 12px 8px;
  margin-top: 6px;
  border-top: 1px solid rgba(255,255,255,.08);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 10px;
  flex-shrink: 0;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: rgba(255,255,255,.68);
  font-size: 13.5px;
  font-weight: 450;
  text-decoration: none;
  transition: background .15s, color .15s;
  border: 1px solid transparent;
  letter-spacing: -.01em;
}

.sidebar-nav a svg {
  flex-shrink: 0;
  opacity: .7;
  transition: opacity .15s;
}

.sidebar-nav a:hover {
  background: rgba(255,255,255,.09);
  color: #FFFFFF;
  border-color: rgba(255,255,255,.06);
}
.sidebar-nav a:hover svg { opacity: 1; }

.sidebar-nav a.active {
  background: rgba(37,136,231,.22);
  color: #FFFFFF;
  font-weight: 600;
  border-color: rgba(37,136,231,.35);
  box-shadow: inset 3px 0 0 #2588E7, 0 2px 8px rgba(37,136,231,.15);
}
.sidebar-nav a.active svg { opacity: 1; }

.sidebar-spacer { flex: 1; }

/* Footer */
.sidebar-footer {
  padding: 12px 10px 20px;
  border-top: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.08);
  margin-bottom: 8px;
}

.user-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--gradient-brand);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(37,136,231,.35);
}

.user-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.user-name {
  font-size: 12.5px;
  font-weight: 600;
  color: rgba(255,255,255,.9);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-role {
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--brand-light);
  opacity: .75;
}

.theme-toggle {
  background: none;
  border: none;
  color: rgba(255,255,255,.5);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: color .15s, background .15s;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.theme-toggle:hover { color: rgba(255,255,255,.85); background: rgba(255,255,255,.1); }

/* ─── Main ───────────────────────────────────────────────────── */
.main {
  grid-column: 2;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* ─── Page Header ────────────────────────────────────────────── */
.page-header {
  padding: 36px 44px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--line-soft);
  position: relative;
}

.page-header::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--gradient-brand);
}

.page-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.page-eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--accent);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-title {
  font-size: clamp(22px, 2.8vw, 30px);
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -.025em;
  line-height: 1.2;
  margin: 0 0 6px;
}

.page-title em {
  font-style: italic;
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  padding-right: 0.12em;
}

.page-subtitle {
  font-size: 13.5px;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* ─── Page Body ──────────────────────────────────────────────── */
.page-body {
  padding: 32px 44px 60px;
  flex: 1;
}

/* ─── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s, transform .2s, border-color .2s;
  margin-bottom: 20px;
}

.card.hover:hover, a.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--line);
}

/* Glass card variant */
.card.glass {
  background: var(--surface-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,.55);
}

/* Gradient accent top border */
.card.accent-top {
  border-top: 3px solid transparent;
  background-clip: padding-box;
  position: relative;
}
.card.accent-top::before {
  content: '';
  position: absolute;
  top: -1px; left: 0; right: 0;
  height: 3px;
  background: var(--gradient-brand);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

/* Stat card */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  box-shadow: var(--shadow-xs);
  transition: box-shadow .2s, transform .2s;
  position: relative;
  overflow: hidden;
}
.stat-card::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 120px; height: 120px;
  background: var(--gradient-brand);
  opacity: .04;
  border-radius: 50%;
  transform: translate(40px, -40px);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.stat-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  margin-bottom: 10px;
}

.stat-value {
  font-size: 36px;
  font-weight: 800;
  line-height: 1;
  background: var(--gradient-btn);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -.03em;
  margin-bottom: 4px;
}

.stat-sub {
  font-size: 12px;
  color: var(--muted);
}

/* Stat grid container */
.stats {
  display: grid;
  gap: 18px;
}

/* Aliases used by dashboard templates */
.stat-eyebrow {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  margin-bottom: 10px;
}

.stat-number {
  font-size: 42px;
  font-weight: 800;
  line-height: 1;
  background: var(--gradient-btn);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -.04em;
  margin: 8px 0 6px;
}

.stat-number.stat-warning {
  background: none;
  -webkit-text-fill-color: var(--warn);
  color: var(--warn);
}

.stat-number.stat-success {
  background: none;
  -webkit-text-fill-color: var(--success);
  color: var(--success);
}

/* ─── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: background .18s, box-shadow .18s, transform .15s, border-color .18s;
  border: 1.5px solid transparent;
  white-space: nowrap;
  text-decoration: none;
  letter-spacing: -.01em;
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--shadow-glow);
}

/* Primary — gradient */
.btn.primary {
  background: var(--gradient-btn);
  color: #FFFFFF;
  border-color: transparent;
  box-shadow: var(--shadow-btn);
}
.btn.primary:hover {
  background: var(--gradient-btn-hover);
  box-shadow: var(--shadow-btn-hover);
  transform: translateY(-1px);
  color: #FFFFFF;
}
.btn.primary:active { transform: translateY(0); box-shadow: var(--shadow-btn); }

/* Ghost */
.btn.ghost {
  background: transparent;
  color: var(--ink-soft);
  border-color: var(--line);
}
.btn.ghost:hover {
  background: var(--surface-2);
  border-color: var(--brand-sky);
  color: var(--brand-sky);
}

/* Secondary */
.btn.secondary {
  background: var(--surface-2);
  color: var(--brand-navy);
  border-color: var(--line);
}
.btn.secondary:hover {
  background: var(--accent-light);
  border-color: var(--brand-sky);
}

/* Danger */
.btn.danger {
  background: linear-gradient(135deg, #be1530, #e02442);
  color: #FFFFFF;
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(190,21,48,.3);
}
.btn.danger:hover {
  background: linear-gradient(135deg, #d01830, #f02848);
  box-shadow: 0 6px 20px rgba(190,21,48,.45);
  transform: translateY(-1px);
}

/* Success */
.btn.success {
  background: linear-gradient(135deg, #0B6E35, #16a34a);
  color: #FFFFFF;
  border-color: transparent;
}
.btn.success:hover { background: linear-gradient(135deg, #0e7d3c, #18b854); }

/* Accent */
.btn.accent {
  background: var(--accent);
  color: #FFFFFF;
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(37,136,231,.3);
}
.btn.accent:hover { background: var(--accent-hover); box-shadow: 0 6px 20px rgba(37,136,231,.45); transform: translateY(-1px); }

/* Light / soft */
.btn.light {
  background: var(--surface);
  color: var(--ink-soft);
  border-color: var(--line);
}
.btn.light:hover {
  background: var(--surface-2);
  border-color: var(--brand-sky);
  color: var(--brand-sky);
}

/* Warning */
.btn.warning {
  background: linear-gradient(135deg, #A05C14, #d97706);
  color: #FFFFFF;
  border-color: transparent;
}

/* Sizes */
.btn.sm  { padding: 7px 13px; font-size: 12.5px; border-radius: 8px; gap: 5px; }
.btn.lg  { padding: 13px 26px; font-size: 15px; border-radius: 12px; }
.btn.xl  { padding: 16px 32px; font-size: 16px; font-weight: 700; border-radius: 14px; }

/* Sidebar logout button */
.sidebar-footer .btn.ghost {
  border-color: rgba(255,255,255,.15);
  color: rgba(255,255,255,.65);
  background: transparent;
  font-size: 12.5px;
}
.sidebar-footer .btn.ghost:hover {
  background: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.25);
  color: rgba(255,255,255,.9);
}

/* ─── Alerts ─────────────────────────────────────────────────── */
.alert {
  padding: 13px 16px;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid;
  margin-bottom: 14px;
}

.alert.success { background: var(--success-light); color: var(--success); border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.alert.error   { background: var(--danger-light);  color: var(--danger);  border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.alert.warning { background: var(--warning-light); color: var(--warn);    border-color: color-mix(in srgb, var(--warn) 30%, transparent); }

/* ─── Badges ─────────────────────────────────────────────────── */
.badge, .tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 6px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: var(--surface-2);
  white-space: nowrap;
}

.badge.dot::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: .8;
  flex-shrink: 0;
}

/* Status variants */
.badge.draft             { color: var(--muted);    background: var(--surface-2);    border-color: var(--line); }
.badge.pdf-generated     { color: #1d4ed8;          background: #dbeafe;             border-color: #93c5fd; }
.badge.waiting-signature { color: var(--warn);      background: var(--warning-light); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.badge.partially-signed  { color: #9a3412;          background: #ffedd5;             border-color: #fdba74; }
.badge.fully-signed      { color: var(--success);   background: var(--success-light); border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.badge.completed         { color: var(--success);   background: var(--success-light); border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.badge.archived          { color: var(--muted);     background: var(--surface-2);    border-color: var(--line); }
.badge.pending-sig       { color: var(--ink-soft);  background: var(--surface-2);    border-color: var(--line); }
/* Semnătura unui pas — clase proprii, ca textul scris în șablon să nu fie rescris de
   etichetele globale de stare (vezi layout.html). */
.badge.sig-yes           { color: var(--success);   background: var(--success-light); border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.badge.sig-no            { color: var(--ink-soft);  background: var(--surface-2);    border-color: var(--line); }
.badge.cancelled         { color: #92400e;          background: #fef3c7;             border-color: #fcd34d; }
.badge.rejected          { color: #991b1b;          background: #fee2e2;             border-color: #fca5a5; }
.badge.pending-admin-fields { color: #1d4ed8;       background: #dbeafe;             border-color: #93c5fd; }
.badge.signature-verification-failed { color: #991b1b; background: #fee2e2;          border-color: #fca5a5; }

.badge.active   { color: var(--success); background: var(--success-light); border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.badge.disabled { color: var(--danger);  background: var(--danger-light);  border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.badge.locked   { color: var(--warn);    background: var(--warning-light); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.badge.eligible { color: #fff;           background: var(--gradient-btn);  border-color: transparent; }

.badge.user  { color: var(--brand-navy);  background: color-mix(in srgb, var(--brand-sky) 12%, white); border-color: var(--accent-light); }
.badge.admin { color: #fff;               background: var(--gradient-btn);  border-color: transparent; }

/* ─── Tables ─────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; }

th, td {
  padding: 12px 20px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: middle;
}

th {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: color-mix(in srgb, var(--brand-light) 15%, var(--surface)); cursor: default; }

.empty-row, td.empty {
  text-align: center;
  color: var(--muted);
  padding: 46px;
  font-size: 13.5px;
}

/* ─── Forms ──────────────────────────────────────────────────── */
.form { max-width: 1250px; }

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
  font-size: 12px;
  color: var(--ink-soft);
  /*margin-bottom: 14px;*/
  letter-spacing: .005em;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="range"]):not([type="image"]),
textarea, select {
  width: 100%;
  padding: 5px 10px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 13.5px;
  transition: border-color .18s, box-shadow .18s;
  outline: none;
  appearance: none;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="range"]):not([type="image"]):focus,
textarea:focus, select:focus {
  border-color: var(--brand-sky);
  box-shadow: 0 0 0 3px rgba(37,136,231,.18);
}

input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }

textarea { min-height: 88px; resize: vertical; }

select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6'><path fill='rgba(96,126,165,.8)' d='M0 0h10L5 6z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 34px;
  cursor: pointer;
}

input:disabled, select:disabled, textarea:disabled {
  background: var(--surface-2);
  color: var(--muted);
  cursor: not-allowed;
  opacity: .7;
}

/* ─── Field rows (template-builder.js) ─────────────────────── */
.field-row, .condition-row {
  display: grid;
  grid-template-columns: 1.1fr .85fr 1.1fr .6fr auto;
  gap: 10px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: var(--surface);
  margin-bottom: 10px;
  transition: border-color .15s, box-shadow .15s;
}
.field-row:hover, .condition-row:hover {
  border-color: var(--brand-sky);
  box-shadow: 0 0 0 3px rgba(37,136,231,.08);
}

.rule-set {
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  background: var(--surface);
  margin-bottom: 14px;
  transition: border-color .15s;
}
.rule-set:hover { border-color: var(--brand-sky); }

.inline-check {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
}
.inline-check input { width: auto; }

.sticky-actions {
  position: sticky;
  bottom: 16px;
  background: color-mix(in srgb, var(--bg) 95%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  justify-content: flex-end;
  box-shadow: var(--shadow-md);
}

/* ─── Form sections ──────────────────────────────────────────── */
.form-section {
  padding: 22px 0;
  border-bottom: 1px solid var(--line-soft);
}
.form-section:first-child { padding-top: 0; }
.form-section:last-of-type { border-bottom: none; padding-bottom: 0; }

.form-section-title {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  margin: 0 0 16px;
}

.form-section-hint {
  font-size: 12.5px;
  color: var(--muted);
  margin: -8px 0 16px;
  line-height: 1.55;
}

/* Form actions row */
.actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 22px;
  border-top: 1px solid var(--line-soft);
  margin-top: 4px;
}

/* ─── Grid helpers ───────────────────────────────────────────── */
.grid.two   { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid.three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.mini-card { margin-bottom: 0; }
.mini-card h3 { font-weight: 700; font-size: 18px; margin: 10px 0 6px; letter-spacing: -.02em; }
.mini-card p  { color: var(--ink-soft); font-size: 13px; min-height: 38px; margin: 0 0 16px; }

/* ─── Steps / Signature workflow ─────────────────────────────── */
.steps { display: flex; flex-direction: column; gap: 10px; }

.step { display: flex; gap: 14px; align-items: flex-start; }

.step-num {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--gradient-btn);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 11px;
  flex-shrink: 0;
  margin-top: 3px;
  box-shadow: 0 2px 8px rgba(3,58,137,.3);
}

.step.signed  .step-num { background: linear-gradient(135deg, #0B6E35, #16a34a); box-shadow: 0 2px 8px rgba(11,110,53,.3); }
.step.pending .step-num { background: var(--surface-2); color: var(--muted); border: 1.5px solid var(--line); box-shadow: none; }

.step-body {
  flex: 1;
  padding: 12px 16px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color .15s;
}
.step-body:hover { border-color: var(--line); }

.step-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.step-header strong { font-size: 13.5px; font-weight: 600; }

.step-meta {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
  align-items: center;
}
.step-meta code {
  font-family: var(--font-mono);
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--accent);
  font-size: 11px;
}

/* ─── Key-value grid ─────────────────────────────────────────── */
.kv-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 22px;
  align-items: start;
}

.kv-key {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--muted);
  white-space: nowrap;
  padding-top: 2px;
}

.kv-value { font-size: 13.5px; word-break: break-word; }

/* ─── Condition chips ────────────────────────────────────────── */
.condition-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.condition-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  background: color-mix(in srgb, var(--brand-sky) 8%, var(--surface));
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12.5px;
}

.condition-chip code {
  font-family: var(--font-mono);
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
  color: var(--accent);
}

.rule-set-display {
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  background: var(--surface);
  margin-bottom: 12px;
  transition: border-color .15s;
}
.rule-set-display:hover { border-color: var(--line); }

.rule-set-name {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--muted);
  margin-bottom: 10px;
}

/* ─── File entries ───────────────────────────────────────────── */
.file-entry {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.file-entry input[type="file"] {
  flex: 1; border: none; padding: 0;
  background: none; box-shadow: none; font-size: 13px;
}

/* ─── Global file picker (consistent everywhere a file can be uploaded/chosen) ──
   Auto-applied by layout.html's enhanceFileInputs() to every <input type="file">
   on any page — no per-page markup needed. Click-to-browse only, no drag-and-drop.
   This IS the visual "frame" — it doesn't depend on a page also having its own
   .file-entry wrapper, so it looks identical everywhere it's used. */
.file-input-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
  padding: 6px 10px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.file-input-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: border-color .12s, background .12s;
}
.file-input-btn:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
.file-input-filename {
  font-size: 12.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.file-input-filename.chosen { color: var(--ink); }

/* ─── Action links ───────────────────────────────────────────── */
.action {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  border-radius: var(--radius);
  border: 1.5px solid var(--line);
  background: var(--surface);
  font-weight: 500;
  font-size: 13.5px;
  margin-bottom: 8px;
  transition: background .15s, border-color .15s, box-shadow .15s;
  color: var(--ink);
  text-decoration: none;
}
.action:hover {
  background: color-mix(in srgb, var(--brand-sky) 6%, var(--surface));
  border-color: var(--brand-sky);
  box-shadow: var(--shadow-sm);
  color: var(--ink);
}

/* ─── Progress bar ───────────────────────────────────────────── */
.progress-bar-wrap {
  height: 6px;
  background: var(--surface-2);
  border-radius: 99px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--gradient-btn);
  border-radius: 99px;
  transition: width .5s cubic-bezier(.25,.8,.25,1);
}

/* ─── Template builder specifics ─────────────────────────────── */
.tb-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 24px;
  align-items: start;
}

.tb-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 84px;
}

.tb-section-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--accent);
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
}

.tb-tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.tb-tab {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 20px; background: transparent; border: none;
  border-bottom: 2px solid transparent;
  color: var(--ink-soft); font-family: var(--font-sans);
  font-size: 13.5px; font-weight: 400; cursor: pointer;
  margin-bottom: -1px; white-space: nowrap;
  transition: color .15s;
}
.tb-tab.active { border-bottom-color: var(--brand-sky); color: var(--ink); font-weight: 600; }
.tb-tab:hover:not(.active) { color: var(--brand-sky); }
.tb-tab-count { font-family: var(--font-mono); font-size: 10px; color: var(--muted); }

.tb-panel { padding: 24px; }
.tb-panel.hidden { display: none; }

.tb-panel-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px;
}

.tb-panel-title { font-weight: 700; font-size: 17px; margin: 0; letter-spacing: -.02em; }

.tb-sidebar label { margin-bottom: 12px; }
.tb-sidebar label:last-of-type { margin-bottom: 0; }

/* Template form field rows */
.field-row {
  position: relative;
  display: flex; flex-direction: column; gap: 12px;
  border: 1.5px solid var(--line); border-radius: var(--radius);
  padding: 16px 50px 16px 16px;
  margin-bottom: 12px; background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
.field-row:hover { border-color: var(--brand-sky); box-shadow: 0 0 0 3px rgba(37,136,231,.07); }
.field-remove-btn { position: absolute; top: 12px; right: 12px; }
.field-row-top { display: grid; grid-template-columns: 1fr auto 1fr 1fr auto; gap: 10px; align-items: end; }

/* PDF mappings */
.pdf-mappings { background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: 8px; padding: 12px 14px; }
.pdf-mappings-label { font-family: var(--font-mono); font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: var(--accent); margin-bottom: 8px; display: block; }
.pdf-mapping-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.pdf-mapping-item { display: flex; gap: 8px; align-items: center; }
.pdf-mapping-item select { flex: 1; margin: 0; font-size: 13px; }

/* Icon button */
.btn-icon {
  width: 28px; height: 28px; border-radius: 7px; border: 1.5px solid var(--line);
  background: var(--surface); color: var(--muted); display: inline-flex;
  align-items: center; justify-content: center; cursor: pointer; font-size: 12px;
  flex-shrink: 0; transition: background .12s, color .12s, border-color .12s; padding: 0; line-height: 1;
}
.btn-icon:hover {
  background: color-mix(in srgb, var(--danger) 10%, var(--surface));
  border-color: color-mix(in srgb, var(--danger) 40%, var(--line));
  color: var(--danger);
}

.rule-set-top { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.rule-set-top input { flex: 1; margin: 0; }

.fi { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.fi-label { font-family: var(--font-mono); font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); white-space: nowrap; }
.fi input, .fi select { margin: 0; }

.condition-row { display: grid; grid-template-columns: 1fr 110px 1fr 1fr 28px; gap: 8px; align-items: end; margin-bottom: 8px; }

.signature-step-row:hover { border-color: var(--brand-sky); box-shadow: 0 0 0 3px rgba(37,136,231,.07); }

/* JSON preview */
#jsonPreview {
  background: var(--gradient-deep);
  color: rgba(174,217,248,.85);
  border-radius: var(--radius);
  padding: 18px 22px; font-size: 12px;
  max-height: 340px; overflow: auto; margin: 0;
  line-height: 1.65; font-family: var(--font-mono);
  border: 1px solid rgba(37,136,231,.3);
}

.empty-hint {
  text-align: center; color: var(--muted); font-size: 13.5px; padding: 28px 16px;
  border: 1.5px dashed var(--line); border-radius: var(--radius);
}

details.json-preview-card > summary {
  padding: 14px 22px; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid transparent;
  font-size: 13px; font-weight: 600; color: var(--ink-soft);
  list-style: none; user-select: none;
}
details.json-preview-card[open] > summary { border-bottom-color: var(--line-soft); }
details.json-preview-card > summary::-webkit-details-marker { display: none; }
.json-preview-card-body { padding: 18px 22px; }

/* ─── Contract details specifics ──────────────────────────────── */
.cd-tabs {
  display: flex; border-bottom: 1px solid var(--line); margin-bottom: 24px; overflow-x: auto;
}
.cd-tab {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 18px; background: transparent; border: none;
  border-bottom: 2px solid transparent;
  color: var(--ink-soft); font-family: var(--font-sans);
  font-size: 13.5px; font-weight: 400; cursor: pointer;
  margin-bottom: -1px; white-space: nowrap;
  transition: color .15s;
}
.cd-tab.active { border-bottom-color: var(--brand-sky); color: var(--ink); font-weight: 600; }
.cd-tab:hover:not(.active) { color: var(--brand-sky); }
.cd-tab-count { font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); }
.cd-panel { display: none; }
.cd-panel.active { display: block; }

.cd-overview { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; align-items: start; }

.doc-preview-header {
  padding: 14px 20px; border-bottom: 1px solid var(--line-soft);
  display: flex; justify-content: space-between; align-items: center;
  background: var(--surface-2);
}
.doc-preview-body { padding: 28px; background: var(--surface-2); min-height: 480px; }
.doc-paper {
  background: white; color: #1a1a1a;
  padding: 56px 52px; border-radius: 8px;
  box-shadow: 0 8px 30px rgba(3,58,137,.12), 0 1px 3px rgba(0,0,0,.05);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 11.5px; line-height: 1.7; max-width: 560px; margin: 0 auto;
}
.doc-paper-hd {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 28px; padding-bottom: 14px; border-bottom: 1px solid #d4d4d4;
}
.doc-paper-title { font-family: Georgia,serif; font-weight: 400; font-size: 20px; text-align: center; margin: 0 0 6px; letter-spacing: .02em; }
.doc-paper-code  { text-align: center; font-size: 10px; color: #888; margin-bottom: 22px; font-style: italic; }
.doc-paper-sigs  { margin-top: 32px; padding-top: 18px; border-top: 1px dashed #c8c8c8; display: grid; gap: 20px; }
.doc-sig-line { height: 44px; border-bottom: 1px solid #888; display: flex; align-items: center; justify-content: center; font-family: 'Caveat', cursive; font-size: 22px; color: #333; }
.doc-sig-line.empty { font-family: Georgia,serif; font-size: 10px; color: #bbb; font-style: italic; }
.doc-sig-role { font-size: 8px; margin-top: 5px; color: #666; font-family: ui-monospace,monospace; text-transform: uppercase; letter-spacing: .1em; text-align: center; }

.party-row {
  display: grid; grid-template-columns: auto 1fr auto;
  gap: 14px; align-items: center;
  padding: 14px 22px; border-bottom: 1px solid var(--line-soft); transition: background .13s;
}
.party-row:last-child { border-bottom: none; }
.party-row:hover { background: var(--surface-2); }
.party-avatar { width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-family: var(--font-mono); font-size: 11px; font-weight: 700; }
.party-avatar.signed  { background: linear-gradient(135deg, #0B6E35, #16a34a); color: #fff; }
.party-avatar.pending { background: var(--surface-2); border: 1.5px solid var(--line); color: var(--muted); }

.sig-timeline { display: flex; flex-direction: column; }
.sig-entry { display: flex; gap: 18px; padding-bottom: 22px; }
.sig-entry:last-child { padding-bottom: 0; }
.sig-rail { display: flex; flex-direction: column; align-items: center; flex-shrink: 0; }
.sig-bullet { width: 38px; height: 38px; border-radius: 50%; z-index: 1; display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 700; border: 1.5px solid var(--line); }
.sig-bullet.signed  { background: linear-gradient(135deg, #0B6E35, #16a34a); color: white; border-color: transparent; box-shadow: 0 2px 8px rgba(11,110,53,.3); }
.sig-bullet.pending { background: var(--surface-2); color: var(--ink-soft); }
.sig-connector { width: 1px; flex: 1; min-height: 16px; margin-top: 4px; }
.sig-connector.signed  { background: linear-gradient(180deg, #16a34a, #0B6E35); }
.sig-connector.pending { background: var(--line); }
.sig-body { flex: 1; padding-top: 6px; }
.sig-body-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 16px; font-weight: 700; margin: 0 0 10px; letter-spacing: -.02em; }
.sig-signed-card { display: grid; grid-template-columns: 80px 1fr auto; gap: 16px; align-items: center; padding: 12px 16px; border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--surface-2); font-size: 12.5px; }
.sig-cursive { height: 40px; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; justify-content: center; font-family: 'Caveat', cursive; font-size: 22px; color: var(--ink); }

/* Datele documentului, ca un tabel liniștit. Linia se pune pe RÂND, nu pe celule: cu borduri pe
   celule, o valoare pe două rânduri împingea linia din coloana a doua mai jos decât cea din
   prima -- arăta strâmb exact acolo unde omul verifică date. */
.data-kv { display: grid; max-width: 760px; }
.data-row {
  display: grid; grid-template-columns: minmax(160px, 26%) minmax(0, 1fr); gap: 0 24px;
  align-items: start; padding: 9px 0; border-bottom: 1px solid var(--line-soft);
}
.data-row:last-child { border-bottom: 0; }
.data-kv-key {
  font-family: var(--font-mono); font-size: 10px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted); padding-right: 8px; padding-top: 2px;
}
.data-kv-val { font-size: 13.5px; color: var(--ink); word-break: break-word; }
/* Datele documentului, grupate: fiecare secțiune cu titlul ei, pe două coloane la ecran lat. */
.cd-data-sections { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 26px; }
.cd-data-section { min-width: 0; }
.cd-data-title {
  font-family: var(--font-mono); font-size: 9.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .09em; color: var(--accent); margin-bottom: 12px; padding-bottom: 8px;
  border-bottom: 1px solid var(--line-soft);
}
/* Eticheta se rupe pe randul urmator cand nu incape. Cu `nowrap` nu avea voie sa se rupa, iar
   coloana ei e plafonata la 26%: o eticheta lunga iesea din casuta si se scria peste valoarea de
   alaturi, fiindca o casuta de grila nu taie ce depaseste. `anywhere` prinde si cuvantul singur
   mai lat decat coloana. */
.data-kv-key { font-size: 11.5px; font-weight: 700; color: var(--muted); padding-top: 2px; text-transform: uppercase; letter-spacing: .05em; font-family: var(--font-mono); overflow-wrap: anywhere; }
.data-kv-val { font-size: 13.5px; color: var(--ink); word-break: break-word; }

/* ─── Bilanțul utilizatorului (Contractele mele / Disponibile) ─── */
/* Bilanțul stă lipit în stânga, la vedere cât timp derulezi. Pe telefon rămâne tot acolo, ca o
   clapetă subțire pe margine, și iese ca un sertar peste conținut — nu coboară la subsolul
   paginii, unde nu s-ar mai uita nimeni. */
.mc-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 24px; align-items: start; }
.mc-side { position: sticky; top: 18px; display: grid; gap: 12px; }
.mc-main { display: flex; flex-direction: column; gap: 28px; min-width: 0; }

/* Cardul poartă tenta accentului paginii și un titlu, ca să se citească drept panou
   informativ („Ce aveți de făcut"), nu drept încă o listă de documente. */
.mc-card {
  border: 1.5px solid color-mix(in srgb, var(--accent) 24%, var(--line));
  border-radius: 14px; background: var(--surface); overflow: hidden;
  box-shadow: 0 1px 2px color-mix(in srgb, var(--accent) 10%, transparent);
}
.mc-card-head {
  padding: 14px 18px 14px; border-bottom: 1px solid color-mix(in srgb, var(--accent) 14%, var(--line-soft));
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
}
.mc-card-title {
  display: flex; align-items: center; gap: 6px; margin-bottom: 7px;
  font-family: var(--font-mono); font-size: 9.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .1em; color: var(--accent);
}
.mc-card-lead { font-size: 14px; font-weight: 600; color: var(--ink); line-height: 1.45; }
.mc-card-sub { font-size: 12px; color: var(--muted); margin-top: 5px; line-height: 1.5; }
.mc-card-foot {
  padding: 13px 18px; border-top: 1px solid var(--line-soft); display: grid; gap: 8px;
  background: color-mix(in srgb, var(--accent) 3%, var(--surface));
}
.mc-card-note { font-size: 11.5px; color: var(--muted); line-height: 1.55; }
.mc-counts { display: grid; }
.mc-count {
  display: flex; align-items: center; gap: 10px; padding: 11px 18px;
  border-bottom: 1px solid var(--line-soft); font-size: 13px; color: var(--ink);
  text-decoration: none; line-height: 1.45;
}
.mc-count .n { flex-shrink: 0; }
.mc-count:last-child { border-bottom: 0; }
.mc-count .n {
  min-width: 26px; height: 22px; padding: 0 7px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--muted);
  border: 1px solid var(--line);
}
.mc-count.hot .n { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); color: var(--accent);
                   border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.mc-count.ok .n  { background: color-mix(in srgb, #22c55e 13%, var(--surface)); color: #16a34a;
                   border-color: color-mix(in srgb, #22c55e 40%, var(--line)); }

.mc-drawer-tab { display: none; }
/* Fundalul sertarului există doar pe telefon; pe ecran lat trebuie să nu ocupe o celulă din
   grilă — altfel împinge conținutul în coloana bilanțului. */
.mc-drawer-backdrop { display: none; }

@media (max-width: 980px) {
  .mc-layout { grid-template-columns: minmax(0, 1fr); }
  /* Sertarul începe sub bara de sus (54px, z-index 200): altfel titlul cardului rămâne
     ascuns în spatele ei. Cardul își ține înălțimea lui, nu se întinde pe tot sertarul. */
  .mc-side {
    position: fixed; top: 54px; right: 0; bottom: 0; width: min(320px, 86vw); z-index: 60;
    padding: 16px; background: var(--surface); border-left: 1.5px solid var(--line);
    box-shadow: -18px 0 40px rgba(0,0,0,.14); transform: translateX(100%);
    transition: transform .22s ease; overflow-y: auto; align-content: start;
  }
  .mc-side.open { transform: translateX(0); }
  /* Clapeta stă pe margine, cu textul pe verticală -- e locul pe care omul îl caută deja. */
  .mc-drawer-tab {
    display: flex; align-items: center; gap: 8px;
    position: fixed; right: 0; top: 40%; z-index: 61;
    padding: 12px 10px; border: 1.5px solid var(--line); border-right: 0;
    border-radius: 12px 0 0 12px; background: var(--surface); color: var(--ink);
    font-size: 12px; font-weight: 600; cursor: pointer;
    writing-mode: vertical-rl; text-orientation: mixed;
    box-shadow: -8px 0 20px rgba(0,0,0,.10);
  }
  .mc-drawer-backdrop {
    display: none; position: fixed; top: 54px; left: 0; right: 0; bottom: 0; z-index: 59;
    background: rgba(15,23,42,.35);
  }
  .mc-drawer-backdrop.open { display: block; }
}

/* ─── Cardurile șabloanelor disponibile ──────────────────────── */
/* Două pe rând pe ecran lat, unul pe rând pe telefon — grila stătea în atributul style, deci
   rămânea cu două coloane înghesuite și pe ecran mic. */
.tpl-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 860px) { .tpl-grid { grid-template-columns: minmax(0, 1fr); } }

/* Sub descriere se scrie drumul documentului, în locul cifrelor „Câmpuri / Pași semnătură",
   care nu spuneau omului nimic despre ce are de făcut. */
.tpl-flow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.tpl-step {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2);
  font-size: 11px; color: var(--ink-soft); white-space: nowrap;
}
.tpl-step.mine {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
  background: color-mix(in srgb, var(--accent) 9%, var(--surface));
  color: var(--accent); font-weight: 600;
}
.tpl-step .i { font-family: var(--font-mono); font-size: 9.5px; opacity: .7; }
.tpl-arrow { color: var(--muted); font-size: 11px; }
/* Un singur rând: pașii la un capăt, butonul la celălalt. Pașii se rup între ei dacă e nevoie,
   dar butonul nu mai coboară sub ei. */
.tpl-foot { display: flex; align-items: center; justify-content: space-between; gap: 14px;
            flex-wrap: nowrap; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.tpl-foot > .tpl-flow { flex: 1 1 auto; min-width: 0; }
.tpl-foot > .btn { flex: 0 0 auto; margin-left: auto; }

/* ─── Banda „ce urmează" de pe pagina unui document ──────────── */
/* ─── Jurnalul documentului ──────────────────────────────────────────────────
   O cronologie, nu un tabel de coduri: fiecare rând spune ce s-a întâmplat, cine a făcut-o și
   când, iar punctul de pe șină are culoarea faptei (bun / în lucru / atenție / rău). */
.aud-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 18px 24px; border-bottom: 1px solid var(--line-soft);
  background: color-mix(in srgb, var(--accent) 4%, var(--surface));
}
.aud-title { font-family: var(--font-serif); font-weight: 500; font-size: 19px; margin: 0; letter-spacing: -.01em; }
.aud-sub { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.55; max-width: 62ch; }
.aud-count {
  flex-shrink: 0; font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  padding: 5px 10px; border-radius: 999px; white-space: nowrap;
}

/* Capul de coloane al jurnalului: aceleași lățimi ca rândurile de dedesubt. */
.aud-cols {
  display: grid; grid-template-columns: 26px minmax(0, 1fr) minmax(160px, 22%) 150px;
  gap: 14px; padding: 9px 24px; align-items: center;
  background: var(--surface-2); border-bottom: 1px solid var(--line-soft);
  font-family: var(--font-mono); font-size: 9.5px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.aud-list { padding: 0 24px 18px; }
.aud-empty { padding: 34px 24px; text-align: center; color: var(--muted); font-size: 13px; }

.aud-item {
  display: grid; grid-template-columns: 26px minmax(0, 1fr) minmax(160px, 22%) 150px;
  gap: 14px; align-items: start; padding: 11px 0; border-bottom: 1px solid var(--line-soft);
}
.aud-item:last-child { border-bottom: 0; }
/* Șina ține toată înălțimea rândului, detaliul inclusiv: altfel, pe rândurile în coloane, se
   strângea la înălțimea bulinei și linia dispărea. */
.aud-rail {
  position: relative; display: flex; justify-content: center;
  grid-row: 1 / -1; align-self: stretch;
}
.aud-rail::before {
  content: ''; position: absolute; top: -11px; bottom: -11px; left: 50%; width: 1.5px;
  transform: translateX(-50%); background: var(--line);
}
.aud-item:first-child .aud-rail::before { top: 6px; }
.aud-item:last-child .aud-rail::before { bottom: auto; height: 9px; }
.aud-dot {
  position: relative; z-index: 1; margin-top: 4px;
  width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0;
  background: var(--surface); border: 2.5px solid var(--muted);
  box-shadow: 0 0 0 3px var(--surface);
}
.aud-item.ok   .aud-dot { border-color: #22c55e; }
.aud-item.info .aud-dot { border-color: var(--accent); }
.aud-item.wait .aud-dot { border-color: #f59e0b; }
.aud-item.bad  .aud-dot { border-color: var(--danger, #dc2626); }

.aud-what { font-size: 13.5px; font-weight: 600; color: var(--ink); min-width: 0; word-break: break-word; }
.aud-who { font-size: 12.5px; color: var(--ink-soft); min-width: 0; word-break: break-all; }
.aud-when { font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); white-space: nowrap; }
/* Detaliul curge pe toată lățimea, sub rândul lui, ca să nu strâmbe coloanele. */
.aud-detail-cell { grid-column: 2 / -1; }
.aud-detail {
  margin-top: 7px; padding: 8px 11px; border-radius: 9px;
  background: var(--surface-2); border: 1px solid var(--line-soft);
  font-size: 12px; color: var(--ink-soft); line-height: 1.6; word-break: break-word;
}

/* Pe ecran mic coloanele se strâng una sub alta, cu șina la locul ei. */
@media (max-width: 900px) {
  .aud-cols { display: none; }
  .aud-item { grid-template-columns: 26px minmax(0, 1fr); }
  .aud-who, .aud-when, .aud-detail-cell { grid-column: 2 / -1; }
}

/* Nota din schița de document: spune ce va fi în locul ei. */
.doc-paper-note {
  margin-top: 26px; padding: 12px 14px; border-radius: 10px;
  border: 1px dashed color-mix(in srgb, var(--accent) 40%, var(--line));
  background: color-mix(in srgb, var(--accent) 5%, #fff);
  font-size: 10.5px; line-height: 1.6; color: #555; text-align: left;
}
.doc-paper-note strong { color: #333; }

/* ─── Fișierul deschis alături, cu linie de legătură ─────────────────────────
   Cine verifică datele are nevoie de fișier și de date în același timp, deci fișierul nu pleacă
   într-o pagină nouă: iese lateral, lângă rândul apăsat, legat de el cu o linie care se trage ca
   la o prezentare. Se retrage la Esc, la „×" sau la un click în afara lui. */
.peek-layer { position: fixed; inset: 0; z-index: 8000; pointer-events: none; }

.peek-link { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.peek-link path {
  stroke: color-mix(in srgb, var(--accent) 70%, transparent);
  stroke-width: 1.8; stroke-linecap: round;
  stroke-dasharray: 1; stroke-dashoffset: 1;
  transition: stroke-dashoffset .3s cubic-bezier(.2, .8, .2, 1) .05s;
}
.peek-layer.open .peek-link path { stroke-dashoffset: 0; }
/* Capătul dinspre rând: un punct mic, ca legătura să înceapă de undeva, nu din aer. */
.peek-link circle { fill: var(--accent); opacity: 0; transition: opacity .2s ease .12s; }
.peek-layer.open .peek-link circle { opacity: 1; }

.peek-card {
  position: fixed; width: min(540px, 42vw); max-height: min(82vh, 780px);
  display: flex; flex-direction: column; overflow: hidden;
  border-radius: 16px; background: var(--surface);
  border: 1.5px solid color-mix(in srgb, var(--accent) 26%, var(--line));
  box-shadow: 0 24px 60px rgba(15, 23, 42, .22), 0 2px 6px rgba(15, 23, 42, .08);
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .28s cubic-bezier(.2, .8, .2, 1);
}
/* Poziția orizontală o pune scriptul, lângă rândul apăsat; aici rămâne doar mișcarea. */
.peek-layer.right .peek-card { transform: translateX(26px) scale(.97); transform-origin: left center; }
.peek-layer.left  .peek-card { transform: translateX(-26px) scale(.97); transform-origin: right center; }
.peek-layer.open .peek-card { opacity: 1; pointer-events: auto; transform: translateX(0) scale(1); }

.peek-head {
  display: flex; align-items: center; gap: 8px; padding: 11px 12px 11px 14px;
  border-bottom: 1px solid var(--line-soft);
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
}
.peek-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.peek-title {
  flex: 1; min-width: 0; font-size: 12.5px; font-weight: 600; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.peek-full, .peek-close {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 8px; flex-shrink: 0;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  cursor: pointer; text-decoration: none; transition: color .15s, border-color .15s, background .15s;
}
.peek-full:hover, .peek-close:hover {
  color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}

.peek-body { overflow: auto; background: #fff; min-height: 190px; }
.peek-body img { display: block; width: 100%; max-height: 66vh; object-fit: contain; }
.peek-body iframe { display: block; width: 100%; height: 60vh; border: none; }
/* Până se încarcă fișierul, corpul respiră ușor, ca să nu pară o fereastră goală. */
.peek-body:empty {
  background: linear-gradient(100deg, var(--surface-2) 30%,
              color-mix(in srgb, var(--accent) 8%, var(--surface-2)) 50%, var(--surface-2) 70%);
  background-size: 200% 100%; animation: peekWait 1.1s ease-in-out infinite;
}
@keyframes peekWait { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* Rândul din care s-a deschis rămâne însemnat, ca să se vadă legătura. */
.peek-source {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line)) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}

/* Un fișier în lista de date: buton discret, cu numele lui. */
.data-kv-file, .af-file-btn {
  display: inline-flex; align-items: center; gap: 7px; max-width: 100%;
  /* În grila de date celula întinde orice copil: fără asta, butonul devenea o bandă lată cât
     rândul, iar panoul nu mai avea loc lângă el și sărea în partea cealaltă a ecranului. */
  justify-self: start; width: fit-content;
  padding: 4px 10px; border-radius: 999px; cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
  color: var(--accent); font-size: 12.5px; font-weight: 500; text-align: left;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.data-kv-file:hover, .af-file-btn:hover {
  background: color-mix(in srgb, var(--accent) 13%, var(--surface));
  border-color: color-mix(in srgb, var(--accent) 50%, var(--line));
}
.data-kv-file span, .af-file-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Pe ecran mic panoul nu mai are loc lateral: se așază jos, ca o foaie, și linia dispare. */
@media (max-width: 860px) {
  .peek-layer .peek-link { display: none; }
  .peek-layer.right .peek-card, .peek-layer.left .peek-card {
    right: 12px; left: 12px !important; width: auto; top: auto !important; bottom: 12px;
    transform: translateY(20px) scale(.98); transform-origin: center bottom;
    max-height: 70vh;
  }
  .peek-layer.open .peek-card { transform: translateY(0) scale(1); }
}

/* Mișcarea se oprește pentru cine a cerut asta din sistem. */
@media (prefers-reduced-motion: reduce) {
  .peek-card, .peek-link path { transition: none; }
}

/* ─── Fereastra de decizie: anulare, transfer, poartă ─────────────────────────
   Aceeași greutate de decizie, deci același cadru. Stilurile stăteau într-un <style>
   din pagina documentului; de când fereastra se folosește și la alocarea camerei,
   ele trebuie să fie unde le vede orice pagină. */
.cxl-backdrop {
  display: none; position: fixed; inset: 0; z-index: 9999;
  align-items: center; justify-content: center;
  background: rgba(10, 12, 16, .55);
  backdrop-filter: blur(3px);
  animation: cxl-fade .18s ease;
}
@keyframes cxl-fade { from { opacity: 0; } to { opacity: 1; } }
.cxl-card {
  background: var(--surface); border-radius: 18px; width: 92%; max-width: 520px;
  max-height: 88vh; overflow-y: auto;
  box-shadow: 0 30px 80px rgba(0,0,0,.35), 0 2px 8px rgba(0,0,0,.12);
  animation: cxl-pop .22s cubic-bezier(.2,.9,.3,1.3);
}
@keyframes cxl-pop { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
.cxl-head {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 26px 28px 18px;
}
.cxl-head-icon {
  width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0;
  background: var(--danger-light); color: var(--danger);
  display: flex; align-items: center; justify-content: center;
}
.cxl-head h3 { margin: 0 0 4px; font-family: var(--font-serif); font-size: 20px; font-weight: 500; color: var(--ink); }
.cxl-head p { margin: 0; font-size: 13px; color: var(--ink-soft); line-height: 1.55; }
.cxl-body { padding: 4px 28px 28px; }

.cxl-label {
  font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .07em; color: var(--muted);
  margin: 18px 0 8px; display: flex; align-items: center; gap: 6px;
}
.cxl-label:first-child { margin-top: 0; }
.cxl-label .req { color: var(--danger); }

.cxl-select, .cxl-textarea {
  width: 100%; box-sizing: border-box; font-family: inherit; font-size: 13.5px;
  border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px;
  background: var(--surface); color: var(--ink); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.cxl-select:focus, .cxl-textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent); }
.cxl-textarea { resize: vertical; min-height: 84px; line-height: 1.5; margin-top: 10px; }
.cxl-textarea.invalid { border-color: var(--danger); }

.cxl-counter { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; font-size: 11px; color: var(--muted); }
.cxl-counter.ok { color: var(--success); }
.cxl-counter.bad { color: var(--danger); }

.cxl-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.cxl-choice {
  border: 1.5px solid var(--line); border-radius: 12px; padding: 14px 14px;
  cursor: pointer; transition: border-color .15s, background .15s, transform .1s;
  display: flex; flex-direction: column; gap: 4px;
}
.cxl-choice:hover { transform: translateY(-1px); }
.cxl-choice-icon { font-size: 17px; line-height: 1; }
.cxl-choice-title { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.cxl-choice-sub { font-size: 11px; color: var(--muted); line-height: 1.4; }
.cxl-choice.regen.selected { border-color: var(--success); background: color-mix(in srgb, var(--success) 7%, var(--surface)); }
.cxl-choice.terminal.selected { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 7%, var(--surface)); }

.cxl-warning {
  display: none; margin-top: 14px; padding: 12px 14px; border-radius: 10px;
  background: var(--danger-light); border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
  color: var(--danger); font-size: 12px; line-height: 1.55; gap: 10px; align-items: flex-start;
}
.cxl-warning.show { display: flex; }
.cxl-warning svg { flex-shrink: 0; margin-top: 1px; }

.cxl-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line-soft); }

/* ─── Alocarea camerei: completare în stânga, verificare în dreapta ───────────
   Administratorul de cămin dă camera uitându-se la ce a scris studentul și la copia
   de buletin. Panoul de verificare stă lipit în dreapta cât timp derulează formularul;
   pe ecran mic trece dedesubt, ca formularul să rămână primul. */
.af-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; align-items: start; }
.af-main { min-width: 0; max-width: 720px; }
/* Panoul e mai înalt decât ecranul la un contract cu multe câmpuri: se derulează în el,
   ca să nu rămână jumătate de listă neajunsă. */
.af-side { position: sticky; top: 18px; align-self: start;
           max-height: calc(100vh - 36px); overflow-y: auto; }

.af-card {
  border: 1.5px solid color-mix(in srgb, var(--accent) 22%, var(--line));
  border-radius: 14px; background: var(--surface); overflow: hidden;
  box-shadow: 0 1px 2px color-mix(in srgb, var(--accent) 10%, transparent);
}
.af-card-head {
  padding: 14px 18px; border-bottom: 1px solid color-mix(in srgb, var(--accent) 14%, var(--line-soft));
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
}
.af-card-title {
  display: flex; align-items: center; gap: 6px; margin-bottom: 5px;
  font-family: var(--font-mono); font-size: 9.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .1em; color: var(--accent);
}
.af-card-lead { font-size: 12.5px; color: var(--ink-soft); line-height: 1.5; }
.af-empty { padding: 18px; font-size: 12.5px; color: var(--muted); }

.af-section {
  padding: 11px 18px 7px; font-family: var(--font-mono); font-size: 9.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .09em; color: var(--muted);
  background: var(--surface-2); border-bottom: 1px solid var(--line-soft);
}
.af-rows { display: grid; }
.af-row {
  display: grid; grid-template-columns: 42% minmax(0, 58%); gap: 10px;
  padding: 9px 18px; border-bottom: 1px solid var(--line-soft); font-size: 12.5px;
}
.af-row:last-child { border-bottom: 0; }
.af-row-label { color: var(--muted); }
.af-row-value { color: var(--ink); font-weight: 500; word-break: break-word; }

.af-files { display: flex; flex-wrap: wrap; gap: 10px; padding: 12px 18px 0; }
.af-files:empty { display: none; padding: 0; }
.af-file {
  display: block; width: 100%; text-decoration: none; color: var(--muted); font-size: 11.5px;
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface-2);
  transition: border-color .15s, box-shadow .15s;
}
.af-file:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
                 box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 12%, transparent); }
.af-file img { display: block; width: 100%; max-height: 260px; object-fit: contain; background: #fff; }
.af-file span { display: block; padding: 7px 10px; }
.af-file.doc { display: flex; align-items: center; gap: 10px; padding: 10px 12px; color: var(--ink-soft); }
.af-file.doc span { padding: 0; }

@media (max-width: 1100px) {
  .af-layout { grid-template-columns: minmax(0, 1fr); }
  .af-main { max-width: none; }
  .af-side { position: static; }
}


/* Omul ajunge pe pagina documentului după ce semnează; de aici trebuie să afle dintr-o privire
   dacă mai are ceva de făcut și pe ce drum se întoarce. */
.next-up {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 14px 18px; border-radius: 14px;
  border: 1.5px solid color-mix(in srgb, var(--accent) 24%, var(--line));
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
}
.next-up.done {
  border-color: color-mix(in srgb, #22c55e 30%, var(--line));
  background: color-mix(in srgb, #22c55e 6%, var(--surface));
}
.next-up-mark {
  width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--line-soft));
  background: color-mix(in srgb, var(--accent) 12%, var(--surface)); color: var(--accent);
}
.next-up.done .next-up-mark {
  border-color: color-mix(in srgb, #22c55e 35%, var(--line-soft));
  background: color-mix(in srgb, #22c55e 12%, var(--surface)); color: #16a34a;
}
.next-up-text { flex: 1 1 260px; min-width: 0; font-size: 13px; line-height: 1.5; }
.next-up-text strong { display: block; color: var(--ink); }
.next-up-text span { color: var(--muted); font-size: 12px; }
.next-up > .btn { margin-left: auto; }

/* ─── Misc helpers ───────────────────────────────────────────── */
.mono    { font-family: var(--font-mono); }
.serif   { font-family: var(--font-sans); }
.muted   { color: var(--muted); }
.ink-soft { color: var(--ink-soft); }
.text-sm { font-size: 12.5px; }
.uppercase { text-transform: uppercase; letter-spacing: .1em; font-size: 10.5px; font-weight: 700; font-family: var(--font-mono); }

.empty {
  grid-column: 1 / -1;
  color: var(--muted);
  padding: 28px;
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  text-align: center;
  font-size: 13.5px;
}

pre:not([style*="display:none"]):not([style*="display: none"]):not(.data-carrier) {
  background: var(--gradient-deep);
  color: var(--brand-light);
  padding: 16px 20px;
  border-radius: var(--radius);
  overflow: auto;
  max-height: 420px;
  white-space: pre-wrap;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.65;
  border: 1px solid rgba(37,136,231,.25);
}

/* Profil page */
.profil-avatar {
  width: 80px; height: 80px; border-radius: 50%;
  background: var(--gradient-btn);
  color: #fff; font-size: 28px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-btn);
  margin-bottom: 14px;
  letter-spacing: -.03em;
}

/* ─── Error page ─────────────────────────────────────────────── */
.error-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--bg); }
.error-card { max-width: 560px; width: 100%; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); padding: 40px; }
.error-card h1 { font-size: 26px; font-weight: 700; margin-bottom: 12px; letter-spacing: -.025em; }
.error-card pre { margin: 16px 0; }

/* ─── Animations ─────────────────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes shimmer {
  from { background-position: -200% 0; }
  to   { background-position:  200% 0; }
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50%       { background-position: 100% 50%; }
}

@media (prefers-reduced-motion: no-preference) {
  .page-body > * { animation: fadeInUp .25s ease-out; }
}

/* ─── Mobile top bar ─────────────────────────────────────────── */
.mobile-topbar {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 54px;
  background: var(--surface);
  border-bottom: 1px solid var(--line-soft);
  z-index: 200;
  padding: 0 16px;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 1px 8px rgba(3,58,137,.08);
}

.mobile-menu-btn {
  width: 36px; height: 36px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.mobile-menu-btn:hover { background: var(--surface-2); color: var(--brand-navy); }

/* Mobile overlay */
.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(3,58,137,.3);
  backdrop-filter: blur(2px);
  z-index: 299;
}
.mobile-overlay.open { display: block; }

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .shell { grid-template-columns: 1fr; }
  .main { grid-column: 1; padding-top: 54px; }
  .sidebar {
    display: flex;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-width);
    z-index: 300;
    transform: translateX(-100%);
    transition: transform .25s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .mobile-topbar { display: flex; }
  .page-header { padding: 24px 24px 18px; }
  .page-body   { padding: 24px 24px 48px; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .tb-layout { grid-template-columns: 1fr; }
  .tb-sidebar { position: static; }
}

@media (max-width: 700px) {
  .page-header-row { flex-direction: column; gap: 16px; }
  .page-actions { width: 100%; }
  .grid.two   { grid-template-columns: 1fr; }
  .grid.three { grid-template-columns: 1fr; }
  .cards      { grid-template-columns: 1fr; }
  .field-row-top  { grid-template-columns: 1fr auto; }
  .condition-row  { grid-template-columns: 1fr; }
  .signature-step-row { grid-template-columns: 1fr; }
  .cd-overview { grid-template-columns: 1fr; }
  .doc-paper { padding: 28px 20px; }
  .sig-signed-card { grid-template-columns: 1fr; }
}

/* ── Cardul de dosar al utilizatorului ───────────────────────────────────────
   Fragmentul `dossier-card.html` se folosește pe „Contractele mele" ȘI pe
   „Disponibile pentru dvs."; de asta stilurile stau aici, nu într-un <style>
   din pagină — altfel a doua pagină arăta cardul nestilat. */
  .dosar-icon {
    width: 30px; height: 30px; border-radius: 8px;
    background: color-mix(in srgb, var(--accent) 10%, var(--surface));
    border: 1px solid color-mix(in srgb, var(--accent) 20%, var(--line-soft));
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  }
  .dosar-group-header {
    display: flex; align-items: center; justify-content: space-between; gap:12px;
    margin: 0 0 10px;
  }
  .dosar-group-title {
    display: flex; align-items: center; gap: 10px; min-width: 0;
  }
  .contract-entry {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 24px;
    border-bottom: 1px solid var(--line-soft);
    transition: background .12s;
  }
  .contract-entry:last-child { border-bottom: none; }
  .contract-entry:hover { background: var(--surface-2); }

  .st-chip { display:inline-block; padding:1px 8px; border-radius:999px; font-size:10.5px; font-weight:600;
             letter-spacing:.02em; border:1px solid var(--line); }
  .st-chip.st-done { color:#16a34a; border-color:color-mix(in srgb,#22c55e 45%,transparent); background:color-mix(in srgb,#22c55e 10%,var(--surface)); }
  .st-chip.st-live { color:var(--accent); border-color:color-mix(in srgb,var(--accent) 40%,transparent); background:color-mix(in srgb,var(--accent) 8%,var(--surface)); }
  .st-chip.st-off  { color:var(--muted); background:var(--surface-2); }
  .st-note { margin-left:6px; font-size:10.5px; color:var(--muted); font-style:italic; }
  .entry-status-icon {
    width: 32px; height: 32px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; font-size: 13px;
  }
  .entry-status-icon.done     { background: color-mix(in srgb, #22c55e 15%, var(--surface)); border: 1.5px solid #22c55e; color: #22c55e; }
  .entry-status-icon.pending  { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); border: 1.5px solid var(--accent); color: var(--accent); }
  /* `blank`, nu `empty`: clasa generală `.empty` e caseta „nimic aici" și-i punea 28px de
     padding, deci semnul documentului nepornit ieșea de două ori cât celelalte. */
  .entry-status-icon.blank    { background: var(--surface-2); border: 1.5px solid var(--line); color: var(--ink-soft); }
  .entry-status-icon.error    { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); border: 1.5px solid var(--danger); color: var(--danger); }

  /* Ce am eu de făcut cu documentul — rândul de sub numele lui. */
  .doc-state { font-size: 12px; margin-top: 3px; }
  .doc-state .lbl { font-weight: 600; color: var(--ink); }
  .doc-state .lbl.turn { color: var(--accent); }
  .doc-state .hint { color: var(--muted); display: block; margin-top: 2px; line-height: 1.45; }

/* În locul butonului de transfer, pe documentul care a plecat deja o dată. */
.trf-done {
  display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted);
  border: 1px dashed var(--line); border-radius: 8px; padding: 5px 10px;
}

/* Când fișierul nu se mai găsește, panoul spune de ce, nu rămâne alb. */
.peek-missing {
  margin: 0; padding: 26px 22px; text-align: center;
  font-size: 12.5px; line-height: 1.6; color: var(--muted);
}
