/* ==========================================================================
   Expertize & Evaluări — Design System
   Design tokens, temă Light/Dark, componente UI
   ========================================================================== */

/* ---------- Design tokens ---------- */
:root {
  /* Paletă de brand (Slate + accent albastru juridic) */
  --slate-50:  #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;
  --slate-950: #020617;

  --accent-400: #60a5fa;
  --accent-500: #3b82f6;
  --accent-600: #2563eb;
  --accent-700: #1d4ed8;

  --red-400: #f87171;
  --red-500: #ef4444;
  --red-600: #dc2626;
  --amber-400: #fbbf24;
  --amber-500: #f59e0b;
  --green-400: #4ade80;
  --green-500: #22c55e;
  --green-600: #16a34a;
  --violet-500: #8b5cf6;
  --teal-500: #14b8a6;

  /* Suprafețe (Light) */
  --bg:            var(--slate-100);
  --bg-subtle:     var(--slate-50);
  --surface:       #ffffff;
  --surface-2:     var(--slate-50);
  --surface-3:     var(--slate-100);
  --border:        var(--slate-200);
  --border-strong: var(--slate-300);

  /* Text (Light) */
  --text:          var(--slate-900);
  --text-muted:    var(--slate-500);
  --text-faint:    var(--slate-400);
  --text-on-accent:#ffffff;

  --accent:        var(--accent-600);
  --accent-soft:   #dbeafe;
  --accent-text:   var(--accent-700);

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, .10), 0 2px 4px rgba(15, 23, 42, .05);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, .16), 0 4px 12px rgba(15, 23, 42, .08);

  /* Forme & mișcare */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 18px;
  --r-full: 999px;

  --t-fast: 150ms cubic-bezier(.4, 0, .2, 1);
  --t-base: 220ms cubic-bezier(.4, 0, .2, 1);

  /* Dimensiuni layout */
  --sidebar-w: 244px;
  --sidebar-w-collapsed: 68px;
  --topbar-h: 60px;

  --font-ui: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-doc: "Calibri", "Carlito", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Code", ui-monospace, Consolas, monospace;
}

html[data-theme="dark"] {
  --bg:            var(--slate-950);
  --bg-subtle:     #0b1220;
  --surface:       #111a2e;
  --surface-2:     #16203a;
  --surface-3:     #1e293b;
  --border:        #24314d;
  --border-strong: #33415c;

  --text:          #e8eefb;
  --text-muted:    #9aabc7;
  --text-faint:    #6b7d9c;

  --accent:        var(--accent-500);
  --accent-soft:   rgba(59, 130, 246, .16);
  --accent-text:   var(--accent-400);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .45);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, .5);
  --shadow-lg: 0 18px 44px rgba(0, 0, 0, .6);
}

/* ---------- Reset & bază ---------- */
*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }

::selection { background: var(--accent-soft); color: var(--text); }

/* Scrollbar discret */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb {
  background: var(--border-strong); border-radius: var(--r-full);
  border: 3px solid transparent; background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--slate-400); background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* ---------- Icoane ---------- */
[data-icon] { display: inline-flex; align-items: center; justify-content: center; line-height: 0; }
[data-icon] svg { width: 100%; height: 100%; stroke-width: 1.9; }
.icon-btn > [data-icon] svg, .nav-item > [data-icon] svg { width: 18px; height: 18px; }
.icon-btn [data-icon], .nav-item [data-icon] { width: 18px; height: 18px; }

/* ---------- Boot ---------- */
.boot-screen {
  position: fixed; inset: 0; z-index: 90;
  display: grid; place-items: center;
  background: var(--bg);
}
.boot-inner { display: grid; gap: 18px; justify-items: center; }
.boot-logo {
  width: 54px; height: 54px; border-radius: var(--r-lg);
  background: linear-gradient(135deg, var(--accent-500), var(--violet-500));
  animation: pulse 1.4s ease-in-out infinite;
}
.boot-text { color: var(--text-muted); font-size: 13px; }
@keyframes pulse { 0%,100% { opacity: .55; transform: scale(.94); } 50% { opacity: 1; transform: scale(1); } }

.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  background: linear-gradient(135deg, var(--accent-500), var(--violet-500));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.22);
  position: relative;
}
.brand-mark::after {
  content: ""; position: absolute; inset: 8px;
  background: #fff; border-radius: 3px 3px 8px 8px;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 74%, 0 100%);
  opacity: .92;
}

/* ---------- Auth ---------- */
.auth-screen {
  position: fixed; inset: 0; z-index: 80;
  display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(1100px 520px at 8% -12%, var(--accent-soft), transparent 62%),
    radial-gradient(900px 480px at 104% 110%, rgba(139, 92, 246, .16), transparent 60%),
    var(--bg);
  overflow: auto;
}
.auth-card {
  width: min(430px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  padding: 28px;
  display: grid; gap: 18px;
}
.auth-brand { display: flex; align-items: center; gap: 13px; }
.auth-brand .brand-mark { width: 40px; height: 40px; border-radius: 12px; }
.auth-title { font-size: 19px; }
.auth-sub { color: var(--text-muted); font-size: 12.5px; margin-top: 2px; }

.auth-tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  background: var(--surface-3); padding: 4px; border-radius: var(--r-md);
}
.auth-tab {
  padding: 8px; border-radius: 7px; font-size: 13px; font-weight: 550;
  color: var(--text-muted); transition: var(--t-fast);
}
.auth-tab.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }

.auth-form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; }
.field > label { font-size: 12.5px; font-weight: 550; color: var(--text-muted); }
.field-hint { font-size: 11.5px; color: var(--text-faint); }

input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], input[type="time"], input[type="search"], input[type="url"], select, textarea {
  width: 100%; padding: 9px 11px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: var(--t-fast);
  font-size: 13.5px;
}
input:hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: var(--surface);
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }
textarea { resize: vertical; min-height: 84px; font-family: inherit; }
select { appearance: none; background-image: none; padding-right: 30px; }

.pwd-meter { height: 4px; border-radius: var(--r-full); background: var(--surface-3); overflow: hidden; }
.pwd-meter > span { display: block; height: 100%; width: 0; background: var(--red-500); transition: var(--t-base); }

.auth-error {
  font-size: 12.5px; color: var(--red-600); background: rgba(239,68,68,.10);
  border: 1px solid rgba(239,68,68,.28); border-radius: var(--r-md); padding: 9px 11px;
}
.auth-divider { display: flex; align-items: center; gap: 12px; color: var(--text-faint); font-size: 11.5px; }
.auth-divider::before, .auth-divider::after { content: ""; height: 1px; background: var(--border); flex: 1; }
.auth-note { font-size: 11.5px; color: var(--text-faint); text-align: center; line-height: 1.5; }
.gicon {
  display: inline-grid; place-items: center; width: 17px; height: 17px; border-radius: 50%;
  background: conic-gradient(#ea4335 0 25%, #fbbc05 25% 50%, #34a853 50% 75%, #4285f4 75% 100%);
  color: #fff; font-size: 10px; font-weight: 700; margin-right: 8px;
}

/* ---------- Butoane ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 15px; border-radius: var(--r-md); font-size: 13.5px; font-weight: 560;
  border: 1px solid transparent; transition: var(--t-fast); white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn [data-icon], .btn [data-icon] svg { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); color: var(--text-on-accent); box-shadow: var(--shadow-xs); }
.btn-primary:hover:not(:disabled) { background: var(--accent-700); }
.btn-ghost { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-3); border-color: var(--border-strong); }
.btn-outline { background: transparent; border-color: var(--border-strong); color: var(--text); }
.btn-outline:hover:not(:disabled) { background: var(--surface-2); }
.btn-danger { background: var(--red-600); color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--red-500); }
.btn-demo { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.btn-demo:hover:not(:disabled) { filter: brightness(.97); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 10px; font-size: 12.5px; border-radius: var(--r-sm); }
.btn-icon { padding: 8px; width: 34px; height: 34px; }

.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px;
  border-radius: var(--r-md); color: var(--text-muted); transition: var(--t-fast);
  background: var(--surface-2); border: 1px solid transparent; position: relative;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn.is-active { background: var(--accent-soft); color: var(--accent-text); }

/* ---------- Layout aplicație ---------- */
.app { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: var(--sidebar-w); flex: none;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  transition: width var(--t-base);
  overflow: hidden;
}
.sidebar.is-collapsed { width: var(--sidebar-w-collapsed); }
.sidebar-head {
  height: var(--topbar-h); flex: none;
  display: flex; align-items: center; gap: 11px; padding: 0 17px;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand-text { font-weight: 680; font-size: 13.5px; white-space: nowrap; }
.sidebar.is-collapsed .sidebar-brand-text { display: none; }
.sidebar.is-collapsed .sidebar-head { justify-content: center; padding: 0; }

.nav { padding: 12px 10px; display: grid; gap: 3px; align-content: start; flex: 1; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border-radius: var(--r-md);
  color: var(--text-muted); font-size: 13.5px; font-weight: 530;
  transition: var(--t-fast); text-align: left; width: 100%;
}
.nav-item span { white-space: nowrap; }
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item.is-active { background: var(--accent-soft); color: var(--accent-text); font-weight: 620; }
.sidebar.is-collapsed .nav-item { justify-content: center; padding: 10px; }
.sidebar.is-collapsed .nav-item span { display: none; }

.sidebar-foot {
  flex: none; border-top: 1px solid var(--border); padding: 12px 17px;
  display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-muted);
}
.sidebar.is-collapsed .sidebar-foot { justify-content: center; padding: 12px 0; }
.sidebar.is-collapsed .sync-label { display: none; }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green-500); flex: none; }
.sync-dot.is-offline { background: var(--amber-500); }
.sync-dot.is-error { background: var(--red-500); }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: var(--topbar-h); flex: none;
  display: flex; align-items: center; gap: 12px; padding: 0 18px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: relative; z-index: 20;
}
.omni { position: relative; flex: 1; max-width: 620px; }
.omni-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-faint); width: 16px; height: 16px; pointer-events: none; }
.omni input { padding-left: 35px; padding-right: 74px; background: var(--surface-2); }
.omni-kbd {
  position: absolute; right: 9px; top: 50%; transform: translateY(-50%);
  font-size: 10.5px; font-family: var(--font-mono); color: var(--text-faint);
  border: 1px solid var(--border); border-radius: 5px; padding: 2px 6px; background: var(--surface);
}
.topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.badge {
  position: absolute; top: -4px; right: -4px; min-width: 17px; height: 17px; padding: 0 4px;
  display: grid; place-items: center; border-radius: var(--r-full);
  background: var(--red-500); color: #fff; font-size: 10px; font-weight: 700;
  border: 2px solid var(--surface);
}

.user-chip {
  display: flex; align-items: center; gap: 9px; padding: 5px 9px 5px 5px;
  border-radius: var(--r-full); border: 1px solid var(--border); background: var(--surface-2);
  transition: var(--t-fast); cursor: pointer;
}
.user-chip:hover { background: var(--surface-3); }
.avatar {
  width: 29px; height: 29px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: 11.5px; font-weight: 700;
  background: linear-gradient(135deg, var(--accent-500), var(--violet-500)); color: #fff;
}
.user-meta { display: grid; line-height: 1.25; }
.user-meta strong { font-size: 12.5px; }
.user-meta small { font-size: 10.5px; color: var(--text-muted); }
.user-chip > [data-icon] { width: 14px; height: 14px; color: var(--text-faint); }
@media (max-width: 720px) { .user-meta { display: none; } }

.menu {
  position: absolute; top: calc(var(--topbar-h) - 6px); right: 18px; z-index: 40;
  min-width: 208px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
}
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 11px; border-radius: var(--r-md); font-size: 13px; text-align: left;
  color: var(--text); transition: var(--t-fast);
}
.menu-item:hover { background: var(--surface-3); }
.menu-item [data-icon], .menu-item [data-icon] svg { width: 16px; height: 16px; color: var(--text-muted); }
.menu-sep { height: 1px; background: var(--border); margin: 5px 4px; }

.viewport { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 22px 24px 60px; }
@media (max-width: 640px) { .viewport { padding: 16px 14px 60px; } }

/* ---------- Elemente de pagină ---------- */
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .grow { flex: 1; min-width: 200px; }
.page-title { font-size: 21px; letter-spacing: -.02em; }
.page-sub { color: var(--text-muted); font-size: 13px; margin-top: 3px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-xs);
}
.card-head {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.card-head h3 { font-size: 14px; }
.card-head .grow { flex: 1; }
.card-body { padding: 16px; }
.card-body.flush { padding: 0; }

.grid { display: grid; gap: 16px; }
.grid-kpi { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
/* Card care ocupă toată lățimea grilei (util pentru rânduri cu controale late). */
.card-wide { grid-column: 1 / -1; }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

/* ---------- KPI ---------- */
.kpi {
  position: relative; overflow: hidden; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 16px; text-align: left; width: 100%;
  transition: var(--t-fast); box-shadow: var(--shadow-xs);
}
.kpi:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.kpi-label { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-muted); font-weight: 550; }
.kpi-label [data-icon], .kpi-label [data-icon] svg { width: 15px; height: 15px; }
.kpi-value { display: block; font-size: 28px; font-weight: 700; letter-spacing: -.03em; margin-top: 8px; line-height: 1.1; }
.kpi-meta { display: block; font-size: 11.5px; color: var(--text-faint); margin-top: 5px; }
.kpi-accent { position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); }
.kpi.is-danger .kpi-accent { background: var(--red-500); }
.kpi.is-warning .kpi-accent { background: var(--amber-500); }
.kpi.is-success .kpi-accent { background: var(--green-500); }
.kpi.is-danger .kpi-value { color: var(--red-600); }
.kpi-pulse { animation: pulseAlert 1.9s ease-in-out infinite; }
@keyframes pulseAlert {
  0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,.34); }
  50% { box-shadow: 0 0 0 7px rgba(239,68,68,0); }
}

/* ---------- Timeline scadențar ---------- */
.deadline-list { display: grid; }
.deadline {
  display: flex; align-items: center; gap: 13px; padding: 12px 16px;
  border-bottom: 1px solid var(--border); transition: var(--t-fast); cursor: pointer;
}
.deadline:last-child { border-bottom: 0; }
.deadline:hover { background: var(--surface-2); }
.deadline-days {
  width: 50px; flex: none; text-align: center; border-radius: var(--r-md);
  padding: 6px 0; font-weight: 700; font-size: 15px; line-height: 1.1;
}
.deadline-days small { display: block; font-size: 9.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.d-days-red { background: rgba(239,68,68,.14); color: var(--red-600); }
.d-days-amber { background: rgba(245,158,11,.16); color: #b45309; }
.d-days-green { background: rgba(34,197,94,.14); color: var(--green-600); }
.d-days-grey { background: var(--surface-3); color: var(--text-muted); }
.deadline-main { flex: 1; min-width: 0; }
.deadline-main strong { font-size: 13.5px; display: block; }
.deadline-main span { font-size: 12px; color: var(--text-muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deadline-date { font-size: 12px; color: var(--text-faint); font-family: var(--font-mono); flex: none; }

/* ---------- Grafice ---------- */
.chart-wrap { padding: 8px 4px 0; position: relative; }
.chart-wrap::before {
  /* rezervă spațiul înainte de randarea canvas-ului, pentru a evita saltul de layout */
  content: ''; display: block; padding-top: var(--chart-ratio, 42%);
}
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; padding: 0 12px 12px; font-size: 12px; color: var(--text-muted); }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
/* Înălțimea este fixată explicit: atributul `width` al canvas-ului este modificat la randare
   (scalare DPR), iar fără o înălțime CSS browserul ar deduce-o din raportul intrinsec. */
.chart-wrap > canvas.chart,
canvas.chart {
  width: 100%;
  height: var(--chart-h, 240px);
  display: block;
}
.chart-wrap > canvas.chart {
  position: absolute; inset: 0;
}
.chart-wrap[data-chart='donut'] { --chart-h: 200px; --chart-ratio: 46%; }

/* ---------- Toolbar & filtre ---------- */
.toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.toolbar .grow { flex: 1; min-width: 150px; }
.search-inline { position: relative; min-width: 220px; }
.search-inline [data-icon] { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--text-faint); }
.search-inline input { padding-left: 32px; }

.chip-row { display: flex; gap: 7px; flex-wrap: wrap; padding: 0 16px 12px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: var(--r-full); font-size: 12px; font-weight: 550;
  background: var(--surface-3); color: var(--text-muted); border: 1px solid transparent; transition: var(--t-fast);
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.is-active { background: var(--accent-soft); color: var(--accent-text); }
.chip .x { opacity: .6; }
.chip .x:hover { opacity: 1; }

/* ---------- Tabel / DataGrid ---------- */
.table-scroll { overflow-x: auto; }
table.grid-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.grid-table thead th {
  position: sticky; top: 0; z-index: 3;
  background: var(--surface-2); border-bottom: 1px solid var(--border);
  padding: 10px 12px; text-align: left; font-size: 11.5px; font-weight: 640;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap;
}
table.grid-table th.sortable { cursor: pointer; user-select: none; }
table.grid-table th.sortable:hover { color: var(--text); }
th .th-inner { display: inline-flex; align-items: center; gap: 5px; }
th .th-inner [data-icon], th .th-inner [data-icon] svg { width: 13px; height: 13px; opacity: .45; }
th.is-sorted .th-inner [data-icon] { opacity: 1; color: var(--accent-text); }
table.grid-table tbody td {
  padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle;
}
table.grid-table tbody tr { transition: background var(--t-fast); }
table.grid-table tbody tr:hover { background: var(--surface-2); }
table.grid-table tbody tr.is-selected { background: var(--accent-soft); }
table.grid-table tbody tr.is-expired td:first-child { box-shadow: inset 3px 0 0 var(--slate-400); }
table.grid-table tbody tr.is-urgent td:first-child { box-shadow: inset 3px 0 0 var(--red-500); }
.col-check { width: 40px; }
.col-actions { width: 1%; white-space: nowrap; }

.cell-nr { font-family: var(--font-mono); font-size: 12.5px; font-weight: 600; }
.cell-sub { font-size: 11.5px; color: var(--text-muted); display: block; margin-top: 1px; }
.cell-clip { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
mark.hl { background: rgba(250, 204, 21, .45); color: inherit; border-radius: 3px; padding: 0 1px; }
html[data-theme="dark"] mark.hl { background: rgba(250, 204, 21, .3); }

.days-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: var(--r-full); font-size: 11.5px; font-weight: 640; white-space: nowrap;
}
.days-red { background: rgba(239,68,68,.14); color: var(--red-600); }
.days-amber { background: rgba(245,158,11,.18); color: #b45309; }
.days-green { background: rgba(34,197,94,.15); color: var(--green-600); }
.days-grey { background: var(--surface-3); color: var(--text-muted); }
html[data-theme="dark"] .days-red { color: #fca5a5; }
html[data-theme="dark"] .days-amber { color: #fcd34d; }
html[data-theme="dark"] .days-green { color: #86efac; }

.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: var(--r-full); font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.status-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-in_curs { background: rgba(59,130,246,.14); color: var(--accent-text); }
.st-asteptare { background: rgba(245,158,11,.16); color: #b45309; }
.st-finalizat { background: rgba(34,197,94,.14); color: var(--green-600); }
.st-arhivat { background: var(--surface-3); color: var(--text-muted); }
html[data-theme="dark"] .st-asteptare { color: #fcd34d; }
html[data-theme="dark"] .st-finalizat { color: #86efac; }

.cell-edit { outline: none; border-radius: var(--r-sm); padding: 4px 6px; margin: -4px -6px; transition: var(--t-fast); display: block; }
.cell-edit:hover { background: var(--surface-3); }
.cell-edit:focus { background: var(--surface); box-shadow: 0 0 0 2px var(--accent); }

.row-actions { display: flex; gap: 2px; opacity: .55; transition: var(--t-fast); }
tr:hover .row-actions, tr:focus-within .row-actions { opacity: 1; }
.row-actions .icon-btn { width: 28px; height: 28px; background: transparent; }
.row-actions .icon-btn [data-icon], .row-actions .icon-btn [data-icon] svg { width: 15px; height: 15px; }

.check { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.check-all { margin: 0; }

/* Bulk bar */
.bulk-bar {
  position: sticky; bottom: 14px; z-index: 15;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px; margin: 12px 16px 0;
  background: var(--slate-900); color: #fff;
  border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  animation: slideUp var(--t-base);
}
html[data-theme="dark"] .bulk-bar { background: var(--slate-800); border: 1px solid var(--border-strong); }
.bulk-bar .bulk-count { font-size: 13px; font-weight: 600; margin-right: 4px; }
.bulk-bar .btn { background: rgba(255,255,255,.10); color: #fff; border-color: rgba(255,255,255,.14); }
.bulk-bar .btn:hover:not(:disabled) { background: rgba(255,255,255,.2); }
.bulk-bar .spacer { flex: 1; }
@keyframes slideUp { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Paginare */
.pager { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.pager .grow { flex: 1; }
.pager .pg-info { font-size: 12.5px; color: var(--text-muted); }
.pg-btns { display: flex; gap: 4px; align-items: center; }
.pg-btn {
  min-width: 32px; height: 32px; padding: 0 8px; border-radius: var(--r-md);
  font-size: 12.5px; font-weight: 560; color: var(--text-muted);
  border: 1px solid transparent; transition: var(--t-fast);
}
.pg-btn:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.pg-btn.is-active { background: var(--accent); color: #fff; }
.pg-btn:disabled { opacity: .4; cursor: not-allowed; }
.pg-size { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-muted); }
.pg-size select { width: auto; padding: 5px 26px 5px 9px; }

/* ---------- Stări goale ---------- */
.empty {
  display: grid; place-items: center; gap: 10px; padding: 54px 24px; text-align: center; color: var(--text-muted);
}
.empty [data-icon], .empty [data-icon] svg { width: 38px; height: 38px; color: var(--text-faint); stroke-width: 1.4; }
.empty strong { font-size: 14.5px; color: var(--text); }
.empty p { font-size: 13px; max-width: 460px; }

.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: sk 1.3s infinite; border-radius: var(--r-sm); height: 14px; }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- Modal ---------- */
.modal-root { position: fixed; inset: 0; z-index: 60; }
.modal-scrim { position: absolute; inset: 0; background: rgba(2, 6, 23, .5); backdrop-filter: blur(2px); animation: fade var(--t-fast); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(880px, calc(100vw - 32px)); max-height: calc(100vh - 56px);
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-xl); box-shadow: var(--shadow-lg);
  animation: modalIn var(--t-base); overflow: hidden;
}
.modal.is-wide { width: min(1180px, calc(100vw - 32px)); }
.modal.is-slim { width: min(520px, calc(100vw - 32px)); }
@keyframes modalIn { from { opacity: 0; transform: translate(-50%, -46%) scale(.98); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); flex: none; }
.modal-head h3 { font-size: 15.5px; flex: 1; }
.modal-head .modal-sub { font-size: 12.5px; color: var(--text-muted); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-foot { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); flex: none; background: var(--surface-2); }
.modal-foot .grow { flex: 1; }

/* ---------- Formulare ---------- */
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid .span-2 { grid-column: 1 / -1; } }

.form-section { margin-bottom: 20px; }
.form-section > h4 {
  font-size: 12px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-faint); margin-bottom: 12px; font-weight: 650;
  display: flex; align-items: center; gap: 8px;
}
.form-section > h4::after { content: ""; flex: 1; height: 1px; background: var(--border); }

label.req::after { content: " *"; color: var(--red-500); }

.part-row {
  display: grid; grid-template-columns: 1.3fr 1.2fr .9fr 1fr 1fr auto; gap: 8px; align-items: center;
  padding: 9px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2);
}
@media (max-width: 900px) {
  .part-row { grid-template-columns: 1fr 1fr; }
  .part-row .btn { justify-self: end; }
}
.part-row input { background: var(--surface); font-size: 12.8px; padding: 7px 9px; }

.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 13px; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 36px; height: 20px; border-radius: var(--r-full); background: var(--border-strong); position: relative; transition: var(--t-fast); flex: none; }
.switch .track::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; background: #fff; top: 2px; left: 2px; transition: var(--t-fast); box-shadow: var(--shadow-xs); }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px var(--accent-soft); }

.radio-card { display: grid; gap: 9px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.radio-card label {
  display: flex; gap: 10px; align-items: flex-start; padding: 11px 13px;
  border: 1px solid var(--border); border-radius: var(--r-md); cursor: pointer; transition: var(--t-fast); background: var(--surface-2);
}
.radio-card label:hover { border-color: var(--border-strong); }
.radio-card input { margin-top: 2px; accent-color: var(--accent); }
.radio-card input:checked ~ div strong { color: var(--accent-text); }
.radio-card label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.radio-card strong { font-size: 13px; display: block; }
.radio-card small { font-size: 11.5px; color: var(--text-muted); }

/* ---------- Toast ---------- */
.toast-root {
  position: fixed; right: 18px; bottom: 18px; z-index: 70;
  display: grid; gap: 10px; justify-items: end; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 12px; min-width: 260px; max-width: 420px;
  padding: 12px 14px; border-radius: var(--r-lg);
  background: var(--slate-900); color: #fff; box-shadow: var(--shadow-lg);
  pointer-events: auto; animation: toastIn var(--t-base);
}
html[data-theme="dark"] .toast { background: var(--slate-800); border: 1px solid var(--border-strong); }
.toast.is-out { animation: toastOut var(--t-base) forwards; }
.toast [data-icon], .toast [data-icon] svg { width: 18px; height: 18px; flex: none; }
.toast .toast-text { flex: 1; font-size: 13px; line-height: 1.4; }
.toast .toast-text small { display: block; opacity: .72; font-size: 11.5px; margin-top: 1px; }
.toast .toast-undo { background: rgba(255,255,255,.14); color: #fff; border: 0; padding: 5px 10px; border-radius: var(--r-sm); font-size: 12px; font-weight: 600; }
.toast .toast-undo:hover { background: rgba(255,255,255,.26); }
.toast.is-success [data-icon] { color: var(--green-400); }
.toast.is-error [data-icon] { color: var(--red-400); }
.toast.is-warn [data-icon] { color: var(--amber-400); }
.toast.is-info [data-icon] { color: var(--accent-400); }
.toast .toast-close { opacity: .5; color: #fff; }
.toast .toast-close:hover { opacity: 1; }
@keyframes toastIn { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toastOut { to { transform: translateX(24px); opacity: 0; } }

/* ---------- Progres ---------- */
.progress-root { position: fixed; inset: 0; z-index: 65; display: grid; place-items: center; background: rgba(2,6,23,.45); backdrop-filter: blur(2px); }
.progress-card { width: min(420px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); padding: 20px; display: grid; gap: 12px; }
.progress-head { display: flex; align-items: center; gap: 10px; font-size: 13.5px; font-weight: 600; }
.progress-head [data-icon] { animation: spin 1s linear infinite; color: var(--accent); }
.progress-head [data-icon], .progress-head [data-icon] svg { width: 17px; height: 17px; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress-bar { height: 6px; border-radius: var(--r-full); background: var(--surface-3); overflow: hidden; }
.progress-bar > span { display: block; height: 100%; width: 0; background: var(--accent); transition: width var(--t-base); }
.progress-detail { font-size: 12px; color: var(--text-muted); min-height: 16px; }
.progress-root .btn { justify-self: end; }

/* ---------- Detalii dosar (drawer/panou) ---------- */
.tabs { display: flex; gap: 3px; border-bottom: 1px solid var(--border); padding: 0 4px; overflow-x: auto; }
.tab {
  padding: 10px 13px; font-size: 13px; font-weight: 550; color: var(--text-muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px; transition: var(--t-fast); white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--accent-text); border-bottom-color: var(--accent); }
.tab-panel { padding-top: 16px; }
.tab-panel[hidden] { display: none; }

.dl { display: grid; grid-template-columns: 158px 1fr; gap: 9px 16px; font-size: 13px; }
.dl dt { color: var(--text-muted); font-size: 12.5px; }
.dl dd { margin: 0; }
@media (max-width: 560px) { .dl { grid-template-columns: 1fr; gap: 3px 0; } .dl dd { margin-bottom: 8px; } }

.pill-list { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { padding: 2px 9px; border-radius: var(--r-full); background: var(--surface-3); font-size: 11.5px; color: var(--text-muted); }
.pill.accent { background: var(--accent-soft); color: var(--accent-text); }

.timeline { display: grid; gap: 0; position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.tl-item { position: relative; padding: 0 0 16px 0; }
.tl-item::before { content: ""; position: absolute; left: -20px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); box-shadow: 0 0 0 2px var(--accent-soft); }
.tl-item.is-past::before { background: var(--slate-400); box-shadow: none; }
.tl-item strong { font-size: 13px; display: block; }
.tl-item p { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.tl-item .tl-date { font-size: 11.5px; color: var(--text-faint); font-family: var(--font-mono); }

/* ---------- Financiar ---------- */
.money { font-variant-numeric: tabular-nums; font-family: var(--font-mono); font-size: 13px; }
.money.pos { color: var(--green-600); }
.money.neg { color: var(--red-600); font-weight: 600; }
html[data-theme="dark"] .money.pos { color: #86efac; }
html[data-theme="dark"] .money.neg { color: #fca5a5; }

.stat-strip { display: grid; gap: 1px; background: var(--border); border-radius: var(--r-lg); overflow: hidden; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.stat-strip > div { background: var(--surface); padding: 14px 16px; }
.stat-strip .s-label { font-size: 12px; color: var(--text-muted); }
.stat-strip .s-value { font-size: 20px; font-weight: 700; letter-spacing: -.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }

.bar-mini { height: 7px; border-radius: var(--r-full); background: var(--surface-3); overflow: hidden; display: flex; }
.bar-mini > span { display: block; height: 100%; }

/* ---------- Documente / Studio ---------- */
.studio { display: grid; grid-template-columns: minmax(330px, 400px) 1fr; gap: 0; border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; background: var(--surface); min-height: 620px; }
@media (max-width: 1020px) { .studio { grid-template-columns: 1fr; } }
.studio-panel { padding: 18px; overflow-y: auto; max-height: calc(100vh - 190px); border-right: 1px solid var(--border); }
.studio-panel.split-load { border-right: 0; }
@media (max-width: 1020px) { .studio-panel { border-right: 0; border-bottom: 1px solid var(--border); max-height: none; } }
.studio-preview { background: var(--surface-3); padding: 22px; overflow: auto; max-height: calc(100vh - 190px); display: grid; justify-items: center; }
@media (max-width: 1020px) { .studio-preview { max-height: none; } }

.tpl-list { display: grid; gap: 7px; }
.tpl-item {
  display: flex; gap: 11px; align-items: flex-start; padding: 10px 12px; width: 100%;
  border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2);
  transition: var(--t-fast); text-align: left;
}
.tpl-item:hover { border-color: var(--border-strong); }
.tpl-item.is-active { border-color: var(--accent); background: var(--accent-soft); }
.tpl-item [data-icon], .tpl-item [data-icon] svg { width: 17px; height: 17px; margin-top: 1px; color: var(--accent-text); flex: none; }
.tpl-item strong { font-size: 13px; display: block; }
.tpl-item small { font-size: 11.5px; color: var(--text-muted); }

/* Foaia A4 */
.a4 {
  width: 100%; max-width: 794px; aspect-ratio: 210 / 297;
  background: #fff; color: #111;
  box-shadow: 0 12px 34px rgba(15,23,42,.22);
  border-radius: 2px; padding: 56px 52px;
  font-family: var(--font-doc); font-size: 12.6px; line-height: 1.32;
  position: relative;
  /* Foaia are proporția A4, dar crește dacă documentul depășește o pagină —
     altfel previzualizarea tăia semnătura documentelor mai lungi. */
  display: flex; flex-direction: column;
}
.a4-inner { position: relative; flex: 1 0 auto; padding-bottom: 30px; }
.a4 .doc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; border-bottom: 1.6px solid #222; padding-bottom: 10px; margin-bottom: 18px; }
.a4 .doc-head-logo { max-height: 58px; max-width: 150px; object-fit: contain; }
.a4 .doc-head-text { text-align: right; font-size: 11.4px; line-height: 1.36; }
.a4 .doc-head-text .nm { font-weight: 700; font-size: 12.6px; }
.a4 h2.doc-title { text-align: center; font-size: 14.4px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; margin: 6px 0 18px; }
.a4 p { margin: 0 0 9px; text-align: justify; text-indent: 2em; }
.a4 p.noindent { text-indent: 0; }
.a4 ul, .a4 ol { margin: 0 0 10px; padding-left: 1.7em; }
.a4 li { margin-bottom: 4px; text-align: justify; }
.a4 table { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 11.6px; }
.a4 table th, .a4 table td { border: 1px solid #334; padding: 5px 7px; text-align: left; }
.a4 table th { background: #eef1f6; font-weight: 700; }
.a4 .doc-foot { position: absolute; bottom: 0; left: 0; right: 0; text-align: center; font-size: 10.4px; color: #555; border-top: 1px solid #ccc; padding-top: 5px; }
.a4 .sign-block { margin-top: 34px; display: flex; justify-content: flex-end; }
.a4 .sign-box { text-align: center; position: relative; min-width: 230px; }
.a4 .sign-box .role { font-size: 11.6px; margin-bottom: 42px; }
.a4 .sign-img { position: absolute; right: 6px; top: 16px; height: 62px; opacity: .92; }
.a4 .stamp-img { position: absolute; right: -22px; top: 4px; height: 96px; width: 96px; object-fit: contain; opacity: .78; mix-blend-mode: multiply; }
.a4 .sign-line { border-top: 1px solid #333; padding-top: 4px; font-size: 11.4px; }
.a4 .nb { font-weight: 700; }
/* Alinieri specifice documentelor (convocare, proces-verbal, cereri) */
.a4 p.center { text-align: center; text-indent: 0; }
.a4 p.right { text-align: right; text-indent: 0; }
.a4 p.reg { text-align: right; text-indent: 0; font-size: 12px; margin-bottom: 22px; }
.a4 p.addr { text-align: center; text-indent: 0; font-weight: 700; font-size: 12.4px; margin-bottom: 2px; }
.a4 p.addr + p.addr { margin-top: 0; }
.a4 p.tight { margin-bottom: 3px; }
.a4 .sig-right { margin-top: 30px; text-align: right; }
.a4 .sig-right p { text-align: right; text-indent: 0; margin: 0 0 2px; }
.a4 .sig-right .rol { margin-top: 12px; }
.a4 .note-jur { margin-top: 16px; padding-top: 8px; border-top: 1px solid #ddd; }
.a4 .note-jur p { font-size: 8.6px; line-height: 1.35; color: #444; text-align: justify; text-indent: 0; margin-bottom: 3px; }
.a4 .bifa { display: inline-block; width: 11px; height: 11px; border: 1px solid #333; vertical-align: -1px; margin-right: 6px; }
.a4 .linie-completare { display: inline-block; border-bottom: 1px dotted #666; min-width: 150px; }
/* Formular oficial al instanței (cerere de acces la dosarul electronic):
   titlu simplu, corp 12pt și casete de bifare ☐/☒ în font de simboluri.
   Stilurile inline din șablon (text-indent, text-align, line-height) preiau controlul. */
.a4 h2.doc-title.title-plain { text-transform: none; font-size: 13.4px; letter-spacing: 0; margin: 8px 0 16px; line-height: 1.28; }
.a4 .formular-oficial { font-size: 12px; }
.a4 .formular-oficial p { margin-bottom: 0; }
.a4 .formular-oficial p.tight { margin-bottom: 0; }
.a4 .formular-oficial p.split { display: flex; justify-content: space-between; gap: 18px; }
/* Antetul formularului: „Instanța<tab>valoare … Anexa 1", valoarea aliniată la ~2.5 cm. */
.a4 .formular-oficial p.header-inst { display: flex; gap: 0; }
.a4 .formular-oficial p.header-inst > span:first-child { flex: 1; }
.a4 .formular-oficial p.header-inst > span:first-child > .nb { display: inline-block; min-width: 1.55cm; }
.a4 .formular-oficial p.header-inst > span:last-child { flex: 0 0 auto; }
/* Linia „Dosar nr.<tab>valoare". */
.a4 .formular-oficial p.dosar-line .nb { display: inline-block; min-width: 1.55cm; }
.a4 .casa-bifa { font-family: "Segoe UI Symbol", "Segoe UI", sans-serif; }
/* Semnătura olografă, așezată deasupra liniei „Semnătura, ___". */
.a4 .semnatura-img { display: block; margin: 0 0 2px auto; max-height: 42px; }
/* Cerere de majorare a onorariului — reproduce documentul de referință al instanței:
   Calibri 12pt, antet dosar, notă de evaluare cu orele aliniate la dreapta. */
.a4 .formular-majorare { font-family: "Calibri", "Carlito", "Segoe UI", system-ui, sans-serif; font-size: 12pt; line-height: 1.15; }
.a4 .formular-majorare p { margin: 0 0 2px; text-align: justify; text-indent: 1.24cm; }
.a4 .formular-majorare p.noindent { text-indent: 0; }
.a4 .formular-majorare p.maj-head { text-indent: 0; text-align: left; margin-bottom: 1px; }
.a4 .formular-majorare p.maj-salut { text-indent: 0; text-align: center; margin: 14px 0 12px; }
.a4 .formular-majorare p.maj-body { margin-bottom: 12px; }
.a4 .formular-majorare p.maj-nota { text-indent: 0; text-align: center; margin: 8px 0 12px; }
.a4 .formular-majorare .maj-lista { margin: 0 0 8px; }
.a4 .formular-majorare p.maj-item { display: flex; text-indent: 0; text-align: left; margin: 0 0 1px; padding-left: 1.15cm; }
.a4 .formular-majorare p.maj-item .maj-text { flex: 1; }
.a4 .formular-majorare p.maj-item .maj-text::before { content: "- "; }
.a4 .formular-majorare p.maj-item .maj-ore { flex: 0 0 auto; padding-left: 12px; white-space: nowrap; }
.a4 .formular-majorare p.maj-total-ore { text-indent: 2.54cm; margin: 6px 0 2px; }
.a4 .formular-majorare p.maj-calc { text-indent: 0; margin-bottom: 2px; }
.a4 .formular-majorare p.maj-body-ind { text-indent: 1.27cm; margin-bottom: 0; }
.a4 .formular-majorare p.maj-rest { text-indent: 1.27cm; margin: 6px 0 12px; }
.a4 .formular-majorare p.maj-concluzie { margin-bottom: 14px; }
.a4 .formular-majorare p.maj-data { text-indent: 0; text-align: right; margin: 0 0 34px; }
.a4 .formular-majorare p.maj-sign-role { text-indent: 0; margin-bottom: 1px; }
.a4 .formular-majorare p.maj-sign-name { text-indent: 0; }
.a4 .formular-majorare .sign-img-maj { display: block; height: 46px; margin: 6px 0 -8px 6px; opacity: .92; }
.a4 .formular-majorare .stamp-img-maj { display: block; height: 84px; width: 84px; object-fit: contain; margin: 4px 0 -46px 0; opacity: .78; mix-blend-mode: multiply; }
/* ---------- Design documente ExpertHub (identic cu .docx — vezi docx-engine.js / letterhead.js) ---------- */
.a4 { --doc-accent: #1f3a5f; --doc-muted: #4b5563; --doc-soft: #eef2f7; --doc-line: #d9dee6; }
.a4 .doc-head { display: flex; justify-content: space-between; gap: 18px; border-bottom: 2px solid var(--doc-accent); padding-bottom: 8px; margin-bottom: 14px; }
.a4 .doc-head-banner { display: block; text-align: center; }
.a4 .doc-head-banner .doc-head-logo { max-width: 100%; max-height: 120px; }
.a4 .lh-who { flex: 0 0 55%; font-size: 10.6px; color: var(--doc-muted); line-height: 1.35; }
.a4 .lh-who .lh-name { font-size: 15px; font-weight: 700; color: var(--doc-accent); margin-bottom: 2px; }
.a4 .lh-contact { text-align: right; font-size: 10.6px; color: var(--doc-muted); line-height: 1.35; }
.a4 .k { color: var(--doc-muted); }
.a4 .accent { color: var(--doc-accent); }
.a4 table.layout { margin: 0 0 16px; font-size: 12px; }
.a4 table.layout td { border: 0; padding: 0 8px 1px 0; vertical-align: top; }
.a4 table.layout td.num { text-align: right; padding-right: 0; }
.a4 table.data { font-size: 11.6px; margin: 6px 0 14px; }
.a4 table.data th, .a4 table.data td { border: 0; border-bottom: 1px solid var(--doc-line); padding: 4px 7px; }
.a4 table.data th { background: var(--doc-soft); color: var(--doc-accent); border-bottom: 1.5px solid var(--doc-accent); }
.a4 table.data .num { text-align: right; white-space: nowrap; }
.a4 table.data tr.tot td { font-weight: 700; border-top: 1.5px solid var(--doc-accent); border-bottom: 0; }
.a4 table.data tr.grand td { font-weight: 700; background: var(--doc-soft); color: var(--doc-accent); border-bottom: 0; }
.a4 table.data tr.tall td { height: 28px; }
.a4 h2.doc-title.spaced { color: var(--doc-accent); font-size: 13.4px; letter-spacing: .16em; margin: 14px 0 4px; }
.a4 p.subtitle { text-align: center; text-indent: 0; color: var(--doc-muted); margin-bottom: 14px; }
.a4 .box { background: var(--doc-soft); border-left: 3px solid var(--doc-accent); padding: 6px 12px; margin: 4px 0 14px; }
.a4 .box p { margin: 0; text-indent: 0; text-align: left; }
.a4 .box .k { display: inline-block; min-width: 2.6cm; }
.a4 .sign-v2 { margin: 26px 0 0 50%; text-align: center; break-inside: avoid; }
.a4 .sign-v2 .sv-imgs { min-height: 56px; display: flex; justify-content: center; align-items: center; gap: 6px; margin: 4px 0; }
.a4 .sign-v2 .sv-stamp { height: 72px; width: 72px; object-fit: contain; opacity: .85; mix-blend-mode: multiply; }
.a4 .sign-v2 .sv-sig { height: 52px; }
.a4 .sign-v2 .sv-name { font-weight: 700; }
.a4 .doc-foot { display: flex; justify-content: space-between; text-align: left; color: #9ca3af; font-size: 9.6px; border-top: 1px solid var(--doc-line); }
.a4 .watermark { position: absolute; inset: 0; display: grid; place-items: center; font-size: 64px; color: rgba(15,23,42,.045); transform: rotate(-28deg); font-weight: 800; pointer-events: none; letter-spacing: 6px; }

/* ---------- Asistent AI ---------- */
.ai-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 18px; }
.ai-out {
  white-space: pre-wrap; font-size: 13px; line-height: 1.58;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 13px; min-height: 150px; max-height: 400px; overflow: auto;
}
.ai-field { display: grid; gap: 4px; padding: 9px 11px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); }
.ai-field .k { font-size: 11.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.ai-field .v { font-size: 13px; }
.mono-box { font-family: var(--font-mono); font-size: 11.8px; white-space: pre; overflow: auto; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: 12px; max-height: 320px; }

/* ---------- Setări ---------- */
.setting-row { display: flex; align-items: center; gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--border); }
.setting-row:last-child { border-bottom: 0; }
.setting-row .grow { flex: 1; min-width: 0; }   /* min-width:0 permite textului să se restrângă corect */
.setting-row strong { font-size: 13.5px; display: block; }
.setting-row p { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.setting-row > select, .setting-row > input { flex: none; }

/* Rânduri cu control lat (ex. cheia API): textul sus, controlul dedesubt. */
.setting-row.is-stacked { display: block; }
.setting-row.is-stacked > .row { margin-top: 10px; }
.setting-row.is-stacked input[type='password'],
.setting-row.is-stacked input[type='text'] { width: 100%; max-width: 340px; }

.token-box { display: flex; gap: 8px; align-items: center; }
.token-box input { font-family: var(--font-mono); font-size: 12px; }
.color-dot { width: 14px; height: 14px; border-radius: 50%; display: inline-block; }
.swatch { width: 34px; height: 34px; border-radius: var(--r-md); border: 1px solid var(--border); }

/* ---------- Utilitare ---------- */
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; }
.text-muted { color: var(--text-muted); }
.text-faint { color: var(--text-faint); }
.text-sm { font-size: 12.5px; }
.text-xs { font-size: 11.5px; }
.text-mono { font-family: var(--font-mono); }
.text-center { text-align: center; }
table.grid-table th.text-center, table.grid-table td.text-center { text-align: center; }
table.grid-table th.text-right, table.grid-table td.text-right { text-align: right; }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }
.hidden, [hidden] { display: none !important; }
.sep { height: 1px; background: var(--border); margin: 16px 0; }
.tag-input { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; padding: 7px 9px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); min-height: 40px; }
.tag-input input { border: 0; background: transparent; padding: 2px 4px; flex: 1; min-width: 110px; }
.tag-input input:focus-visible { box-shadow: none; }
.tag-chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: var(--r-full); background: var(--accent-soft); color: var(--accent-text); font-size: 11.5px; font-weight: 550; }
.tag-chip button { color: inherit; opacity: .6; font-size: 13px; line-height: 1; }
.tag-chip button:hover { opacity: 1; }

.filter-pop { position: absolute; z-index: 45; right: 16px; top: 52px; width: 258px; padding: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); }
.filter-pop h5 { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); margin-bottom: 9px; }
.filter-pop label { display: flex; align-items: center; gap: 9px; padding: 6px 4px; font-size: 13px; cursor: pointer; border-radius: var(--r-sm); }
.filter-pop label:hover { background: var(--surface-2); }

@media print {
  body { overflow: visible; }
  .sidebar, .topbar, .studio-panel, .toast-root, .modal-foot { display: none !important; }
  .a4 { box-shadow: none; max-width: none; width: 100%; aspect-ratio: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* =========================================================================
   Analiză documente cu AI (Asistent) + dosar asociat
   ========================================================================= */

/* ---------- Zonă de încărcare (drag & drop) ---------- */
.drop-zone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; text-align: center; cursor: pointer;
  padding: 22px 16px; margin-top: 12px;
  border: 2px dashed var(--border-strong); border-radius: var(--r-lg, 12px);
  background: var(--surface-2); color: var(--text-muted);
  transition: var(--t-fast);
}
.drop-zone:hover, .drop-zone:focus-visible { border-color: var(--accent-500); color: var(--text); background: var(--surface-3); outline: none; }
.drop-zone.is-over { border-color: var(--accent-500); background: var(--accent-soft, rgba(59,130,246,.08)); color: var(--text); transform: scale(1.01); }
.drop-zone > [data-icon] { width: 30px; height: 30px; color: var(--accent-500); }
.drop-zone > [data-icon] svg { width: 30px; height: 30px; }
.drop-zone strong { font-size: 13px; color: var(--text); }

/* Variantă compactă, folosită în interiorul cardurilor */
.drop-zone-sm { padding: 14px 12px; margin-top: 0; gap: 3px; }
.drop-zone-sm > [data-icon] { width: 20px; height: 20px; }
.drop-zone-sm > [data-icon] svg { width: 20px; height: 20px; }
.drop-zone-sm strong { font-size: 12.5px; }

/* ---------- Lista de experți (Setări) ---------- */
.expert-list { display: flex; flex-direction: column; gap: 8px; }
.expert-row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border); border-radius: var(--r-lg, 12px);
  background: var(--surface-2);
  transition: var(--t-fast);
}
.expert-row:hover { border-color: var(--border-strong); }
.expert-row.is-default { border-left: 3px solid var(--accent-500); }

.er-avatar {
  flex: none; width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface-3); color: var(--accent-500);
}
.er-avatar svg { width: 19px; height: 19px; }

.expert-row .grow { min-width: 0; }
.er-nume { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 5px; }
.er-nume > span:first-child { font-size: 14px; font-weight: 650; }

.er-detalii { display: flex; flex-direction: column; gap: 3px; }
.er-detaliu { display: flex; align-items: flex-start; gap: 7px; font-size: 12.5px; color: var(--text-muted); line-height: 1.45; }
.er-detaliu svg { width: 13px; height: 13px; flex: none; margin-top: 2px; color: var(--text-faint); }
.er-detaliu span { word-break: break-word; }

.er-gol { font-size: 12.5px; color: var(--amber-500); margin: 0; }
.er-actiuni { display: flex; gap: 4px; flex: none; align-items: center; }

@media (max-width: 720px) {
  .expert-row { flex-wrap: wrap; }
  .er-actiuni { width: 100%; justify-content: flex-end; }
}

/* ---------- Analiza obiecțiunilor ---------- */
.analiza-box {
  margin-top: 4px; padding: 12px;
  border: 1px solid var(--border); border-left: 3px solid var(--accent-500);
  border-radius: var(--r-md, 8px);
  background: var(--surface);
}
.analiza-titlu {
  font-size: 12px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--accent-text, var(--accent-600)); margin-bottom: 9px;
}
.puncte-slabe {
  margin-top: 12px; padding: 10px 12px;
  border-radius: var(--r-md, 8px);
  background: rgba(245, 158, 11, .10);
  border-left: 3px solid var(--amber-500);
}
.puncte-slabe strong { font-size: 12.5px; display: block; margin-bottom: 5px; color: var(--text); }
.puncte-slabe ul { padding-left: 18px; margin: 0; }
.puncte-slabe li { color: var(--text-muted); margin-bottom: 3px; }

/* ---------- Lista fișierelor atașate ---------- */
.file-list { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.file-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--r-md, 8px);
  background: var(--surface-2);
}
.file-item.is-error { border-color: var(--red-500); background: rgba(239,68,68,.06); }
.file-item > [data-icon] { flex: none; color: var(--accent-500); }
.file-item.is-error > [data-icon] { color: var(--red-500); }
.file-item > [data-icon] svg { width: 18px; height: 18px; }
.file-item strong { font-size: 12.5px; display: block; word-break: break-all; }
.file-item small { font-size: 11.5px; color: var(--text-muted); display: block; }
.file-item.is-error small { color: var(--red-500); }

/* ---------- Dosar asociat: detaliile afișate sub selector ---------- */
.dosar-asociat-detaliu {
  margin-top: 8px; padding: 9px 11px;
  border-left: 3px solid var(--accent-500);
  border-radius: 0 var(--r-md, 8px) var(--r-md, 8px) 0;
  background: var(--surface-2);
}
.dad-rand { display: flex; gap: 8px; font-size: 12.5px; line-height: 1.5; }
.dad-rand + .dad-rand { margin-top: 2px; }
.dad-k { flex: none; min-width: 54px; color: var(--text-faint); }
.dad-v { color: var(--text); }

/* ---------- Răspunsul AI (markdown simplu) ---------- */
.ai-markdown { font-size: 13.5px; line-height: 1.65; color: var(--text); }
.ai-markdown h3, .ai-markdown h4, .ai-markdown h5, .ai-markdown h6 {
  font-size: 13px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--accent-text, var(--accent-600)); margin: 14px 0 6px;
}
.ai-markdown h3:first-child, .ai-markdown h4:first-child { margin-top: 0; }
.ai-markdown p { margin: 0 0 8px; }
.ai-markdown ul { margin: 0 0 10px; padding-left: 20px; }
.ai-markdown li { margin-bottom: 3px; }
.ai-markdown strong { font-weight: 650; }
.ai-markdown code {
  font-family: var(--font-mono); font-size: 12px;
  background: var(--surface-3); padding: 1px 5px; border-radius: 4px;
}

/* ---------- Raționamentul modelului ---------- */
.ai-reasoning { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 10px; }
.ai-reasoning summary { cursor: pointer; font-size: 12px; color: var(--text-muted); user-select: none; }
.ai-reasoning summary:hover { color: var(--text); }
.ai-reasoning pre {
  margin-top: 8px; padding: 10px; max-height: 260px; overflow: auto;
  background: var(--surface-3); border-radius: var(--r-md, 8px);
  font-family: var(--font-mono); font-size: 11.5px; line-height: 1.55;
  white-space: pre-wrap; word-break: break-word; color: var(--text-muted);
}

/* Administrare */
.nav-item[hidden] { display: none; }
.view-admin .tabs .tab { display: inline-flex; align-items: center; gap: 6px; }
.view-admin .grid-table tr.is-clickable:hover td { background: var(--surface-2); }
.view-admin .form-grid { align-items: start; }

/* =========================================================================
   Panou de administrare (views/admin) — consolă cu navigare laterală
   ========================================================================= */
:root {
  --ok-bg: #dcfce7; --ok-fg: #15803d; --warn-bg: #fef3c7; --warn-fg: #a16207;
  --bad-bg: #fee2e2; --bad-fg: #b91c1c; --info-bg: #dbeafe; --info-fg: #1d4ed8;
}
[data-theme="dark"] {
  --ok-bg: rgba(34, 197, 94, .16); --ok-fg: #4ade80; --warn-bg: rgba(245, 158, 11, .16); --warn-fg: #fbbf24;
  --bad-bg: rgba(239, 68, 68, .16); --bad-fg: #f87171; --info-bg: rgba(59, 130, 246, .16); --info-fg: #60a5fa;
}

.adm { display: grid; grid-template-columns: 208px minmax(0, 1fr); gap: 18px; align-items: start; }
.adm-side { position: sticky; top: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 12px 8px; }
.adm-brand { display: flex; align-items: center; gap: 9px; padding: 2px 8px 14px; }
.adm-brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
.adm-brand-txt { font-size: 13.5px; font-weight: 650; letter-spacing: -.01em; }
.adm-brand-sub { font-size: 11px; color: var(--text-faint); }
.adm-nav { display: flex; flex-direction: column; gap: 2px; }
.adm-nav-item { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: var(--r-md); font-size: 13px; color: var(--text-muted); border: none; background: none; text-align: left; width: 100%; cursor: pointer; transition: background var(--t-fast), color var(--t-fast); }
.adm-nav-item [data-icon], .adm-nav-item [data-icon] svg { width: 15px; height: 15px; flex: none; }
.adm-nav-item:hover { background: var(--surface-3); color: var(--text); }
.adm-nav-item.is-on { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.adm-nav-badge { margin-left: auto; font-size: 11px; padding: 1px 7px; border-radius: var(--r-full); background: var(--surface-3); color: var(--text-muted); font-weight: 500; }
.adm-nav-badge.is-alert { background: var(--bad-bg); color: var(--bad-fg); font-weight: 650; }
.adm-nav-sep { margin: 12px 10px 6px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-faint); }

.adm-main { min-width: 0; }
.adm-side, .adm-panel, .adm-kpis, .adm-segs { min-width: 0; }
.adm-top { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.adm-title { font-size: 20px; letter-spacing: -.02em; margin: 0; }
.adm-top .grow { flex: 1; }
.adm-search { display: flex; align-items: center; gap: 7px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 0 10px; width: 280px; max-width: 100%; }
.adm-search [data-icon], .adm-search [data-icon] svg { width: 15px; height: 15px; color: var(--text-faint); flex: none; }
.adm-search input { border: none; background: none; box-shadow: none; padding: 8px 0; font-size: 13px; width: 100%; }
.adm-search input:focus { outline: none; box-shadow: none; }
.adm-search:focus-within { border-color: var(--accent); }
.adm-top-actions { display: flex; gap: 6px; }
.adm-sim { font-size: 12px; color: var(--text-muted); background: var(--warn-bg); border-radius: var(--r-md); padding: 8px 12px; margin-bottom: 14px; }

.adm-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.adm-kpi { display: flex; flex-direction: column; text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 13px 15px; font: inherit; color: inherit; }
.adm-kpi.is-link { cursor: pointer; transition: border-color var(--t-fast), box-shadow var(--t-fast); }
.adm-kpi.is-link:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.adm-kpi .l { font-size: 11.5px; color: var(--text-muted); margin-bottom: 5px; }
.adm-kpi .v { font-size: 23px; font-weight: 650; letter-spacing: -.02em; line-height: 1.2; }
.adm-kpi .m { font-size: 11.5px; color: var(--text-faint); margin-top: 3px; }
.adm-kpi.is-accent { border-color: var(--accent); background: var(--accent-soft); }
.adm-kpi.is-warn .v { color: var(--warn-fg); }
.adm-kpi.is-bad .v { color: var(--bad-fg); }
.adm-kpi.is-ok .v { color: var(--ok-fg); }

.adm-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; margin-bottom: 16px; }
.adm-panel-head { display: flex; align-items: center; gap: 8px; padding: 11px 15px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.adm-panel-head h2 { font-size: 13.5px; font-weight: 650; margin: 0; }
.adm-panel-head .grow { flex: 1; }
.adm-panel-pad { padding: 15px; }
.adm-count { font-size: 11.5px; color: var(--text-muted); background: var(--surface-3); border-radius: var(--r-full); padding: 1px 9px; }
.adm-select { width: auto; font-size: 12.5px; padding: 5px 28px 5px 9px; min-height: 0; height: 31px; max-width: 220px; }
.adm-foot { font-size: 11.5px; color: var(--text-faint); padding: 10px 15px; margin: 0; line-height: 1.6; border-top: 1px solid var(--border); }
.adm-check { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-muted); cursor: pointer; }

.adm-mgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.adm-drawer .adm-mgrid { grid-template-columns: repeat(auto-fit, minmax(88px, 1fr)); gap: 9px; }
.adm-mbox { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: 10px 12px; }
.adm-mbox .l { font-size: 11px; color: var(--text-muted); }
.adm-mbox .v { font-size: 19px; font-weight: 650; }
.adm-mbox .m { font-size: 11.5px; color: var(--text-faint); margin-top: 3px; }

.adm-segs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.adm-seg { display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; border-radius: var(--r-full); border: 1px solid var(--border); background: var(--surface); font: inherit; font-size: 12.5px; color: var(--text-muted); cursor: pointer; transition: all var(--t-fast); }
.adm-seg:hover { border-color: var(--border-strong); color: var(--text); }
.adm-seg.is-on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.adm-seg b { color: var(--text); font-weight: 650; }
.adm-seg.is-on b { color: var(--accent-text); }
.adm-seg .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }

.adm-tabs { display: flex; gap: 4px; margin-bottom: 14px; flex-wrap: wrap; }
.adm-tab { font: inherit; font-size: 13px; padding: 7px 13px; border-radius: var(--r-md); border: 1px solid transparent; background: none; color: var(--text-muted); cursor: pointer; }
.adm-tab:hover { background: var(--surface-3); color: var(--text); }
.adm-tab.is-on { background: var(--surface); border-color: var(--border); color: var(--text); font-weight: 600; box-shadow: var(--shadow-xs); }

.adm-table-wrap { overflow-x: auto; }
.adm-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.adm-table thead th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); font-weight: 600; padding: 9px 15px; border-bottom: 1px solid var(--border); white-space: nowrap; user-select: none; background: var(--surface); }
.adm-table thead th.sortable { cursor: pointer; }
.adm-table thead th.sortable:hover, .adm-table thead th.is-sorted { color: var(--text-muted); }
.adm-table tbody td { padding: 9px 15px; border-bottom: 1px solid var(--border); white-space: nowrap; vertical-align: middle; }
.adm-table tbody tr.is-clickable { cursor: pointer; }
.adm-table tbody tr.is-clickable:hover td { background: var(--surface-2); }
.adm-table tbody tr:last-child td { border-bottom: none; }
.adm-empty-cell { text-align: center; color: var(--text-faint); padding: 32px 15px !important; white-space: normal !important; }
.adm-ellipsis { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
td.adm-ellipsis { display: table-cell; }
.adm-who { display: flex; align-items: center; gap: 9px; min-width: 170px; }
.adm-who strong { display: block; font-weight: 600; }
.adm-who small { display: block; font-size: 11px; color: var(--text-faint); max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.adm-av { width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); display: grid; place-items: center; font-size: 11px; font-weight: 650; flex: none; }
.adm-bar-cell { display: flex; align-items: center; gap: 7px; font-variant-numeric: tabular-nums; }
.adm-bar { width: 52px; height: 5px; border-radius: 3px; background: var(--surface-3); overflow: hidden; display: inline-block; }
.adm-bar > i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.adm-more { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 15px; border-top: 1px solid var(--border); }
.adm-more-n { font-size: 10.5px; color: var(--text-faint); margin-left: 5px; }

.adm .chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: var(--r-full); border: none; cursor: inherit; margin-right: 4px; }
.adm .chip:hover { border: none; }
.adm .c-ok { background: var(--ok-bg); color: var(--ok-fg); }
.adm .c-warn { background: var(--warn-bg); color: var(--warn-fg); }
.adm .c-bad { background: var(--bad-bg); color: var(--bad-fg); }
.adm .c-info { background: var(--info-bg); color: var(--info-fg); }
.adm .c-mute { background: var(--surface-3); color: var(--text-muted); }
.adm .btn.is-on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.btn-danger-ghost { background: transparent; border-color: var(--bad-fg); color: var(--bad-fg); }
.btn-danger-ghost:hover:not(:disabled) { background: var(--bad-bg); }

.adm-todo { display: flex; flex-direction: column; }
.adm-todo-item { display: flex; align-items: center; gap: 10px; padding: 10px 15px; border: none; border-bottom: 1px solid var(--border); background: none; font: inherit; font-size: 13px; color: var(--text); text-align: left; cursor: pointer; }
.adm-todo-item:last-child { border-bottom: none; }
.adm-todo-item:hover { background: var(--surface-2); }
.adm-todo-item span { flex: 1; }
.adm-todo-item [data-icon], .adm-todo-item [data-icon] svg { width: 16px; height: 16px; flex: none; }
.adm-todo-item.is-warn > [data-icon]:first-child { color: var(--warn-fg); }
.adm-todo-item.is-bad > [data-icon]:first-child { color: var(--bad-fg); }
.adm-todo-item.is-mute > [data-icon]:first-child { color: var(--text-faint); }

.adm-preview { margin: 0 15px 15px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); }
.adm-preview-head { padding: 9px 12px; border-bottom: 1px solid var(--border); }
.adm-preview-head small { display: block; font-size: 11px; color: var(--text-faint); }
.adm-preview pre, .adm-script pre { margin: 0; padding: 12px; white-space: pre-wrap; font-family: var(--font-ui); font-size: 12.5px; line-height: 1.6; color: var(--text); max-height: 280px; overflow: auto; }

/* Panou lateral (fișa contului / prospectului / solicitării) */
.adm-backdrop { position: fixed; inset: 0; background: rgba(2, 6, 23, .5); opacity: 0; pointer-events: none; transition: opacity 200ms; z-index: 45; }
.adm-backdrop.open { opacity: 1; pointer-events: auto; }
.adm-drawer { position: fixed; top: 0; right: 0; height: 100vh; height: 100dvh; width: min(460px, 100vw); background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg); transform: translateX(102%); transition: transform 220ms cubic-bezier(.4, 0, .2, 1), visibility 220ms; z-index: 50; display: flex; flex-direction: column; visibility: hidden; }
.adm-drawer.open { transform: none; visibility: visible; }
.adm-drawer-head { padding: 16px 18px; border-bottom: 1px solid var(--border); display: flex; gap: 12px; align-items: flex-start; }
.adm-drawer-title { font-weight: 650; font-size: 15px; }
.adm-drawer-sub { font-size: 12px; color: var(--text-muted); word-break: break-word; }
.adm-drawer-body { flex: 1; overflow-y: auto; padding: 14px 18px 28px; }
.adm-av-lg { width: 44px; height: 44px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); display: grid; place-items: center; font-size: 15px; font-weight: 650; flex: none; }
.adm-h3 { font-size: 11.5px; font-weight: 650; color: var(--text-muted); margin: 18px 0 9px; text-transform: uppercase; letter-spacing: .05em; }
.adm-chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.adm-kv { display: grid; grid-template-columns: 128px minmax(0, 1fr); gap: 6px 12px; font-size: 13px; margin: 0; }
.adm-kv dt { color: var(--text-muted); }
.adm-kv dd { margin: 0; word-break: break-word; }
.adm-acts { display: flex; flex-wrap: wrap; gap: 7px; }
.adm-note { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: 9px 11px; font-size: 12.5px; color: var(--text-muted); line-height: 1.55; margin-bottom: 7px; }
.adm-note b { color: var(--text); }
.adm-gdpr { font-size: 11.5px; color: var(--text-faint); border-top: 1px solid var(--border); margin-top: 18px; padding-top: 12px; line-height: 1.6; }
.adm-log, .adm-msg { border-left: 2px solid var(--border-strong); padding: 2px 0 2px 10px; margin-bottom: 9px; font-size: 12.5px; }
.adm-log .when, .adm-msg .when { font-size: 11px; color: var(--text-faint); }
.adm-msg .what { white-space: pre-wrap; }
.adm-msg.is-admin { border-left-color: var(--accent); }
.adm-tel { color: var(--accent-text); font-weight: 600; font-variant-numeric: tabular-nums; text-decoration: none; }
.adm-tel:hover { text-decoration: underline; }
.adm-inline { display: flex; gap: 6px; margin-top: 9px; flex-wrap: wrap; }
.adm-date { flex: 1; min-width: 140px; height: 31px; font-size: 12.5px; }
.adm-textarea { width: 100%; font: inherit; font-size: 13px; }
.adm-script { border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); }
.adm-script summary { cursor: pointer; padding: 8px 12px; font-size: 12.5px; color: var(--text-muted); }

@media (max-width: 980px) {
  .adm { grid-template-columns: minmax(0, 1fr); }
  .adm-side { position: static; padding: 6px; }
  .adm-brand, .adm-nav-sep { display: none; }
  .adm-nav { flex-direction: row; overflow-x: auto; }
  .adm-nav-item { width: auto; white-space: nowrap; }
  .adm-search { width: 100%; }
  .adm-top-actions { flex-wrap: wrap; }
  .adm-kpis { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  .adm-kv { grid-template-columns: 110px minmax(0, 1fr); }
}
@media (max-width: 640px) { .announcements { padding: 10px 14px 0; } }

/* Anunțuri în aplicație (bandă deasupra conținutului) */
.announcements:empty { display: none; }
.announcements { display: flex; flex-direction: column; gap: 6px; padding: 10px 24px 0; }
.announce { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface); font-size: 13px; }
.announce .grow { flex: 1; }
.announce p { margin: 2px 0 0; color: var(--text-muted); white-space: pre-wrap; }
.announce > [data-icon], .announce > [data-icon] svg { width: 17px; height: 17px; flex: none; margin-top: 1px; }
.announce.is-info { border-left: 3px solid var(--accent); }
.announce.is-success { border-left: 3px solid var(--green-500); }
.announce.is-warning { border-left: 3px solid var(--amber-500); }
.announce .icon-btn { width: 28px; height: 28px; }

/* Fereastra „Ajutor și suport" */
.menu-item .badge { position: static; margin-left: auto; }
.support-list { display: flex; flex-direction: column; gap: 8px; }
.support-ticket { border: 1px solid var(--border); border-radius: var(--r-md); padding: 8px 12px; background: var(--surface-2); }
.support-ticket summary { cursor: pointer; font-size: 13px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.support-msg { border-left: 2px solid var(--border-strong); padding: 2px 0 2px 10px; margin: 10px 0; font-size: 13px; }
.support-msg.is-admin { border-left-color: var(--accent); }
.support-msg small { color: var(--text-faint); font-size: 11px; }
.support-msg p { margin: 2px 0 0; white-space: pre-wrap; }

.auth-link { display: block; margin: 10px auto 0; background: none; border: none; color: var(--accent-text); font: inherit; font-size: 12.5px; cursor: pointer; }
.auth-link:hover { text-decoration: underline; }
.cal-steps { margin: 0; padding-left: 20px; font-size: 13px; line-height: 1.6; display: flex; flex-direction: column; gap: 6px; }
.cal-alt { background: var(--accent-soft); border-radius: var(--r-md); padding: 10px 12px; font-size: 13px; margin-bottom: 14px; }
.cal-advanced { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 10px; }
.cal-advanced > summary { cursor: pointer; font-size: 12.5px; color: var(--text-muted); user-select: none; }
.cal-advanced[open] > summary { margin-bottom: 8px; }

/* Acțiuni rapide, primii pași, ajutor contextual */
.topbar-new { white-space: nowrap; }
@media (max-width: 720px) { .topbar-new span { display: none; } }
.qs-menu { display: flex; flex-direction: column; gap: 4px; padding: 4px; }
.qs-item { display: flex; gap: 10px; align-items: flex-start; text-align: left; padding: 9px 10px; border: none; border-radius: var(--r-md); background: none; color: var(--text); font: inherit; cursor: pointer; }
.qs-item:hover { background: var(--surface-3); }
.qs-item [data-icon], .qs-item [data-icon] svg { width: 18px; height: 18px; margin-top: 2px; color: var(--accent); flex: none; }
.qs-item strong { display: block; font-size: 13.5px; }
.qs-item small { display: block; font-size: 12px; color: var(--text-muted); }
.qs-card .card-head .pill { margin-left: 6px; }
.qs-bar { height: 4px; background: var(--surface-3); }
.qs-bar > i { display: block; height: 100%; background: var(--accent); transition: width var(--t-base); }
.qs-steps { display: flex; flex-direction: column; }
.qs-step { display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-top: 1px solid var(--border); }
.qs-step strong { display: block; font-size: 13.5px; }
.qs-step small { display: block; font-size: 12px; color: var(--text-muted); }
.qs-step.is-done strong { color: var(--text-muted); text-decoration: line-through; }
.qs-check { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-strong); display: grid; place-items: center; flex: none; }
.qs-step.is-done .qs-check { background: var(--green-500); border-color: var(--green-500); color: #fff; }
.qs-check [data-icon], .qs-check [data-icon] svg { width: 13px; height: 13px; }
.qs-banner { display: flex; gap: 10px; align-items: flex-start; background: var(--accent-soft); color: var(--text); border-radius: var(--r-md); padding: 12px 14px; margin-bottom: 14px; font-size: 13px; line-height: 1.55; }
.qs-banner > [data-icon], .qs-banner > [data-icon] svg { width: 18px; height: 18px; color: var(--accent); flex: none; margin-top: 1px; }
.page-title .help-btn { margin-left: 8px; vertical-align: middle; }
.help-btn { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-muted); font: 600 12.5px var(--font-ui); cursor: pointer; display: inline-grid; place-items: center; padding: 0; }
.help-btn:hover { color: var(--accent-text); border-color: var(--accent); }
.help-pop { padding: 4px 2px; font-size: 13px; line-height: 1.55; }
.help-pop strong { display: block; margin-bottom: 6px; font-size: 13.5px; }
.help-pop p { margin: 0 0 6px; color: var(--text-muted); }
