/* ==========================================================================
   Sistem Decizii ISJ — foaie de stil unică
   Fără dependențe externe (fără Bootstrap / jQuery / Select2).
   1. Token-uri     2. Bază     3. Structură     4. Componente     5. Tipar
   ========================================================================== */

/* 1. TOKEN-URI ------------------------------------------------------------ */
:root {
    color-scheme: light;

    --brand:        #1e4c8a;
    --brand-dark:   #143661;
    --brand-soft:   #eaf1fa;
    --brand-border: #c3d7ef;

    --ink-900: #0f172a;
    --ink-700: #334155;
    --ink-500: #64748b;
    --ink-400: #94a3b8;

    --bg:      #f1f5f9;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --line:    #e2e8f0;
    --line-strong: #cbd5e1;

    --ok:      #15803d;  --ok-bg:   #e9f6ed;  --ok-border:   #b8e0c5;
    --warn:    #a55a00;  --warn-bg: #fdf3e3;  --warn-border: #f0d5a8;
    --err:     #b42318;  --err-bg:  #fdeceb;  --err-border:  #f4c4c0;
    --info:    #0b6ba8;  --info-bg: #e8f3fb;  --info-border: #b9d9ee;

    --r-sm: 6px;
    --r:    10px;
    --r-lg: 14px;
    --r-pill: 999px;

    --sh-1: 0 1px 2px rgba(15, 23, 42, .06);
    --sh-2: 0 2px 8px rgba(15, 23, 42, .07);
    --sh-3: 0 10px 30px rgba(15, 23, 42, .10);

    /* Font cu serife, apropiat de cel al documentelor emise. */
    --font: "Times New Roman", Times, "Liberation Serif", Georgia, serif;
    --mono: "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace;

    --header-h: 60px;
}

/* 2. BAZĂ ----------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

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

body {
    margin: 0;
    font-family: var(--font);
    /* Times are ochiul mai mic decât fonturile fără serife: compensăm cu 1px. */
    font-size: 17px;
    line-height: 1.55;
    color: var(--ink-900);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5 { margin: 0 0 .5rem; line-height: 1.25; font-weight: 700; }
h1 { font-size: 1.75rem; letter-spacing: -.005em; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }
p  { margin: 0 0 1rem; }
p:last-child { margin-bottom: 0; }

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

img { max-width: 100%; height: auto; }

.muted     { color: var(--ink-500); }
.small     { font-size: .875rem; }
.tiny      { font-size: .78rem; }
.strong    { font-weight: 700; }
.mono      { font-family: var(--mono); }
.nowrap    { white-space: nowrap; }
.center    { text-align: center; }
.right     { text-align: right; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }
.hidden { display: none !important; }

/* Focus vizibil, consistent, peste tot. */
:focus-visible {
    outline: 3px solid #7aa7dd;
    outline-offset: 2px;
    border-radius: 4px;
}

.skip-link {
    position: absolute; left: -9999px; top: 0; z-index: 200;
    background: var(--brand); color: #fff; padding: .7rem 1.1rem;
    border-radius: 0 0 var(--r) 0; font-weight: 600;
}
.skip-link:focus { left: 0; }

/* 3. STRUCTURĂ ------------------------------------------------------------ */
.container      { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 1.25rem; }
.container-wide { width: 100%; max-width: 1440px; margin: 0 auto; padding: 0 1.25rem; }

main { padding: 1.75rem 0 4rem; }

/* --- Bara de sus --- */
.app-header {
    position: sticky; top: 0; z-index: 50;
    background: var(--brand-dark);
    color: #fff;
    box-shadow: var(--sh-2);
}
.app-header a { color: #fff; text-decoration: none; }

.app-header__inner {
    display: flex; align-items: center; gap: 1rem;
    min-height: var(--header-h);
}

.brand { display: flex; align-items: center; gap: .6rem; flex: none; }
.brand__mark {
    width: 34px; height: 34px; flex: none;
    display: grid; place-items: center;
    background: rgba(255, 255, 255, .14);
    border-radius: 8px; font-size: 1.05rem;
}
.brand__text { display: flex; flex-direction: column; }
/* Numele instituției poate fi foarte lung: îl limităm la două rânduri,
   ca bara de sus să rămână de aceeași înălțime. Numele complet e în title.
   „width: max-content” îi dă o lățime proprie, ca să nu fie strivit de meniu. */
.brand__name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    width: max-content;
    max-width: 200px;
    font-weight: 700; font-size: .82rem; line-height: 1.2;
    text-transform: uppercase; letter-spacing: .03em;
}
.brand__sub { display: block; font-weight: 400; font-size: .72rem; opacity: .72; letter-spacing: .02em; white-space: nowrap; }

.nav { display: flex; align-items: center; gap: .15rem; margin-left: auto; min-width: 0; }
.nav__link {
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .45rem .6rem; border-radius: var(--r-sm);
    font-size: .88rem; font-weight: 500; color: rgba(255, 255, 255, .84) !important;
    white-space: nowrap;
}
.nav__link:hover { background: rgba(255, 255, 255, .12); color: #fff !important; text-decoration: none; }
.nav__link[aria-current="page"] { background: rgba(255, 255, 255, .18); color: #fff !important; font-weight: 600; }
.nav__link--admin { color: #ffd79a !important; }
.nav__sep { width: 1px; height: 24px; background: rgba(255, 255, 255, .22); margin: 0 .45rem; }

.user-chip {
    display: inline-flex; align-items: center; gap: .55rem;
    padding: .3rem .35rem .3rem .7rem; border-radius: var(--r-pill);
    background: rgba(255, 255, 255, .12); font-size: .85rem;
    min-width: 0;
}
/* Numele complet se afișează întreg (ex. „ALEXANDRU BURBULEA”). Se scurtează
   cu „…” doar dacă un nume neobișnuit de lung chiar nu mai încape în bară. */
.user-chip__name {
    flex: 0 1 auto; min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-chip__role, .user-chip form { flex: none; }
.user-chip__role {
    font-size: .65rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700;
    background: rgba(255, 255, 255, .2); padding: .1rem .4rem; border-radius: var(--r-pill);
}
.user-chip form { margin: 0; }
.btn-logout {
    border: 0; cursor: pointer; font: inherit;
    background: rgba(255, 255, 255, .16); color: #fff;
    padding: .3rem .75rem; border-radius: var(--r-pill); font-size: .82rem; font-weight: 600;
}
.btn-logout:hover { background: #b42318; }

.nav-toggle {
    display: none; margin-left: auto;
    background: rgba(255, 255, 255, .12); color: #fff; border: 0;
    width: 42px; height: 38px; border-radius: var(--r-sm); cursor: pointer; font-size: 1.1rem;
}

@media (max-width: 1280px) {
    .nav-toggle { display: block; }
    .nav {
        display: none; position: absolute; left: 0; right: 0; top: var(--header-h);
        flex-direction: column; align-items: stretch; gap: 0;
        background: var(--brand-dark); padding: .5rem 1rem 1rem; margin: 0;
        box-shadow: var(--sh-3);
    }
    .nav.is-open { display: flex; }
    .nav__link { padding: .75rem .8rem; font-size: .95rem; }
    .nav__sep { width: auto; height: 1px; margin: .5rem 0; }
    .user-chip { justify-content: space-between; }
    .user-chip__name { max-width: none; }
}

/* --- Antetul paginii --- */
.page-head {
    display: flex; flex-wrap: wrap; align-items: flex-start; gap: 1rem;
    margin-bottom: 1.5rem;
}
.page-head__text { flex: 1 1 340px; min-width: 0; }
.page-head__actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.page-head h1 { margin-bottom: .2rem; }
.page-head .lead { color: var(--ink-500); margin: 0; font-size: .95rem; }

.breadcrumb { display: flex; flex-wrap: wrap; gap: .4rem; font-size: .82rem; color: var(--ink-500); margin-bottom: .6rem; }
.breadcrumb a { color: var(--ink-500); }
.breadcrumb a:hover { color: var(--brand); }
.breadcrumb span::before { content: "/"; margin-right: .4rem; color: var(--ink-400); }

/* --- Grile --- */
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.split  { display: grid; gap: 1.25rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 980px) {
    .split--sidebar { grid-template-columns: 360px minmax(0, 1fr); }
    .split--main    { grid-template-columns: minmax(0, 1fr) 340px; }
}

/* 4. COMPONENTE ----------------------------------------------------------- */

/* --- Card --- */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-1);
    overflow: hidden;
}
.card__head {
    display: flex; flex-wrap: wrap; align-items: center; gap: .75rem;
    padding: .9rem 1.25rem;
    background: var(--surface-2);
    border-bottom: 1px solid var(--line);
}
.card__head h2, .card__head h3 { margin: 0; font-size: 1rem; }
.card__head .spacer { margin-left: auto; }
.card__body { padding: 1.25rem; }
.card__body--flush { padding: 0; }
.card__foot {
    padding: .85rem 1.25rem; background: var(--surface-2);
    border-top: 1px solid var(--line);
    display: flex; flex-wrap: wrap; align-items: center; gap: .75rem;
}

/* --- Butoane --- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
    padding: .58rem 1.05rem;
    min-height: 42px;
    font: inherit; font-size: .92rem; font-weight: 600;
    border-radius: var(--r-sm);
    border: 1px solid transparent;
    background: var(--surface); color: var(--ink-900);
    cursor: pointer; text-decoration: none;
    transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { text-decoration: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }

.btn-primary   { background: var(--brand); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-dark); }
.btn-secondary { background: var(--surface); color: var(--ink-700); border-color: var(--line-strong); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-2); border-color: var(--ink-400); }
.btn-danger    { background: var(--err); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #911d14; }
.btn-ghost     { background: transparent; color: var(--ink-700); }
.btn-ghost:hover:not(:disabled) { background: rgba(15, 23, 42, .06); }
.btn-sm  { padding: .35rem .7rem; min-height: 34px; font-size: .82rem; }
.btn-lg  { padding: .8rem 1.6rem; min-height: 52px; font-size: 1rem; }
.btn-block { width: 100%; }

.btn-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.btn-row--end { justify-content: flex-end; }
.btn-row--center { justify-content: center; }

/* Bara lipită jos, cu acțiunea principală mereu la îndemână. */
.actionbar {
    position: sticky; bottom: 0; z-index: 20;
    display: flex; flex-wrap: wrap; align-items: center; gap: .75rem;
    padding: .85rem 1.25rem;
    margin: 1.5rem -1.25rem -1.25rem;
    background: var(--surface);
    border-top: 1px solid var(--line);
    box-shadow: 0 -4px 14px rgba(15, 23, 42, .06);
}
.actionbar .spacer { margin-left: auto; }

/* --- Formulare --- */
.section {
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 1.15rem 1.25rem 1.25rem;
    margin-bottom: 1.25rem;
    background: var(--surface);
}
.section__title {
    display: flex; align-items: center; gap: .6rem;
    font-size: .95rem; font-weight: 700; color: var(--ink-900);
    padding-bottom: .65rem; margin: 0 0 1.1rem;
    border-bottom: 1px solid var(--line);
}
.section__num {
    width: 26px; height: 26px; flex: none;
    display: grid; place-items: center;
    background: var(--brand-soft); color: var(--brand);
    border-radius: var(--r-pill); font-size: .8rem; font-weight: 700;
}
.section__hint { margin-left: auto; font-weight: 400; font-size: .8rem; color: var(--ink-500); }

.fields { display: grid; gap: 1rem; grid-template-columns: repeat(12, minmax(0, 1fr)); }
.field  { grid-column: span 12; min-width: 0; }
@media (min-width: 720px) {
    .c2 { grid-column: span 2; } .c3 { grid-column: span 3; } .c4 { grid-column: span 4; }
    .c5 { grid-column: span 5; } .c6 { grid-column: span 6; } .c8 { grid-column: span 8; }
    .c9 { grid-column: span 9; } .c12 { grid-column: span 12; }
}

.label {
    display: block; margin-bottom: .35rem;
    font-size: .82rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
    color: var(--ink-500);
}
.label .req { color: var(--err); margin-left: .15rem; }

.input, .select, .textarea {
    width: 100%; display: block;
    padding: .6rem .8rem; min-height: 44px;
    font: inherit; font-size: .95rem; color: var(--ink-900);
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--r-sm);
    transition: border-color .15s, box-shadow .15s;
}
.input::placeholder, .textarea::placeholder { color: var(--ink-400); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--ink-400); }
.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(30, 76, 138, .16);
}
.input:disabled, .textarea:disabled { background: var(--surface-2); color: var(--ink-500); }
.textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.textarea--code { font-family: var(--mono); font-size: .86rem; }

.select {
    appearance: none;
    padding-right: 2.2rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%2364748b'%3E%3Cpath d='M8 11 3.5 6h9z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .7rem center;
    background-size: 14px;
}

.input--key { font-weight: 700; color: var(--err); letter-spacing: .02em; }

.hint { display: block; margin-top: .35rem; font-size: .8rem; color: var(--ink-500); }
.field--invalid .input, .field--invalid .select, .field--invalid .combo__input { border-color: var(--err); }
.field-error { display: block; margin-top: .35rem; font-size: .8rem; font-weight: 600; color: var(--err); }

.check { display: flex; align-items: flex-start; gap: .6rem; font-size: .92rem; }
.check input { width: 18px; height: 18px; margin: .18rem 0 0; flex: none; accent-color: var(--brand); }

/* Câmp de fișier */
.file {
    display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
    padding: 1rem; border: 2px dashed var(--line-strong); border-radius: var(--r);
    background: var(--surface-2);
}
.file input[type="file"] { flex: 1 1 220px; font-size: .9rem; min-width: 0; }

/* --- Combo: listă căutabilă care acceptă și text liber --- */
.combo { position: relative; }
.combo__input { padding-right: 2.2rem; }
.combo__toggle {
    position: absolute; right: 1px; top: 1px; bottom: 1px; width: 2rem;
    display: grid; place-items: center;
    background: transparent; border: 0; cursor: pointer; color: var(--ink-500);
    border-radius: 0 var(--r-sm) var(--r-sm) 0;
}
.combo__toggle:hover { color: var(--brand); background: var(--surface-2); }
.combo__list {
    position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 4px);
    max-height: 280px; overflow-y: auto;
    margin: 0; padding: .25rem; list-style: none;
    background: var(--surface); border: 1px solid var(--line-strong);
    border-radius: var(--r); box-shadow: var(--sh-3);
}
.combo__list[hidden] { display: none; }
.combo__opt {
    padding: .5rem .65rem; border-radius: var(--r-sm);
    font-size: .92rem; cursor: pointer;
}
.combo__opt:hover, .combo__opt.is-active { background: var(--brand-soft); color: var(--brand-dark); }
.combo__opt mark { background: #fde68a; color: inherit; padding: 0 1px; border-radius: 2px; }
.combo__empty { padding: .6rem .65rem; font-size: .88rem; color: var(--ink-500); }

/* --- Tabele --- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { padding: .7rem .9rem; text-align: left; vertical-align: middle; }
.table thead th {
    position: sticky; top: 0; z-index: 2;
    background: var(--surface-2);
    font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
    color: var(--ink-500);
    border-bottom: 1px solid var(--line-strong);
    white-space: nowrap;
}
.table tbody tr { border-bottom: 1px solid var(--line); }
.table tbody tr:last-child { border-bottom: 0; }
.table tbody tr:hover { background: var(--brand-soft); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table td.actions { text-align: right; white-space: nowrap; }
.table td.actions .btn-row { justify-content: flex-end; flex-wrap: nowrap; }
.table__meta { display: block; font-size: .8rem; color: var(--ink-500); }
.table--scroll { max-height: 70vh; overflow-y: auto; }

/* --- Insigne --- */
.badge {
    display: inline-flex; align-items: center; gap: .3rem;
    padding: .2rem .6rem; border-radius: var(--r-pill);
    font-size: .78rem; font-weight: 700; letter-spacing: .03em;
    background: var(--surface-2); color: var(--ink-700); border: 1px solid var(--line);
    white-space: nowrap;
}
.badge--ok   { background: var(--ok-bg);   color: var(--ok);   border-color: var(--ok-border); }
.badge--warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-border); }
.badge--err  { background: var(--err-bg);  color: var(--err);  border-color: var(--err-border); }
.badge--info { background: var(--info-bg); color: var(--info); border-color: var(--info-border); }
.badge--brand{ background: var(--brand-soft); color: var(--brand); border-color: var(--brand-border); }

/* --- Alerte / mesaje flash --- */
.alert {
    display: flex; align-items: flex-start; gap: .75rem;
    padding: .85rem 1rem; margin-bottom: 1rem;
    border: 1px solid var(--line); border-left-width: 4px;
    border-radius: var(--r-sm);
    background: var(--surface-2); font-size: .93rem;
}
.alert__icon { flex: none; font-size: 1.1rem; line-height: 1.35; }
.alert__body { flex: 1; min-width: 0; }
.alert__body :last-child { margin-bottom: 0; }
.alert--success { background: var(--ok-bg);   border-color: var(--ok-border);   border-left-color: var(--ok); }
.alert--error   { background: var(--err-bg);  border-color: var(--err-border);  border-left-color: var(--err); }
.alert--warning { background: var(--warn-bg); border-color: var(--warn-border); border-left-color: var(--warn); }
.alert--info    { background: var(--info-bg); border-color: var(--info-border); border-left-color: var(--info); }
.alert__close {
    border: 0; background: transparent; cursor: pointer; color: inherit;
    font-size: 1.1rem; line-height: 1; padding: .1rem .3rem; opacity: .6;
}
.alert__close:hover { opacity: 1; }

/* --- Stat / dashboard --- */
.stat {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--r); padding: 1rem 1.1rem;
    display: flex; align-items: center; gap: .9rem;
}
.stat__icon {
    width: 42px; height: 42px; flex: none; display: grid; place-items: center;
    border-radius: var(--r); background: var(--brand-soft); font-size: 1.2rem;
}
.stat__value { font-size: 1.5rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat__label { font-size: .8rem; color: var(--ink-500); }

.tile {
    display: flex; align-items: center; gap: .9rem;
    padding: 1.05rem 1.15rem;
    background: var(--surface); color: inherit;
    border: 1px solid var(--line); border-radius: var(--r);
    box-shadow: var(--sh-1);
    transition: border-color .15s, box-shadow .15s, transform .15s;
}
.tile:hover {
    text-decoration: none; border-color: var(--brand-border);
    box-shadow: var(--sh-2); transform: translateY(-2px);
}
.tile__icon {
    width: 44px; height: 44px; flex: none; display: grid; place-items: center;
    border-radius: var(--r); background: var(--brand-soft); font-size: 1.35rem;
}
.tile__body  { display: block; min-width: 0; }
.tile__title { display: block; font-weight: 700; font-size: 1.02rem; line-height: 1.3; color: var(--ink-900); }
.tile__desc  { display: block; margin-top: .15rem; font-size: .88rem; line-height: 1.4; color: var(--ink-500); }
.tile--feature { border-color: var(--brand-border); background: linear-gradient(180deg, var(--brand-soft), var(--surface) 70%); }
.tile--feature .tile__icon { background: var(--brand); color: #fff; }

/* --- Bară de unelte / căutare --- */
.toolbar {
    display: flex; flex-wrap: wrap; align-items: center; gap: .6rem;
}
.toolbar .spacer { margin-left: auto; }
.search { display: flex; gap: .4rem; flex: 1 1 260px; min-width: 0; }
.search .input { min-height: 40px; }
.filters { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; }
.filters .field { grid-column: auto; }
.filters .label { margin-bottom: .2rem; }
.filters .search { max-width: 420px; }

/* --- Paginare --- */
.pagination { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; justify-content: center; }
.pagination a, .pagination span {
    display: inline-grid; place-items: center;
    min-width: 40px; height: 40px; padding: 0 .6rem;
    border: 1px solid var(--line-strong); border-radius: var(--r-sm);
    font-size: .88rem; font-weight: 600; color: var(--ink-700); background: var(--surface);
}
.pagination a:hover { background: var(--brand-soft); border-color: var(--brand-border); text-decoration: none; }
.pagination .is-current { background: var(--brand); border-color: var(--brand); color: #fff; }
.pagination .is-disabled { opacity: .45; }

/* --- Stare goală --- */
.empty { padding: 3rem 1.5rem; text-align: center; color: var(--ink-500); }
.empty__icon { font-size: 2.4rem; display: block; margin-bottom: .6rem; opacity: .7; }
.empty h3 { color: var(--ink-700); }

/* --- Dialog (înlocuiește confirm() și modalele Bootstrap) --- */
dialog.modal {
    width: min(560px, calc(100vw - 2rem));
    padding: 0; border: 0; border-radius: var(--r-lg);
    box-shadow: var(--sh-3); color: var(--ink-900); background: var(--surface);
}
dialog.modal::backdrop { background: rgba(15, 23, 42, .55); }
dialog.modal--wide { width: min(880px, calc(100vw - 2rem)); }
.modal__head {
    display: flex; align-items: center; gap: .75rem;
    padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); background: var(--surface-2);
}
.modal__head h2 { margin: 0; font-size: 1.05rem; }
.modal__close {
    margin-left: auto; border: 0; background: transparent; cursor: pointer;
    font-size: 1.3rem; line-height: 1; color: var(--ink-500); padding: .2rem .4rem; border-radius: var(--r-sm);
}
.modal__close:hover { background: rgba(15, 23, 42, .07); color: var(--ink-900); }
.modal__body { padding: 1.25rem; max-height: 65vh; overflow-y: auto; }
.modal__foot {
    display: flex; flex-wrap: wrap; gap: .5rem; justify-content: flex-end;
    padding: .9rem 1.25rem; border-top: 1px solid var(--line); background: var(--surface-2);
}

/* --- Previzualizare document --- */
.preview {
    background: #fff; border: 1px solid var(--line-strong); border-radius: var(--r-sm);
    padding: 1.5rem 1.75rem;
    font-family: Georgia, "Times New Roman", serif; font-size: .92rem; line-height: 1.5;
    text-align: justify; white-space: pre-wrap; word-break: break-word;
}
.preview strong { font-weight: 700; }
.preview__title { text-align: center; font-weight: 700; margin-bottom: 1rem; font-size: 1rem; }

/* --- Pagini centrate (login, erori) --- */
.page-centered {
    min-height: 100vh;
    display: grid; place-items: center;
    padding: 2rem 1.25rem;
    background: linear-gradient(160deg, #e8eef7 0%, var(--bg) 55%);
}
.auth-card {
    width: 100%; max-width: 420px;
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--r-lg); box-shadow: var(--sh-3);
    overflow: hidden;
}
.auth-card__head { padding: 1.75rem 1.75rem 1rem; text-align: center; }
.auth-card__mark {
    width: 54px; height: 54px; margin: 0 auto .75rem;
    display: grid; place-items: center; font-size: 1.6rem;
    background: var(--brand-soft); color: var(--brand); border-radius: var(--r-lg);
}
.auth-card__body { padding: 0 1.75rem 1.75rem; }
.auth-card__foot { padding: .9rem 1.75rem; background: var(--surface-2); border-top: 1px solid var(--line); text-align: center; font-size: .8rem; color: var(--ink-500); }

.msg-page {
    max-width: 520px; text-align: center; padding: 2.5rem 2rem;
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--r-lg); box-shadow: var(--sh-2);
}
.msg-icon { font-size: 2.6rem; display: block; margin-bottom: .75rem; }

/* --- Câmp de parolă cu comutator + indicator de putere --- */
.pass { position: relative; }
.pass .input { padding-right: 3.2rem; }
.pass__toggle {
    position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
    background: transparent; border: 0; cursor: pointer;
    font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
    color: var(--ink-500); padding: .4rem .55rem; border-radius: var(--r-sm);
}
.pass__toggle:hover { color: var(--brand); background: var(--surface-2); }
.meter { display: flex; gap: 4px; margin-top: .45rem; }
.meter__seg { height: 5px; flex: 1; border-radius: 3px; background: var(--line); }
.meter__seg.on-1 { background: var(--err); }
.meter__seg.on-2 { background: #d98324; }
.meter__seg.on-3 { background: #2f9e44; }
.meter__seg.on-4 { background: var(--ok); }

/* --- Subsol --- */
.app-footer {
    border-top: 1px solid var(--line);
    background: var(--surface);
    padding: 1.25rem 0;
    font-size: .82rem; color: var(--ink-500);
}
.app-footer__inner { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.app-footer .spacer { margin-left: auto; }

/* 5. TIPAR ---------------------------------------------------------------- */
@media print {
    .app-header, .app-footer, .actionbar, .page-head__actions, .toolbar, .pagination, .btn { display: none !important; }
    body { background: #fff; }
    .card { border: 0; box-shadow: none; }
    .table thead th { position: static; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
    .tile:hover { transform: none; }
}
