:root {
    --bg: #f4f7fb;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --border: #e6ebf2;
    --text: #172033;
    --muted: #6f7b91;

    --primary: #2557d6;
    --primary-soft: #eaf0ff;

    --green: #159a67;
    --green-soft: #e7f8f1;

    --amber: #d98b14;
    --amber-soft: #fff4dd;

    --red: #d44545;
    --red-soft: #fdecec;

    --purple: #7656d6;
    --purple-soft: #f0ebff;

    --shadow:
        0 1px 2px rgba(16, 24, 40, 0.03),
        0 8px 30px rgba(30, 45, 75, 0.05);

    --radius: 18px;
}

* {
    box-sizing: border-box;
}

html {
    color-scheme: light;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family:
        Inter,
        ui-sans-serif,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 250px 1fr;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 24px 18px;
    background: #111a2e;
    color: #dbe3f4;
    display: flex;
    flex-direction: column;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 8px 26px;
}

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 13px;
    display: grid;
    place-items: center;
    color: white;
    font-size: 20px;
    font-weight: 800;
    background:
        linear-gradient(
            145deg,
            #3468ea,
            #6946d4
        );
    box-shadow:
        0 8px 24px rgba(55, 99, 230, 0.32);
}

.brand strong,
.brand span {
    display: block;
}

.brand strong {
    color: white;
    font-size: 15px;
}

.brand span {
    margin-top: 2px;
    font-size: 12px;
    color: #8f9bb3;
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nav-item {
    min-height: 46px;
    padding: 0 13px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 11px;
    text-decoration: none;
    color: #aeb8ce;
    font-size: 14px;
    font-weight: 600;
}

.nav-item:hover:not(.disabled) {
    background: rgba(255, 255, 255, 0.06);
    color: white;
}

.nav-item.active {
    color: white;
    background:
        linear-gradient(
            90deg,
            rgba(58, 103, 224, 0.28),
            rgba(67, 93, 180, 0.12)
        );
}

.nav-item.disabled {
    opacity: 0.42;
    cursor: default;
}

.nav-item small {
    margin-left: auto;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
}

.nav-icon {
    width: 22px;
    font-size: 18px;
    text-align: center;
}

.sidebar-footer {
    margin-top: auto;
    padding: 14px 8px 2px;
}

.security-pill {
    display: flex;
    gap: 8px;
    align-items: center;
    color: #77849d;
    font-size: 11px;
}

.security-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #2ed795;
    box-shadow: 0 0 0 4px rgba(46, 215, 149, 0.08);
}

.main {
    min-width: 0;
    padding: 30px 36px 46px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0;
    font-size: 29px;
    letter-spacing: -0.025em;
}

h2 {
    margin-bottom: 8px;
    font-size: 26px;
    letter-spacing: -0.025em;
}

h3 {
    margin-bottom: 0;
    font-size: 18px;
    letter-spacing: -0.015em;
}

.eyebrow {
    margin-bottom: 6px;
    color: #8792a7;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.14em;
}

.user-chip {
    padding: 7px 12px 7px 7px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow);
}

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    color: white;
    font-weight: 800;
    background:
        linear-gradient(
            145deg,
            #2c5eda,
            #6b4bd0
        );
}

.user-chip strong,
.user-chip span {
    display: block;
}

.user-chip strong {
    font-size: 12px;
}

.user-chip span {
    margin-top: 2px;
    color: var(--muted);
    font-size: 10px;
}

.hero {
    padding: 28px 30px;
    margin-bottom: 22px;
    min-height: 144px;
    border-radius: 22px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    overflow: hidden;
    background:
        radial-gradient(
            circle at 85% 10%,
            rgba(255, 255, 255, 0.16),
            transparent 28%
        ),
        linear-gradient(
            120deg,
            #1e4ec3 0%,
            #3d5bd2 48%,
            #6950cb 100%
        );
    box-shadow:
        0 18px 40px rgba(48, 77, 171, 0.20);
}

.hero.compact {
    min-height: 120px;
}

.hero .eyebrow {
    color: rgba(255, 255, 255, 0.65);
}

.hero h2 {
    font-size: 29px;
}

.hero-copy {
    margin-bottom: 0;
    color: rgba(255, 255, 255, 0.72);
    font-size: 13px;
}

.hero-date {
    color: rgba(255, 255, 255, 0.76);
    font-size: 13px;
    font-weight: 600;
}

.kpi-grid {
    margin-bottom: 22px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.kpi-card,
.panel {
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.kpi-card {
    padding: 20px;
    border-radius: var(--radius);
}

.kpi-card.has-tooltip {
    position: relative;
    cursor: help;
    outline: none;
}

.kpi-card.has-tooltip:hover,
.kpi-card.has-tooltip:focus,
.kpi-card.has-tooltip:focus-within {
    z-index: 40;
}

.kpi-card.has-tooltip:focus {
    border-color: var(--primary);
}

.kpi-tooltip {
    position: absolute;
    z-index: 100;
    top: calc(100% + 10px);
    left: 12px;
    width: min(390px, calc(100vw - 44px));
    padding: 14px;
    border: 1px solid #e9d48a;
    border-radius: 12px;
    background: #fff8d6;
    box-shadow:
        0 18px 45px rgba(15, 23, 42, 0.18);
    color: #1f2937;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-4px);
    transition:
        opacity 0.15s ease,
        transform 0.15s ease,
        visibility 0.15s ease;
}

.kpi-card.has-tooltip:hover .kpi-tooltip,
.kpi-card.has-tooltip:focus .kpi-tooltip,
.kpi-card.has-tooltip:focus-within .kpi-tooltip {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

.kpi-tooltip-title {
    margin-bottom: 9px;
    padding-bottom: 9px;
    border-bottom: 1px solid #eadca8;
    color: #111827;
    font-size: 13px;
    font-weight: 800;
}

.kpi-tooltip-list {
    max-height: 340px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.kpi-tooltip-row {
    padding: 9px 2px;
    border-bottom: 1px solid #efe3b8;
}

.kpi-tooltip-row-title {
    color: #263244;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.4;
}

.kpi-tooltip-row-meta {
    margin-top: 2px;
    color: var(--muted);
    font-size: 10px;
}

.kpi-tooltip-row-amount {
    margin-top: 3px;
    color: #586477;
    font-size: 11px;
    font-weight: 600;
}

.kpi-tooltip-total {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    margin-top: 8px;
    padding: 10px 2px 1px;
    color: #263244;
    font-size: 11px;
}

.kpi-tooltip-total strong {
    color: #111827;
}

.kpi-tooltip-empty {
    padding: 10px 2px;
    color: var(--muted);
    font-size: 11px;
}

.kpi-card.featured {
    border-color: #efd9ac;
    background:
        linear-gradient(
            150deg,
            #ffffff,
            #fffbf1
        );
}

.kpi-icon {
    width: 34px;
    height: 34px;
    margin-bottom: 18px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-size: 14px;
    font-weight: 800;
}

.kpi-icon.blue {
    color: var(--primary);
    background: var(--primary-soft);
}

.kpi-icon.green {
    color: var(--green);
    background: var(--green-soft);
}

.kpi-icon.amber {
    color: var(--amber);
    background: var(--amber-soft);
}

.kpi-icon.purple {
    color: var(--purple);
    background: var(--purple-soft);
}

.kpi-label {
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.kpi-value {
    margin-bottom: 8px;
    font-size: clamp(20px, 2vw, 29px);
    font-weight: 800;
    letter-spacing: -0.035em;
}

.kpi-foot {
    color: #939daf;
    font-size: 10px;
    line-height: 1.45;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.8fr);
    gap: 18px;
    margin-bottom: 18px;
}

.panel {
    padding: 22px;
    border-radius: var(--radius);
    margin-bottom: 18px;
}

.panel-header {
    margin-bottom: 22px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
}

.text-link {
    color: var(--primary);
    text-decoration: none;
    font-size: 12px;
    font-weight: 700;
}

.status-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.status-stat {
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: var(--surface-soft);
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-stat strong,
.status-stat span {
    display: block;
}

.status-stat strong {
    font-size: 22px;
}

.status-stat div span {
    margin-top: 2px;
    color: var(--muted);
    font-size: 10px;
}

.status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
}

.status-dot.pending {
    background: #7183aa;
}

.status-dot.partial {
    background: var(--amber);
}

.status-dot.paid {
    background: var(--green);
}

.status-dot.overdue {
    background: var(--red);
}

.progress-block {
    margin-top: 22px;
}

.progress-header {
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    color: var(--muted);
    font-size: 11px;
}

.progress {
    width: 100%;
    height: 8px;
    border: 0;
    border-radius: 999px;
    overflow: hidden;
}

.progress::-webkit-progress-bar {
    background: #edf0f5;
}

.progress::-webkit-progress-value {
    background:
        linear-gradient(
            90deg,
            #2f62dc,
            #5d75e4
        );
}

.progress::-moz-progress-bar {
    background: #2f62dc;
}

.money-stack {
    display: grid;
    gap: 10px;
}

.money-row {
    padding: 13px 14px;
    border-radius: 12px;
    background: var(--surface-soft);
    display: flex;
    justify-content: space-between;
    gap: 14px;
}

.money-row span {
    color: var(--muted);
    font-size: 11px;
}

.money-row strong {
    font-size: 13px;
}

.money-row.highlight {
    color: #9a6100;
    background: var(--amber-soft);
}

.table-wrap {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.data-table th {
    padding: 11px 12px;
    border-bottom: 1px solid #eadca8;
    color: #8a95a8;
    text-align: left;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.data-table td {
    padding: 14px 12px;
    border-bottom: 1px solid #efe3b8;
    vertical-align: middle;
}

.data-table tbody tr:last-child td {
    border-bottom: 0;
}

.table-empty {
    padding: 30px !important;
    text-align: center;
    color: var(--muted);
}

.invoice-number {
    color: #274aa8;
    font-weight: 750;
}

.client-secondary {
    margin-top: 3px;
    color: var(--muted);
    font-size: 10px;
}

.money {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 9px;
    border-radius: 999px;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.badge.pending {
    color: #536381;
    background: #eef1f6;
}

.badge.partial {
    color: #9a650e;
    background: var(--amber-soft);
}

.badge.paid {
    color: #137d57;
    background: var(--green-soft);
}

.badge.overdue {
    color: #b33232;
    background: var(--red-soft);
}

.badge.cancelled {
    color: #5c6575;
    background: #eceef2;
}

.filters-panel {
    padding: 16px 18px;
}

.filters {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) 190px auto auto;
    align-items: end;
    gap: 12px;
}

.field {
    display: grid;
    gap: 6px;
}

.field span {
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
}

input,
select {
    width: 100%;
    height: 42px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 11px;
    outline: none;
    color: var(--text);
    background: white;
    font: inherit;
    font-size: 12px;
}

input:focus,
select:focus {
    border-color: #9bb3f5;
    box-shadow: 0 0 0 3px rgba(49, 96, 220, 0.08);
}

.button {
    height: 42px;
    padding: 0 16px;
    border: 0;
    border-radius: 11px;
    cursor: pointer;
    font: inherit;
    font-size: 11px;
    font-weight: 750;
}

.button.primary {
    color: white;
    background: var(--primary);
}

.button.secondary {
    color: #556079;
    border: 1px solid var(--border);
    background: white;
}

.button:disabled {
    opacity: 0.45;
    cursor: default;
}

.pagination {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
}

.pagination-info,
.pagination span {
    color: var(--muted);
    font-size: 10px;
}

.alert {
    padding: 13px 15px;
    margin-bottom: 18px;
    border-radius: 12px;
    font-size: 11px;
}

.alert-error {
    color: #a62d2d;
    border: 1px solid #f0caca;
    background: var(--red-soft);
}

.hidden {
    display: none !important;
}

@media (max-width: 1100px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .status-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 820px) {
    .app-shell {
        display: block;
    }

    .sidebar {
        position: static;
        width: auto;
        height: auto;
    }

    .sidebar-footer {
        display: none;
    }

    .nav {
        flex-direction: row;
        overflow-x: auto;
    }

    .nav-item {
        flex: 0 0 auto;
    }

    .main {
        padding: 22px 16px 36px;
    }

    .filters {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .kpi-grid,
    .status-grid {
        grid-template-columns: 1fr;
    }

    .topbar {
        align-items: flex-start;
    }

    .hero {
        padding: 23px 20px;
    }

    .hero-date {
        display: none;
    }

    .user-chip div:not(.avatar) {
        display: none;
    }
}

/* Login */

.login-body {
    min-height: 100vh;
    background: #eef2f8;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns:
        minmax(400px, 1.05fr)
        minmax(420px, 0.95fr);
}

.login-visual {
    position: relative;
    min-height: 100vh;
    padding: 44px 52px;
    color: white;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background:
        radial-gradient(
            circle at 82% 20%,
            rgba(99, 120, 255, 0.45),
            transparent 28%
        ),
        radial-gradient(
            circle at 15% 80%,
            rgba(43, 182, 181, 0.19),
            transparent 30%
        ),
        linear-gradient(
            145deg,
            #101a34 0%,
            #173b82 50%,
            #473db5 100%
        );
}

.login-visual::before {
    content: "";
    position: absolute;
    width: 440px;
    height: 440px;
    top: 19%;
    right: -220px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.10);
    box-shadow:
        0 0 0 70px rgba(255,255,255,0.025),
        0 0 0 140px rgba(255,255,255,0.018);
}

.login-brand {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-mark.large {
    width: 48px;
    height: 48px;
    font-size: 22px;
}

.login-brand strong,
.login-brand span {
    display: block;
}

.login-brand strong {
    font-size: 17px;
}

.login-brand span {
    margin-top: 2px;
    color: rgba(255,255,255,0.58);
    font-size: 12px;
}

.login-message {
    position: relative;
    z-index: 1;
    max-width: 620px;
    margin: auto 0;
}

.login-message h1 {
    margin-bottom: 22px;
    color: white;
    font-size: clamp(38px, 5vw, 62px);
    line-height: 1.03;
    letter-spacing: -0.052em;
}

.login-message p:not(.eyebrow) {
    max-width: 500px;
    color: rgba(255,255,255,0.65);
    font-size: 15px;
    line-height: 1.7;
}

.eyebrow.light {
    color: rgba(255,255,255,0.48);
}

.login-security {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(255,255,255,0.52);
    font-size: 11px;
}

.login-panel {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 42px;
    background: #f8fafc;
}

.login-form-wrap {
    width: min(100%, 410px);
}

.login-heading {
    margin-bottom: 30px;
}

.login-heading h2 {
    margin-bottom: 10px;
    font-size: 32px;
}

.login-heading > p:last-child {
    color: var(--muted);
    font-size: 13px;
}

.login-form {
    display: grid;
    gap: 18px;
}

.login-form input {
    height: 48px;
    font-size: 14px;
}

.login-button {
    height: 50px;
    margin-top: 4px;
    box-shadow:
        0 10px 24px rgba(37, 87, 214, 0.22);
}

.login-footnote {
    margin: 22px auto 0;
    max-width: 330px;
    color: #929bad;
    text-align: center;
    font-size: 10px;
    line-height: 1.6;
}

@media (max-width: 850px) {
    .login-shell {
        display: block;
    }

    .login-visual {
        min-height: 280px;
        padding: 32px 26px;
    }

    .login-message {
        margin: 50px 0 26px;
    }

    .login-message h1 {
        font-size: 37px;
    }

    .login-message p:not(.eyebrow) {
        display: none;
    }

    .login-panel {
        min-height: calc(100vh - 280px);
        padding: 38px 22px;
    }
}

/* Invoice detail */

.detail-back {
    margin: -10px 0 18px;
}

.invoice-detail-hero {
    padding: 24px 28px;
    margin-bottom: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 30px;
}

.invoice-title-row {
    display: flex;
    align-items: center;
    gap: 14px;
}

.invoice-title-row h2 {
    margin: 0;
    font-size: 27px;
}

.invoice-client-name {
    margin-top: 8px;
    color: var(--muted);
    font-size: 13px;
}

.invoice-meta {
    display: flex;
    gap: 34px;
}

.invoice-meta div {
    min-width: 110px;
}

.invoice-meta span,
.invoice-meta strong {
    display: block;
}

.invoice-meta span {
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 9px;
    font-weight: 750;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.invoice-meta strong {
    font-size: 13px;
}

.invoice-kpis {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.invoice-detail-grid {
    grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.7fr);
}

.payment-timeline {
    position: relative;
    display: grid;
}

.payment-timeline-item {
    position: relative;
    display: grid;
    grid-template-columns: 24px 1fr;
    gap: 12px;
    padding-bottom: 24px;
}

.payment-timeline-item:not(:last-child)::before {
    content: "";
    position: absolute;
    top: 18px;
    left: 8px;
    bottom: -2px;
    width: 1px;
    background: var(--border);
}

.timeline-marker {
    position: relative;
    z-index: 1;
    width: 17px;
    height: 17px;
    margin-top: 3px;
    border-radius: 50%;
    border: 4px solid white;
    box-shadow: 0 0 0 1px var(--border);
}

.timeline-marker.confirmed {
    background: var(--green);
}

.timeline-marker.warning {
    background: var(--amber);
}

.timeline-content {
    padding: 0 0 2px;
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.timeline-title {
    font-size: 13px;
    font-weight: 750;
}

.timeline-amount {
    font-size: 15px;
    font-variant-numeric: tabular-nums;
}

.timeline-meta,
.timeline-reference {
    margin-top: 5px;
    color: var(--muted);
    font-size: 10px;
}

.timeline-reference {
    color: #69748a;
}

.timeline-footer {
    margin-top: 9px;
    display: flex;
    align-items: center;
    gap: 9px;
}

.timeline-footer > span:last-child {
    color: var(--muted);
    font-size: 9px;
}

.invoice-number-link {
    color: #274aa8;
    font-weight: 750;
    text-decoration: none;
}

.invoice-number-link:hover {
    text-decoration: underline;
}

@media (max-width: 900px) {
    .invoice-detail-hero {
        align-items: flex-start;
        flex-direction: column;
    }

    .invoice-kpis {
        grid-template-columns: repeat(2, 1fr);
    }

    .invoice-detail-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .invoice-kpis {
        grid-template-columns: 1fr;
    }

    .invoice-meta {
        width: 100%;
        gap: 18px;
    }
}

/* Payments */

.payment-kpis {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.payment-row-attention {
    background: #fffaf0;
}

.payment-row-attention:hover {
    background: #fff6df;
}

.cell-subtitle {
    margin-top: 4px;
    color: var(--muted);
    font-size: 9px;
}

.muted-value {
    color: var(--muted);
}

.money-cell {
    white-space: nowrap;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
}

.money-attention {
    color: #a15c00;
    font-weight: 800;
}

.status-badge.confirmed_allocated {
    color: #16794b;
    background: #e9f8f0;
}

.status-badge.confirmed_unallocated {
    color: #965b00;
    background: #fff1cf;
}

.status-badge.confirmed {
    color: #16794b;
    background: #e9f8f0;
}

.status-badge.pending_review {
    color: #6f55c4;
    background: #f0ebff;
}

.status-badge.possible {
    color: #8b6200;
    background: #fff3cf;
}

.status-badge.rejected {
    color: #b33a3a;
    background: #feecec;
}

@media (max-width: 900px) {
    .payment-kpis {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 560px) {
    .payment-kpis {
        grid-template-columns: 1fr;
    }
}

/* Payment detail */

.payment-detail-hero {
    padding: 24px 28px;
    margin-bottom: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 28px;
}

.payment-detail-kpis {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.payment-detail-grid {
    grid-template-columns:
        minmax(0, 1.3fr)
        minmax(320px, .7fr);
}

.allocation-list {
    display: grid;
    gap: 10px;
}

.allocation-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    color: inherit;
    text-decoration: none;
    transition:
        border-color .16s ease,
        background .16s ease;
}

.allocation-list-item:hover {
    border-color: #b8c5e8;
    background: #f8faff;
}

.allocation-list-item > div {
    display: grid;
    gap: 4px;
}

.allocation-list-item span {
    color: var(--muted);
    font-size: 10px;
}

.allocation-list-amount {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.allocation-form {
    display: grid;
    gap: 16px;
}

.allocation-invoice-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 14px;
    background: #f7f9fd;
    border: 1px solid var(--border);
    border-radius: 12px;
}

.allocation-invoice-info span,
.allocation-invoice-info strong {
    display: block;
}

.allocation-invoice-info span {
    color: var(--muted);
    margin-bottom: 4px;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.allocation-empty {
    padding: 18px;
    color: var(--muted);
    background: #f7f9fd;
    border-radius: 12px;
    font-size: 12px;
}

.form-help,
.panel-copy {
    margin: 0;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.6;
}

.alert-success {
    color: #17643f;
    background: #eaf8f0;
    border: 1px solid #bde7cd;
}

@media (max-width: 950px) {
    .payment-detail-hero {
        flex-direction: column;
        align-items: flex-start;
    }

    .payment-detail-kpis {
        grid-template-columns:
            repeat(2, 1fr);
    }

    .payment-detail-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .payment-detail-kpis {
        grid-template-columns: 1fr;
    }

    .allocation-invoice-info {
        grid-template-columns: 1fr;
    }
}

/* Clients */

.client-kpis {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.client-table strong {
    font-weight: 750;
}

@media (max-width: 900px) {
    .client-kpis {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 560px) {
    .client-kpis {
        grid-template-columns: 1fr;
    }
}

/* Client detail */

.client-detail-hero {
    padding: 24px 28px;
    margin-bottom: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 28px;
}

.client-contact-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(150px, 1fr));
    gap: 28px;
}

.client-contact-grid span,
.client-contact-grid strong {
    display: block;
}

.client-contact-grid span {
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 9px;
    font-weight: 750;
    text-transform: uppercase;
    letter-spacing: .07em;
}

.client-contact-grid strong {
    font-size: 12px;
}

.client-detail-kpis {
    grid-template-columns:
        repeat(4, minmax(0, 1fr));
}

.client-detail-grid {
    grid-template-columns:
        minmax(0, 1.35fr)
        minmax(320px, .65fr);
}

.client-payment-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 16px;
}

.client-payment-summary > div {
    padding: 14px;
    background: #f7f9fd;
    border: 1px solid var(--border);
    border-radius: 12px;
}

.client-payment-summary span,
.client-payment-summary strong {
    display: block;
}

.client-payment-summary span {
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.client-payment-list {
    display: grid;
    gap: 9px;
}

.client-payment-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 13px 14px;
    color: inherit;
    text-decoration: none;
    border: 1px solid var(--border);
    border-radius: 12px;
    transition:
        background .16s ease,
        border-color .16s ease;
}

.client-payment-item:hover {
    background: #f8faff;
    border-color: #b9c6e8;
}

.client-payment-item > div:first-child {
    display: grid;
    gap: 4px;
}

.client-payment-item span {
    color: var(--muted);
    font-size: 9px;
}

.client-payment-right {
    display: grid;
    justify-items: end;
    gap: 6px;
    white-space: nowrap;
}

@media (max-width: 950px) {
    .client-detail-hero {
        flex-direction: column;
        align-items: flex-start;
    }

    .client-detail-kpis {
        grid-template-columns:
            repeat(2, 1fr);
    }

    .client-detail-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .client-detail-kpis {
        grid-template-columns: 1fr;
    }

    .client-contact-grid,
    .client-payment-summary {
        grid-template-columns: 1fr;
    }
}

.alert-warning {
    color: #805b12;
    background: #fff8e6;
    border: 1px solid #efd99b;
}


/* Documents */

.document-kpis {
    grid-template-columns:
        repeat(4, minmax(0, 1fr));
}

.document-upload-panel {
    margin-bottom: 18px;
}

.document-upload-grid {
    display: grid;
    grid-template-columns:
        minmax(180px, .65fr)
        minmax(260px, 1.35fr)
        auto;
    gap: 14px;
    align-items: end;
}

.document-upload-grid label {
    display: grid;
    gap: 7px;
}

.document-upload-grid label > span {
    color: var(--muted);
    font-size: 9px;
    font-weight: 750;
    text-transform: uppercase;
    letter-spacing: .07em;
}

.document-upload-grid select,
.document-upload-grid input,
.document-filters select {
    min-height: 42px;
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    color: inherit;
}

.document-help {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 10px;
}

.document-filters {
    display: flex;
    gap: 8px;
}

.document-action-note {
    color: var(--muted);
    font-size: 10px;
}

@media (max-width: 950px) {
    .document-kpis {
        grid-template-columns: repeat(2, 1fr);
    }

    .document-upload-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .document-kpis {
        grid-template-columns: 1fr;
    }

    .document-filters {
        width: 100%;
        flex-direction: column;
    }
}

/* Document detail */

.document-detail-grid {
    grid-template-columns:
        minmax(0, 1.25fr)
        minmax(320px, .75fr);
}

.document-data-grid {
    display: grid;
    grid-template-columns:
        repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.document-data-grid > div {
    padding: 13px 14px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: #f8faff;
}

.document-data-grid span,
.document-data-grid strong {
    display: block;
}

.document-data-grid span {
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 9px;
    font-weight: 750;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.document-data-grid strong {
    overflow-wrap: anywhere;
}

.document-review-actions {
    display: flex;
    gap: 10px;
    margin-top: 18px;
}

#documentCandidatePanel {
    margin-top: 18px;
}

@media (max-width: 950px) {
    .document-detail-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .document-data-grid {
        grid-template-columns: 1fr;
    }
}

/* Candidate exact invoice matching */

.candidate-match-section {
    margin-top: 24px;
    padding-top: 22px;
    border-top: 1px solid var(--border);
}

.candidate-match-message {
    margin-bottom: 14px;
    padding: 12px 14px;
    border-radius: 10px;
    background: #f8faff;
    color: var(--muted);
}

.candidate-match-strong {
    border: 1px solid #b7d4ff;
    background: #f0f6ff;
    color: #234a8c;
}

.candidate-match-grid {
    display: grid;
    grid-template-columns:
        repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.candidate-match-card {
    display: grid;
    gap: 7px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
}

.candidate-match-title {
    font-size: 15px;
    font-weight: 750;
}

.candidate-match-amount {
    font-size: 18px;
}

.candidate-match-exact {
    width: fit-content;
    padding: 4px 8px;
    border-radius: 999px;
    background: #e9f8ef;
    color: #247447;
    font-size: 10px;
    font-weight: 750;
}

.candidate-match-card small {
    color: var(--muted);
}

@media (max-width: 750px) {
    .candidate-match-grid {
        grid-template-columns: 1fr;
    }
}


/* Candidate match selectable button fix */

.candidate-match-select-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    margin-top: 8px;
    padding: 9px 14px;
    border: 0;
    border-radius: 8px;
    background: #2457e6;
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    pointer-events: auto;
    position: relative;
    z-index: 5;
}

.candidate-match-select-button:hover {
    background: #1947c7;
}

.candidate-match-select-button:disabled {
    opacity: .6;
    cursor: wait;
}


/* Candidate confirmation actions */

.candidate-actions {
    margin-top: 18px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.candidate-confirm-button {
    cursor: pointer;
    pointer-events: auto;
    position: relative;
    z-index: 5;
}


/* Evidence thumbnails */

.evidence-cell {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.evidence-cell-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.evidence-thumbnail-link {
    display: block;
    width: 58px;
    height: 58px;
    flex: 0 0 58px;
    overflow: hidden;
    border: 1px solid #dce3ef;
    border-radius: 10px;
    background: #f5f7fb;
    box-shadow:
        0 1px 2px rgba(20, 35, 60, .05);
    cursor: zoom-in;
}

.evidence-thumbnail-link:hover {
    border-color: #9eb8ff;
    box-shadow:
        0 0 0 3px rgba(40, 91, 230, .08);
}

.evidence-thumbnail {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

@media (max-width: 900px) {
    .evidence-thumbnail-link {
        width: 48px;
        height: 48px;
        flex-basis: 48px;
    }

    .evidence-cell {
        gap: 8px;
    }
}

/* Evidence thumbnail as button */

button.evidence-thumbnail-link {
    padding: 0;
    appearance: none;
    -webkit-appearance: none;
    font: inherit;
    text-align: inherit;
}


/* Portal evidence modal v2 */

body.portal-evidence-modal-open {
    overflow: hidden;
}

.portal-evidence-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 22px;
    background: rgba(10, 18, 32, .78);
}

.portal-evidence-modal-overlay[hidden] {
    display: none !important;
}

.portal-evidence-modal {
    width: min(1000px, 95vw);
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 16px;
    background: #fff;
    box-shadow:
        0 28px 90px rgba(0, 0, 0, .35);
}

.portal-evidence-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 18px;
    border-bottom: 1px solid #e3e8f0;
}

.portal-evidence-modal-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.portal-evidence-modal-close {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border: 0;
    border-radius: 10px;
    background: #eef2f7;
    color: #172033;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.portal-evidence-modal-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    max-height: calc(92vh - 70px);
    overflow: auto;
    padding: 18px;
    background: #e8edf4;
}

.portal-evidence-modal-image {
    display: block;
    max-width: 100%;
    max-height: calc(92vh - 110px);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 10px;
    background: #fff;
    box-shadow:
        0 8px 28px rgba(15, 23, 42, .14);
}

@media (max-width: 700px) {
    .portal-evidence-modal-overlay {
        padding: 8px;
    }

    .portal-evidence-modal {
        width: 100%;
        max-height: 96vh;
    }

    .portal-evidence-modal-image {
        max-height: calc(96vh - 105px);
    }
}

/* Document invoice creation */

.document-invoice-creation-actions {
    margin-top: 1.25rem;
}

.document-invoice-warning {
    margin-bottom: 1rem;
}

.document-invoice-form {
    display: grid;
    gap: 0.85rem;
    max-width: 560px;
}

.document-invoice-form .field {
    display: grid;
    gap: 0.45rem;
}

.document-invoice-form input {
    width: 100%;
    min-height: 44px;
    padding: 0.7rem 0.8rem;
    border: 1px solid #d7dce5;
    border-radius: 8px;
    background: #fff;
    color: #172033;
    font: inherit;
}

.document-invoice-form input:focus {
    outline: none;
    border-color: #4f6ef7;
    box-shadow:
        0 0 0 3px rgba(79, 110, 247, 0.12);
}

.document-invoice-form input:disabled {
    background: #f5f6f8;
    cursor: not-allowed;
}

/* Client create modal */

.client-panel-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.client-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.55);
}

.client-modal-overlay[hidden] {
    display: none;
}

.client-modal {
    width: min(100%, 560px);
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    padding: 24px;
    background: #fff;
    border-radius: 18px;
    box-shadow:
        0 24px 60px rgba(15, 23, 42, 0.24);
}

.client-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 20px;
}

.client-modal-close {
    border: 0;
    padding: 0;
    background: transparent;
    color: inherit;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.client-modal form {
    display: grid;
    gap: 16px;
}

.client-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 8px;
}

@media (max-width: 640px) {
    .client-panel-actions {
        flex-direction: column;
        align-items: flex-end;
    }

    .client-modal-overlay {
        padding: 12px;
    }

    .client-modal {
        padding: 20px;
        border-radius: 14px;
    }

    .client-modal-actions {
        flex-direction: column-reverse;
    }

    .client-modal-actions .button {
        width: 100%;
    }
}

/* =========================================================
   Administración de tarifas de servicio
   ========================================================= */

.billing-grid {
    display: grid;
    grid-template-columns:
        minmax(280px, 360px)
        minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.billing-form-panel,
.billing-history-panel {
    padding: 22px;
    border-radius: var(--radius);
}

.billing-panel-header {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.billing-field {
    display: block;
    margin-bottom: 16px;
}

.billing-field > span {
    display: block;
    margin-bottom: 7px;
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
}

.billing-field input,
.billing-field select {
    width: 100%;
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: white;
    color: var(--text);
    font: inherit;
}

.billing-field input:focus,
.billing-field select:focus {
    outline: 2px solid var(--primary-soft);
    border-color: var(--primary);
}

.billing-field small {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 11px;
}

.billing-primary-button {
    width: 100%;
    min-height: 44px;
    border: 0;
    border-radius: 11px;
    background: var(--primary);
    color: white;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.billing-primary-button:hover:not(:disabled) {
    filter: brightness(0.96);
}

.billing-primary-button:disabled {
    opacity: 0.6;
    cursor: wait;
}

.billing-count {
    padding: 6px 10px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 11px;
    font-weight: 700;
}

.billing-table-wrap {
    overflow-x: auto;
}

.billing-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.billing-table th,
.billing-table td {
    padding: 12px 10px;
    border-bottom: 1px solid #eadca8;
    text-align: left;
    vertical-align: middle;
    white-space: nowrap;
}

.billing-table th {
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.billing-status {
    display: inline-flex;
    align-items: center;
    padding: 5px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
}

.billing-status.active {
    color: var(--green);
    background: var(--green-soft);
}

.billing-status.inactive {
    color: var(--muted);
    background: var(--surface-soft);
}

.billing-message {
    margin-bottom: 18px;
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.billing-message.success {
    color: var(--green);
    background: var(--green-soft);
    border: 1px solid #bcebd8;
}

.billing-message.error {
    color: var(--red);
    background: var(--red-soft);
    border: 1px solid #f3c5c5;
}

.billing-message.hidden {
    display: none;
}

@media (max-width: 960px) {
    .billing-grid {
        grid-template-columns: 1fr;
    }
}



/* Payment receivable allocation reversals */

.allocation-list-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.65rem;
    text-align: right;
}

.allocation-amount-breakdown {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    color: #64748b;
    font-size: 0.85rem;
}

.allocation-amount-breakdown strong {
    color: #0f172a;
    font-size: 0.95rem;
}

.payment-reversal-dialog {
    width: min(92vw, 520px);
    border: 0;
    border-radius: 16px;
    padding: 0;
    box-shadow:
        0 24px 64px
        rgba(15, 23, 42, 0.28);
}

.payment-reversal-dialog::backdrop {
    background:
        rgba(15, 23, 42, 0.55);
}

.payment-reversal-form {
    display: grid;
    gap: 1rem;
    padding: 1.5rem;
}

.payment-reversal-form h3 {
    margin: 0;
}

.payment-reversal-maximum {
    padding: 0.75rem 1rem;
    border-radius: 10px;
    background: #f8fafc;
    color: #334155;
    font-weight: 600;
}

.payment-reversal-form textarea {
    resize: vertical;
    min-height: 96px;
}

.payment-reversal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

@media (max-width: 640px) {
    .allocation-list-right {
        align-items: flex-start;
        text-align: left;
    }

    .payment-reversal-actions {
        flex-direction: column-reverse;
    }

    .payment-reversal-actions .button {
        width: 100%;
    }
}

/* =========================================================
   UX BUTTON HIERARCHY - 2026-08-22
   Homologa .button.primary/.secondary con
   .primary-button/.secondary-button.
   ========================================================= */

.primary-button {
    min-height: 42px;
    padding: 0 18px;
    border: 0;
    border-radius: 11px;
    background: var(--primary);
    color: #fff;
    font: inherit;
    font-size: 12px;
    font-weight: 750;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(49, 96, 220, 0.18);
}

.primary-button:hover:not(:disabled) {
    filter: brightness(0.94);
}

.secondary-button {
    min-height: 40px;
    padding: 0 16px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: #fff;
    color: #556079;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.secondary-button:hover:not(:disabled) {
    background: #f7f9fc;
    border-color: #aeb8ca;
}

.button.danger,
.danger-button {
    min-height: 42px;
    padding: 0 16px;
    border: 0;
    border-radius: 11px;
    background: #c62828;
    color: #fff;
    font: inherit;
    font-size: 12px;
    font-weight: 750;
    cursor: pointer;
}

.button.danger:hover:not(:disabled),
.danger-button:hover:not(:disabled) {
    background: #a61f1f;
}

.primary-button:disabled,
.secondary-button:disabled,
.danger-button:disabled,
.button.danger:disabled {
    opacity: 0.45;
    cursor: default;
}

/* Acción preparatoria: no debe competir con la confirmación final */
.candidate-match-select-button {
    background: #fff;
    color: #556079;
    border: 1px solid var(--border);
    box-shadow: none;
}

/* Acción financiera final: deliberadamente prominente */
.candidate-confirm-button {
    min-height: 46px;
    padding: 0 22px;
    font-size: 13px;
    box-shadow: 0 5px 16px rgba(49, 96, 220, 0.24);
}

.primary-button:focus-visible,
.secondary-button:focus-visible,
.danger-button:focus-visible,
.button.danger:focus-visible {
    outline: 3px solid rgba(49, 96, 220, 0.22);
    outline-offset: 2px;
}


/* File input - visual consistency */
.document-upload-grid input[type="file"] {
    padding: 5px 8px;
    cursor: pointer;
}

.document-upload-grid input[type="file"]::file-selector-button {
    min-height: 32px;
    margin-right: 12px;
    padding: 0 14px;

    border: 1px solid var(--border);
    border-radius: 8px;

    background: #fff;
    color: #556079;

    font: inherit;
    font-size: 11px;
    font-weight: 700;

    cursor: pointer;
}

.document-upload-grid input[type="file"]::file-selector-button:hover {
    background: #f7f9fc;
    border-color: #aeb8ca;
}

/* File selector button - warm accent */
.document-upload-grid input[type="file"]::file-selector-button {
    background: #fff7ed;
    color: #b45309;
    border: 1px solid #f59e0b;
    box-shadow: 0 1px 2px rgba(245, 158, 11, 0.10);
}

.document-upload-grid input[type="file"]::file-selector-button:hover {
    background: #ffedd5;
    border-color: #ea580c;
    color: #9a3412;
}


/* Bulk invoice ZIP upload */
.document-batch-upload-panel {
    margin-bottom: 18px;
}

.document-batch-upload-grid {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) auto;
    gap: 14px;
    align-items: end;
}

.document-batch-upload-grid label {
    display: grid;
    gap: 7px;
}

.document-batch-upload-grid label > span {
    color: var(--muted);
    font-size: 9px;
    font-weight: 750;
    text-transform: uppercase;
    letter-spacing: .07em;
}

.document-batch-upload-grid input[type="file"] {
    min-height: 42px;
    padding: 5px 8px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    color: inherit;
    cursor: pointer;
}

.document-batch-upload-grid input[type="file"]::file-selector-button {
    min-height: 32px;
    margin-right: 12px;
    padding: 0 14px;
    border: 1px solid #f59e0b;
    border-radius: 8px;
    background: #fff7ed;
    color: #b45309;
    font: inherit;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
}

.document-batch-upload-grid input[type="file"]::file-selector-button:hover {
    background: #ffedd5;
    border-color: #ea580c;
    color: #9a3412;
}

.document-batch-result {
    margin-top: 14px;
    padding: 12px 14px;
    border: 1px solid #bbdfc8;
    border-radius: 10px;
    background: #f0faf4;
    color: #24633b;
    font-size: 12px;
    font-weight: 650;
}

@media (max-width: 950px) {
    .document-batch-upload-grid {
        grid-template-columns: 1fr;
    }
}

/* Bulk invoice review */
.document-batch-result {
    color: inherit;
    background: #fff;
    border-color: var(--border);
}

.batch-review-title {
    margin: 0 0 4px;
    font-size: 14px;
}

.batch-review-summary {
    margin: 0 0 14px;
    color: var(--muted);
    font-size: 11px;
}

.batch-review-table-wrap {
    overflow-x: auto;
}

.batch-review-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

.batch-review-table th,
.batch-review-table td {
    padding: 10px 8px;
    border-bottom: 1px solid #eadca8;
    text-align: left;
    vertical-align: middle;
}

.batch-review-table th {
    color: var(--muted);
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.batch-invoice-number-input {
    width: 110px;
    min-height: 34px;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    font: inherit;
}

.batch-status-success {
    color: #277443;
    font-weight: 750;
}

.batch-status-ready {
    color: #2458c6;
    font-weight: 750;
}

.batch-review-actions {
    margin-top: 14px;
    display: flex;
    justify-content: flex-end;
}

/* Batch workflow actions */
.batch-review-actions {
    gap: 10px;
    flex-wrap: wrap;
}

.batch-review-checkbox,
.batch-incorporate-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.batch-review-table tbody tr:hover {
    background: #f8faff;
}

/* Bulk client onboarding */
.batch-status-client-missing {
    color: #b45309;
    font-weight: 750;
}

.batch-status-warning {
    color: #a16207;
    font-weight: 750;
}

.batch-missing-clients {
    margin-top: 18px;
    padding: 16px;
    border: 1px solid #fed7aa;
    border-radius: 12px;
    background: #fffaf3;
}

.batch-missing-clients h4 {
    margin: 0 0 5px;
    color: #9a3412;
    font-size: 14px;
}

.batch-missing-clients-help {
    margin: 0 0 14px;
    color: #7c5a3d;
    font-size: 11px;
}

.batch-missing-client-list {
    display: grid;
    gap: 9px;
}

.batch-missing-client-row {
    display: grid;
    grid-template-columns:
        22px minmax(150px, .45fr) minmax(260px, 1fr);
    gap: 10px;
    align-items: center;
}

.batch-client-tax-id,
.batch-client-name {
    min-height: 38px;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 9px;
    font: inherit;
}

.batch-client-tax-id {
    background: #f5f7fa;
    color: #596579;
    font-weight: 700;
}

.batch-client-name {
    background: white;
}

.batch-missing-client-actions {
    margin-top: 14px;
    display: flex;
    justify-content: flex-end;
}

/* BRANDING LOGO SIZING */
.brand-logo {
    display: block;
    object-fit: contain;
}

.brand-logo--sidebar {
    width: 42px !important;
    height: 42px !important;
    max-width: 42px !important;
    max-height: 42px !important;
    flex: 0 0 42px;
}

.brand-logo--login {
    width: 96px !important;
    height: 72px !important;
    max-width: 96px !important;
    max-height: 72px !important;
    margin: 0 auto;
}

.brand-logo--preview {
    width: 320px !important;
    height: 140px !important;
    max-width: 100% !important;
    max-height: 140px !important;
    object-fit: contain;
}

.branding-preview {
    overflow: hidden;
}

.branding-preview img {
    display: block;
    width: 320px;
    height: 140px;
    max-width: 100%;
    max-height: 140px;
    object-fit: contain;
}

/* Branding containment fix 2026-08-23 */
.sidebar .branding-sidebar-brand {
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
}

.sidebar .branding-sidebar-brand img {
    width: auto !important;
    height: auto !important;
    max-width: 180px !important;
    max-height: 95px !important;
    object-fit: contain !important;
}

.branding-preview {
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
}

.branding-preview img {
    width: auto !important;
    height: auto !important;
    max-width: 520px !important;
    max-height: 220px !important;
    object-fit: contain !important;
}

/* =========================================================
   Sidebar compacto + logout + branding apilado
   2026-08-23
   ========================================================= */

.sidebar .nav {
    gap: 3px !important;
}

.sidebar .nav-item {
    min-height: 42px !important;
    padding-top: 9px !important;
    padding-bottom: 9px !important;
}

.sidebar .nav-icon {
    flex: 0 0 24px;
}

.sidebar .sidebar-footer {
    margin-top: auto !important;
    padding-top: 10px !important;
}

.topbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.logout-button {
    appearance: none;
    border: 1px solid #d7dfec;
    background: #ffffff;
    color: #34425a;
    border-radius: 12px;
    padding: 10px 14px;
    min-height: 42px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition:
        background-color .15s ease,
        border-color .15s ease,
        color .15s ease;
}

.logout-button:hover {
    background: #fff4f4;
    border-color: #f1bcbc;
    color: #a52d2d;
}

.company-brand-stack {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden !important;
}

.company-brand-logo-box {
    display: flex !important;
    width: 190px !important;
    height: 96px !important;
    max-width: 100% !important;
    align-items: center !important;
    justify-content: flex-start !important;
    overflow: hidden !important;
}

.company-brand-logo-box img {
    display: block !important;
    width: auto !important;
    height: auto !important;
    max-width: 190px !important;
    max-height: 96px !important;
    object-fit: contain !important;
    object-position: left center !important;
}

.company-brand-text {
    display: block !important;
    clear: both !important;
    width: 100% !important;
    max-width: 210px !important;
    margin-top: 8px !important;
    padding: 0 !important;
}

.company-brand-text strong {
    display: block !important;
    width: 100% !important;
    font-size: 16px !important;
    line-height: 1.2 !important;
    overflow-wrap: anywhere;
}

.company-brand-text span {
    display: block !important;
    width: 100% !important;
    margin-top: 2px !important;
    font-size: 12px !important;
    line-height: 1.2 !important;
}

/* =========================================================
   BRANDING CONTAINMENT FINAL
   2026-08-23
   ========================================================= */

/*
 * Sidebar:
 * el IMG interno se oculta por completo.
 * El logo se pinta en el contenedor fijo.
 */
.sidebar .branding-sidebar-logo-container {
    display: block !important;

    width: 190px !important;
    height: 96px !important;

    min-width: 190px !important;
    min-height: 96px !important;

    max-width: 190px !important;
    max-height: 96px !important;

    margin: 0 0 8px 0 !important;
    padding: 0 !important;

    flex: none !important;

    background-image: url('/brand-logo.php') !important;
    background-repeat: no-repeat !important;
    background-position: left center !important;
    background-size: contain !important;

    overflow: hidden !important;
    box-sizing: border-box !important;
}

.sidebar .branding-sidebar-logo-container img {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    max-width: 0 !important;
    max-height: 0 !important;
}

/*
 * El nombre queda inequívocamente debajo.
 */
.sidebar .branding-sidebar-name {
    display: block !important;
    clear: both !important;

    width: 190px !important;
    max-width: 190px !important;

    margin: 0 !important;
    padding: 0 !important;

    font-size: 16px !important;
    line-height: 1.2 !important;
    font-weight: 700 !important;

    white-space: normal !important;
    overflow-wrap: anywhere !important;
}

.sidebar .branding-sidebar-subtitle {
    display: block !important;
    clear: both !important;

    width: 190px !important;

    margin: 3px 0 0 0 !important;
    padding: 0 !important;

    font-size: 12px !important;
    line-height: 1.2 !important;
}

/*
 * Preview de Administración:
 * misma estrategia, pero con caja mayor.
 */
.branding-preview-logo-box {
    display: block !important;

    width: 540px !important;
    height: 210px !important;

    min-height: 210px !important;

    max-width: 100% !important;
    max-height: 210px !important;

    margin: 0 auto !important;
    padding: 0 !important;

    flex: none !important;

    background-image: url('/brand-logo.php') !important;
    background-repeat: no-repeat !important;
    background-position: center center !important;
    background-size: contain !important;

    overflow: hidden !important;
    box-sizing: border-box !important;
}

.branding-preview-logo-box img {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    max-width: 0 !important;
    max-height: 0 !important;
}

.branding-preview-name {
    display: block !important;
    clear: both !important;

    width: 100% !important;

    margin: 14px 0 0 0 !important;

    text-align: center !important;

    font-size: 24px !important;
    line-height: 1.2 !important;
    font-weight: 700 !important;
}

/*
 * Sidebar compacto.
 */
.sidebar .nav {
    gap: 0 !important;
}

.sidebar .nav-item {
    min-height: 37px !important;

    padding-top: 6px !important;
    padding-bottom: 6px !important;
}

.sidebar .nav-icon {
    flex: 0 0 24px !important;
}

.sidebar .sidebar-footer {
    margin-top: auto !important;
    padding-top: 6px !important;
}

/* Logout debajo del usuario */
.user-account-stack {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
}

.logout-link {
    display: block;
    width: 100%;
    padding: 0 4px;

    border: 0;
    background: transparent;

    color: #6f7f98;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    text-align: right;

    cursor: pointer;
}

.logout-link:hover {
    color: #b42318;
    text-decoration: underline;
}

/* =========================================================
   Usuario + logout vertical FINAL
   ========================================================= */

.topbar .account-actions {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-end !important;
    justify-content: center !important;
    gap: 4px !important;
}

.topbar .account-actions .user-chip {
    display: flex !important;
    flex-direction: row !important;
}

.topbar .account-logout-link {
    display: inline-block !important;

    width: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;

    margin: 0 5px 0 0 !important;
    padding: 2px 3px !important;

    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;

    color: #718099 !important;

    font: inherit !important;
    font-size: 12px !important;
    line-height: 1.3 !important;
    font-weight: 600 !important;

    text-align: right !important;

    cursor: pointer !important;
}

.topbar .account-logout-link:hover {
    color: #b42318 !important;
    text-decoration: underline !important;
}

/* =========================================================
   LOGIN BRANDING - CSP SAFE
   ========================================================= */

.login-credential-brand {
    display: flex;
    flex-direction: column;
    align-items: center;

    width: 100%;

    margin-bottom: 24px;
}

.login-credential-logo {
    display: block;

    width: 190px;
    height: 88px;

    max-width: 100%;

    margin: 0 auto;

    background-image: url('/brand-logo.php');
    background-repeat: no-repeat;
    background-position: center center;
    background-size: contain;

    overflow: hidden;
}

.login-credential-name {
    display: block;

    max-width: 320px;

    margin-top: 8px;

    color: #17213a;

    font-size: 20px;
    line-height: 1.15;
    font-weight: 700;

    text-align: center;
    overflow-wrap: anywhere;
}

.login-credential-subtitle {
    display: block;

    margin-top: 3px;

    color: #7a8ba7;

    font-size: 12px;
    line-height: 1.2;

    text-align: center;
}

.login-default-brand-mark {
    margin: 0 auto 6px auto;
}

/* =========================================================
   PORTAL BRANDING GLOBAL
   ========================================================= */

.sidebar .portal-branding-sidebar {
    display: block !important;

    width: 100% !important;
    max-width: 100% !important;

    padding-bottom: 10px !important;

    overflow: hidden !important;
}

.sidebar .portal-sidebar-logo {
    display: block !important;

    width: 190px !important;
    height: 96px !important;

    max-width: 190px !important;
    max-height: 96px !important;

    margin: 0 0 8px 0 !important;

    background-image:
        url('/brand-logo.php');

    background-repeat:
        no-repeat;

    background-position:
        left center;

    background-size:
        contain;

    overflow: hidden;
}

.sidebar .portal-sidebar-brand-text {
    display: block !important;

    width: 190px !important;
    max-width: 190px !important;
}

.sidebar .portal-sidebar-brand-text strong {
    display: block !important;

    font-size: 16px !important;
    line-height: 1.2 !important;

    overflow-wrap:
        anywhere;
}

.sidebar .portal-sidebar-brand-text span {
    display: block !important;

    margin-top: 3px !important;

    font-size: 12px !important;
    line-height: 1.2 !important;
}

.topbar .user-account-stack {
    display: flex !important;
    flex-direction: column !important;

    align-items: flex-end !important;

    gap: 4px !important;
}

.topbar .account-logout-link {
    display: inline-block !important;

    width: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;

    margin: 0 5px 0 0 !important;
    padding: 2px 3px !important;

    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;

    color: #718099 !important;

    font: inherit !important;
    font-size: 12px !important;
    line-height: 1.3 !important;
    font-weight: 600 !important;

    cursor: pointer !important;
}

.topbar .account-logout-link:hover {
    color: #b42318 !important;

    text-decoration:
        underline !important;
}

/*
 * Mantenemos el sidebar compacto ahora
 * que tiene tres opciones administrativas.
 */
.sidebar .nav {
    gap: 0 !important;
}

.sidebar .nav-item {
    min-height: 37px !important;

    padding-top: 6px !important;
    padding-bottom: 6px !important;
}


/* PAYMENT CANDIDATE DATE EDITOR - CSP SAFE */

.candidate-date-editor {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.candidate-date-input {
    width: auto;
    min-width: 220px;
    min-height: 42px;
    padding: 0.65rem 0.8rem;
    border: 1px solid #d7deea;
    border-radius: 10px;
    background: #fff;
    color: #172033;
    font: inherit;
}

.candidate-date-input:focus {
    outline: 2px solid #2563eb;
    outline-offset: 1px;
    border-color: #2563eb;
}

.candidate-date-input:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.candidate-date-editor .button {
    width: auto;
    min-width: 0;
    margin: 0;
}

@media (max-width: 640px) {
    .candidate-date-editor {
        align-items: stretch;
    }

    .candidate-date-input,
    .candidate-date-editor .button {
        width: 100%;
    }
}

/* DASHBOARD RECEIVABLE PAYMENT OPTIONS - CSP SAFE */

.due-concept {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.due-concept .button {
    width: auto;
    min-width: 0;
    margin: 0;
}

.receivable-options-row > td {
    padding-top: 0;
}

.receivable-options-panel {
    padding: 18px;
    margin: 4px 0 14px;
    border: 1px solid #dfe5ee;
    border-radius: 14px;
    background: #f8fafc;
}

.receivable-options-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.receivable-options-header span {
    color: #64748b;
}

.receivable-options-list {
    display: grid;
    gap: 12px;
}

.receivable-option-card {
    padding: 16px;
    border: 1px solid #dfe5ee;
    border-radius: 12px;
    background: #ffffff;
}

.receivable-option-card.recommended {
    border-color: #93c5fd;
    background: #f8fbff;
}

.receivable-option-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 14px;
}

.receivable-option-amount {
    color: #0f172a;
    white-space: nowrap;
}

.receivable-option-details {
    display: grid;
    grid-template-columns:
        repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px 18px;
}

.receivable-option-details > div {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.receivable-option-details span {
    color: #64748b;
    font-size: 0.85rem;
}

.receivable-option-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.receivable-option-actions .button {
    width: auto;
    min-width: 0;
    margin: 0;
}

@media (max-width: 640px) {
    .receivable-option-top {
        align-items: flex-start;
        flex-direction: column;
    }

    .receivable-option-actions .button {
        width: 100%;
    }
}


/* Dashboard financial charts */

.financial-chart-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 22px;
}

.financial-chart-grid .panel {
    margin-bottom: 0;
}

.financial-chart-card {
    min-width: 0;
}

.financial-chart-header {
    margin-bottom: 20px;
}

.financial-chart-header h3 {
    margin: 2px 0 0;
}

.donut-layout {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    align-items: center;
    gap: 24px;
}

.donut-chart {
    --donut-value: 0;
    --donut-active: var(--primary);

    width: 150px;
    height: 150px;
    border-radius: 50%;
    display: grid;
    place-items: center;

    background:
        conic-gradient(
            var(--donut-active)
                0
                calc(var(--donut-value) * 1%),
            #e8edf5
                calc(var(--donut-value) * 1%)
                100%
        );

    position: relative;
}

.donut-chart::before {
    content: "";
    position: absolute;
    width: 104px;
    height: 104px;
    border-radius: 50%;
    background: var(--surface);
    box-shadow:
        inset 0 0 0 1px
        rgba(148, 163, 184, 0.10);
}

.donut-green {
    --donut-active: var(--green);
}

.donut-blue {
    --donut-active: var(--primary);
}

.donut-amber {
    --donut-active: var(--amber);
}

.donut-center {
    position: relative;
    z-index: 1;
    text-align: center;
}

.donut-center strong,
.donut-center span {
    display: block;
}

.donut-center strong {
    color: var(--text);
    font-size: 25px;
    line-height: 1;
    font-weight: 800;
    letter-spacing: -0.04em;
}

.donut-center span {
    margin-top: 6px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.donut-details {
    min-width: 0;
}

.donut-detail-row {
    padding: 9px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid #eadca8;
    color: var(--muted);
    font-size: 12px;
}

.donut-detail-row:last-child {
    border-bottom: 0;
}

.donut-detail-row span {
    display: flex;
    align-items: center;
    gap: 8px;
}

.donut-detail-row strong {
    color: var(--text);
    font-size: 13px;
    text-align: right;
}

.donut-detail-row.total {
    margin-top: 4px;
    padding-top: 12px;
    font-weight: 700;
}

.donut-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex: 0 0 auto;
    background: #e8edf5;
}

.donut-dot.paid {
    background: var(--green);
}

.donut-dot.collected {
    background: var(--primary);
}

.donut-dot.generated-collected {
    background: var(--amber);
}

.donut-dot.pending {
    background: #d9e0eb;
}


/* Dashboard collapsible panels */

.collapsible-panel {
    padding: 0;
    overflow: hidden;
}

.collapsible-summary {
    padding: 18px 22px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    user-select: none;
    list-style: none;
}

.collapsible-summary::-webkit-details-marker {
    display: none;
}

.collapsible-summary::marker {
    display: none;
    content: "";
}

.collapsible-summary::after {
    content: "⌄";
    margin-left: 4px;
    color: var(--muted);
    font-size: 18px;
    line-height: 1;
    transition: transform 160ms ease;
}

.collapsible-panel[open]
.collapsible-summary::after {
    transform: rotate(180deg);
}

.collapsible-summary-title {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.collapsible-summary-title .eyebrow {
    margin: 0;
}

.collapsible-heading {
    color: var(--text);
    font-size: 16px;
    font-weight: 700;
}

.collapsible-summary-value {
    margin-left: auto;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-align: right;
}

.collapsible-content {
    padding: 0 22px 22px;
    border-top: 1px solid var(--border);
}

.collapsible-content > .money-stack,
.collapsible-content > .table-wrap {
    margin-top: 18px;
}

@media (max-width: 1200px) {
    .financial-chart-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .financial-chart-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .donut-layout {
        grid-template-columns: 1fr;
    }

    .donut-chart {
        margin: 0 auto;
    }

    .collapsible-summary {
        padding: 16px 18px;
    }

    .collapsible-content {
        padding:
            0
            18px
            18px;
    }

    .collapsible-summary-value {
        max-width: 42%;
    }
}

/* Dashboard chart scope switch */

.chart-scope-toolbar {
    margin: 0 0 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.chart-scope-toolbar .eyebrow {
    margin-bottom: 3px;
}

.chart-scope-copy {
    color: var(--muted);
    font-size: 11px;
}

.chart-scope-switch {
    padding: 4px;
    display: inline-flex;
    gap: 4px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    box-shadow:
        0 4px 14px
        rgba(15, 23, 42, 0.04);
}

.chart-scope-button {
    appearance: none;
    border: 0;
    border-radius: 9px;
    padding: 9px 14px;
    color: var(--muted);
    background: transparent;
    cursor: pointer;
    font: inherit;
    font-size: 11px;
    font-weight: 700;
    transition:
        color 140ms ease,
        background 140ms ease,
        box-shadow 140ms ease;
}

.chart-scope-button:hover {
    color: var(--primary);
}

.chart-scope-button.active {
    color: #ffffff;
    background: var(--primary);
    box-shadow:
        0 5px 12px
        rgba(37, 99, 235, 0.20);
}

.chart-scope-button:focus-visible {
    outline: 3px solid
        rgba(37, 99, 235, 0.20);
    outline-offset: 2px;
}

@media (max-width: 700px) {
    .chart-scope-toolbar {
        align-items: stretch;
        flex-direction: column;
        gap: 10px;
    }

    .chart-scope-switch {
        width: 100%;
    }

    .chart-scope-button {
        flex: 1 1 0;
    }
}

/* Dashboard sidebar session v3 */

.sidebar-user-block {
    margin: 12px 0 18px;
}

.sidebar-user-chip {
    width: 100%;
    padding: 10px 12px;
    gap: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.035);
}

.sidebar-user-chip .avatar {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
}

.sidebar-user-chip strong {
    color: #ffffff;
}

.sidebar-user-chip span {
    color: rgba(255, 255, 255, 0.56);
}

.sidebar-user-block .user-account-stack {
    width: 100%;
    align-items: stretch;
}

.sidebar-user-block #logoutButton {
    width: auto;
    margin: 8px 0 0 12px;
    padding: 0;
    border: 0;
    color: rgba(255, 255, 255, 0.62);
    background: transparent;
    box-shadow: none;
    text-align: left;
    font-size: 10px;
    font-weight: 600;
}

.sidebar-user-block #logoutButton:hover {
    color: #ffffff;
    background: transparent;
}


/* Sidebar SVG icons */

.nav-icon {
    display: inline-grid;
    place-items: center;
}

.nav-icon svg {
    width: 17px;
    height: 17px;
    display: block;
    fill: currentColor;
}

/* Shared sidebar authentication */

.topbar > .user-chip,
.topbar .user-account-stack {
    display: none !important;
}

.sidebar-user-block {
    margin: 12px 0 18px;
}

.sidebar-user-chip {
    width: 100%;
    padding: 10px 12px;
    gap: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.035);
}

.sidebar-user-chip .avatar {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
}

.sidebar-user-chip strong {
    color: #ffffff;
}

.sidebar-user-chip span {
    color: rgba(255, 255, 255, 0.56);
}

.nav-icon {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
}

.nav-icon svg {
    width: 17px;
    height: 17px;
    display: block;
    fill: currentColor;
}


/* Documents pagination v3 */

.table-pagination {
    padding-top: 18px;
    margin-top: 6px;
    border-top: 1px solid var(--border);

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.table-pagination-summary {
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
}

.table-pagination-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
}

.table-pagination-button {
    min-width: 34px;
    height: 34px;
    padding: 0 10px;

    border: 1px solid var(--border);
    border-radius: 9px;

    color: var(--text);
    background: var(--surface);

    cursor: pointer;

    font: inherit;
    font-size: 11px;
    font-weight: 700;
}

.table-pagination-button:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
}

.table-pagination-button.active {
    border-color: var(--primary);
    color: #ffffff;
    background: var(--primary);
}

.table-pagination-button:disabled {
    opacity: 0.42;
    cursor: default;
}

.table-pagination-ellipsis {
    padding: 0 3px;
    color: var(--muted);
    font-size: 12px;
}

@media (max-width: 700px) {

    .table-pagination {
        align-items: stretch;
        flex-direction: column;
    }

    .table-pagination-controls {
        justify-content: flex-start;
    }
}
/* PORTAL-DOCUMENT-DELETE-CLIENT-EDIT */

.document-delete-button {
    margin-left: 0.5rem;
    color: #b42318;
    background: #fff;
    border: 1px solid #f0b4ae;
}

.document-delete-button:hover {
    background: #fff4f2;
    border-color: #e88b82;
}

.document-delete-button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.client-basic-editor {
    margin: 0 0 1.5rem;
    padding: 1.5rem;
    background: #fff;
    border: 1px solid #e5eaf2;
    border-radius: 18px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

.client-basic-editor-header {
    margin-bottom: 1.25rem;
}

.client-basic-editor-header h2 {
    margin: 0.2rem 0 0;
}

.client-basic-editor-grid {
    display: grid;
    grid-template-columns:
        minmax(0, 2fr)
        minmax(220px, 1fr);
    gap: 1rem;
}

.client-basic-editor-grid label {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.client-basic-editor-grid label span {
    color: #667085;
    font-size: 0.82rem;
    font-weight: 700;
}

.client-basic-editor-grid input {
    width: 100%;
    min-height: 44px;
    padding: 0.7rem 0.85rem;
    color: #172033;
    background: #fff;
    border: 1px solid #d8dee9;
    border-radius: 10px;
    font: inherit;
}

.client-basic-editor-grid input:focus {
    outline: none;
    border-color: #315fd8;
    box-shadow:
        0 0 0 3px
        rgba(49, 95, 216, 0.12);
}

.client-basic-editor-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

#clientBasicDataError {
    margin-top: 1rem;
}

@media (max-width: 760px) {
    .client-basic-editor-grid {
        grid-template-columns: 1fr;
    }

    .client-basic-editor-actions {
        flex-direction: column-reverse;
    }

    .client-basic-editor-actions .button {
        width: 100%;
    }
}

/* PORTAL-CLIENT-SORT */

.client-sort-button {
    display: inline-flex;
    align-items: center;
    gap: 0.32rem;
    padding: 0;
    color: inherit;
    background: transparent;
    border: 0;
    font: inherit;
    font-weight: inherit;
    text-align: left;
    cursor: pointer;
}

.client-sort-button:hover {
    color: #315fd8;
}

.client-sort-icon {
    display: inline-block;
    min-width: 0.8rem;
    color: #98a2b3;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
    opacity: 0.7;
}

.client-sort-button:hover .client-sort-icon {
    opacity: 1;
}

.client-sort-button.is-active {
    color: #172033;
}

.client-sort-button.is-active .client-sort-icon {
    color: #315fd8;
    opacity: 1;
}

.client-sort-button:focus-visible {
    outline: 2px solid rgba(49, 95, 216, 0.35);
    outline-offset: 3px;
    border-radius: 3px;
}

/* PORTAL-INVOICE-SORT */

.invoice-sort-button {
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: inherit;
    text-align: left;
    cursor: pointer;
}

.invoice-sort-button:hover {
    color: #315fd8;
}

.invoice-sort-icon {
    display: inline-block;
    min-width: 0.8rem;
    color: #98a2b3;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
    opacity: 0.65;
}

.invoice-sort-button:hover
.invoice-sort-icon {
    opacity: 1;
}

.invoice-sort-button.is-active
.invoice-sort-icon {
    color: #315fd8;
    opacity: 1;
}

.invoice-sort-button:focus-visible {
    outline: 2px solid rgba(49,95,216,.3);
    outline-offset: 3px;
    border-radius: 3px;
}

/* PORTAL-PAYMENT-SORT */

.payment-sort-button {
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: inherit;
    text-align: left;
    cursor: pointer;
}

.payment-sort-button:hover {
    color: #315fd8;
}

.payment-sort-icon {
    display: inline-block;
    min-width: 0.8rem;
    color: #98a2b3;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
    opacity: 0.65;
}

.payment-sort-button:hover
.payment-sort-icon {
    opacity: 1;
}

.payment-sort-button.is-active
.payment-sort-icon {
    color: #315fd8;
    opacity: 1;
}

.payment-sort-button:focus-visible {
    outline: 2px solid rgba(49,95,216,.3);
    outline-offset: 3px;
    border-radius: 3px;
}
