/* ============================================================
   Siteap — stylesheet ("Calm Document" refinement)
   PALETTE: exactly 3 brand colors (change them here, once).
   ============================================================ */
:root {
    --c-dark:   #1B263B;   /* 1) navy   — topbar, headings           */
    --c-accent: #2E6BE6;   /* 2) blue   — primary action, links, focus */
    --c-light:  #F4F6FA;   /* 3) grey   — page background            */

    /* neutrals (not brand colors) */
    --c-white:         #FFFFFF;
    --c-text:          #25303F;
    --c-muted:         #6B7686;   /* secondary body text */
    --c-muted-2:       #8A94A6;   /* quiet micro-labels  */
    --c-border:        #E4E8F0;   /* card / panel hairlines */
    --c-border-strong: #DDE3EC;   /* form controls */
    --c-row-line:      #F1F3F8;   /* inner table rows */
    --c-row-hover:     #F7F9FC;

    --radius:    8px;
    --radius-sm: 6px;
    --radius-lg: 12px;

    --shadow-sm: 0 1px 2px rgba(27,38,59,.05);
    --shadow:    0 1px 2px rgba(27,38,59,.05), 0 1px 3px rgba(27,38,59,.06);
    --shadow-md: 0 4px 16px rgba(27,38,59,.10);
    --shadow-lg: 0 16px 40px rgba(27,38,59,.18);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', system-ui, -apple-system, Segoe UI, Arial, sans-serif;
    background: var(--c-light);
    color: var(--c-text);
    font-size: 14px;
    line-height: 1.5;
    letter-spacing: -0.006em;
    font-feature-settings: "cv11", "ss01";
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }

/* ===================== TOPBAR ===================== */
.topbar {
    background: var(--c-dark);
    color: var(--c-white);
    position: sticky; top: 0; z-index: 100;
    box-shadow: 0 1px 0 rgba(27,38,59,.12);
}
.topbar-inner {
    max-width: 1560px; margin: 0 auto; padding: 0 32px;
    height: 60px; display: flex; align-items: center; gap: 28px;
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
    width: 32px; height: 32px; background: var(--c-accent); color: #fff;
    border-radius: var(--radius-sm); display: grid; place-items: center;
    font-weight: 700; font-size: 18px;
}
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: -0.01em; }
.brand-logo { height: 32px; width: auto; max-width: 150px; object-fit: contain; display: block; border-radius: var(--radius-sm); }
.auth-brand .brand-logo { height: 40px; max-width: 200px; }

.nav { display: flex; align-items: center; gap: 2px; flex: 1; }
.nav-item { position: relative; }
.nav-link {
    display: flex; align-items: center; gap: 4px;
    padding: 8px 12px; border-radius: var(--radius-sm);
    color: rgba(255,255,255,.78); font-size: 13.5px; font-weight: 500;
    cursor: pointer; white-space: nowrap; transition: background .15s, color .15s;
}
.nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-link.active { background: transparent; color: #fff; box-shadow: inset 0 -2px 0 var(--c-accent); border-radius: 0; }
.caret { font-size: 9px; opacity: .55; margin-left: 4px; }

.dropdown {
    position: absolute; top: calc(100% + 6px); left: 0; min-width: 210px;
    background: var(--c-white); border: 1px solid var(--c-border);
    border-radius: var(--radius); box-shadow: var(--shadow-md); padding: 6px;
    opacity: 0; visibility: hidden; transform: translateY(-4px);
    transition: opacity .15s, transform .15s, visibility .15s;
}
.nav-item.has-children:hover .dropdown,
.nav-item.open .dropdown { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown-link { display: block; padding: 9px 12px; border-radius: var(--radius-sm); color: var(--c-text); font-size: 14px; }
.dropdown-link:hover { background: var(--c-light); color: var(--c-dark); }

.topbar-right { display: flex; align-items: center; gap: 18px; }
.lang { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.lang-link { color: rgba(255,255,255,.6); font-weight: 600; padding: 2px 4px; }
.lang-link.active, .lang-link:hover { color: #fff; }
.lang-sep { color: rgba(255,255,255,.3); }

.user-chip { display: flex; align-items: center; gap: 8px; }
a.user-chip { padding: 4px 6px; border-radius: var(--radius-sm); transition: background .15s; }
a.user-chip:hover { background: rgba(255,255,255,.08); }
.user-avatar {
    width: 30px; height: 30px; background: var(--c-accent); border-radius: 50%;
    display: grid; place-items: center; font-weight: 600; font-size: 13px; color: #fff;
}
.user-name { font-size: 13.5px; font-weight: 500; }
img.user-avatar { object-fit: cover; }

/* User avatars (photo or initials) */
.uavatar {
    border-radius: 50%; object-fit: cover; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(46,107,230,.12); color: var(--c-accent); font-weight: 600; overflow: hidden;
}
.uavatar--sm { width: 30px; height: 30px; font-size: 12px; }
.uavatar--md { width: 40px; height: 40px; font-size: 15px; }
.uavatar--lg { width: 64px; height: 64px; font-size: 22px; }
.avatar-upload { display: flex; align-items: center; gap: 16px; }
.avatar-controls { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.avatar-remove-btn { background: none; border: 0; padding: 0; color: var(--c-muted); font-size: 12px; cursor: pointer; text-decoration: underline; }
.avatar-remove-btn:hover { color: #c0392b; }

/* Role cards (Utilizatori) */
.role-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.role-card { display: flex; flex-direction: column; padding: 20px; }
.role-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.role-card-head h2 { font-size: 15px; font-weight: 600; color: var(--c-dark); margin: 0; }
.role-count { display: inline-block; margin-left: 4px; font-size: 12px; font-weight: 600; color: var(--c-muted); background: var(--c-light); border-radius: 999px; padding: 1px 8px; }
.link-btn { background: none; border: none; color: var(--c-accent); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; padding: 0; }
.link-btn:hover { text-decoration: underline; }
.role-card-list { display: flex; flex-direction: column; gap: 12px; flex: 1; }
.role-card-user { display: flex; align-items: center; gap: 10px; }
.rcu-info { flex: 1; min-width: 0; }
.rcu-name { font-size: 14px; font-weight: 600; color: var(--c-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rcu-email { font-size: 12px; color: var(--c-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rcu-empty { font-size: 13px; padding: 8px 0; }
.role-card-manage { margin-top: 16px; width: 100%; text-align: center; }

/* Status badges */
.status-badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.status-active   { background: #e7f6ee; color: #14794a; }
.status-pending  { background: #fdf6e3; color: #9a6b00; }
.status-inactive { background: #eef1f6; color: #6b7686; }

/* Users toolbar (tabs + search) */
.users-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 24px; border-bottom: 1px solid var(--c-border); flex-wrap: wrap; }
.user-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.user-tab { background: none; border: none; font: inherit; font-size: 13.5px; font-weight: 500; color: var(--c-muted); cursor: pointer; padding: 6px 12px; border-radius: var(--radius-sm); }
.user-tab:hover { background: var(--c-light); color: var(--c-dark); }
.user-tab.active { background: rgba(46,107,230,.10); color: var(--c-accent); }
.tab-count { font-size: 12px; opacity: .8; }
.user-search { width: 260px; max-width: 100%; padding: 8px 12px; border: 1px solid var(--c-border-strong); border-radius: var(--radius-sm); font-size: 14px; font-family: inherit; }
.user-search:focus { outline: none; border-color: var(--c-accent); box-shadow: 0 0 0 3px rgba(46,107,230,.12); }

/* Account cell (avatar + name) */
.account-cell { display: flex; align-items: center; gap: 10px; }

@media (max-width: 980px) {
    .role-cards { grid-template-columns: 1fr; }
    .users-toolbar { flex-direction: column; align-items: stretch; }
    .user-search { width: 100%; }
}

.logout-form { margin: 0; }
.logout-btn {
    background: transparent; border: 1px solid rgba(255,255,255,.25);
    color: rgba(255,255,255,.85); font: inherit; font-size: 13px; font-weight: 500;
    padding: 6px 12px; border-radius: var(--radius-sm); cursor: pointer;
    transition: background .15s, color .15s;
}
.logout-btn:hover { background: rgba(255,255,255,.12); color: #fff; }

/* ===================== PAGE ===================== */
.page { max-width: 1280px; margin: 0 auto; padding: 40px 32px; }
.page.layout-wide { max-width: 1560px; }
.page-head { margin-bottom: 28px; }
.page-head h1 { font-size: 22px; font-weight: 700; line-height: 1.25; letter-spacing: -0.02em; color: var(--c-dark); }
.page-head p { margin-top: 6px; }
.muted { color: var(--c-muted); }
.page-head--row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.back-link { display: inline-block; color: var(--c-accent); font-size: 14px; margin-bottom: 8px; }
.back-link:hover { text-decoration: underline; }

/* ===================== CARDS ===================== */
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 32px; }
.card { background: var(--c-white); border: 1px solid var(--c-border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); }
.card-label { font-size: 13px; color: var(--c-muted-2); font-weight: 500; margin-bottom: 8px; }
.card-value { font-size: 26px; font-weight: 700; color: var(--c-dark); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.card-unit { font-size: 14px; font-weight: 600; color: var(--c-muted); }

/* ===================== PANELS ===================== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.panel { background: var(--c-white); border: 1px solid var(--c-border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow-sm); }
.panel h2 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; color: var(--c-dark); margin-bottom: 20px; }
.panel--flush { padding: 0; overflow: hidden; }
.panel--narrow { max-width: 560px; }

/* ===================== BUTTONS ===================== */
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
    display: inline-block; padding: 9px 16px; border-radius: var(--radius-sm);
    font-size: 14px; font-weight: 500; cursor: pointer;
    background: var(--c-white); color: var(--c-text); border: 1px solid var(--c-border-strong);
    transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--c-light); border-color: #CDD5E3; }
.btn-primary { background: var(--c-accent); color: #fff; border-color: var(--c-accent); }
.btn-primary:hover { background: #2459C2; border-color: #2459C2; }
.btn-block { width: 100%; text-align: center; padding: 11px; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-danger { background: var(--c-white); color: #c0392b; border-color: #F0CDCD; }
.btn-danger:hover { background: #FDF2F2; }
.inline { display: inline; }

/* ===================== EMPTY STATE ===================== */
.empty-state { text-align: center; padding: 72px 20px; }
.empty-state h1 { font-size: 16px; font-weight: 600; color: var(--c-dark); margin-bottom: 6px; }
.empty-state .btn { margin-top: 20px; }

/* ===================== ALERTS ===================== */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 20px; font-size: 14px; }
.alert-success { background: #e7f6ee; color: #14794a; border: 1px solid #c2e7d3; }
.alert-error   { background: #fdecec; color: #b82020; border: 1px solid #f3c8c8; }
.alert-error ul { margin: 0; padding-left: 18px; }

/* ===================== TABLE ===================== */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table thead th {
    text-align: left; padding: 12px 20px; background: var(--c-white);
    color: var(--c-muted-2); font-weight: 600; font-size: 11px;
    text-transform: uppercase; letter-spacing: .06em;
    border-bottom: 1px solid var(--c-border);
}
.table tbody td { padding: 14px 20px; border-bottom: 1px solid var(--c-row-line); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--c-row-hover); }
.table th:first-child, .table td:first-child { padding-left: 24px; }
.table th:last-child, .table td:last-child { padding-right: 24px; }
.table .strong { font-weight: 600; color: var(--c-dark); }
.ta-right { text-align: right; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }

.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--c-row-line); color: var(--c-muted); }
.badge--accent { background: rgba(46,107,230,.10); color: var(--c-accent); }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; }
.dot--on  { background: #1faa5d; }
.dot--off { background: #c0c6d0; }

.pagination-wrap { padding: 16px 24px; }

/* ===================== FORMS ===================== */
.form .field { margin-bottom: 20px; }
.form label { display: block; font-size: 13px; font-weight: 600; color: var(--c-dark); margin-bottom: 6px; }
.form input[type=text],
.form input[type=email],
.form input[type=password],
.form input[type=date],
.form input[type=number],
.form select,
.form textarea {
    width: 100%; padding: 10px 12px;
    border: 1px solid var(--c-border-strong); border-radius: var(--radius-sm);
    font-size: 14px; font-family: inherit; color: var(--c-text); background: #fff;
}
.form textarea { resize: vertical; }
.form input:focus, .form select:focus, .form textarea:focus {
    outline: none; border-color: var(--c-accent); box-shadow: 0 0 0 3px rgba(46,107,230,.12);
}
.form .hint { display: block; margin-top: 5px; font-size: 12px; color: var(--c-muted-2); }
.form input[type=file] { font-size: 13px; }

.field--check { margin-top: 4px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--c-accent); }
.check--block { display: flex; align-items: center; gap: 8px; margin: 4px 0 16px; }
.form-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 28px; }

/* Field label wrapping an input (used in modals) */
.field-label { display: block; margin-bottom: 16px; font-size: 13px; font-weight: 600; color: var(--c-dark); }
.field-label input[type=text],
.field-label input[type=email],
.field-label input[type=password],
.field-label select {
    display: block; width: 100%; margin-top: 6px;
    padding: 10px 12px; border: 1px solid var(--c-border-strong); border-radius: var(--radius-sm);
    font-size: 14px; font-family: inherit; font-weight: 400; color: var(--c-text); background: #fff;
}
.field-label input:focus, .field-label select:focus {
    outline: none; border-color: var(--c-accent); box-shadow: 0 0 0 3px rgba(46,107,230,.12);
}
.field-label .hint { display: block; margin-top: 5px; font-weight: 400; }

/* Permissions section (Editor role) */
.perms-section { display: none; border: 1px solid var(--c-border); border-radius: var(--radius); padding: 16px; margin-bottom: 18px; background: #fff; }
.perms-title { font-size: 13px; font-weight: 600; color: var(--c-dark); margin-bottom: 4px; }
.perm-group { margin-top: 14px; }
.perm-group:first-of-type { margin-top: 8px; }
.perm-group-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--c-muted-2); margin-bottom: 8px; }
.perm-items { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; }
.perm-item { font-size: 13px; font-weight: 500; }
.perm-item input { width: 15px; height: 15px; accent-color: var(--c-accent); }

/* Projects assignment in user modal */
.user-projects { margin-bottom: 16px; }
.ulabel { font-size: 13px; font-weight: 600; color: var(--c-dark); margin-bottom: 8px; }

/* Form sections + responsive grid */
.form-section {
    font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
    color: var(--c-muted-2); margin: 28px 0 16px; padding-bottom: 8px; border-bottom: 1px solid var(--c-border);
}
.form-section:first-child { margin-top: 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 24px; }

/* Larger contract-form fields */
.form-lg input[type=text],
.form-lg input[type=email],
.form-lg input[type=password],
.form-lg input[type=date],
.form-lg input[type=number],
.form-lg select { padding-top: 15px; padding-bottom: 15px; }
.form-lg .tagselect-box { min-height: 52px; }

/* Nice file upload button */
.file-field { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; }
.file-input { position: absolute; width: 1px; height: 1px; padding: 0; opacity: 0; overflow: hidden; }
.file-btn {
    display: inline-block; padding: 11px 20px;
    background: var(--c-white); color: var(--c-text);
    border: 1px solid var(--c-border-strong); border-radius: var(--radius-sm);
    font-size: 14px; font-weight: 500; transition: background .15s, border-color .15s;
}
.file-field:hover .file-btn { background: var(--c-light); border-color: #CDD5E3; }
.file-name { font-size: 13px; color: var(--c-muted); }

/* Inline link */
.link { color: var(--c-accent); font-weight: 500; }
.link:hover { text-decoration: underline; }

/* Topbar project switcher */
.proj-switch-current { background: rgba(255,255,255,.10); color: #fff; font-weight: 600; }
.proj-switch-option { width: 100%; text-align: left; background: none; border: none; cursor: pointer; font: inherit; }
.proj-switch-option.is-active { color: var(--c-accent); font-weight: 600; }
.dropdown--right { left: auto; right: 0; }

/* No-project banner */
.project-banner {
    background: #fff7e6; color: #8a5a00; border-bottom: 1px solid #f0e0b8;
    text-align: center; padding: 10px 16px; font-size: 14px;
}

/* Project picker choices (login pop-up) */
.project-choices { display: flex; flex-direction: column; gap: 8px; }
.project-choice {
    display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
    padding: 12px; background: #fff; border: 1px solid var(--c-border-strong);
    border-radius: var(--radius-sm); cursor: pointer; transition: background .15s, border-color .15s;
}
.project-choice:hover { background: var(--c-light); border-color: var(--c-accent); }
.project-choice-text { display: flex; flex-direction: column; }
.project-choice-name { font-weight: 600; color: var(--c-dark); font-size: 14px; }
.project-choice-addr { font-size: 13px; color: var(--c-muted); }

/* Project photo thumbnail + preview */
.project-thumb {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: var(--radius-sm);
    object-fit: cover; background: var(--c-light); color: var(--c-muted-2);
    font-weight: 600; font-size: 15px; vertical-align: middle;
}
.project-thumb--empty { border: 1px solid var(--c-border); }
.foto-preview { margin-bottom: 10px; }
.foto-preview img { max-width: 180px; max-height: 130px; border-radius: var(--radius-sm); border: 1px solid var(--c-border); display: block; }

/* Actiune/detalii picker: dropdown on the left, chosen field on the right */
.detalii-row { display: flex; gap: 12px; align-items: flex-start; }
.detalii-select { flex: 0 0 220px; }
.detalii-inputs { flex: 1; min-width: 0; }
.detalii-inputs input { display: none; }
.detalii-inputs input.active { display: block; }
@media (max-width: 980px) {
    .detalii-row { flex-direction: column; }
    .detalii-select { flex: none; width: 100%; }
}

/* Combined "Detalii" cell (Descriere | Avans | Comenzi) */
.detalii-cell { max-width: 360px; font-size: 14px; line-height: 1.5; }
.detalii-label { font-weight: 600; color: var(--c-dark); }
.detalii-sep { color: var(--c-border); margin: 0 7px; font-weight: 600; }

/* Contract documents */
.doc-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.doc-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--c-border); border-radius: var(--radius-sm); }
.doc-name { flex: 1; min-width: 0; word-break: break-all; }
.new-docs { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.new-doc-row { display: flex; gap: 10px; align-items: center; }
.new-doc-cat { flex: 0 0 200px; }
.new-doc-file { flex: 1; font-size: 13px; }
.doc-chip { display: inline-block; font-size: 13px; margin: 1px 8px 1px 0; white-space: nowrap; }
@media (max-width: 980px) {
    .new-doc-row { flex-direction: column; align-items: stretch; }
    .new-doc-cat { flex: none; width: 100%; }
}

/* Contract status badges (functional semantic tints) */
.cstatus-rezolvat      { background: #e7f6ee; color: #14794a; }
.cstatus-asteptam      { background: #fdf6e3; color: #9a6b00; }
.cstatus-nu_impune     { background: #eef1f6; color: #6b7686; }
.cstatus-in_ofertare   { background: rgba(46,107,230,.10); color: var(--c-accent); }
.cstatus-de_finalizat  { background: #fdf0e6; color: #b5651d; }
.cstatus-in_curs       { background: rgba(46,107,230,.10); color: var(--c-accent); }
.cstatus-cauta_solutie { background: #eef1f6; color: #6b7686; }
.status-note { font-size: 12px; color: var(--c-muted); margin-top: 3px; max-width: 220px; }
.status-detail-wrap { display: none; }

/* Responsabili tag select */
.tagselect { position: relative; }
.tagselect-box {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
    padding: 6px 8px; min-height: 42px;
    border: 1px solid var(--c-border-strong); border-radius: var(--radius-sm); background: #fff;
}
.tagselect-box:focus-within { border-color: var(--c-accent); box-shadow: 0 0 0 3px rgba(46,107,230,.12); }
.tagselect-chips { display: contents; }
.tag-chip {
    display: inline-flex; align-items: center; gap: 2px;
    background: rgba(46,107,230,.10); color: var(--c-accent);
    border-radius: 999px; padding: 3px 6px 3px 11px; font-size: 13px; font-weight: 500;
}
.tag-chip button { background: none; border: none; color: var(--c-accent); cursor: pointer; font-size: 16px; line-height: 1; padding: 0 3px; }
.tag-chip button:hover { color: #1a4fb0; }
.tagselect-input { flex: 1; min-width: 150px; border: none; outline: none; font: inherit; font-size: 14px; padding: 4px; background: transparent; }
.tagselect-dropdown {
    position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 50;
    background: #fff; border: 1px solid var(--c-border); border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md); max-height: 240px; overflow-y: auto; display: none;
}
.tagselect-dropdown.open { display: block; }
.tagselect-option { padding: 9px 12px; font-size: 14px; cursor: pointer; }
.tagselect-option:hover { background: var(--c-light); color: var(--c-accent); }

/* ===================== MODAL ===================== */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(20,28,46,.45);
    display: none; align-items: center; justify-content: center;
    padding: 24px; z-index: 200;
}
.modal-overlay.open { display: flex; }
.modal {
    background: var(--c-white); border-radius: var(--radius-lg); width: 100%; max-width: 460px;
    box-shadow: var(--shadow-lg); animation: modalIn .15s ease-out;
    display: flex; flex-direction: column; max-height: calc(100vh - 48px);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
.modal--lg { max-width: 540px; }
.modal--add { max-width: 860px; }
.modal--xl { max-width: 780px; }

/* Two fields side by side (Prenume+Nume, Email+Telefon) */
.field-row { display: flex; gap: 16px; align-items: flex-start; }
.field-row .field-label { flex: 1 1 0; min-width: 0; }

/* Drepturi: Administrator toggle + per-project view/edit grid */
.drepturi { margin: 6px 0 4px; }
.drepturi-admin { margin: 8px 0 16px; font-weight: 600; }
.perm-projects { display: flex; flex-direction: column; gap: 16px; }
.perm-project-title { font-size: 14px; font-weight: 700; color: var(--c-dark); margin-bottom: 6px; }
.perm-grid { width: 100%; border-collapse: collapse; }
.perm-grid td { border: 1px solid var(--c-border); padding: 9px 12px; }
.perm-grid .pg-mod { font-weight: 500; }
.perm-grid .pg-cb { width: 150px; }
.perm-grid .pg-cb .check { font-weight: 500; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; border-bottom: 1px solid var(--c-border); }
.modal-head h2 { font-size: 15px; font-weight: 600; color: var(--c-dark); }
.modal-close { background: none; border: none; font-size: 22px; line-height: 1; color: var(--c-muted); cursor: pointer; padding: 0 4px; }
.modal-close:hover { color: var(--c-dark); }
.modal-body { padding: 20px 24px 24px; overflow-y: auto; }

/* ===================== LOGIN ===================== */
.auth-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: linear-gradient(135deg, var(--c-dark) 0%, #2a3a57 100%); }
.auth-card { width: 100%; max-width: 400px; background: var(--c-white); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 36px 32px; }
.auth-brand { display: flex; align-items: center; gap: 10px; justify-content: center; margin-bottom: 22px; }
.auth-brand .brand-name { color: var(--c-dark); font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.auth-title { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; color: var(--c-dark); text-align: center; }
.auth-sub { text-align: center; margin-bottom: 24px; font-size: 14px; }
.btn-block { width: 100%; text-align: center; padding: 11px; }
.auth-forgot { text-align: center; margin-top: 16px; font-size: 13px; }
.auth-forgot a { color: var(--c-accent); }
.auth-forgot a:hover { text-decoration: underline; }
.auth-lang { text-align: center; margin-top: 20px; font-size: 13px; }
.auth-lang a { color: var(--c-accent); }
.auth-lang a:hover { text-decoration: underline; }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 980px) {
    .page { padding: 28px 20px; }
    .topbar-inner { padding: 0 20px; }
    .cards { grid-template-columns: repeat(2, 1fr); }
    .grid-2 { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .nav { display: none; } /* a mobile menu can be added later */
}

/* ===================== CONTRACTS TRACKING ===================== */
/* Generic form helpers (used in modals outside a .form wrapper) */
.form-control { width: 100%; padding: 10px 12px; border: 1px solid var(--c-border-strong); border-radius: var(--radius-sm); font-size: 14px; font-family: inherit; color: var(--c-text); background: #fff; }
.form-control:focus { outline: none; border-color: var(--c-accent); box-shadow: 0 0 0 3px rgba(46,107,230,.12); }
textarea.form-control { resize: vertical; }

/* Uniform single-line field heights inside modals */
.modal-body input.form-control:not([type=file]),
.modal-body select.form-control { height: 42px; }
.modal-body input[type=file].form-control { height: 42px; padding-top: 9px; padding-bottom: 9px; }
.modal-body .ac-box { min-height: 42px; }
.modal-body textarea.form-control { min-height: 42px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--c-dark); margin-bottom: 6px; }
.form-error { display: block; margin-top: 5px; font-size: 12px; color: #c0392b; }
.form-row { display: flex; gap: 16px; flex-wrap: wrap; }
.form-row .field { flex: 1; min-width: 140px; }
.modal-body .field { margin-bottom: 18px; }

/* Table layout */
.contracts-table th.th-narrow, .contracts-table td.hist-cell, .contracts-table td.nr-crt { width: 1%; white-space: nowrap; }
.contracts-table .th-termen { width: 130px; }
.contracts-table .th-status { width: 155px; }
.contracts-table .th-docs { width: 135px; }
.contracts-table td { vertical-align: middle; }
.nr-crt { text-align: center; color: var(--c-muted); font-weight: 600; }

/* Tracking expander arrow */
.hist-btn { background: none; border: none; cursor: pointer; font-size: 26px; line-height: 1; color: var(--c-muted); padding: 0 6px; border-radius: var(--radius-sm); transition: transform .15s, color .15s; }
.hist-btn:hover { color: var(--c-dark); }
.hist-btn.open { transform: rotate(180deg); color: var(--c-accent); }
.contracts-table td.hist-cell { text-align: center; }

/* Compact rows + wider Obiect Contract column */
.contracts-table thead th { padding: 9px 12px; }
.contracts-table tbody td { padding: 7px 12px; }
.contracts-table th:first-child, .contracts-table td:first-child { padding-left: 18px; }
.contracts-table th:last-child, .contracts-table td:last-child { padding-right: 14px; }
.contracts-table .th-obiect { width: 400px; }

/* Contracts filter bar */
.contracts-filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: flex-end; padding: 14px 18px; border-bottom: 1px solid var(--c-border); }
.filter-input, .filter-select { padding: 8px 12px; border: 1px solid var(--c-border-strong); border-radius: var(--radius-sm); font-size: 13.5px; font-family: inherit; color: var(--c-text); background: #fff; }
.filter-input { flex: 0 1 440px; min-width: 150px; }
.filter-select { flex: 0 0 auto; min-width: 170px; cursor: pointer; }
.filter-input:focus, .filter-select:focus { outline: none; border-color: var(--c-accent); box-shadow: 0 0 0 3px rgba(46,107,230,.12); }

/* Editable cells */
.cell-editable { display: block; width: 100%; text-align: left; background: none; border: 1px dashed transparent; border-radius: var(--radius-sm); padding: 6px 8px; font: inherit; color: var(--c-text); cursor: pointer; white-space: normal; }
.cell-editable:hover { border-color: var(--c-border-strong); background: #fbfcfe; }

/* Termen — colored pill, like Status */
.termen-cell { padding: 6px 10px; }
.termen-input, .termen-pill {
    display: inline-block; border: 1px solid var(--c-border-strong); border-radius: 999px;
    padding: 5px 12px; font-size: 13px; font-weight: 500; font-family: inherit; background: #fff;
    cursor: pointer; text-align: center;
}
.termen-input { width: 116px; }
.termen-input:focus { outline: none; box-shadow: 0 0 0 3px rgba(46,107,230,.12); }
.termen-green  { background: #e9f7ef; color: #14794a; border-color: #c2e7d3; }
.termen-orange { background: #fdf3e3; color: #9a6b00; border-color: #f0e2b8; }
.termen-red    { background: #fdecea; color: #b03b2e; border-color: #f3c8c2; }

/* Status inline */
.status-select-inline { border: 1px solid var(--c-border-strong); border-radius: 999px; padding: 5px 10px; font-size: 13px; font-weight: 500; font-family: inherit; cursor: pointer; background: #fff; }
.status-select-inline:focus { outline: none; border-color: var(--c-accent); }
.cstatus-ofertare    { background: #fdf6e3; color: #9a6b00; border-color: #f0e2b8; }
.cstatus-contractare { background: #e8f0fe; color: #1a56c4; border-color: #c9dcfb; }
.cstatus-rezolvat    { background: #e7f6ee; color: #14794a; border-color: #c2e7d3; }
span.badge.cstatus-ofertare, span.badge.cstatus-contractare, span.badge.cstatus-rezolvat { font-weight: 500; }

/* Documents */
.doc-btn { white-space: nowrap; }
.docs-list { margin-bottom: 16px; }
.doc-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--c-border); }
.doc-row:last-child { border-bottom: none; }
.doc-name { flex: 1; min-width: 0; word-break: break-word; }
.doc-add-form { border-top: 1px solid var(--c-border); padding-top: 14px; }
.doc-add-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.doc-add-row select { flex: 0 0 130px; }
.doc-add-row input[type=file] { flex: 1; min-width: 140px; }

/* Documents inside the Add-contract form */
.add-doc-row { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.add-doc-row .filepick { flex: 0 0 auto; }
.add-doc-desc { flex: 1 1 220px; }
.add-doc-remove { flex: 0 0 auto; line-height: 1; }
/* "+ Adauga document" — a tidy accent-tinted add button, with breathing room before the hint. */
#addDocRowBtn { margin-top: 4px; color: var(--c-accent); background: rgba(46,107,230,.06); border: 1px solid var(--c-border-strong); border-radius: var(--radius-sm); padding: 8px 14px; font-size: 13px; font-weight: 600; }
#addDocRowBtn:hover { background: rgba(46,107,230,.12); border-color: var(--c-accent); }
#addDocRowBtn + .hint { margin-top: 14px; }

/* Custom file picker — guaranteed visible, styled button + filename */
.filepick { position: relative; display: inline-flex; align-items: center; gap: 10px; vertical-align: middle; }
.filepick-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.filepick-btn { display: inline-block; background: var(--c-accent); color: #fff; padding: 9px 18px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; white-space: nowrap; }
.filepick:hover .filepick-btn { filter: brightness(.93); }
.filepick-btn--err { box-shadow: 0 0 0 2px #c0392b; }
.filepick-name { font-size: 13px; color: var(--c-muted); max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Autocomplete (responsabil / membri) */
.ac { position: relative; }
.ac-box { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 42px; padding: 6px 8px; border: 1px solid var(--c-border-strong); border-radius: var(--radius-sm); background: #fff; }
.ac-box:focus-within { border-color: var(--c-accent); box-shadow: 0 0 0 3px rgba(46,107,230,.12); }
.ac-chips { display: contents; }
.ac-chip { display: inline-flex; align-items: center; gap: 6px; background: rgba(46,107,230,.10); color: var(--c-accent); border-radius: 999px; padding: 3px 6px 3px 10px; font-size: 13px; font-weight: 500; }
.ac-chip button { background: none; border: none; color: inherit; cursor: pointer; font-size: 15px; line-height: 1; padding: 0; }
.ac-input { flex: 1; min-width: 120px; border: none; outline: none; font: inherit; padding: 4px; background: none; }
.ac-dropdown { display: none; position: absolute; left: 0; right: 0; top: 100%; margin-top: 4px; background: #fff; border: 1px solid var(--c-border-strong); border-radius: var(--radius-sm); box-shadow: 0 8px 24px rgba(27,38,59,.12); z-index: 20; max-height: 220px; overflow-y: auto; }
.ac-dropdown.open { display: block; }
.ac-option { padding: 9px 12px; cursor: pointer; font-size: 14px; }
.ac-option:hover { background: var(--c-light); }

/* Inline tracking timeline (expands under the contract) */
.tracking-row > .tracking-cell { background: #fff; padding: 14px 20px 16px 48px; border-bottom: 2px solid var(--c-border); }

/* Main contract line uses the pale tone; the preview + full history are white. */
.contracts-table tbody tr.contract-row > td { border-bottom: none; background: #f8fafc; }
.contracts-table tbody tr.contract-row:hover > td { background: #eef2f8; }
.last-mod-row > .last-mod-cell { background: #fff; padding: 4px 18px 8px; border-bottom: 1px solid var(--c-border); }
.last-mod-cell .track-item { padding: 0; border: none; font-size: 12.5px; }
.last-mod-cell .track-date, .last-mod-cell .track-sep, .last-mod-cell .track-text { color: var(--c-muted); }
.last-mod-cell .track-user { font-weight: 600; color: var(--c-dark); }
.tracking { font-size: 13.5px; }
/* Normal text flow (not flexbox) so the note continues right after the name and wraps
   full-width, instead of the long text dropping to its own line. */
.track-item { padding: 7px 0; border-bottom: 1px solid var(--c-row-line); line-height: 1.55; }
.track-item:last-of-type { border-bottom: none; }
.track-date { color: var(--c-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.track-sep { color: var(--c-border-strong); margin: 0 3px; }
.track-user { font-weight: 600; color: var(--c-dark); white-space: nowrap; }
.track-text { color: var(--c-text); }
.track-note-editable { cursor: text; border-bottom: 1px dashed var(--c-border-strong); }
.track-note-editable:hover { background: #fff6da; }
.track-item--editing { display: flex; align-items: flex-start; }
.track-item--editing .track-date, .track-item--editing .track-sep, .track-item--editing .track-user { padding-top: 7px; }
.track-edit { display: flex; align-items: flex-start; gap: 6px; flex: 1; min-width: 0; }
textarea.track-note-edit { flex: 1; min-width: 0; padding: 6px 10px; resize: none; overflow: hidden; line-height: 1.5; }
.track-edit-btn { width: 30px; height: 30px; flex: 0 0 auto; border-radius: 50%; border: 1px solid var(--c-border-strong); background: #fff; cursor: pointer; font-size: 15px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.track-edit-save { color: #14794a; border-color: #c2e7d3; }
.track-edit-save:hover { background: #e7f6ee; }
.track-edit-cancel { color: #b03b2e; border-color: #f3c8c2; }
.track-edit-cancel:hover { background: #fdecea; }
.track-add { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.track-doc-link { color: var(--c-accent); font-weight: 500; text-decoration: underline; }
.track-doc-link:hover { text-decoration: none; }
.track-old { color: var(--c-muted); text-decoration: line-through; }
/* Former (inactive/pending) members: name stays visible but dimmed & italic. */
.user-off { font-style: italic; color: var(--c-muted); font-weight: 400; }
.track-user.user-off { font-weight: 400; }
.track-arrow { color: var(--c-accent); font-weight: 700; margin: 0 4px; }
.track-note-input { flex: 1; }
.track-loading, .track-empty { padding: 8px 0; }

/* Document description fields */
.add-doc-desc { flex: 1 1 200px; margin-top: 0; }
/* The remove (×) sits to the right of the description; hidden on the first row
   (you always keep one document slot — the × only appears on rows you add). */
#addDocsRows > .add-doc-row:first-child .add-doc-remove { display: none; }
.doc-add-desc { margin-top: 8px; width: 100%; }

.empty-cell { text-align: center; padding: 40px 0; }
