/* ============================================================
   Thales — design tokens
   Light only. Bootstrap 5.1 underneath (reboot, utilities, the
   user menu's dropdown), this file on top. One accent, --brand:
   a deep green, a nod to the old Socrate's. Neutral surfaces with
   a faint green lean.
   ============================================================ */
:root {
    --bg: #f2f5f4;
    --surface: #ffffff;
    --surface-2: #f7faf9;
    --field: #f3f6f5;
    --border: #dbe3e0;
    --border-strong: #c3cec9;
    --ink: #0f1f1a;
    --ink-2: #41524c;
    --muted: #64756f;
    --brand: #0c7a5f;
    --brand-hover: #09604b;
    --brand-top: #13946f;
    --brand-soft: #e4f3ed;
    --brand-line: #b3dccd;
    --night: #0c3a2f;
    --danger: #b42318;
    --danger-soft: #fef3f2;
    --danger-line: #f4c7c1;
    --r-sm: 6px;
    --r-md: 10px;
    --r-lg: 16px;
    --r-pill: 999px;
    --sh-card: 0 1px 2px rgba(15, 31, 26, .05), 0 14px 34px -18px rgba(15, 31, 26, .25);
    --sh-pop: 0 12px 32px -12px rgba(15, 31, 26, .3);
    --focus: 0 0 0 3px rgba(12, 122, 95, .28);
    --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, "Cascadia Mono", Consolas, "Liberation Mono", monospace;
}

html {
    font-size: 15px;
}

body {
    min-height: 100vh;
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font);
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--brand);
    text-decoration: none;
}

    a:hover {
        color: var(--brand-hover);
    }

.icon {
    flex: 0 0 auto;
}

.muted {
    color: var(--muted);
}

.mono {
    font-family: var(--mono);
    font-size: .86em;
}

.brand-lockup {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    text-decoration: none;
}

    .brand-lockup:hover {
        color: var(--ink);
    }

    .brand-lockup img {
        display: block;
    }

.brand-name {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -.01em;
}

/* ============================================================
   SIGN-IN (Conectare → Societatea): the form alone, centred.
   ============================================================ */
.auth {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 40px 16px;
}

.auth-panel {
    width: 100%;
    max-width: 440px;
}

/* The login's background picture, at 50% (Login.cshtml, and Societate.cshtml during the login). */
.auth-bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    background: url("../images/login-bg.jpg") center / cover no-repeat;
    opacity: .5;
    pointer-events: none;
}

/* What sits on the picture outside the card — the logo, the steps, the note under the card — rides on frosted white
   pills, so it reads whatever part of the picture is behind it. */
.auth-panel-brand,
.steps,
.auth-note {
    width: fit-content;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    border: 1px solid rgba(255, 255, 255, .7);
    border-radius: var(--r-pill);
    background: rgba(255, 255, 255, .86);
    backdrop-filter: blur(10px) saturate(1.2);
    box-shadow: 0 6px 20px -10px rgba(15, 31, 26, .45);
}

.auth-panel-brand {
    display: flex;
    margin-bottom: 12px;
    padding: 6px 18px 6px 6px;
}

.auth-card {
    padding: 28px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-card);
}

@media (max-width: 400px) {
    .auth-card {
        padding: 22px 18px;
    }
}

.auth-title {
    margin: 0 0 4px;
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -.015em;
}

.auth-subtitle {
    margin: 0 0 22px;
    color: var(--ink-2);
}

.auth-note {
    margin-top: 16px;
    padding: 6px 14px;
    color: var(--ink-2);
    font-size: .84rem;
    text-align: center;
}

/* The login's two steps: 1 Conectare — 2 Societate. */
.steps {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 0;
    margin-bottom: 16px;
    padding: 5px 14px 5px 5px;
    list-style: none;
    color: var(--ink-2);
    font-size: .86rem;
    font-weight: 600;
}

.step {
    display: flex;
    align-items: center;
    gap: 8px;
}

    .step + .step::before {
        content: "";
        width: 28px;
        height: 2px;
        margin-right: 2px;
        border-radius: 1px;
        background: var(--border-strong);
    }

    .step.is-done + .step::before {
        background: var(--brand-line);
    }

.step-dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: 1.5px solid var(--border-strong);
    border-radius: 50%;
    background: var(--surface);
    font-size: .78rem;
}

.step.is-current {
    color: var(--ink);
}

    .step.is-current .step-dot {
        border-color: var(--brand);
        background: var(--brand);
        color: #fff;
    }

.step.is-done {
    color: var(--brand);
}

    .step.is-done .step-dot {
        border-color: var(--brand-line);
        background: var(--brand-soft);
        color: var(--brand);
    }

/* ============================================================
   FORMS
   ============================================================ */
.form-field {
    margin: 0 0 18px;
}

.form-label {
    margin-bottom: 6px;
    color: var(--ink-2);
    font-size: .82rem;
    font-weight: 600;
}

legend.form-label {
    float: none;
    font-size: .82rem;
}

.form-control {
    height: 44px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background-color: var(--field);
    color: var(--ink);
    font-size: 1rem;
    transition: border-color .12s, background-color .12s, box-shadow .12s;
}

    .form-control:hover:not(:focus) {
        border-color: var(--border-strong);
    }

    .form-control:focus {
        border-color: var(--brand);
        background-color: var(--surface);
        box-shadow: var(--focus);
    }

    .form-control::placeholder {
        color: var(--muted);
    }

    .form-control.input-validation-error {
        border-color: var(--danger);
    }

.field-error {
    display: block;
    margin-top: 6px;
    color: var(--danger);
    font-size: .82rem;
}

    .field-error:empty {
        display: none;
    }

.form-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 18px;
    padding: 12px 14px;
    border: 1px solid var(--danger-line);
    border-radius: var(--r-md);
    background: var(--danger-soft);
    color: var(--danger);
    font-size: .92rem;
}

    .form-alert .icon {
        margin-top: 1px;
    }

    .form-alert p {
        margin: 0;
    }

        .form-alert p + p {
            margin-top: 4px;
        }

    .form-alert a {
        color: inherit;
        font-weight: 600;
        text-decoration: underline;
    }

/* The database picker: a segmented control (the old DSN list). */
.segmented {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--field);
}

.segmented-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.segmented-option {
    display: flex;
    flex: 1 1 0;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 88px;
    height: 36px;
    padding: 0 12px;
    border-radius: 7px;
    color: var(--ink-2);
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    transition: background-color .12s, color .12s, box-shadow .12s;
}

    .segmented-option:hover {
        background: rgba(15, 31, 26, .05);
        color: var(--ink);
    }

.segmented-input:checked + .segmented-option {
    background: var(--surface);
    color: var(--brand-hover);
    box-shadow: 0 1px 2px rgba(15, 31, 26, .08), 0 0 0 1px var(--brand-line);
}

.segmented-input:focus-visible + .segmented-option {
    box-shadow: var(--focus);
}

/* "Detalii conexiune": where the chosen database is (the old window's "Opțiuni"), read only. */
.conn-details {
    margin-top: 10px;
    font-size: .86rem;
}

    .conn-details summary {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        color: var(--muted);
        font-weight: 600;
        cursor: pointer;
        list-style: none;
    }

        .conn-details summary::-webkit-details-marker {
            display: none;
        }

        .conn-details summary:hover {
            color: var(--ink-2);
        }

        .conn-details summary .icon {
            transition: transform .15s;
        }

    .conn-details[open] summary .icon {
        transform: rotate(90deg);
    }

.conn-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 6px 14px;
    margin: 10px 0 0;
    padding: 12px 14px;
    border: 1px dashed var(--border-strong);
    border-radius: var(--r-md);
    background: var(--surface-2);
}

    .conn-grid dt {
        color: var(--muted);
        font-weight: 500;
    }

    .conn-grid dd {
        margin: 0;
        color: var(--ink);
        font-family: var(--mono);
        font-size: .82rem;
        word-break: break-all;
    }

/* The password's show / hide button, inside the field. */
.input-affix {
    position: relative;
}

    .input-affix .form-control {
        padding-right: 48px;
    }

.input-affix-btn {
    position: absolute;
    top: 50%;
    right: 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    transform: translateY(-50%);
}

    .input-affix-btn:hover {
        background: rgba(15, 31, 26, .06);
        color: var(--ink);
    }

    .input-affix-btn:focus-visible {
        outline: none;
        box-shadow: var(--focus);
    }

    .input-affix-btn .icon-hide,
    .input-affix-btn[aria-pressed="true"] .icon-show {
        display: none;
    }

    .input-affix-btn[aria-pressed="true"] .icon-hide {
        display: inline;
    }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    border-radius: var(--r-md);
    font-weight: 600;
}

    .btn:focus-visible {
        box-shadow: var(--focus);
    }

.btn-brand,
.btn-quiet {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 44px;
    padding: 0 18px;
}

.btn-brand {
    border: 1px solid var(--brand-hover);
    background: linear-gradient(180deg, var(--brand-top), var(--brand));
    color: #fff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 8px 20px -10px rgba(12, 122, 95, .75);
}

    .btn-brand:hover,
    .btn-brand:focus {
        background: linear-gradient(180deg, var(--brand), var(--brand-hover));
        color: #fff;
    }

    .btn-brand:focus-visible {
        box-shadow: var(--focus);
    }

    .btn-brand .spinner {
        display: none;
        width: 16px;
        height: 16px;
        border: 2px solid rgba(255, 255, 255, .45);
        border-top-color: #fff;
        border-radius: 50%;
        animation: spin .7s linear infinite;
    }

    .btn-brand.is-busy .spinner {
        display: inline-block;
    }

    .btn-brand.is-busy .btn-icon {
        display: none;
    }

.btn-quiet {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--ink-2);
}

    .btn-quiet:hover,
    .btn-quiet:focus {
        border-color: var(--border-strong);
        background: var(--surface-2);
        color: var(--ink);
    }

    .btn-quiet.btn-sm {
        gap: 6px;
        height: 32px;
        padding: 0 12px;
        font-size: .86rem;
    }

.is-busy {
    pointer-events: none;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Continuare first in the page (Enter sends the form with it), on the right on screen. */
.form-actions {
    display: flex;
    flex-direction: row-reverse;
    gap: 10px;
    margin-top: 20px;
}

    .form-actions .btn-brand {
        flex: 1 1 auto;
    }

/* ============================================================
   COMPANY CHOOSER (Societatea)
   ============================================================ */
.company-search {
    position: relative;
    margin-bottom: 12px;
}

    .company-search .icon {
        position: absolute;
        top: 50%;
        left: 14px;
        color: var(--muted);
        transform: translateY(-50%);
        pointer-events: none;
    }

    .company-search .form-control {
        padding-left: 40px;
    }

/* position: relative — the items' offsetTop counts from the list (site.js scrolls the checked one into view). */
.company-list {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: min(46vh, 420px);
    margin: 0 -4px;
    padding: 4px;
    overflow-y: auto;
}

.company-item {
    display: block;
    margin: 0;
    cursor: pointer;
}

.company-radio {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.company-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--surface);
    transition: border-color .12s, background-color .12s, box-shadow .12s;
}

.company-item:hover .company-card {
    border-color: var(--border-strong);
    background: var(--surface-2);
}

.company-radio:checked + .company-card {
    border-color: var(--brand);
    background: var(--brand-soft);
    box-shadow: inset 0 0 0 1px var(--brand);
}

.company-radio:focus-visible + .company-card {
    box-shadow: inset 0 0 0 1px var(--brand), var(--focus);
}

.company-avatar {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--brand-line);
    border-radius: 9px;
    background: var(--brand-soft);
    color: var(--brand-hover);
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: .02em;
}

.company-radio:checked + .company-card .company-avatar {
    border-color: var(--brand);
    background: var(--brand);
    color: #fff;
}

.company-text {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-width: 0;
}

.company-name,
.company-meta {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.company-name {
    color: var(--ink);
    font-weight: 600;
}

.company-meta {
    color: var(--muted);
    font-size: .82rem;
}

.company-check {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: 1.5px solid var(--border-strong);
    border-radius: 50%;
    color: transparent;
}

.company-radio:checked + .company-card .company-check {
    border-color: var(--brand);
    background: var(--brand);
    color: #fff;
}

.company-none {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 20px;
    border: 1px dashed var(--border-strong);
    border-radius: var(--r-md);
    color: var(--muted);
    text-align: center;
}

    .company-none p {
        margin: 0;
    }

/* ============================================================
   APP SHELL — the top bar: the brand, the database and company
   of the session (the company opens "Schimbă societatea"), the
   user menu.
   ============================================================ */
.topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    align-items: center;
    gap: 16px;
    height: 60px;
    padding: 0 20px;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, .88);
    backdrop-filter: saturate(1.4) blur(10px);
}

.topbar-context {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.topbar-spacer {
    flex: 1 1 auto;
}

.ctx-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 32px;
    min-width: 0;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--r-pill);
    background: var(--surface);
    color: var(--ink-2);
    font-size: .86rem;
    font-weight: 600;
    white-space: nowrap;
}

    .ctx-chip .icon {
        color: var(--muted);
    }

.ctx-chip--company {
    max-width: 360px;
    color: var(--ink);
    font-family: inherit;
    cursor: pointer;
}

    .ctx-chip--company:hover,
    .ctx-chip--company[aria-expanded="true"] {
        border-color: var(--brand-line);
        background: var(--brand-soft);
        color: var(--brand-hover);
    }

    .ctx-chip--company:focus-visible {
        outline: none;
        box-shadow: var(--focus);
    }

.ctx-chip-text {
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 10px 0 4px;
    border: 1px solid transparent;
    border-radius: var(--r-pill);
    background: transparent;
    color: var(--ink);
    font-weight: 600;
}

    .user-btn:hover,
    .user-btn[aria-expanded="true"] {
        border-color: var(--border);
        background: var(--surface);
    }

    .user-btn:focus-visible {
        outline: none;
        box-shadow: var(--focus);
    }

.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--night);
    color: #fff;
    font-size: .8rem;
    font-weight: 700;
}

.dropdown-menu {
    min-width: 240px;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    box-shadow: var(--sh-pop);
    font-size: .92rem;
}

.dropdown-info {
    display: flex;
    flex-direction: column;
    padding: 8px 10px 10px;
}

    .dropdown-info span {
        color: var(--muted);
        font-size: .82rem;
    }

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    border-radius: 7px;
    color: var(--ink);
}

    .dropdown-item .icon {
        color: var(--muted);
    }

    .dropdown-item:hover,
    .dropdown-item:focus {
        background: var(--brand-soft);
        color: var(--brand-hover);
    }

    .dropdown-item:active {
        background: var(--brand);
        color: #fff;
    }

        .dropdown-item:active .icon {
            color: #fff;
        }

/* The top bar's company menu (Schimbă societatea): the person's companies, the current one marked. */
.company-menu {
    width: 340px;
    max-width: calc(100vw - 24px);
}

.company-menu-head {
    padding: 6px 10px 8px;
    color: var(--muted);
    font-size: .74rem;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
}

.company-menu-search {
    margin: 0 4px 6px;
}

    .company-menu-search .form-control {
        height: 36px;
        font-size: .92rem;
    }

.company-menu-list {
    max-height: min(60vh, 360px);
    margin: 0;
    overflow-y: auto;
}

.company-menu-item {
    gap: 10px;
    padding: 7px 10px;
}

    .company-menu-item .company-avatar {
        width: 30px;
        height: 30px;
        border-radius: 8px;
        font-size: .72rem;
    }

    .company-menu-item .company-name {
        font-size: .92rem;
    }

    .company-menu-item .company-meta {
        font-size: .76rem;
    }

    .company-menu-item.is-current {
        background: var(--brand-soft);
        cursor: default;
    }

        .company-menu-item.is-current .company-avatar {
            border-color: var(--brand);
            background: var(--brand);
            color: #fff;
        }

        .company-menu-item.is-current:active {
            background: var(--brand-soft);
            color: var(--ink);
        }

    .company-menu-item .company-menu-check {
        color: var(--brand);
    }

.company-menu-empty {
    margin: 0;
    padding: 12px 10px;
    color: var(--muted);
    font-size: .86rem;
    text-align: center;
}

@media (max-width: 767.98px) {
    .topbar {
        gap: 10px;
        padding: 0 12px;
    }

        .topbar .brand-name,
        .topbar .user-name,
        .ctx-chip--db {
            display: none;
        }

    .ctx-chip--company {
        max-width: 52vw;
    }
}

/* ============================================================
   PAGES
   ============================================================ */
.page {
    max-width: 1120px;
    margin: 0 auto;
    padding: 32px 20px 56px;
}

.page-head {
    margin-bottom: 24px;
}

    .page-head h1 {
        margin: 0;
        font-family: var(--font-display);
        font-size: 1.85rem;
        font-weight: 700;
        letter-spacing: -.02em;
    }

.page-eyebrow {
    margin: 0 0 4px;
    color: var(--muted);
    font-size: .86rem;
    font-weight: 600;
}

.panel {
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    background: var(--surface);
    box-shadow: var(--sh-card);
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 54px;
    padding: 10px 20px;
    border-bottom: 1px solid var(--border);
}

    .panel-head h2 {
        margin: 0;
        color: var(--muted);
        font-size: .78rem;
        font-weight: 700;
        letter-spacing: .07em;
        text-transform: uppercase;
    }

.panel-body {
    padding: 20px;
}

.home-grid {
    display: grid;
    gap: 20px;
    margin-bottom: 20px;
}

@media (min-width: 992px) {
    .home-grid {
        grid-template-columns: 3fr 2fr;
    }
}

.company-hero {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
}

.company-avatar--lg {
    width: 52px;
    height: 52px;
    border-color: var(--brand);
    border-radius: 13px;
    background: var(--brand);
    color: #fff;
    font-size: 1.05rem;
}

.company-hero-name {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -.01em;
}

.company-hero-meta {
    margin: 0;
    color: var(--muted);
    font-size: .88rem;
}

.facts {
    margin: 0;
}

    .facts > div {
        display: grid;
        grid-template-columns: 140px 1fr;
        gap: 12px;
        padding: 10px 0;
        border-top: 1px solid var(--border);
    }

    .facts dt {
        color: var(--muted);
        font-size: .88rem;
        font-weight: 500;
    }

    .facts dd {
        margin: 0;
        color: var(--ink);
        font-weight: 500;
        overflow-wrap: anywhere;
    }

@media (max-width: 480px) {
    .facts > div {
        grid-template-columns: 1fr;
        gap: 2px;
    }
}

.panel-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 44px 20px;
    border-style: dashed;
    background: var(--surface-2);
    box-shadow: none;
    text-align: center;
}

    .panel-empty h2 {
        margin: 0;
        font-size: 1.08rem;
        font-weight: 700;
    }

    .panel-empty p {
        max-width: 460px;
        margin: 0;
        color: var(--muted);
    }

.empty-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    margin-bottom: 6px;
    border-radius: 14px;
    background: var(--brand-soft);
    color: var(--brand);
}

.empty-icon--danger {
    background: var(--danger-soft);
    color: var(--danger);
}

/* ============================================================
   TOP NAV — the modules (Facturi clienți …)
   ============================================================ */
.topnav {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

.topnav-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 34px;
    padding: 0 12px;
    border-radius: var(--r-pill);
    color: var(--ink-2);
    font-size: .9rem;
    font-weight: 600;
    white-space: nowrap;
}

    .topnav-link:hover {
        background: rgba(15, 31, 26, .05);
        color: var(--ink);
    }

    .topnav-link.is-active {
        background: var(--brand-soft);
        color: var(--brand-hover);
    }

/* ============================================================
   START PAGE — the module tiles
   ============================================================ */
.section-title {
    margin: 28px 0 12px;
    color: var(--muted);
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
}

.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.module-tile {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    background: var(--surface);
    box-shadow: var(--sh-card);
    color: var(--ink);
    transition: border-color .12s, transform .12s;
}

    .module-tile:hover {
        border-color: var(--brand-line);
        color: var(--ink);
        transform: translateY(-1px);
    }

    .module-tile .empty-icon {
        flex: 0 0 auto;
        width: 46px;
        height: 46px;
        margin: 0;
    }

.module-tile-text {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
}

.module-tile-name {
    font-weight: 700;
}

.module-tile-desc {
    color: var(--muted);
    font-size: .86rem;
}

.module-tile-go {
    color: var(--muted);
}

/* ============================================================
   LISTS WITH FILTERS (Facturi clienți)
   ============================================================ */
.page--wide {
    max-width: none;
    padding: 12px 16px;
}

/* A list page as tall as the window (below the 60px top bar): the filters keep their height, the results panel takes
   the rest and its list scrolls inside. A window too low for that scrolls as a normal page. */
@media (min-height: 560px) {
    .page--fill {
        display: flex;
        flex-direction: column;
        height: calc(100vh - 60px);
    }

        .page--fill > .filters {
            flex: 0 0 auto;
        }

        .page--fill > .results {
            display: flex;
            flex: 1 1 auto;
            flex-direction: column;
            min-height: 0;
        }

            .page--fill > .results .grid-wrap {
                flex: 1 1 auto;
                min-height: 0;
                max-height: none;
            }
}

.form-control-sm,
.form-select-sm {
    height: 32px;
    padding-top: 0;
    padding-bottom: 0;
    font-size: .88rem;
}

.form-control-sm {
    padding-left: 10px;
    padding-right: 10px;
}

.form-select {
    border-color: var(--border);
    border-radius: var(--r-md);
    background-color: var(--field);
    color: var(--ink);
}

    .form-select:focus {
        border-color: var(--brand);
        background-color: var(--surface);
        box-shadow: var(--focus);
    }

.form-check-input:checked {
    border-color: var(--brand);
    background-color: var(--brand);
}

.form-check-input:focus {
    border-color: var(--brand);
    box-shadow: var(--focus);
}

.btn-brand.btn-sm,
.btn-quiet.btn-sm {
    height: 32px;
    padding: 0 14px;
    font-size: .88rem;
}

.filters {
    margin-bottom: 10px;
}

/* The tabs, with the hint and the buttons on the same row. */
.filters-top {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 6px 12px;
    padding: 6px 12px 0;
    border-bottom: 1px solid var(--border);
}

.filter-tabs {
    display: flex;
    gap: 2px;
}

.filter-tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-bottom: -1px;
    padding: 7px 12px;
    border: 1px solid transparent;
    border-radius: var(--r-md) var(--r-md) 0 0;
    background: transparent;
    color: var(--muted);
    font-size: .9rem;
    font-weight: 600;
}

    .filter-tab:hover {
        color: var(--ink);
    }

    .filter-tab.active {
        border-color: var(--border);
        border-bottom-color: var(--surface);
        background: var(--surface);
        color: var(--brand-hover);
    }

.filter-tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: var(--r-pill);
    background: var(--brand);
    color: #fff;
    font-size: .7rem;
}

.filters-body {
    padding: 8px 12px 0;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0 10px;
}

.filter-field {
    margin-bottom: 8px;
}

    .filter-field .form-label {
        margin-bottom: 2px;
        font-size: .76rem;
    }

/* A "de la – până la" pair takes two columns. */
.filter-field--range {
    grid-column: span 2;
}

@media (max-width: 520px) {
    .filter-field--range {
        grid-column: auto;
    }
}

.filter-range-label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
}

    .filter-range-label .form-label {
        margin: 0;
    }

    .filter-range-label .form-check-input {
        margin: 0;
    }

.filter-range {
    display: flex;
    align-items: center;
    gap: 6px;
}

    .filter-range .form-control:disabled {
        opacity: .55;
    }

.filter-range-dash {
    color: var(--muted);
}

.filters-hint {
    color: var(--muted);
    font-size: .78rem;
}

    .filters-hint code {
        color: var(--ink-2);
    }

@media (max-width: 1100px) {
    .filters-hint {
        display: none;
    }
}

.filters-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 6px;
}

.results-head {
    flex: 0 0 auto;
    flex-wrap: wrap;
    min-height: 0;
    padding: 8px 14px;
}

    .results-head h2 {
        display: flex;
        align-items: center;
        gap: 8px;
    }

.results-count {
    padding: 2px 8px;
    border-radius: var(--r-pill);
    background: var(--brand-soft);
    color: var(--brand-hover);
    font-size: .78rem;
    letter-spacing: 0;
}

.totals {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 22px;
    margin: 0;
}

    .totals > div {
        display: flex;
        align-items: baseline;
        gap: 7px;
    }

    .totals dt {
        color: var(--muted);
        font-size: .82rem;
        font-weight: 500;
    }

    .totals dd {
        margin: 0;
        font-weight: 700;
        font-variant-numeric: tabular-nums;
    }

.results-alert {
    margin: 16px;
}

.results-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 44px 20px;
    color: var(--muted);
}

    .results-empty p {
        margin: 0;
    }

.grid-wrap {
    max-height: 70vh;
    overflow: auto;
    border-radius: 0 0 var(--r-lg) var(--r-lg);
}

.grid {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: .88rem;
}

    .grid th,
    .grid td {
        padding: 6px 10px;
        border-bottom: 1px solid var(--border);
        white-space: nowrap;
        vertical-align: middle;
    }

    .grid thead th {
        position: sticky;
        top: 0;
        z-index: 1;
        background: var(--surface-2);
        color: var(--muted);
        font-size: .76rem;
        font-weight: 700;
        letter-spacing: .04em;
        text-transform: uppercase;
        cursor: pointer;
        user-select: none;
    }

        .grid thead th:hover {
            color: var(--ink);
        }

        .grid thead th[aria-sort="ascending"]::after {
            content: " ▲";
            font-size: .7em;
        }

        .grid thead th[aria-sort="descending"]::after {
            content: " ▼";
            font-size: .7em;
        }

    .grid tbody tr:hover td {
        background: var(--brand-soft);
    }

    .grid .num {
        text-align: right;
        font-variant-numeric: tabular-nums;
    }

    .grid .strong {
        font-weight: 700;
    }

    /* Long text (client names, explanations) stays on one line — every row the same height; the whole text is its title. */
    .grid .clip {
        max-width: 320px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .grid .muted-cell {
        color: var(--ink-2);
    }

.chip {
    display: inline-block;
    padding: 2px 9px;
    border-radius: var(--r-pill);
    background: var(--field);
    color: var(--ink-2);
    font-size: .78rem;
    font-weight: 600;
}

.chip--ok {
    background: var(--brand-soft);
    color: var(--brand-hover);
}

.chip--warn {
    background: #fdf3df;
    color: #8a5a10;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition: none !important;
        animation-duration: 1.5s !important;
    }
}
