/*
 * Sistem de design – Programator Angajați și Utilaje.
 * Temă clară, sobră. Fără stiluri inline (CSP: style-src 'self'), fără fonturi/imagini externe.
 * Secțiuni: 1 variabile · 2 bază · 3 aplicație (layout) · 4 componente · 5 utilitare · 6 responsive
 */

/* ---- 1. Variabile ------------------------------------------------------------------------ */
:root {
    /* culori de bază */
    --color-bg: #f1f3f5;
    --color-surface: #ffffff;
    --color-surface-alt: #f8f9fa;
    --color-text: #1c2530;
    --color-muted: #5b6776;
    --color-border: #d3d9e0;
    --color-border-strong: #aeb7c2;

    /* culoare principală (albastru industrial) */
    --color-primary: #1e5a99;
    --color-primary-hover: #17497d;
    --color-primary-soft: #e6eef7;
    --color-on-primary: #ffffff;

    /* bară laterală / antet */
    --color-nav-bg: #1b2a3a;
    --color-nav-text: #d6dee8;
    --color-nav-muted: #7d8b9b;
    --color-nav-hover: rgba(255, 255, 255, 0.08);
    --color-nav-active: rgba(255, 255, 255, 0.14);
    --color-accent: #f2a900; /* galben de șantier – marcaj element activ */

    /* semantice */
    --color-danger: #b42318;
    --color-danger-hover: #912018;
    --color-danger-soft: #fdecea;
    --color-success: #1a6b3c;
    --color-success-soft: #e6f4ea;
    --color-warning: #8a5300;
    --color-warning-soft: #fff3d6;
    --color-info: #1e5a99;
    --color-info-soft: #e6eef7;

    /* spațieri */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.5rem;
    --space-6: 2rem;
    --space-7: 3rem;

    /* tipografie */
    --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, "Cascadia Mono", Consolas, Menlo, monospace;
    --text-xs: 0.8125rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.375rem;
    --text-2xl: 1.75rem;

    /* forme */
    --radius-sm: 4px;
    --radius: 6px;
    --radius-lg: 10px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
    --shadow: 0 2px 8px rgba(16, 24, 40, 0.08);
    --focus-ring: 0 0 0 3px rgba(30, 90, 153, 0.35);

    /* dimensiuni layout */
    --topbar-height: 3.5rem;
    --sidebar-width: 15rem;
}

/* ---- 2. Bază ----------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

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

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: 1.5;
    color: var(--color-text);
    background: var(--color-bg);
}

h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 var(--space-3); font-weight: 650; }
h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }
p { margin: 0 0 var(--space-3); }

a { color: var(--color-primary); }
a:hover { color: var(--color-primary-hover); }

code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 0.05em 0.35em;
}

:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

.skip-link {
    position: absolute; left: var(--space-2); top: -4rem; z-index: 100;
    background: var(--color-surface); color: var(--color-text);
    padding: var(--space-2) var(--space-4); border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.skip-link:focus { top: var(--space-2); }

/* ---- 3. Aplicație: antet, meniu lateral, conținut ---------------------------------------- */
.app { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
    position: sticky; top: 0; z-index: 30;
    height: var(--topbar-height);
    display: flex; align-items: center; gap: var(--space-3);
    padding: 0 var(--space-4);
    background: var(--color-nav-bg);
    color: var(--color-on-primary);
    border-bottom: 3px solid var(--color-accent);
}
.brand {
    display: flex; align-items: center; gap: var(--space-2);
    color: #fff; text-decoration: none; font-weight: 650; font-size: var(--text-lg);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.brand:hover { color: #fff; }
.brand-mark {
    flex: none; display: inline-flex; align-items: center; justify-content: center;
    width: 2rem; height: 2rem; border-radius: var(--radius);
    background: var(--color-accent); color: var(--color-nav-bg); font-weight: 800; font-size: var(--text-base);
}
.brand-name { overflow: hidden; text-overflow: ellipsis; }

.nav-toggle {
    display: none; flex: none;
    align-items: center; justify-content: center;
    width: 2.5rem; height: 2.5rem; padding: 0;
    background: transparent; color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3); border-radius: var(--radius); cursor: pointer;
}
.nav-toggle:hover { background: var(--color-nav-hover); }
.nav-toggle-bars, .nav-toggle-bars::before, .nav-toggle-bars::after {
    display: block; width: 1.25rem; height: 2px; background: currentColor; border-radius: 1px; content: "";
}
.nav-toggle-bars { position: relative; }
.nav-toggle-bars::before { position: absolute; top: -6px; left: 0; }
.nav-toggle-bars::after { position: absolute; top: 6px; left: 0; }

.account { margin-left: auto; display: flex; align-items: center; gap: var(--space-3); font-size: var(--text-sm); }
.account-name { font-weight: 600; color: #fff; white-space: nowrap; }
.account a, .account .link-button { color: var(--color-nav-text); text-decoration: none; }
.account a:hover, .account .link-button:hover { color: #fff; text-decoration: underline; }
.account-sep { width: 1px; height: 1.25rem; background: rgba(255, 255, 255, 0.25); }

.inline-form { display: inline; margin: 0; }
.link-button {
    background: none; border: 0; padding: 0; font: inherit; color: var(--color-primary);
    cursor: pointer; text-decoration: underline;
}

.app-body { flex: 1 1 auto; display: flex; min-height: 0; }

.sidebar {
    flex: none; width: var(--sidebar-width);
    background: var(--color-nav-bg);
    padding: var(--space-3) var(--space-2) var(--space-5);
    overflow-y: auto;
}
.menu { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.menu-item {
    display: block; padding: var(--space-2) var(--space-3);
    border-left: 3px solid transparent; border-radius: var(--radius-sm);
    color: var(--color-nav-text); text-decoration: none; font-size: var(--text-sm);
}
a.menu-item:hover { background: var(--color-nav-hover); color: #fff; }
.menu-item.is-active { background: var(--color-nav-active); border-left-color: var(--color-accent); color: #fff; font-weight: 600; }
.menu-item.is-disabled { color: var(--color-nav-muted); cursor: not-allowed; }
.sidebar :focus-visible { outline-color: #fff; }

.content { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

/* Zona principală: ocupă toată lățimea disponibilă (grila de planificare). Paginile de text
   pot adăuga .page-narrow pe un element interior pentru a limita lățimea. */
.main { flex: 1 0 auto; width: 100%; padding: var(--space-5); }
.page-narrow { max-width: 42rem; }
.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-5); }
.page-header h1 { margin: 0; }
.page-subtitle { margin: var(--space-1) 0 0; color: var(--color-muted); }

.footer { padding: var(--space-3) var(--space-5); color: var(--color-muted); font-size: var(--text-xs); }

/* Pagini fără meniu (login, erori pentru vizitatori) */
.auth-body { min-height: 100vh; display: flex; flex-direction: column; }
.auth-main { flex: 1 0 auto; display: flex; align-items: center; justify-content: center; padding: var(--space-5) var(--space-4); }
.auth-box { width: 100%; max-width: 26rem; }
.auth-brand { text-align: center; margin-bottom: var(--space-5); }
.auth-brand .brand-mark { width: 3.25rem; height: 3.25rem; font-size: var(--text-2xl); margin-bottom: var(--space-3); border-radius: var(--radius-lg); }
.auth-brand-name { display: block; font-size: var(--text-lg); font-weight: 650; }
.auth-brand-tagline { display: block; color: var(--color-muted); font-size: var(--text-sm); }
.auth-body .footer { text-align: center; }

/* ---- 4. Componente ----------------------------------------------------------------------- */

/* Carduri */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    box-shadow: var(--shadow-sm);
}
.card > :last-child { margin-bottom: 0; }
.card-title { font-size: var(--text-lg); margin-bottom: var(--space-2); }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-4); }
.card-header > * { margin-bottom: 0; }
.card-footer { margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--color-border); }
.card-form { max-width: 32rem; }
.card-error { text-align: center; max-width: 34rem; margin: var(--space-6) auto; }
.card.is-disabled { background: var(--color-surface-alt); box-shadow: none; color: var(--color-muted); }
.card.is-disabled .card-title { color: var(--color-muted); }

.card-grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); }

.error-code { font-size: 4rem; font-weight: 800; line-height: 1; color: var(--color-border-strong); margin: 0 0 var(--space-3); }

/* Butoane */
.button {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
    min-height: 2.5rem; padding: var(--space-2) var(--space-4);
    font: inherit; font-weight: 600; line-height: 1.2; text-decoration: none; cursor: pointer;
    color: var(--color-text); background: var(--color-surface);
    border: 1px solid var(--color-border-strong); border-radius: var(--radius);
    transition: background-color 0.12s, border-color 0.12s;
}
.button:hover { background: var(--color-surface-alt); border-color: var(--color-muted); color: var(--color-text); }
.button:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.button:disabled, .button.is-disabled { opacity: 0.55; cursor: not-allowed; }

.button-primary { background: var(--color-primary); border-color: var(--color-primary); color: var(--color-on-primary); }
.button-primary:hover { background: var(--color-primary-hover); border-color: var(--color-primary-hover); color: var(--color-on-primary); }

.button-secondary { background: var(--color-primary-soft); border-color: transparent; color: var(--color-primary); }
.button-secondary:hover { background: #d5e3f2; border-color: transparent; color: var(--color-primary-hover); }

.button-danger { background: var(--color-danger); border-color: var(--color-danger); color: #fff; }
.button-danger:hover { background: var(--color-danger-hover); border-color: var(--color-danger-hover); color: #fff; }

.button-sm { min-height: 2rem; padding: var(--space-1) var(--space-3); font-size: var(--text-sm); }
.button-block { display: flex; width: 100%; }
.button-row { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-4); }

/* Formulare */
.field { margin-bottom: var(--space-4); }
.field label, .field-label { display: block; margin-bottom: var(--space-1); font-weight: 600; font-size: var(--text-sm); }
.field .required { color: var(--color-danger); }
.field input[type="text"], .field input[type="password"], .field input[type="email"],
.field input[type="number"], .field input[type="date"], .field input[type="tel"],
.field input[type="search"], .field select, .field textarea {
    display: block; width: 100%; min-height: 2.5rem; padding: var(--space-2) var(--space-3);
    font: inherit; color: var(--color-text); background: var(--color-surface);
    border: 1px solid var(--color-border-strong); border-radius: var(--radius);
}
.field textarea { min-height: 6rem; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none; border-color: var(--color-primary); box-shadow: var(--focus-ring);
}
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--color-danger); }
.field.has-error input:focus, .field.has-error select:focus, .field.has-error textarea:focus { box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.3); }
.field-error { color: var(--color-danger); margin: var(--space-1) 0 0; font-size: var(--text-sm); font-weight: 500; }
.field-hint { color: var(--color-muted); margin: var(--space-1) 0 0; font-size: var(--text-sm); }
.field-check { display: flex; align-items: center; gap: var(--space-2); }
.field-check label { margin: 0; font-weight: 500; }

/* Alerte */
.alert {
    display: block; padding: var(--space-3) var(--space-4); margin-bottom: var(--space-4);
    border: 1px solid transparent; border-left-width: 4px; border-radius: var(--radius);
    font-size: var(--text-sm);
}
.alert > :last-child { margin-bottom: 0; }
.alert-success { background: var(--color-success-soft); border-color: #b9dfc6; border-left-color: var(--color-success); color: #124d2a; }
.alert-error, .alert-danger { background: var(--color-danger-soft); border-color: #f3c1bc; border-left-color: var(--color-danger); color: #7a1a12; }
.alert-warning { background: var(--color-warning-soft); border-color: #f1d59a; border-left-color: #d98e04; color: #5e3900; }
.alert-info { background: var(--color-info-soft); border-color: #c3d6ea; border-left-color: var(--color-info); color: #153f6b; }

/* Badge-uri */
.badge {
    display: inline-block; padding: 0.1rem 0.55rem; border-radius: 999px;
    font-size: var(--text-xs); font-weight: 600; line-height: 1.5; white-space: nowrap;
    background: #e8ebef; color: #3a4552;
}
.badge-primary { background: var(--color-primary-soft); color: var(--color-primary-hover); }
.badge-success { background: var(--color-success-soft); color: var(--color-success); }
.badge-warning { background: var(--color-warning-soft); color: var(--color-warning); }
.badge-danger { background: var(--color-danger-soft); color: var(--color-danger); }
.badge-muted { background: #eef0f3; color: var(--color-muted); }

/* Tabel de bază */
.table-wrap { overflow-x: auto; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); }
.table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.table th, .table td { padding: var(--space-2) var(--space-3); text-align: left; vertical-align: middle; border-bottom: 1px solid var(--color-border); }
.table thead th {
    background: var(--color-surface-alt); color: var(--color-muted); font-size: var(--text-xs);
    font-weight: 650; text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--color-surface-alt); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table-actions { white-space: nowrap; text-align: right; }

/* ---- 5. Utilitare ------------------------------------------------------------------------ */
.muted { color: var(--color-muted); font-size: var(--text-sm); }
.text-center { text-align: center; }
.text-left { text-align: left; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.kept-manual { margin-bottom: 1rem; }
.kept-manual summary { cursor: pointer; }
.visually-hidden {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
    clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---- 6. Responsive ----------------------------------------------------------------------- */
@media (max-width: 767.98px) {
    .main { padding: var(--space-4); }
    .account-name { max-width: 7rem; overflow: hidden; text-overflow: ellipsis; }
    .account-sep { display: none; }
    .account { gap: var(--space-3); }
    .page-header h1 { font-size: var(--text-xl); }

    /* Meniul devine colapsabil doar când JS rulează (clasa .js pusă de app.js); fără JS rămâne vizibil. */
    .js .nav-toggle { display: inline-flex; }
    .app-body { flex-direction: column; }
    .sidebar { width: 100%; max-height: 70vh; padding: var(--space-2); }
    .js .sidebar { display: none; }
    .js.nav-open .sidebar { display: block; }
    .menu-item { padding: var(--space-3); font-size: var(--text-base); }
}

@media (max-width: 420px) {
    .brand-name { display: none; }
}

@media (min-width: 768px) {
    .sidebar {
        position: sticky; top: var(--topbar-height);
        height: calc(100vh - var(--topbar-height)); align-self: flex-start;
    }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}

/* ---- 7. Nomenclatoare (etapa 2): filtre, paginare, fișe, formulare pe secțiuni ---------------
   Adăugat de backend-php ca să fie ecranele utilizabile; rafinarea vizuală rămâne a frontend-ui. */
.filters {
    display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-3);
    margin-bottom: var(--space-4); padding: var(--space-3) var(--space-4);
    background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg);
}
.filters .field { margin: 0; flex: 1 1 12rem; min-width: 10rem; }
.filters-actions { display: flex; gap: var(--space-2); flex: none; }

.sort-link { color: inherit; text-decoration: none; white-space: nowrap; }
.sort-link:hover { color: var(--color-primary); text-decoration: underline; }
.sort-link.is-sorted { color: var(--color-primary); }

.pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); margin-top: var(--space-3); }
.pagination p { margin: 0; }
.pagination-links { display: flex; align-items: center; gap: var(--space-3); font-size: var(--text-sm); }

.form-section { margin-bottom: var(--space-4); }
.form-grid { display: grid; gap: 0 var(--space-4); grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); align-items: start; }
.color-field { display: flex; align-items: center; gap: var(--space-2); }
.color-field input[type="color"] { flex: none; width: 2.75rem; height: 2.5rem; padding: 2px; border: 1px solid var(--color-border-strong); border-radius: var(--radius); background: var(--color-surface); cursor: pointer; }
.color-field input[type="text"] {
    display: block; width: 100%; min-height: 2.5rem; padding: var(--space-2) var(--space-3);
    font: inherit; color: var(--color-text); background: var(--color-surface);
    border: 1px solid var(--color-border-strong); border-radius: var(--radius);
}
.field.has-error .color-field input[type="text"] { border-color: var(--color-danger); }
.field-check input[type="checkbox"] { width: 1.1rem; height: 1.1rem; flex: none; }
.checklist { display: grid; gap: var(--space-1) var(--space-4); grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); max-height: 20rem; overflow-y: auto; padding: var(--space-3); border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-surface-alt); }

.color-dot { display: inline-block; width: 1rem; height: 1rem; vertical-align: -0.15em; border-radius: 3px; }
.color-dot-lg { width: 1.5rem; height: 1.5rem; vertical-align: -0.2em; }

.detail-grid { display: grid; gap: var(--space-3) var(--space-5); grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); margin: 0 0 var(--space-3); }
.detail-grid dt { font-size: var(--text-xs); font-weight: 650; text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-muted); }
.detail-grid dd { margin: 0; overflow-wrap: anywhere; }
.plain-list { margin: 0; padding-left: var(--space-5); }
.preline { white-space: pre-line; }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-5); }

/* ---- 8. Rafinări etapa 2 (frontend-ui): secțiuni, liste, librării vendorizate ------------------ */

/* Secțiuni de formular / fișă: titlu cu separator, spațiere uniformă */
.form-section > .card-title {
    margin: calc(var(--space-1) * -1) 0 var(--space-4); padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--color-border); font-size: var(--text-base); font-weight: 650;
    text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-muted);
}
.form-section { max-width: 64rem; }
.form-section .table-wrap { box-shadow: none; }
form > .button-row { position: sticky; bottom: 0; z-index: 5; max-width: 64rem; margin-top: 0; padding: var(--space-3) 0; background: linear-gradient(to top, var(--color-bg) 70%, rgba(241, 243, 245, 0)); }

/* Alerte de formular lângă titlu */
.page-header + .alert { max-width: 64rem; }

/* Filtre: aliniere pe același rând, câmp de căutare mai lat */
.filters .field:first-child { flex: 2 1 16rem; }
.filters .field label { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-muted); }
.filters .button { min-height: 2.5rem; }

/* Liste: antet lipit, rânduri aerisite, acțiuni discrete */
.table-wrap { box-shadow: var(--shadow-sm); }
.table tbody td { padding-top: 0.7rem; padding-bottom: 0.7rem; }
.table td a strong { font-weight: 600; }
.table-actions { display: flex; justify-content: flex-end; gap: var(--space-2); }
.table-actions .inline-form { display: inline-flex; }
.table-actions + .table-actions, td.table-actions { white-space: nowrap; }
.table td .color-dot { margin-right: var(--space-1); }

/* Badge-uri mai vizibile în fișe */
.badge-lg { padding: 0.2rem 0.8rem; font-size: var(--text-sm); }
.page-subtitle .badge { margin-right: var(--space-2); }

/* Fișe: dt/dd cu separator discret */
.detail-grid > div { padding: var(--space-2) 0; border-bottom: 1px dashed var(--color-border); }
.detail-grid dd { margin-top: 2px; font-size: var(--text-base); }
.map-link { display: inline-flex; vertical-align: middle; margin-left: var(--space-2); }

/* Revizie: panou de stare cu accent */
.status-panel { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); margin-bottom: var(--space-4); padding: var(--space-3) var(--space-4); border-radius: var(--radius); background: var(--color-surface-alt); border-left: 4px solid var(--color-border-strong); }
.status-panel.is-ok { border-left-color: var(--color-success); background: var(--color-success-soft); }
.status-panel.is-soon { border-left-color: #d98e04; background: var(--color-warning-soft); }
.status-panel.is-overdue { border-left-color: var(--color-danger); background: var(--color-danger-soft); }

/* Câmpuri: erori lângă câmp */
.field.has-error label { color: var(--color-danger); }
.field-error::before { content: "⚠ "; }
.field input[type="date"] { min-width: 0; }

/* ---- Tom Select (potrivit cu câmpurile aplicației) ---- */
.field .ts-wrapper { width: 100%; }
.ts-wrapper .ts-control, .ts-wrapper.single .ts-control {
    min-height: 2.5rem; padding: 0.4rem var(--space-3); font: inherit; color: var(--color-text);
    background: var(--color-surface); border: 1px solid var(--color-border-strong); border-radius: var(--radius); box-shadow: none;
}
.ts-wrapper.focus .ts-control { border-color: var(--color-primary); box-shadow: var(--focus-ring); }
.ts-wrapper.multi .ts-control > div { background: var(--color-primary-soft); color: var(--color-primary-hover); border: 0; border-radius: var(--radius-sm); padding: 0.1rem 0.5rem; }
.ts-wrapper.multi .ts-control > div.active { background: var(--color-primary); color: #fff; }
.ts-wrapper.plugin-remove_button .item .remove { border-left-color: rgba(0, 0, 0, 0.12); color: inherit; }
.ts-dropdown { border: 1px solid var(--color-border-strong); border-radius: var(--radius); box-shadow: var(--shadow); font-size: var(--text-sm); z-index: 60; }
.ts-dropdown .option, .ts-dropdown .no-results { padding: var(--space-2) var(--space-3); }
.ts-dropdown .active { background: var(--color-primary-soft); color: var(--color-text); }
.ts-dropdown .no-results { color: var(--color-muted); }
.field.has-error .ts-control { border-color: var(--color-danger); }
.filters .field .ts-wrapper { min-width: 10rem; }

/* ---- flatpickr ---- */
.field input.flatpickr-input[type="text"] { cursor: pointer; background-image: none; }
.flatpickr-calendar { font-family: var(--font-sans); border-radius: var(--radius-lg); box-shadow: var(--shadow); z-index: 70; }
.flatpickr-day.selected, .flatpickr-day.selected:hover { background: var(--color-primary); border-color: var(--color-primary); }
.flatpickr-day.today { border-color: var(--color-accent); }
.flatpickr-day.today:hover { background: var(--color-accent); border-color: var(--color-accent); color: var(--color-nav-bg); }
span.flatpickr-weekday { color: var(--color-muted); font-weight: 600; }

/* ---- Telefon: liste cu scroll orizontal controlat, filtre pe o coloană ---- */
@media (max-width: 767.98px) {
    .filters { flex-direction: column; align-items: stretch; }
    .filters .field, .filters .field:first-child { flex: none; min-width: 0; width: 100%; }
    .filters-actions .button { flex: 1; }
    .table-wrap .table { min-width: 40rem; }
    .table-wrap { -webkit-overflow-scrolling: touch; }
    .form-grid { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
    .card { padding: var(--space-4); }
    .page-header .button-row { width: 100%; }
    .pagination { justify-content: center; }
}
.main { min-width: 0; max-width: 100%; }
.table-wrap { max-width: 100%; }
@media (max-width: 767.98px) {
    .content, .app-body { max-width: 100vw; }
}
/* „Schimbă parola” rămâne vizibil pe telefon (QA etapa 1, m1). Pe ecrane foarte înguste se ascunde numele utilizatorului. */
@media (max-width: 380px) {
    .account-name { display: none; }
}
.table-wrap { position: relative; }

/* Etapa 3: badge-ul de alerte din antet (frontend-ui poate rafina) */
.account a.alert-link { display: inline-flex; align-items: center; gap: var(--space-1); }
.account a.alert-link:hover { text-decoration: none; }

/* ---- 9. Etapa 3 (frontend-ui): alerte, documente, indisponibilități, confirmări ----------------- */

/* Nuanțe suplimentare pentru badge-uri (portocaliu = urgent, în afara roșului) */
:root {
    --color-orange: #9a3f00;
    --color-orange-soft: #ffe6d0;
    --color-orange-edge: #e8710a;
    --color-yellow-edge: #d9a400;
    --color-teal: #0d6b6b;
    --color-teal-soft: #dcf2f1;
    --color-violet: #5b3fa0;
    --color-violet-soft: #ece7f8;
}
.badge-orange { background: var(--color-orange-soft); color: var(--color-orange); }
.badge-teal { background: var(--color-teal-soft); color: var(--color-teal); }
.badge-violet { background: var(--color-violet-soft); color: var(--color-violet); }
.badge-info { background: var(--color-info-soft); color: var(--color-info); }

/* Antet: link „Alerte” cu badge discret; pe telefon rămâne doar pictograma și numărul */
.account a.alert-link {
    padding: 0.15rem 0.35rem 0.15rem 0.6rem; border: 1px solid rgba(255, 255, 255, 0.25); border-radius: 999px;
}
.account a.alert-link:hover { background: var(--color-nav-hover); border-color: rgba(255, 255, 255, 0.5); }
.alert-link .badge { padding: 0 0.5rem; }
.alert-link-icon { display: none; }
@media (max-width: 520px) {
    .alert-link-text { display: none; }
    .alert-link-icon { display: inline; }
    .account a.alert-link { padding: 0.15rem 0.35rem; }
    .account { gap: var(--space-2); }
}

/* Etichete de stare / tip */
.is-replaced td { color: var(--color-muted); }
.is-replaced td strong { font-weight: 500; }
.is-past td { color: var(--color-muted); }
.is-past .badge { opacity: 0.75; }
.cell-sub { display: block; color: var(--color-muted); font-size: var(--text-xs); }

/* Panou de alerte: tuiluri de sinteză + grupuri colorate */
.stat-grid { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); max-width: 64rem; margin-bottom: var(--space-5); }
.stat-tile {
    display: block; padding: var(--space-3) var(--space-4); text-decoration: none; color: var(--color-text);
    background: var(--color-surface); border: 1px solid var(--color-border); border-top: 4px solid var(--color-border-strong);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
}
.stat-tile:hover { color: var(--color-text); box-shadow: var(--shadow); }
.stat-tile-value { display: block; font-size: var(--text-2xl); font-weight: 750; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-tile-label { display: block; margin-top: 2px; color: var(--color-muted); font-size: var(--text-xs); font-weight: 600; }
.stat-tile.is-danger { border-top-color: var(--color-danger); }
.stat-tile.is-danger .stat-tile-value { color: var(--color-danger); }
.stat-tile.is-orange { border-top-color: var(--color-orange-edge); }
.stat-tile.is-orange .stat-tile-value { color: var(--color-orange); }
.stat-tile.is-yellow { border-top-color: var(--color-yellow-edge); }
.stat-tile.is-yellow .stat-tile-value { color: var(--color-warning); }
.stat-tile.is-info { border-top-color: var(--color-info); }
.stat-tile.is-info .stat-tile-value { color: var(--color-info); }
.stat-tile.is-zero .stat-tile-value { color: var(--color-border-strong); }

.alert-group { border-left: 5px solid var(--color-border-strong); }
.alert-group.is-expired { border-left-color: var(--color-danger); }
.alert-group.is-week { border-left-color: var(--color-orange-edge); }
.alert-group.is-window { border-left-color: var(--color-yellow-edge); }
.alert-group.is-service { border-left-color: var(--color-info); }
.alert-group > .card-header { margin-bottom: var(--space-2); }
.alert-group-note { margin: 0 0 var(--space-3); }

.alert-list { list-style: none; margin: 0; padding: 0; }
.alert-item {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-4);
    padding: var(--space-3) 0; border-top: 1px solid var(--color-border);
}
.alert-item:first-child { border-top: 0; }
.alert-item-main { flex: 1 1 16rem; min-width: 0; }
.alert-item-title { font-weight: 650; overflow-wrap: anywhere; }
.alert-item-sub { display: block; color: var(--color-muted); font-size: var(--text-sm); overflow-wrap: anywhere; }
.alert-item-when { flex: none; display: flex; align-items: center; gap: var(--space-3); }
.alert-item-date { font-variant-numeric: tabular-nums; font-weight: 600; font-size: var(--text-sm); }

.empty-state { text-align: center; padding: var(--space-6) var(--space-4); max-width: 64rem; }
.empty-state-icon {
    display: inline-flex; align-items: center; justify-content: center; width: 3.5rem; height: 3.5rem; margin-bottom: var(--space-3);
    border-radius: 50%; background: var(--color-success-soft); color: var(--color-success); font-size: 1.75rem; font-weight: 800;
}
.empty-state h2 { margin-bottom: var(--space-1); }
.empty-state p { color: var(--color-muted); }

/* Secțiuni din fișe: panou pliabil de adăugare / istoric */
.card-title .badge { margin-left: var(--space-2); vertical-align: 0.1em; text-transform: none; letter-spacing: 0; }
.fold { margin-top: var(--space-4); border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-surface-alt); }
.fold > summary {
    display: flex; align-items: center; gap: var(--space-2); padding: var(--space-3) var(--space-4); cursor: pointer;
    font-weight: 650; font-size: var(--text-sm); list-style: none; user-select: none;
}
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::before { content: "▸"; display: inline-block; width: 1rem; color: var(--color-muted); transition: transform 0.12s; }
.fold[open] > summary::before { transform: rotate(90deg); }
.fold > summary:hover { color: var(--color-primary); }
.fold-body { padding: 0 var(--space-4) var(--space-4); }
.fold-primary { background: var(--color-primary-soft); border-color: #c3d6ea; }
.fold-primary > summary { color: var(--color-primary-hover); }
.fold-primary .fold-body { background: var(--color-surface); margin: 0 var(--space-3) var(--space-3); padding: var(--space-4); border-radius: var(--radius); }
.form-subtitle { margin: var(--space-4) 0 var(--space-3); font-size: var(--text-xs); font-weight: 650; text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-muted); }
.form-subtitle:first-child { margin-top: 0; }
.field-check { flex-wrap: wrap; }
.field-check .field-hint, .field-check .field-error { flex: 0 0 100%; margin-left: 1.6rem; }

/* Filtre pe grilă: toate câmpurile aliniate, căutarea pe două coloane */
.filters-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); align-items: end; gap: var(--space-3); }
.filters-grid .field, .filters-grid .field:first-child { flex: none; min-width: 0; width: 100%; }
.filters-grid .field-wide { grid-column: span 2; }

/* Confirmări (409 ALLOCATIONS_AFFECTED, citiri de contor): panou de avertizare + opțiuni explicate */
.confirm-panel {
    display: flex; gap: var(--space-4); max-width: 64rem; margin-bottom: var(--space-4); padding: var(--space-4) var(--space-5);
    background: var(--color-warning-soft); border: 1px solid #f1d59a; border-left: 5px solid var(--color-orange-edge); border-radius: var(--radius-lg); color: #4d2f00;
}
.confirm-panel-icon {
    flex: none; display: inline-flex; align-items: center; justify-content: center; width: 2.25rem; height: 2.25rem;
    border-radius: 50%; background: var(--color-orange-edge); color: #fff; font-weight: 800; font-size: 1.25rem;
}
.confirm-panel-body { min-width: 0; }
.confirm-panel h2 { margin: 0 0 var(--space-2); font-size: var(--text-lg); }
.confirm-panel p { margin-bottom: var(--space-2); }
.confirm-panel .plain-list { margin-bottom: var(--space-2); }
.chip-list { list-style: none; display: flex; flex-wrap: wrap; gap: var(--space-2); margin: var(--space-2) 0; padding: 0; }
.chip-list li { padding: 0.15rem 0.6rem; background: rgba(255, 255, 255, 0.75); border: 1px solid #ecc983; border-radius: 999px; font-size: var(--text-sm); font-variant-numeric: tabular-nums; }
.choice-list { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); max-width: 64rem; margin: var(--space-4) 0 var(--space-3); }
.choice { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-2); padding: var(--space-3) var(--space-4); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); }
.choice p { margin: 0; color: var(--color-muted); font-size: var(--text-sm); }
.choice-danger { border-color: #f3c1bc; }

@media (max-width: 767.98px) {
    .filters-grid { grid-template-columns: 1fr; }
    .filters-grid .field-wide { grid-column: auto; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .alert-item-when { width: 100%; justify-content: space-between; }
    .confirm-panel { padding: var(--space-3); gap: var(--space-3); }
    .choice-list { grid-template-columns: 1fr; }
    .choice .button { width: 100%; }
    .empty-state { padding: var(--space-5) var(--space-3); }
    .fold > summary { padding: var(--space-3); }
    .fold-body { padding: 0 var(--space-3) var(--space-3); }
    .fold-primary .fold-body { margin: 0 var(--space-2) var(--space-2); padding: var(--space-3); }
}

/* Celula de acțiuni rămâne celulă de tabel (display:flex o rupea din rând) */
td.table-actions { display: table-cell; text-align: right; white-space: nowrap; }
td.table-actions > * + * { margin-left: var(--space-2); }
td.table-actions .inline-form { display: inline-block; }
.fold-body form > .button-row { position: static; background: none; padding: 0; margin-top: var(--space-3); }
form > .button-row.is-static { position: static; background: none; padding: 0; margin-top: var(--space-3); }
.card form > .button-row { position: static; background: none; padding: 0; margin-top: var(--space-3); }

/* Tabele „în carduri” pe telefon: fiecare rând devine un bloc cu etichete (fără scroll orizontal) */
@media (max-width: 767.98px) {
    .table-wrap .table.table-stack { min-width: 0; }
    .table-stack thead { display: none; }
    .table-stack tbody, .table-stack tr { display: block; }
    .table-stack tr { padding: var(--space-3); border-bottom: 1px solid var(--color-border); }
    .table-stack tbody tr:last-child { border-bottom: 0; }
    .table-stack td { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); padding: 0.2rem 0; border: 0; text-align: right; }
    .table-stack td::before { content: attr(data-label); flex: none; color: var(--color-muted); font-size: var(--text-xs); font-weight: 650; text-transform: uppercase; letter-spacing: 0.04em; text-align: left; }
    .table-stack td:not([data-label])::before { content: none; }
    .table-stack td.num { text-align: right; }
    .table-stack td[data-label] > * { text-align: right; }
    .table-stack td.table-actions { display: flex; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-2); padding-top: var(--space-2); border-top: 1px dashed var(--color-border); }
    .table-stack td.table-actions > * + * { margin-left: 0; }
    .table-stack td.table-actions:empty { display: none; }
}
@media (max-width: 767.98px) { .table-stack td:empty { display: none; } }

/* ---- Import angajați (etapa 6) ------------------------------------------------------------ */
.diff-old { color: var(--color-muted); text-decoration: line-through; }
.diff-new { font-weight: 600; }
.import-bulk { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0 0 var(--space-3); }
.import-notes { max-width: 52rem; }
.import-upload input[type="file"] { max-width: 100% }
.table td input[type="checkbox"] { width: 1.15rem; height: 1.15rem; }
