/* Resets, typography and layout primitives. All colors via var() from tokens.css */

/* Box sizing reset */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    font-weight: var(--font-normal);
    line-height: 1.5;
    background-color: var(--color-background);
    color: var(--color-text);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Typography scale */
h1, h2, h3, h4, h5, h6 {
    font-weight: var(--font-bold);
    line-height: 1.25;
    color: var(--color-primary);
    margin: 0 0 var(--space-4) 0;
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); }

p {
    margin: 0 0 var(--space-4) 0;
}

small {
    font-size: var(--text-sm);
}

code, pre {
    font-family: var(--font-mono);
}

code {
    font-size: var(--text-sm);
    background-color: var(--color-gray-100);
    padding: var(--space-0-5) var(--space-1);
    border-radius: var(--radius-sm);
}

pre {
    font-size: var(--text-sm);
    background-color: var(--color-gray-100);
    padding: var(--space-4);
    border-radius: var(--radius-md);
    overflow-x: auto;
}

/* Links */
a {
    color: var(--color-blue);
    text-decoration: none;
    transition: color var(--duration-default) var(--ease-default);
}

a:hover {
    text-decoration: underline;
}

/* Layout */
header {
    background-color: var(--color-primary);
    color: var(--color-white);
    padding: var(--space-4) var(--space-8);
}

main {
    max-width: 72rem;
    margin: var(--space-8) auto;
    padding: 0 var(--space-4);
}

footer {
    text-align: center;
    padding: var(--space-8);
    color: var(--color-text-muted);
    border-top: 1px solid var(--color-border);
    margin-top: var(--space-16);
}

/* Cards */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-8);
    box-shadow: var(--shadow);
}

/* Alerts */
.alert {
    padding: var(--space-4);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-4);
}

.was-validated input:invalid,
.was-validated select:invalid,
.was-validated textarea:invalid {
    border-color: var(--color-error);
}

.was-validated input:invalid ~ .invalid-feedback,
.was-validated select:invalid ~ .invalid-feedback,
.was-validated textarea:invalid ~ .invalid-feedback {
    display: block;
}

.invalid-feedback {
    display: none;
    color: var(--color-error);
    font-size: var(--text-xs);
    margin-top: 4px;
}

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

.alert-success {
    background-color: var(--color-success-soft);
    color: var(--color-success);
    border: 1px solid var(--color-success);
}

/* Auth Card Wrapper */
.auth-card-wrapper {
    max-width: 400px;
    margin: 0 auto;
    width: 100%;
}

.invitation-unavailable {
    text-align: center;
    padding: var(--space-2) 0;
}

.invitation-unavailable-icon {
    width: 3.25rem;
    height: 3.25rem;
    margin: 0 auto var(--space-5);
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #E8FAF9;
    border: 1px solid #C9F2F1;
    color: var(--color-primary-hover);
    font-size: 1.5rem;
    font-weight: 700;
}

.invitation-unavailable h2 {
    margin: 0 0 var(--space-3);
    color: var(--color-primary-hover);
    font-size: 1.75rem;
    line-height: 1.2;
}

.invitation-unavailable-message {
    margin: 0 auto var(--space-6);
    max-width: 20rem;
    color: var(--color-text-muted);
    line-height: 1.65;
}

.invitation-unavailable-action {
    display: inline-flex;
    justify-content: center;
    min-width: 11rem;
    text-decoration: none;
}

/* Password Wrapper */
.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper input[type="password"],
.password-wrapper input[type="text"] {
    width: 100%;
    padding-right: 40px;
}

.password-toggle {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 4px;
}

/* The eye is an icon, not a button to paint: the global button:hover fill
   and the focus ring must not colour it on any screen. */
.password-toggle:hover,
.password-toggle:focus,
.password-toggle:focus-visible,
.password-toggle:active {
    background: none;
    box-shadow: none;
    outline: none;
    transform: none;
}

/* Forms */
.form-stack > * + * {
    margin-top: var(--space-5);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

label {
    font-weight: var(--font-medium);
    font-size: var(--text-sm);
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
input[type="url"],
input[type="tel"],
input[type="date"] {
    padding: var(--space-2-5);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--text-base);
    font-family: var(--font-sans);
    transition: border-color var(--duration-default) var(--ease-default),
                box-shadow var(--duration-default) var(--ease-default);
}

input:focus {
    outline: none;
    border-color: var(--color-blue);
    box-shadow: 0 0 0 3px var(--color-primary-ring);
}

textarea {
    padding: var(--space-2-5);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--text-base);
    font-family: var(--font-sans);
    resize: vertical;
    min-height: 5rem;
    transition: border-color var(--duration-default) var(--ease-default),
                box-shadow var(--duration-default) var(--ease-default);
}

textarea:focus {
    outline: none;
    border-color: var(--color-blue);
    box-shadow: 0 0 0 3px var(--color-primary-ring);
}

select {
    padding: var(--space-2-5);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--text-base);
    font-family: var(--font-sans);
    background-color: var(--color-surface);
    cursor: pointer;
    transition: border-color var(--duration-default) var(--ease-default);
}

select:focus {
    outline: none;
    border-color: var(--color-blue);
    box-shadow: 0 0 0 3px var(--color-primary-ring);
}

/* Buttons */
button {
    background-color: var(--color-primary);
    color: var(--color-white);
    padding: var(--space-2-5) var(--space-5);
    border: none;
    border-radius: var(--radius-md);
    font-weight: var(--font-medium);
    cursor: pointer;
    font-size: var(--text-base);
    font-family: var(--font-sans);
    transition: background-color var(--duration-default) var(--ease-default),
                transform var(--duration-default) var(--ease-default);
}

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

button:active {
    transform: scale(0.98);
}

button:disabled {
    background-color: var(--color-gray-400);
    cursor: not-allowed;
    opacity: 0.7;
    transform: none;
}

/* App Shell */
.app-shell {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.app-sidebar {
    width: 260px;
    flex-shrink: 0;
    background-color: var(--color-white);
    color: var(--color-text);
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    border-right: 1px solid var(--color-border);
    height: 100vh;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.app-sidebar::-webkit-scrollbar {
    display: none;
}

.app-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background-color: #F7F9FA;
    height: 100vh;
    overflow-y: auto;
}

.app-content main {
    flex: 1;
    max-width: 100%;
    width: 100%;
    margin: 0;
    padding: var(--space-6) var(--space-8);
    box-sizing: border-box;
}

/* Sidebar */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: var(--space-2-5);
    color: #172033;
    font-weight: var(--font-bold);
    font-size: var(--text-lg);
    text-decoration: none;
    padding: var(--space-2) var(--space-2);
}

.sidebar-brand-icon {
    width: 34px;
    height: 34px;
    background-color: var(--color-primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-white);
}

.sidebar-user-profile {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
}

.user-avatar {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    background-color: #E8FAF9;
    color: var(--color-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--font-bold);
    font-size: var(--text-base);
    text-transform: uppercase;
}

.user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.sidebar-divider {
    height: 1px;
    background-color: #DDE4E8;
    margin: 0;
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    padding: var(--space-4);
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    color: #667085;
    text-decoration: none;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: background-color var(--duration-default) var(--ease-default),
                color var(--duration-default) var(--ease-default);
}

.sidebar-icon {
    opacity: 0.7;
    width: 18px;
    height: 18px;
}

.sidebar-item:hover {
    background-color: #F0F4F8;
    color: #172033;
    text-decoration: none;
}

.sidebar-item--active {
    background-color: #E8FAF9;
    color: var(--color-primary-hover);
}

.sidebar-item--active .sidebar-icon {
    opacity: 1;
    color: var(--color-primary-hover);
}

.sidebar-section-title {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: 14px;
    font-weight: 500;
    color: #667085;
    margin-top: var(--space-4);
    margin-bottom: 4px;
    padding: 10px 12px;
    text-transform: none;
}

.sidebar-section-title svg {
    opacity: 0.7;
    width: 18px;
    height: 18px;
}

.sidebar-subitem {
    padding-left: 42px;
    font-weight: 400;
    color: #667085;
    font-size: 14px;
}

.sidebar-subitem:hover {
    color: #303642;
}

.sidebar-subitem.sidebar-item--active {
    background-color: #E8FAF9;
    color: var(--color-primary-hover);
    font-weight: 500;
}

.sidebar-footer {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.sidebar-version {
    text-align: center;
    color: #9CA3AF;
    font-size: 11px;
    margin-bottom: var(--space-2);
}

.sidebar-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    width: 100%;
    background: none;
    border: none;
    color: #667085;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    padding: var(--space-2);
    border-radius: var(--radius-md);
    transition: background-color var(--duration-default) var(--ease-default);
}

.sidebar-logout:hover {
    background-color: #F0F4F8;
    color: #172033;
}

.sidebar-collapse-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    width: 100%;
    background: none;
    border: none;
    color: #667085;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    padding: var(--space-2);
    border-radius: var(--radius-md);
    transition: background-color var(--duration-default) var(--ease-default), transform var(--duration-default) var(--ease-default);
}

.sidebar-collapse-toggle:hover {
    background-color: #F0F4F8;
    color: #172033;
}

.sidebar-collapse-icon {
    transition: transform var(--duration-default) var(--ease-default);
}

.sidebar-submenu {
    display: none;
    flex-direction: column;
}
.sidebar-group[open] > .sidebar-submenu {
    display: flex;
}
.sidebar-group[open] .sidebar-group-chevron {
    transform: rotate(180deg);
}
.sidebar-group > summary { list-style: none; cursor: pointer; }
.sidebar-group > summary::-webkit-details-marker { display: none; }

/* Tabs */
.tabs {
    display: flex;
    gap: var(--space-1);
    border-bottom: 1px solid var(--color-border);
    margin-bottom: var(--space-6);
}

.tab-btn {
    background: none;
    border: none;
    color: var(--color-text-muted);
    text-decoration: none;
    padding: var(--space-2-5) var(--space-4);
    border-bottom: 2px solid transparent;
    font-weight: var(--font-medium);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: color var(--duration-default) var(--ease-default),
                border-color var(--duration-default) var(--ease-default);
}

.tab-btn:hover {
    color: var(--color-text);
}

.tab-btn--active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}

.table th,
.table td {
    text-align: center;
    padding: var(--space-2-5);
    border-bottom: 1px solid var(--color-border);
}

.table th {
    color: var(--color-text-muted);
    font-weight: var(--font-semibold);
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.table td {
    vertical-align: middle;
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 48rem) {
    .table,
    .data-table {
        min-width: 100%;
        width: 100%;
    }

    .table th:not(:first-child),
    .table td:not(:first-child),
    .data-table th:not(:first-child),
    .data-table td:not(:first-child) {
        display: none;
    }

    .table th:first-child,
    .table td:first-child,
    .data-table th:first-child,
    .data-table td:first-child {
        width: 100%;
    }

    .table tbody tr,
    .data-table tbody tr {
        cursor: pointer;
    }

    .filter-bar {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: var(--space-2);
    }

    .filter-bar .search-input-wrapper,
    .filter-bar .filter-search {
        flex: 1 1 auto;
        min-width: 0;
        display: flex;
        align-items: center;
        gap: var(--space-1);
    }

    .filter-bar .search-input {
        min-width: 0;
        flex: 1 1 auto;
        width: 100%;
    }

    .filter-bar .role-select,
    .filter-bar .filter-select {
        flex: 0 0 auto;
        min-width: 0;
        width: auto;
        max-width: 8rem;
    }

    .filter-bar .filter-actions {
        width: 100%;
        flex-basis: 100%;
        margin-left: 0;
        margin-top: var(--space-1);
    }

    .filter-bar .filter-actions .btn,
    .filter-bar .filter-actions a {
        width: 100%;
        display: flex;
        justify-content: center;
        text-align: center;
    }
}

/* Utility */
.mt-3 {
    margin-top: var(--space-4);
}

/* Sidebar Toggle (Mobile) */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: var(--space-3);
    left: var(--space-3);
    z-index: 30;
    padding: var(--space-1-5) var(--space-3);
    font-size: var(--text-xl);
    line-height: 1;
}

.sidebar-backdrop {
    display: none;
}

/* App Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--color-primary);
    color: var(--color-white);
    padding: var(--space-3-5) var(--space-6);
    position: sticky;
    top: 0;
    z-index: 10;
}

.app-header-left {
    flex: 1;
}

.app-header-title {
    margin: 0;
    font-size: var(--text-xl);
    font-weight: var(--font-semibold);
}

.app-header-right {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.app-header-right .btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}

.header-user {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: var(--space-0-5);
    font-size: var(--text-sm);
}

.user-name {
    font-weight: var(--font-semibold);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: var(--text-xs);
    opacity: 0.8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-6);
    gap: var(--space-4);
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    display: inline-block;
    background-color: var(--color-primary);
    color: var(--color-white);
    padding: var(--space-2-5) var(--space-5);
    border: none;
    border-radius: 20px;
    font-weight: var(--font-medium);
    cursor: pointer;
    font-size: var(--text-base);
    text-decoration: none;
    transition: background-color var(--duration-default) var(--ease-default),
                transform var(--duration-default) var(--ease-default);
}

.btn:hover {
    background-color: var(--color-primary-hover);
    color: var(--color-white);
    text-decoration: none;
}

.btn:active {
    transform: scale(0.98);
}

.btn-sm {
    padding: var(--space-1-5) var(--space-3);
    font-size: var(--text-sm);
}

.btn-outline {
    background: none;
    color: var(--color-primary);
    border: 1px solid var(--color-primary);
}

.btn-outline:hover {
    background-color: var(--color-primary);
    color: var(--color-white);
}

.btn-danger {
    color: var(--color-error);
    border-color: var(--color-error);
}

.btn-danger:hover {
    background-color: var(--color-error-soft);
    border-color: var(--color-error);
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-3);
    margin-top: var(--space-4);
    padding-top: var(--space-3);
    border-top: 1px solid var(--color-border);
}

.pagination-summary {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    flex-wrap: wrap;
}

.pagination-info {
    color: var(--color-text-muted);
    font-size: var(--text-sm);
}

.pagination-page-size {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--color-text-muted);
}

.pagination-page-size select {
    height: 2rem;
    padding: 0 var(--space-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    font-size: var(--text-sm);
    color: var(--color-text);
    cursor: pointer;
}

.pagination-links {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.pagination-current {
    background-color: var(--color-primary);
    color: var(--color-white);
    cursor: default;
}

/* Forms */
.form-row {
    display: flex;
    gap: var(--space-4);
    flex-wrap: wrap;
}

.form-row .form-group {
    flex: 1;
    min-width: 150px;
}

.form-section {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.form-section legend {
    font-weight: var(--font-semibold);
    color: var(--color-text);
    padding: 0 var(--space-2);
}

/* Badges */
.badge {
    display: inline-block;
    padding: var(--space-1) var(--space-2-5);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
}

/* Badges that carry a title="" tooltip (e.g. why a candidate is/isn't
   pre-qualified) — the help cursor is the only affordance we can give
   without adding a column or any JS. */
.badge[title] {
    cursor: help;
}

.badge-active {
    background-color: var(--color-success-soft);
    color: var(--color-success);
}

.badge-inactive {
    background-color: var(--color-error-soft);
    color: var(--color-error);
}

.badge-pending {
    background-color: var(--color-warning-soft);
    color: var(--color-warning);
}

/* Aliases used by several catalog pages (users, kyc, rejections) for simple
   yes/no active flags — same colors as .badge-active/.badge-inactive. */
.badge-success {
    background-color: var(--color-success-soft);
    color: var(--color-success);
}

.badge-warning {
    background-color: var(--color-error-soft);
    color: var(--color-error);
}

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

.badge-outline {
    background-color: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
}

/* Permission Grid */
.permission-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: var(--space-2);
    margin-top: var(--space-3);
}

.permission-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-2-5);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background-color var(--duration-default) var(--ease-default);
}

.permission-item:hover {
    background-color: var(--color-primary-soft);
}

.permission-code {
    font-weight: var(--font-semibold);
    font-size: var(--text-xs);
}

.permission-desc {
    color: var(--color-text-muted);
    font-size: var(--text-xs);
}

/* Form Hint */
.password-requirements {
    margin: 0;
    padding: 0;
    list-style: none;
    line-height: 1.5;
}
.password-requirements li {
    display: flex;
    align-items: baseline;
    gap: var(--space-2);
}
.password-requirements [data-rule-icon] {
    flex-shrink: 0;
    width: 1em;
    text-align: center;
}
.password-requirements [data-met="true"] {
    color: var(--color-success);
}

.form-hint {
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    margin-top: var(--space-2);
}

/* Per-period equivalents of the annual interest rate (company forms):
   five small tiles, two per row on a phone. */
.rate-breakdown {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: var(--space-2);
    margin: 0;
}
.rate-breakdown > div {
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface-muted);
}
.rate-breakdown dt {
    color: var(--color-text-muted);
    font-size: var(--text-xs);
}
.rate-breakdown dd {
    margin: 0;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
@media (max-width: 640px) {
    .rate-breakdown {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Inline Form */
.inline-form {
    display: inline-flex;
}

/* Table Actions */
.table-actions {
    display: flex;
    gap: var(--space-2);
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.inline-form {
    display: inline;
    margin: 0;
}

/* Keeps an icon + text label spaced like a bare button's children. Declared
   before the busy-state rules so a pressed button still hides it. */
.btn .btn-label {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}

/* The geographic catalog (left as it was, with htmx markup) keeps its
   indicators hidden. */
.htmx-indicator {
    display: none;
}

/* "Working…" while the server answers, without JS: the submit button just
   clicked keeps the focus until the next page arrives, so it swaps its label
   for the busy one. Only a mouse/touch press (not a Tab onto it) of a valid
   form — one that will really be sent — shows it. The label is hidden only
   when the button has a busy label to show instead: a button without one
   would go empty and shrink under the pointer as it is pressed, so the
   release lands outside it and the browser drops the click (the form only
   went out on a second click). The same happens when the busy label is
   narrower than the normal one and the button sits at the right end of a
   bar ("Enviar invitaciones" → "Enviando..."): its left edge moves away
   from the pointer. So both labels share one grid cell and only their
   visibility swaps — the button keeps the width of the wider one. */
button:has(> .btn-busy) {
    display: inline-grid;
    place-items: center;
}
button:has(> .btn-busy) > .btn-label,
button:has(> .btn-busy) > .btn-busy {
    grid-area: 1 / 1;
}
.btn-busy {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    visibility: hidden;
}
form:valid button[type="submit"]:focus:not(:focus-visible) > .btn-busy {
    visibility: visible;
}
form:valid button[type="submit"]:has(> .btn-busy):focus:not(:focus-visible) > .btn-label {
    visibility: hidden;
}
/* A form sent from a confirmation popover (SPEI import): the button that
   opened it shows the busy label too. */
form:valid:has(button[type="submit"]:focus:not(:focus-visible)) button[popovertarget] > .btn-busy {
    visibility: visible;
}
form:valid:has(button[type="submit"]:focus:not(:focus-visible)) button[popovertarget]:has(> .btn-busy) > .btn-label {
    visibility: hidden;
}
/* Sent (busy_submit.js): the busy label stays even when the focus leaves
   the button, and a second click cannot send the form twice. */
button.is-busy {
    pointer-events: none;
}
button.is-busy > .btn-busy,
form:has(button.is-busy) button[popovertarget] > .btn-busy {
    visibility: visible;
}
button.is-busy > .btn-label,
form:has(button.is-busy) button[popovertarget]:has(> .btn-busy) > .btn-label {
    visibility: hidden;
}

.btn-spinner {
    display: inline-block;
    width: 0.9rem;
    height: 0.9rem;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: var(--radius-full);
    animation: btn-spin 0.6s linear infinite;
}

@keyframes btn-spin {
    to {
        transform: rotate(360deg);
    }
}

.import-indicator {
    color: var(--color-text-muted);
    font-size: var(--text-sm);
}

/* Drawers */
[id$="-drawer-root"] {
    position: fixed;
    inset: 0;
    z-index: 40;
    pointer-events: none;
    visibility: hidden;
}

[id$="-drawer-root"]:has(> *) {
    visibility: visible;
    pointer-events: auto;
}

/* backdrop-filter itself stays constant (not animated) — transitioning
   the blur radius forces the browser to recomposite everything behind it
   every frame, which showed up as blocky rendering glitches. Only opacity
   animates, same as before; the blur just fades in with it. */
[id$="-drawer-root"] .drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgb(15 23 42 / 0.35);
    backdrop-filter: blur(6px) saturate(120%);
    -webkit-backdrop-filter: blur(6px) saturate(120%);
    opacity: 0;
    transition: opacity var(--duration-default) var(--ease-default);
}

[id$="-drawer-root"] .drawer-backdrop.visible {
    opacity: 1;
}

[id$="-drawer-root"] .drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(560px, 100%);
    max-width: 100%;
    background: var(--color-surface);
    box-shadow: var(--shadow-xl);
    transform: translateX(100%);
    transition: transform var(--duration-default) var(--ease-default);
    display: flex;
    flex-direction: column;
    z-index: 50;
}

[id$="-drawer-root"] .drawer.open {
    transform: translateX(0);
}

[id$="-drawer-root"] .drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--color-border);
}

[id$="-drawer-root"] .drawer-header h2 {
    margin: 0;
    font-size: var(--text-xl);
}

/* Rounded left edge on the role drawer, matching the Figma reference.
   overflow:hidden keeps the scrolling body clipped to that corner instead
   of the scrolled content bleeding past it. Desktop-only: below 768px the
   drawer becomes a bottom sheet (rounded top corners instead — see the
   max-width:768px block) and this higher-specificity ID selector would
   otherwise beat that rule. */
@media (min-width: 769px) {
    #role-drawer-root .drawer {
        border-radius: 16px 0 0 16px;
        overflow: hidden;
    }
}

/* The Figma reference uses a rounder card style inside this drawer (stat
   tiles + permission-group cards) than the site-wide 8px .card default.
   Exact value (14px) pulled from the live prototype's computed styles,
   not eyeballed — scoped here instead of changing --radius-lg globally. */
#role-drawer-root .card {
    border-radius: 14px;
}

/* The role drawer builds its own title bar + identity block inside
   #roleForm (see role_form.html) instead of the generic .drawer-header/
   .drawer-body split every other drawer uses — that's what let the title
   and role-identity row match the Figma reference's exact single bordered
   block, pinned together above the scrolling permission list. This just
   makes the scrolling region fill the remaining space. */
#role-drawer-root .role-drawer-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: var(--space-6);
}

/* Detalle del rol (read-only): scrolling still works with the mouse
   wheel, just without the visible native scrollbar track/thumb. */
#role-drawer-root .role-drawer-scroll-hide-bar {
    scrollbar-width: none;
    -ms-overflow-style: none;
}
#role-drawer-root .role-drawer-scroll-hide-bar::-webkit-scrollbar {
    display: none;
}

/* Nombre/Descripción inputs, matching the Figma reference's computed
   styles exactly: a soft gray fill (no visible border), 14px radius —
   not a full pill, that was an earlier eyeballed guess. Scoped so the
   rest of the app keeps its normal white/bordered rectangular inputs. */
#role-drawer-root #roleForm input[type="text"] {
    border-radius: 14px;
    padding: 8px 12px;
    background: #F7F9FA;
    border: 1px solid transparent;
}

/* Form labels ("Nombre del rol", "Descripción") run smaller/bolder here
   than the site-wide label default. */
#role-drawer-root #roleForm .form-group > label {
    font-size: 12px;
    font-weight: 600;
    color: #172033;
}

/* Stat-tile labels ("Usuarios asignados" / "Permisos asignados"). */
#role-drawer-root #roleForm .role-drawer-scroll .card .metrics-card-label {
    font-size: 12px;
    font-weight: 500;
    color: #667085;
}

/* Exact type scale pulled from the live Figma prototype's computed styles
   (DevTools getComputedStyle, not eyeballed from a screenshot) — the
   permission labels there run smaller than our site-wide defaults, so
   these are scoped overrides rather than global changes. The title/
   identity block sizes its own text inline in role_form.html instead. */
#role-drawer-root .checkbox-text {
    font-size: 12px;
}
#role-drawer-root .badge-active {
    font-size: 10px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 8px;
    background: #ECFDF5;
    color: #22A06B;
}

/* Custom checkbox instead of native accent-color: the browser picks the
   checkmark's black/white contrast on its own based on the accent color,
   which was rendering a black check on the turquoise fill instead of
   white. Building the box + checkmark by hand guarantees turquoise fill
   + white check every time — Nuevo rol, Editar rol and read-only Detalle
   del rol all use the same look. */
#role-drawer-root .checkbox-custom {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    margin: 0;
    border: 1.5px solid #CBD5E1;
    border-radius: 4px;
    background: white;
    position: relative;
    flex-shrink: 0;
}
#role-drawer-root .checkbox-custom:checked {
    background: #20C3C3;
    border-color: #20C3C3;
}
#role-drawer-root .checkbox-custom:checked::after {
    content: "";
    position: absolute;
    left: 4px;
    top: 1px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
#role-drawer-root .checkbox-custom:disabled {
    opacity: 1;
}

/* Cancelar / Guardar cambios footer buttons — exact colors, radius and
   sizing pulled from the live Figma prototype. .btn-outline-gray/.btn-teal
   declare everything with !important site-wide, so these overrides need
   it too (specificity alone can't win against an !important rule). */
/* Figma stretches both footer buttons to fill the whole row instead of
   sizing them to their text and right-aligning the pair. */
#role-drawer-root .form-actions-right {
    justify-content: stretch;
}
#role-drawer-root .form-actions-right .btn-outline-gray,
#role-drawer-root .form-actions-right .btn-teal {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
#role-drawer-root .form-actions-right .btn-outline-gray {
    background-color: white !important;
    color: #303642 !important;
    border: 1px solid #DDE4E8 !important;
    border-radius: 14px !important;
    font-weight: 600 !important;
    font-size: 14px !important;
    height: 40px;
    padding: 0 20px !important;
}
#role-drawer-root .form-actions-right .btn-teal {
    background-color: #20C3C3 !important;
    border-radius: 14px !important;
    font-weight: 600 !important;
    font-size: 14px !important;
    height: 40px;
    padding: 0 20px !important;
}
#role-drawer-root .form-actions-right .btn-teal:hover {
    background-color: #17AEAE !important;
}

/* Collapsible permission groups in the role drawer */
.permission-group-header {
    cursor: pointer;
}
.permission-group-header .group-chevron {
    margin-left: auto;
    color: var(--color-text-muted);
    flex-shrink: 0;
    transition: transform 0.2s ease;
}
.permission-group.collapsed .group-chevron {
    transform: rotate(180deg);
}
.permission-group.collapsed .card-grid-2 {
    display: none;
}

[id$="-drawer-root"] .drawer-close {
    background: none;
    border: none;
    font-size: var(--text-2xl);
    line-height: 1;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: var(--space-1);
    transition: color var(--duration-default) var(--ease-default);
}

[id$="-drawer-root"] .drawer-close:hover {
    color: var(--color-text);
}

[id$="-drawer-root"] .drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-6);
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* old Edge/IE */
}
[id$="-drawer-root"] .drawer-body::-webkit-scrollbar {
    display: none; /* Chrome/Safari/new Edge */
}

/* Sidebar Footer */
.sidebar-footer {
    margin-top: auto;
    padding-top: var(--space-6);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logout {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-2-5) var(--space-3);
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-md);
    color: #172033;
    font: inherit;
    font-size: var(--text-sm);
    cursor: pointer;
    transition: all var(--duration-default) var(--ease-default);
}

.sidebar-logout:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
    color: #172033;
}

.logout-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.22);
}

.logout-modal-backdrop[hidden] {
    display: none;
}

.logout-modal {
    width: min(100%, 390px);
    padding: 18px 20px 16px;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.2);
}

.logout-modal-header,
.logout-modal-title,
.logout-modal-actions {
    display: flex;
    align-items: center;
}

.logout-modal-header {
    justify-content: space-between;
}

.logout-modal-title {
    gap: 10px;
}

.logout-modal-title h2 {
    margin: 0;
    color: #172033;
    font-size: 15px;
    font-weight: 500;
}

.logout-modal-info {
    display: grid;
    width: 18px;
    height: 18px;
    place-items: center;
    border: 1px solid #1D4ED8;
    border-radius: 50%;
    color: #1D4ED8;
    font-size: 12px;
    font-weight: 600;
}

.logout-modal-close {
    padding: 0;
    border: 0;
    color: #667085;
    background: transparent;
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
}

/* The × is an icon, not a button to paint: the global button:hover fill and
   the focus ring (the dialog focuses it on opening) must not colour it. */
.logout-modal-close:hover,
.logout-modal-close:focus,
.logout-modal-close:focus-visible,
.logout-modal-close:active {
    background: transparent;
    box-shadow: none;
    outline: none;
    transform: none;
    color: #344054;
}

.logout-modal p {
    margin: 14px 0 16px;
    color: #667085;
    font-size: 12px;
}

/* A field inside a confirmation (the new end date of Extender/Reactivar)
   keeps the same breathing room from the buttons as the message does. */
.logout-modal .form-group {
    margin: 0 0 20px;
}

.logout-modal-actions {
    justify-content: flex-end;
    gap: 8px;
}

.logout-modal-actions button {
    padding: 7px 11px;
    border-radius: 7px;
    font-size: 12px;
    cursor: pointer;
}

.logout-modal-cancel {
    border: 1px solid #DDE4E8;
    color: #667085;
    background: #fff;
}

/* Cancelar is a secondary button: the global button:hover fill must not turn
   it primary. Same neutral hover as .btn-outline-gray. */
.logout-modal-cancel:hover,
.logout-modal-cancel:focus,
.logout-modal-cancel:active {
    border-color: #CBD5E1;
    color: #344054;
    background: #F7F9FA;
}

.logout-modal-confirm {
    border: 1px solid #20C3C3;
    color: #fff;
    background: #20C3C3;
}

.logout-modal-confirm:hover {
    border-color: #17AEAE;
    background: #17AEAE;
}

.delete-modal-info {
    border-color: #D64545;
    color: #D64545;
}

.logout-modal-info--success {
    border-color: var(--color-success);
    color: var(--color-success);
}

/* Rows skipped by an employee import, listed in its success modal; a long
   file can skip hundreds, so the list scrolls instead of growing the modal. */
.import-success-omitted {
    margin: -6px 0 16px;
    color: #667085;
    font-size: 12px;
}
.import-success-omitted ul {
    max-height: 180px;
    overflow-y: auto;
    margin: 6px 0 0;
    padding-left: 18px;
}

.delete-modal-confirm {
    border-color: #D64545;
    background: #D64545;
}

.delete-modal-confirm:hover {
    border-color: #D64545;
    background: #D64545;
}

/* Header action buttons */
.app-header-right .btn-primary {
    background-color: var(--color-white);
    color: var(--color-primary);
}

.app-header-right .btn-primary:hover {
    background-color: var(--color-primary-hover);
    color: var(--color-white);
}

.app-header-right .btn-outline {
    background: none;
    color: var(--color-white);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.app-header-right .btn-outline:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: var(--color-white);
}

/* Dashboard styles */
.dashboard-title-wrapper {
    margin-bottom: var(--space-8);
}

.dashboard-title-wrapper h1 {
    color: var(--color-primary);
    margin: 0 0 var(--space-2) 0;
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
}

.dashboard-title-wrapper p {
    color: var(--color-text-muted);
    margin: 0;
    font-size: var(--text-base);
}

.dashboard-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: var(--space-8);
}

.flex-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-8);
    border-bottom: 1px solid var(--color-border);
    padding-bottom: var(--space-4);
    gap: var(--space-4);
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-6);
    margin-bottom: var(--space-10);
}

.metrics-card-wrapper {
    padding: var(--space-6);
}

.metrics-card-blue {
    border-left: 4px solid var(--color-blue);
}

.metrics-card-green {
    border-left: 4px solid var(--color-green);
}

.metrics-card-amber {
    border-left: 4px solid var(--color-amber);
}

.metrics-card-indigo {
    border-left: 4px solid var(--color-indigo);
}

.metrics-card-label {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    font-weight: var(--font-semibold);
    text-transform: uppercase;
    margin-bottom: var(--space-2);
}

.metrics-card-value {
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    color: var(--color-primary);
}

.metrics-card-subtext {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    margin-top: var(--space-1);
}

.recent-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-4);
    gap: var(--space-4);
}

.recent-header h3 {
    color: var(--color-primary);
    margin: 0;
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
}

.distribution-header {
    color: var(--color-primary);
    margin: 0 0 var(--space-4) 0;
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
}

.distribution-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

.distribution-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-1-5);
}

.distribution-status-label {
    font-weight: var(--font-semibold);
    text-transform: uppercase;
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

.distribution-status-value {
    font-size: var(--text-sm);
    font-weight: var(--font-bold);
    color: var(--color-primary);
}

.distribution-bar-bg {
    height: 6px;
    background-color: var(--color-border);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.distribution-bar {
    height: 100%;
    width: 100%;
}

.distribution-bar-pending {
    background-color: var(--color-amber);
}

.distribution-bar-approved {
    background-color: var(--color-green);
}

.distribution-bar-dispersing {
    background-color: var(--color-cyan);
}

.distribution-bar-dispersed {
    background-color: var(--color-indigo);
}

.distribution-bar-rejected {
    background-color: var(--color-red);
}

/* Employee Specific Styles */
.employee-no-credit-card {
    padding: var(--space-12);
    text-align: center;
    background-color: var(--color-surface);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-md);
}

.employee-no-credit-icon {
    font-size: var(--text-4xl);
    margin-bottom: var(--space-4);
    color: var(--color-text-muted);
}

.employee-no-credit-title {
    color: var(--color-primary);
    margin-top: 0;
    font-size: var(--text-3xl);
    font-weight: var(--font-bold);
}

.employee-no-credit-text {
    color: var(--color-text-muted);
    font-size: var(--text-base);
    max-width: 500px;
    margin: 0 auto var(--space-6) auto;
}

.employee-progress-card {
    padding: var(--space-10);
    text-align: center;
    border-radius: var(--radius-2xl);
}

.employee-progress-icon {
    font-size: var(--text-3xl);
    margin-bottom: var(--space-4);
    color: var(--color-amber);
}

.employee-progress-title {
    color: var(--color-primary);
    margin-top: 0;
    font-size: var(--text-3xl);
    font-weight: var(--font-bold);
}

.employee-progress-text {
    color: var(--color-text-muted);
    font-size: var(--text-base);
    margin-bottom: var(--space-6);
}

.employee-progress-badge-wrapper {
    display: inline-block;
}

.employee-progress-badge {
    font-size: var(--text-sm);
    text-transform: uppercase;
    font-weight: var(--font-bold);
    padding: var(--space-2) var(--space-6);
    border-radius: var(--radius-full);
}

.employee-progress-badge-pending {
    background-color: var(--color-warning-soft);
    color: var(--color-warning);
}

.employee-progress-badge-approved {
    background-color: var(--color-success-soft);
    color: var(--color-success);
}

.employee-progress-badge-dispersing {
    background-color: var(--color-info-soft);
    color: var(--color-info);
}

.employee-progress-badge-rejected {
    background-color: var(--color-error-soft);
    color: var(--color-error);
}

.employee-active-card {
    padding: var(--space-10);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-md);
    background-color: var(--color-surface);
}

.employee-active-title {
    color: var(--color-primary);
    margin: 0;
    font-size: var(--text-3xl);
    font-weight: var(--font-bold);
}

.employee-active-subtitle {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
}

.employee-active-status {
    background-color: var(--color-success-soft);
    color: var(--color-success);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-full);
    font-weight: var(--font-semibold);
    font-size: var(--text-sm);
    text-transform: uppercase;
}

.employee-metric-widget {
    background-color: var(--color-gray-50);
    border: 1px solid var(--color-border);
    padding: var(--space-6);
    border-radius: var(--radius-xl);
}

.employee-metric-widget-label {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    font-weight: var(--font-medium);
}

.employee-metric-widget-val-primary {
    font-size: var(--text-3xl);
    font-weight: var(--font-bold);
    color: var(--color-primary);
    margin-top: var(--space-2);
}

.employee-metric-widget-val-secondary {
    font-size: var(--text-3xl);
    font-weight: var(--font-bold);
    color: var(--color-sky);
    margin-top: var(--space-2);
}

.employee-metric-widget-val-tertiary {
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    color: var(--color-primary);
    margin-top: var(--space-2);
}

.employee-metric-widget-progress-bg {
    height: 6px;
    background-color: var(--color-border);
    border-radius: var(--radius-full);
    margin-top: var(--space-4);
    overflow: hidden;
}

.employee-metric-widget-progress-bar {
    height: 100%;
    background-color: var(--color-success);
}

.employee-metric-widget-subtext {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    display: block;
    margin-top: var(--space-2);
}

.employee-section-header {
    color: var(--color-primary);
    margin: 0 0 var(--space-4) 0;
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    border-bottom: 2px solid var(--color-primary);
    padding-bottom: var(--space-2);
    width: max-content;
}

/* Helper utility classes */
.card-table {
    padding: 0 !important;
    overflow: hidden;
}

.table-min-600 {
    margin: 0;
    min-width: 600px;
}

.table-min-500 {
    margin: 0;
    min-width: 500px;
}

.table-min-450 {
    min-width: 450px;
}

.card-distribution {
    padding: var(--space-6);
}

.table-cell-bold {
    font-weight: var(--font-semibold);
}

.table-cell-normal {
}

.table-cell-amount {
    font-weight: var(--font-bold);
    color: var(--color-primary);
}

.table-cell-muted {
    color: var(--color-text-muted);
    font-size: var(--text-sm);
}

/* Long values (CURP, email) that otherwise force the table wider than its
   card and push the last column (Acciones) past the visible edge. */
.table-cell-truncate {
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* For a wide table (many columns) that should scroll horizontally inside its
   .table-responsive wrapper instead of wrapping cell text onto several lines
   — one cell wrapping to 3 lines otherwise drags every other cell in that row
   down with it, and the row heights end up wildly inconsistent. */
.table-cell-nowrap {
    white-space: nowrap;
}

.table-cell-empty {
    padding: var(--space-8) !important;
    text-align: center;
    color: var(--color-text-muted);
}

.badge-approved {
    background-color: var(--color-success-soft);
    color: var(--color-success);
}

.badge-dispersing {
    background-color: var(--color-info-soft);
    color: var(--color-info);
}

.badge-dispersed {
    background-color: var(--color-success-soft);
    color: var(--color-success);
}

.badge-rejected {
    background-color: var(--color-error-soft);
    color: var(--color-error);
}

.text-center-muted {
    text-align: center;
    color: var(--color-text-muted);
    font-size: var(--text-sm);
}

th.text-center,
td.text-center {
    text-align: center;
}

.table-wrapper-mb {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-12);
}

.table-cell-mono {
    padding: var(--space-3) var(--space-4) !important;
    font-family: var(--font-mono);
}

.text-right {
    text-align: right;
}

.text-green {
    padding: var(--space-3) var(--space-4) !important;
    font-weight: var(--font-bold);
    color: var(--color-success);
}

.text-normal-cell {
    padding: var(--space-3) var(--space-4) !important;
}

.table-header-bg {
    background-color: var(--color-gray-50);
}

.table-header-alt {
    background-color: var(--color-gray-100);
}

/* Responsive */
@media (max-width: 768px) {
    .app-shell {
        flex-direction: column;
    }

    .sidebar-toggle {
        display: block;
    }

    .app-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 15rem;
        transform: translateX(-100%);
        transition: transform var(--duration-default) var(--ease-default);
        z-index: 20;
    }

    .sidebar-open-state:checked ~ .app-sidebar {
        transform: translateX(0);
    }

    .sidebar-open-state:checked ~ .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgb(0 0 0 / 0.4);
        z-index: 10;
    }

    .app-header {
        padding-left: 3.5rem;
    }

    .app-content main {
        margin: var(--space-4) auto;
        padding: 0 var(--space-3);
    }

    .card {
        padding: var(--space-5);
    }

    .tabs {
        overflow-x: auto;
        white-space: nowrap;
    }

    main {
        padding: 0 var(--space-3);
    }

    [id$="-drawer-root"] .drawer {
        top: auto;
        right: 0;
        bottom: 0;
        width: 100%;
        max-height: 92vh;
        border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
        transform: translateY(100%);
        transition: transform var(--duration-default) var(--ease-default);
    }

    [id$="-drawer-root"] .drawer.open {
        transform: translateY(0);
    }

    .app-header {
        padding: var(--space-3) var(--space-4);
    }

    .app-header-title {
        font-size: var(--text-lg);
    }

    .header-user {
        display: none;
    }

    .app-header-right .btn {
        padding: var(--space-2) var(--space-3);
        font-size: var(--text-sm);
    }
}

@media (max-width: 1024px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
        gap: var(--space-6);
    }
}

@media (max-width: 640px) {
    .flex-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-3);
    }
}

/* Stats Grid for Dashboard and Disbursements */
.stats-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}
@media (max-width: 1024px) {
    .stats-grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 640px) {
    .stats-grid-4 {
        grid-template-columns: 1fr;
    }
}

/* Stats Grid (3-up) — employee catalog and similar summary rows */
.stats-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-5);
    margin-bottom: var(--space-6);
}
@media (max-width: 768px) {
    .stats-grid-3 {
        grid-template-columns: 1fr;
    }
}

.stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    box-shadow: var(--shadow);
}

.stat-card-label {
    color: var(--color-text-muted);
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    margin-bottom: var(--space-2);
}

.stat-card-value {
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
}

.stat-card-value--blue { color: var(--color-blue); }
.stat-card-value--primary { color: var(--color-primary); }
.stat-card-value--indigo { color: var(--color-indigo); }

/* Search field with a leading icon */
.search-field {
    position: relative;
    margin-bottom: var(--space-6);
}

/* Search box + campaign filter side by side above a results table. */
.filters-row {
    display: flex;
    gap: var(--space-4);
    align-items: flex-start;
    flex-wrap: wrap;
}

.filters-row .search-field {
    flex: 1;
    min-width: 220px;
}

.filters-row .campaign-filter {
    min-width: 200px;
}

.search-field-icon {
    position: absolute;
    left: var(--space-4);
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    pointer-events: none;
    display: flex;
}

.search-field input[type="text"] {
    width: 100%;
    padding-left: calc(var(--space-4) + 24px);
    box-sizing: border-box;
}

/* Extra status badges beyond the generic set */
.badge-invited {
    background-color: var(--color-warning-soft);
    color: var(--color-warning);
}

.badge-declined {
    background-color: var(--color-error-soft);
    color: var(--color-error);
}

/* Selection bar for bulk actions (e.g. sending invitations), shown via pure
   CSS when a checkbox inside the associated table is checked — no JS. The
   bar is placed after the table in markup and pulled to the top visually
   with `order`, so the :has()+sibling selector below can reach it. */
.selectable-panel {
    display: flex;
    flex-direction: column;
}

.selectable-panel > form {
    display: flex;
    flex-direction: column;
}

.selection-bar {
    order: -1;
    display: none;
    align-items: center;
    gap: var(--space-4);
    background: oklch(0.95 0.04 195);
    border: 1px solid var(--color-primary);
    border-radius: var(--radius-lg);
    padding: var(--space-3) var(--space-5);
    margin-bottom: var(--space-4);
    color: var(--color-primary);
    font-weight: var(--font-medium);
    font-size: var(--text-sm);
}

.selectable-table:has(.select-checkbox:checked) ~ .selection-bar {
    display: flex;
}

/* Invitations (#237) without JS: the bar shows once something is chosen —
   rows, or every candidate of the filter (#invite-select-all, all=1). In
   that mode the rows show their "exclude" box, drawn inverted (unticked =
   left out). The counts are CSS counters over the ticked boxes. */
.employees-card form:has(.invite-include:checked, #invite-select-all:checked) .selection-bar {
    display: flex;
}
#invite-form { counter-reset: invite-selected invite-excluded; }
.employees-table .invite-include:checked { counter-increment: invite-selected; }
.employees-table .invite-exclude:checked { counter-increment: invite-excluded; }
/* Rows ticked on other pages travel as boxes nobody sees, but they still
   count: opacity, not display:none, keeps them in the counters. */
#invite-form .invite-carried {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    opacity: 0;
    pointer-events: none;
}
#invite-form .invite-include.invite-carried:checked { counter-increment: invite-selected; }
#invite-form .invite-exclude.invite-carried:checked { counter-increment: invite-excluded; }
.invite-selected-count::before { content: counter(invite-selected); }
.invite-excluded-count::before { content: counter(invite-excluded); }
.invite-summary--all,
.invite-excluded,
.employees-table .invite-exclude { display: none; }
#invite-form:has(#invite-select-all:checked) .invite-summary--some,
#invite-form:has(#invite-select-all:checked) .employees-table .invite-include { display: none; }
#invite-form:has(#invite-select-all:checked) .invite-summary--all { display: inline; }
#invite-form:has(#invite-select-all:checked) .employees-table .invite-exclude { display: inline-block; }
#invite-form:has(.invite-exclude:checked) .invite-excluded { display: inline; }
/* An exclude box reads "in" while unticked. */
.employees-table .invite-exclude:not(:checked) {
    background: #20C3C3;
    border-color: #20C3C3;
}
.employees-table .invite-exclude:not(:checked)::after {
    content: "";
    position: absolute;
    left: 4px;
    top: 1px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.employees-table .invite-exclude:checked {
    background: white;
    border-color: #CBD5E1;
}
.employees-table .invite-exclude:checked::after { content: none; }
/* The header box reads "some" (a dash) when only part of the filter is in. */
#invite-form:has(#invite-select-all:checked):has(.invite-exclude:checked) #invite-select-all::after,
#invite-form:has(.invite-include:checked) #invite-select-all:not(:checked)::after {
    content: "";
    position: absolute;
    left: 3px;
    top: 6px;
    width: 7px;
    height: 2px;
    border: 0;
    transform: none;
    background: var(--color-white);
}
#invite-form:has(.invite-include:checked) #invite-select-all:not(:checked) {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

/* Simple overlay modal (e.g. employee detail) */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: oklch(0.2 0.02 260 / 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: var(--space-6);
}

.modal-panel {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 45rem;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 25px -5px oklch(0 0 0 / 0.15);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-6);
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.modal-header h2 {
    margin: 0;
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-muted);
    padding: var(--space-1);
    line-height: 0;
}

.modal-body {
    padding: var(--space-6);
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    padding: var(--space-5) var(--space-6);
    border-top: 1px solid var(--color-border);
    flex-shrink: 0;
}

/* Summary line above a detail page's stats (e.g. campaign status + company +
   date) — a wrapping row of small label:value pairs. */
.campaign-meta {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    flex-wrap: wrap;
}

.meta-item {
    color: var(--color-text-muted);
    font-size: var(--text-sm);
}

.detail-fields {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: var(--space-5) var(--space-6);
}

.detail-field-label {
    display: block;
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    color: var(--color-text-muted);
    margin-bottom: var(--space-1-5);
}

.detail-field-value {
    padding: var(--space-2-5) var(--space-3-5);
    border-radius: var(--radius-md);
    background: var(--color-gray-50);
    border: 1px solid var(--color-border);
    font-size: var(--text-sm);
    color: var(--color-text);
    min-height: 1.25rem;
}

/* Page topbar (title + subtitle strip under the app header) */
.content-topbar {
    background-color: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: var(--space-6) var(--space-8) var(--space-4);
}

.content-topbar-title {
    font-size: var(--text-lg);
    color: var(--color-text);
    font-weight: var(--font-semibold);
    margin: 0;
    line-height: 1.2;
}

.content-topbar-subtitle {
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    margin: var(--space-1) 0 0;
    line-height: 1.2;
}

.icon-sm {
    width: 14px;
    height: 14px;
}

/* Icon-only buttons (e.g. table row actions) — .btn defaults to
   display:inline-block with text-oriented padding, which leaves a bare
   <svg> off-center inside the box. This centers it and keeps the button
   roughly square instead of pill-shaped. */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-2);
    line-height: 0;
}

/* Borderless icon button (e.g. a lone "view" action in a table row) — no box,
   just the icon, with a soft hover tint instead of a visible outline. */
.btn-ghost {
    background: none;
    color: var(--color-primary);
    border: none;
}

.btn-ghost:hover {
    background-color: oklch(0.95 0.04 195);
    color: var(--color-primary-hover);
}

/* A ghost button that's also a destructive action (e.g. "Eliminar") — the
   two-class selector wins over plain .btn-ghost regardless of source order,
   so the icon stays red instead of falling back to the primary teal. */
.btn-ghost.btn-danger {
    color: var(--color-error);
}

.btn-ghost.btn-danger:hover {
    background-color: var(--color-error-soft);
    color: var(--color-error);
}

.page-header-desc {
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    margin: 0;
}

.th-checkbox {
    width: 1%;
}

/* Drawer header with a leading icon (import/upload style drawers) */
.drawer-header-inner {
    display: flex;
    gap: var(--space-3);
}

.drawer-header-icon {
    color: var(--color-primary);
    flex-shrink: 0;
}

.drawer-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-border);
}
/* Footer actions share the available row width. */
.drawer-actions > .btn,
.drawer-actions > .inline-form {
    flex: 1 1 0;
}
.drawer-actions > .inline-form > .btn {
    width: 100%;
}

/* Used when a drawer's actions mix a secondary status toggle with the
   primary action — keeps them from bunching together on the right. */
.drawer-actions--split {
    justify-content: space-between;
}

/* A .drawer-actions that sits directly in the drawer (not nested inside
   .drawer-body, which already carries its own padding) needs its own —
   otherwise its buttons sit flush against the drawer's edges. */
.drawer > .drawer-actions,
.drawer > #employee-detail-content > .drawer-actions {
    padding: var(--space-4) var(--space-6) var(--space-6);
}

/* File picker styled as a drop zone, but a plain native <input type=file> so
   the chosen filename shows without any JS. */
.file-drop {
    border: 2px dashed var(--color-primary);
    border-radius: var(--radius-lg);
    background: oklch(0.95 0.04 195);
    padding: var(--space-10);
    text-align: center;
}

.file-drop-icon {
    color: var(--color-primary);
    margin-bottom: var(--space-4);
}

.file-drop-label {
    display: block;
    color: var(--color-primary);
    font-weight: var(--font-semibold);
    margin-bottom: var(--space-3);
}

.file-drop-input {
    display: block;
    margin: 0 auto var(--space-2);
}

.file-drop-hint {
    color: var(--color-primary);
    font-size: var(--text-xs);
}

/* Role Module & Shared Utilities (Recovered) */
.page-topbar {
    background-color: var(--color-white);
    border-bottom: 1px solid var(--color-border);
    padding: var(--space-6) var(--space-8) var(--space-4) var(--space-8);
}
.margin-bottom-0 { margin-bottom: 0 !important; }
.margin-bottom-1 { margin-bottom: var(--space-1) !important; }
.margin-bottom-3 { margin-bottom: var(--space-3) !important; }
.margin-bottom-4 { margin-bottom: var(--space-4) !important; }
.margin-bottom-6 { margin-bottom: var(--space-6) !important; }
.margin-right-2 { margin-right: var(--space-2) !important; }

.text-color-primary { color: var(--color-primary) !important; }
.text-color-success { color: var(--color-success) !important; }
.text-color-indigo { color: var(--color-indigo) !important; }
.text-color-blue { color: var(--color-blue) !important; }
.text-color-text { color: var(--color-text) !important; }
.font-medium { font-weight: var(--font-medium) !important; }

.flex-col-gap-4 {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}
.flex-col-gap-0 {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.padding-12 { padding: var(--space-12) !important; }
.padding-4 { padding: var(--space-4) !important; }
.flex-start-gap-4 {
    display: flex;
    align-items: flex-start;
    gap: var(--space-4);
}
.icon-box-primary {
    width: 48px;
    height: 48px;
    background: color-mix(in oklab, var(--color-primary) 10%, transparent);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary);
}
.flex-center-gap-3 {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}
.flex-center-gap-4 {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}
.card-title-m0 {
    margin: 0;
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    color: var(--color-text);
}
.flex-wrap-gap-2 {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}
.badge-outline {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
}
.card-no-pad { padding: 0 !important; overflow: hidden; }
.card-header-muted {
    background: var(--color-gray-50);
    padding: var(--space-4);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--color-text-muted);
    border-bottom: 1px solid var(--color-border);
}
.card-grid-2 {
    background: var(--color-white);
    padding: var(--space-4);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
}
.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}
.checkbox-label.pointer { cursor: pointer; }
.checkbox-label.not-allowed { cursor: not-allowed; }
.checkbox-custom {
    width: 16px;
    height: 16px;
    accent-color: var(--color-primary);
    cursor: inherit;
}
.checkbox-text {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
}
.form-actions-right {
    margin-top: auto;
    padding-top: var(--space-8);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
}
.h-full { height: 100% !important; }
/* Dashboard Specific Classes */
.stat-card {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.stat-card-title {
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    margin-bottom: var(--space-4);
}
.stat-card-value {
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    margin-bottom: var(--space-1);
}
.stat-card-subtitle {
    color: var(--color-text-muted);
    font-size: var(--text-xs);
}
.text-purple { color: #7C3AED; }
.text-orange { color: #F59E0B; }
.text-green { color: #22A06B; }
.text-red { color: #D64545; }

.chart-card {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
}
.chart-card-title {
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    color: var(--color-text);
    margin-bottom: var(--space-6);
}
.chart-container {
    width: 100%;
}
.chart-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--color-text-muted);
    text-align: center;
}
.chart-empty-icon {
    margin-bottom: var(--space-3);
    opacity: 0.5;
}
.chart-empty-title {
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
}
.chart-empty-text {
    font-size: var(--text-xs);
    margin-top: var(--space-1);
    max-width: 80%;
}
/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--color-gray-300, #cbd5e1);
    transition: .4s;
    border-radius: 24px;
}
.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}
input:checked + .toggle-slider {
    background-color: var(--color-success, #22A06B);
}
input:checked + .toggle-slider:before {
    transform: translateX(20px);
}
input:disabled + .toggle-slider {
    cursor: not-allowed;
    opacity: 0.7;
}
.btn-teal {
    background-color: #20C3C3 !important;
    color: white !important;
    border-radius: 20px !important;
    border: none !important;
    padding: 8px 16px !important;
    font-weight: 500 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
}
.btn-teal:hover {
    background-color: #17AEAE !important;
}

.btn-outline-gray {
    background-color: white !important;
    color: #667085 !important;
    border: 1px solid #DDE4E8 !important;
    border-radius: 8px !important;
    padding: 8px 16px !important;
    font-weight: 500 !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
}
.btn-outline-gray:hover {
    background-color: #F7F9FA !important;
    border-color: #CBD5E1 !important;
}

/* Extracted from auth_layout.html and backoffice_sidebar.html */
.auth-layout-body {
    background-color: #F7F9FA; 
    background-image: radial-gradient(circle at top right, #E8FAF9, transparent 40%), radial-gradient(circle at bottom left, #C9F2F1, transparent 40%);
    display: flex; 
    align-items: center; 
    justify-content: center; 
    min-height: 100vh; 
    margin: 0; 
    padding: 1rem; 
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.sidebar-header-wrapper { height: 81px; display: flex; align-items: flex-start; padding: 24px 24px 0 24px; box-sizing: border-box; }
.sidebar-brand-link { padding: 0; }
.sidebar-divider-nomargin { margin: 0; }
.sidebar-user-profile-custom { background: linear-gradient(180deg, #F7F9FA 0%, #F0F4F8 100%); padding: 20px 24px; border-radius: 0; }
.user-name-custom { color: #172033; font-weight: 600; }
.user-role-custom { color: #667085; font-weight: 400; margin-top: 2px; }
.sidebar-menu-custom { padding: 16px 16px; margin: 0; }
.sidebar-group-custom { margin-top: 8px; }
.sidebar-group-toggle-btn {
    display: flex; align-items: center; justify-content: space-between; width: 100%; background: none; border: none; padding: 12px 16px; cursor: pointer; color: #667085; font-size: 14px; font-weight: 500; border-radius: 8px; transition: all 0.2s;
}
.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}
.checkbox-label.pointer { cursor: pointer; }
.checkbox-label.not-allowed { cursor: not-allowed; }
.checkbox-custom {
    width: 16px;
    height: 16px;
    accent-color: var(--color-primary);
    cursor: inherit;
}
.checkbox-text {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
}
.form-actions-right {
    margin-top: auto;
    padding-top: var(--space-8);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
}
.h-full { height: 100% !important; }
/* Dashboard Specific Classes */
.stat-card {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.stat-card-title {
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    margin-bottom: var(--space-4);
}
.stat-card-value {
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    margin-bottom: var(--space-1);
}
.stat-card-subtitle {
    color: var(--color-text-muted);
    font-size: var(--text-xs);
}
.text-purple { color: #7C3AED; }
.text-orange { color: #F59E0B; }
.text-green { color: #22A06B; }
.text-red { color: #D64545; }

.chart-card {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
}
.chart-card-title {
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    color: var(--color-text);
    margin-bottom: var(--space-6);
}
.chart-container {
    width: 100%;
}
.chart-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--color-text-muted);
    text-align: center;
}
.chart-empty-icon {
    margin-bottom: var(--space-3);
    opacity: 0.5;
}
.chart-empty-title {
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
}
.chart-empty-text {
    font-size: var(--text-xs);
    margin-top: var(--space-1);
    max-width: 80%;
}
/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--color-gray-300, #cbd5e1);
    transition: .4s;
    border-radius: 24px;
}
.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}
input:checked + .toggle-slider {
    background-color: var(--color-success, #22A06B);
}
input:checked + .toggle-slider:before {
    transform: translateX(20px);
}
input:disabled + .toggle-slider {
    cursor: not-allowed;
    opacity: 0.7;
}
.btn-teal {
    background-color: #20C3C3 !important;
    color: white !important;
    border-radius: 20px !important;
    border: none !important;
    padding: 8px 16px !important;
    font-weight: 500 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
}
.btn-teal:hover {
    background-color: #17AEAE !important;
}

.btn-outline-gray {
    background-color: white !important;
    color: #667085 !important;
    border: 1px solid #DDE4E8 !important;
    border-radius: 8px !important;
    padding: 8px 16px !important;
    font-weight: 500 !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
}
.btn-outline-gray:hover {
    background-color: #F7F9FA !important;
    border-color: #CBD5E1 !important;
}

/* Extracted from auth_layout.html and backoffice_sidebar.html */
.auth-layout-body {
    background-color: #F7F9FA; 
    background-image: radial-gradient(circle at top right, #E8FAF9, transparent 40%), radial-gradient(circle at bottom left, #C9F2F1, transparent 40%);
    display: flex; 
    align-items: center; 
    justify-content: center; 
    min-height: 100vh; 
    margin: 0; 
    padding: 1rem; 
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.sidebar-header-wrapper { height: 81px; display: flex; align-items: flex-start; padding: 24px 24px 0 24px; box-sizing: border-box; }
.sidebar-brand-link { padding: 0; }
.sidebar-divider-nomargin { margin: 0; }
.sidebar-user-profile-custom { background: linear-gradient(180deg, #F7F9FA 0%, #F0F4F8 100%); padding: 20px 24px; border-radius: 0; }
.user-name-custom { color: #172033; font-weight: 600; }
.user-role-custom { color: #667085; font-weight: 400; margin-top: 2px; }
.sidebar-menu-custom { padding: 16px 16px; margin: 0; }
.sidebar-group-custom { margin-top: 8px; }
.sidebar-group-toggle-btn {
    display: flex; align-items: center; justify-content: space-between; width: 100%; background: none; border: none; padding: 12px 16px; cursor: pointer; color: #667085; font-size: 14px; font-weight: 500; border-radius: 8px; transition: all 0.2s;
}
.sidebar-group-toggle-btn:hover { background: #F7F9FA; color: #172033; }
.sidebar-group-title-wrapper { display: flex; align-items: center; gap: 16px; }
.sidebar-icon-opacity { opacity: 0.8; }
.sidebar-group-chevron-custom { opacity: 0.7; transition: transform 0.2s; }

/* Topbar extracted from dashboard and pages */
.topbar-wrapper { background-color: white; border-bottom: 1px solid #DDE4E8; padding: 24px 32px 16px 32px; }
.topbar-title { font-size: 18px; color: #172033; font-weight: 600; margin: 0; line-height: 1.2; }
.topbar-subtitle { color: #667085; font-size: 13px; margin: 4px 0 0 0; line-height: 1.2; }

/* Dashboard Styles */
.dashboard-title-wrapper { margin-bottom: var(--space-6); }
.dashboard-title-wrapper h1 { font-size: var(--text-2xl); font-weight: 500; margin-bottom: var(--space-1); color: #172033; }
.dashboard-title-wrapper p { color: #667085; font-size: var(--text-sm); margin: 0; }
.stats-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-4); margin-bottom: var(--space-6); }
.stats-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-4); margin-bottom: var(--space-6); }
.stat-card { background: #FFFFFF; border: 1px solid #DDE4E8; border-radius: 12px; padding: var(--space-4) var(--space-5); display: flex; flex-direction: column; justify-content: space-between; min-height: 110px; }
.stat-card-title { color: #667085; font-size: 13px; font-weight: 500; margin-bottom: var(--space-3); }
.stat-card-value { font-size: 24px; font-weight: 600; color: var(--color-primary); margin-bottom: var(--space-1); }
.stat-card-value.text-orange { color: #F59E0B; }
.stat-card-value.text-green { color: #22A06B; }
.stat-card-value.text-purple { color: #7C3AED; }
.stat-card-value.text-red { color: #D64545; }
.stat-card-subtitle { font-size: 11px; color: #9CA3AF; display: flex; align-items: center; gap: 4px; }
.stat-card-subtitle .trend-up { color: #22A06B; font-weight: 600; }
.charts-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); margin-bottom: var(--space-6); }
.chart-card { background: #FFFFFF; border: 1px solid #DDE4E8; border-radius: 12px; padding: var(--space-5); }
.chart-card-title { color: #172033; font-size: 14px; font-weight: 500; margin-bottom: var(--space-4); }
.chart-container { position: relative; height: 250px; width: 100%; }

/* Companies Page Styles */
.badge-status-active { background-color: #E8F7F0; color: #22A06B; padding: 4px 8px; border-radius: 4px; font-size: 11px; font-weight: 500; }
.badge-status-inactive { background-color: #F0F4F8; color: #667085; padding: 4px 8px; border-radius: 4px; font-size: 11px; font-weight: 500; }
.badge-status-pending { background-color: #FFF8E6; color: #D97706; padding: 4px 8px; border-radius: 4px; font-size: 11px; font-weight: 500; }
.hover-row { transition: background-color 0.2s ease; }
.hover-row:hover { background-color: #F7F9FA; }

/* Solicitudes Page Styles */
.solicitud-table th { padding: 16px; font-size: 11px; font-weight: 600; color: #667085; border-bottom: 1px solid #DDE4E8; text-align: center; text-transform: uppercase; letter-spacing: 0.05em; }
.solicitud-table td { padding: 16px; font-size: 13px; color: #172033; border-bottom: 1px solid #F0F4F8; vertical-align: middle; text-align: center; }
.solicitud-table tr:last-child td { border-bottom: none; }
.tab-item { padding: 12px 16px; font-size: 14px; color: #667085; cursor: pointer; border-bottom: 2px solid transparent; font-weight: 500; text-decoration: none; }
.tab-item:hover { color: var(--color-primary-hover); }
.tab-item--active { color: var(--color-primary-hover); border-bottom: 2px solid var(--color-primary-hover); }
.badge-sol-pending, .badge-sol-dispersing { background-color: #FFF8E6; color: #D97706; padding: 4px 12px; border-radius: 12px; font-size: 12px; font-weight: 500; }
.badge-sol-approved, .badge-sol-dispersed, .badge-sol-paid { background-color: #E8F7F0; color: #22A06B; padding: 4px 12px; border-radius: 12px; font-size: 12px; font-weight: 500; }
.badge-sol-rejected, .badge-sol-cancelled { background-color: #FEF2F2; color: #D64545; padding: 4px 12px; border-radius: 12px; font-size: 12px; font-weight: 500; }

/* Company Drawer Styles */
#company-drawer-inner .drawer-body::-webkit-scrollbar { width: 8px; }
#company-drawer-inner .drawer-body::-webkit-scrollbar-track { background: #F0F4F8; border-radius: 4px; }
#company-drawer-inner .drawer-body::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 4px; }
#company-drawer-inner .drawer-body::-webkit-scrollbar-thumb:hover { background: #9CA3AF; }
#company-drawer-inner .drawer-header { background-color: #F7F9FA; border-bottom: 2px solid #DDE4E8; padding: 24px 32px; }
#company-drawer-inner .drawer-header h2 { color: #172033; font-weight: 700; font-size: 20px; letter-spacing: -0.02em; }
#company-drawer-inner .drawer-close { color: #667085; background: #DDE4E8; border-radius: 50%; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; font-size: 20px; transition: all 0.2s; }
#company-drawer-inner .drawer-close:hover { background: var(--color-primary-hover); color: white; }
#company-drawer-inner .drawer-body { padding: 32px; }

/* Filter Bar & Table Styles */
.filter-bar-wrapper { display:flex; justify-content:space-between; align-items:center; background:white; padding:16px; border-radius:12px; border:1px solid #DDE4E8; margin-bottom:var(--space-6); }
.search-input-wrapper { flex:1; display:flex; align-items:center; background:#F7F9FA; border-radius:20px; padding:8px 16px; max-width:400px; }
.search-input { background:transparent; border:none; outline:none; margin-left:8px; width:100%; font-size:13px; color:#667085; }
.filter-actions { display:flex; align-items:center; gap:12px; }
.filter-select { border:1px solid #DDE4E8; border-radius:8px; padding:8px 12px; font-size:13px; color:#667085; outline:none; background:white; }
.btn-primary-custom { background:var(--color-primary-hover) !important; color:white !important; border-radius:20px !important; padding:8px 16px !important; font-size:13px !important; font-weight:500 !important; border:none !important; display:inline-flex !important; align-items:center !important; gap:8px !important; }
.text-primary { color: var(--color-primary-hover) !important; }
.text-green { color: #22A06B !important; }
.table-wrapper { background:white; border-radius:12px; border:1px solid #DDE4E8; overflow:hidden; }
.table-empty-state { padding: 40px; text-align: center; color: #667085; }

/* Final utility classes */
.w-full { width: 100%; }
.border-collapse { border-collapse: collapse; }
.text-center { text-align: center; }
.cursor-pointer { cursor: pointer; }
.flex { display: flex; }
.items-center { align-items: center; }
.flex-col { display: flex; flex-direction: column; }
.gap-12 { gap: 12px; }

/* Company Table specific */
.company-icon { width: 36px; height: 36px; background: #E8FAF9; color: var(--color-primary-hover); border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.company-name { font-weight: 600; font-size: 12px; color: #172033; text-transform: uppercase; }
.company-business-name { font-size: 11px; color: #667085; text-transform: uppercase; }
.badge-rfc { background: #F0F4F8; color: #667085; padding: 4px 10px; border-radius: 8px; font-size: 11px; font-weight: 500; text-transform: uppercase; }
.location-city { font-weight: 500; font-size: 12px; color: #172033; }
.location-state { font-size: 11px; color: #667085; }
.employee-count { color: #22A06B; font-weight: 600; font-size: 12px; }
.active-credits { font-size: 11px; color: #667085; }

/* Solicitudes Page specific */
.px-0 { padding: 0; }
.search-section-wrapper { background: white; border-radius: 12px; border: 1px solid #DDE4E8; padding: 20px; margin-bottom: 24px; }
.search-title { font-size: 13px; font-weight: 600; color: #667085; margin-bottom: 12px; }
.search-box { display: flex; align-items: center; background: #F7F9FA; border-radius: 8px; padding: 12px 16px; width: 100%; }
.search-input-large { background: transparent; border: none; outline: none; width: 100%; font-size: 14px; color: #667085; }
.mb-4 { margin-bottom: 16px; }
.pagination-summary { font-size: 12px; color: #667085; margin-bottom: 16px; }
.font-semibold { font-weight: 600; }
.tabs-container { display: flex; gap: 16px; border-bottom: 1px solid #DDE4E8; }
.sol-id { font-weight: 600; font-size: 12px; }
.sol-date { font-size: 11px; color: #667085; }
.text-12 { font-size: 12px; }

/* Users Page Styles */
.user-header {
    padding: 24px 32px 16px 32px;
    background: white;
    border-bottom: 1px solid #DDE4E8;
}
.user-header h1 {
    font-size: 18px;
    color: #172033;
    font-weight: 600;
    margin: 0;
    line-height: 1.2;
}
.user-header p {
    color: #667085;
    font-size: 13px;
    margin: 4px 0 0 0;
    line-height: 1.2;
}

.stats-margin {
    margin-bottom: var(--space-6);
}
.text-indigo { color: var(--color-primary); }
.text-green { color: #22A06B; }

.filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid #DDE4E8;
    margin-bottom: var(--space-6);
}
.search-input-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    background: #F7F9FA;
    border-radius: 20px;
    padding: 8px 16px;
    max-width: 400px;
}
.search-input {
    background: transparent;
    border: none;
    outline: none;
    margin-left: 8px;
    width: 100%;
    font-size: 13px;
    color: #667085;
}
.filter-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}
.role-select {
    border: none;
    background: transparent;
    font-size: 13px;
    color: #667085;
    outline: none;
    cursor: pointer;
    font-weight: 500;
}
.btn-primary-rounded {
    background: var(--color-primary);
    color: white;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    border: none;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.table-container {
    background: white;
    border-radius: 12px;
    border: 1px solid #DDE4E8;
    overflow: hidden;
}
.empty-state {
    padding: 40px;
    text-align: center;
    color: #667085;
}
.custom-table {
    width: 100%;
    border-collapse: collapse;
}
.custom-table th {
    padding: 16px;
    font-size: 11px;
    font-weight: 600;
    color: #667085;
    border-bottom: 1px solid #DDE4E8;
    text-align: center;
    text-transform: uppercase;
}
.custom-table td {
    padding: 16px;
    border-bottom: 1px solid #F0F4F8;
    vertical-align: middle;
    text-align: center;
}
.custom-table th.text-center, .custom-table td.text-center {
    text-align: center;
}

.user-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}
.user-avatar-circle {
    width: 36px;
    height: 36px;
    background: #EEF2FF;
    color: var(--color-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    text-transform: uppercase;
}
.user-info-text {
    display: flex;
    flex-direction: column;
}
.user-email-main {
    font-weight: 600;
    font-size: 12px;
    color: #172033;
}
.user-email-sub {
    font-size: 11px;
    color: #667085;
}

.role-badge {
    background: #EEF2FF;
    color: var(--color-primary);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}
.department-text, .access-text, .status-text {
    font-size: 12px;
    color: #667085;
}

.toggle-form {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.toggle-btn {
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
}
.toggle-track {
    width: 36px;
    height: 20px;
    background: #CBD5E1;
    border-radius: 10px;
    display: flex;
    align-items: center;
    padding: 2px;
    transition: background-color 0.2s;
}
.toggle-track.active {
    background: #22A06B;
}
.toggle-thumb {
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    transform: translateX(0);
    transition: transform 0.2s;
}
.toggle-thumb.active {
    transform: translateX(16px);
}

.action-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #667085;
    padding: 4px;
}
.action-btn:hover {
    color: #172033;
}
.action-disabled {
    color: #CBD5E1;
}

/* User Form/Drawer Styles */
.user-drawer-form-wrapper {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}
.user-drawer-form-row {
    display: flex;
    gap: var(--space-4);
}
.user-drawer-form-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}
.user-drawer-input, .user-drawer-select {
    padding: 10px 12px;
    border: 1px solid #DDE4E8;
    border-radius: 8px;
    font-size: 14px;
    color: #172033;
    background: #F7F9FA;
    outline: none;
    width: 100%;
}
.user-drawer-input:focus, .user-drawer-select:focus {
    border-color: var(--color-primary);
    background: white;
}
.user-drawer-label {
    font-size: 13px;
    font-weight: 600;
    color: #172033;
}
.user-drawer-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}
.btn-cancel {
    background: white;
    border: 1px solid #DDE4E8;
    color: #172033;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 500;
    cursor: pointer;
}
.btn-submit {
    background: var(--color-primary);
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 500;
    cursor: pointer;
}
.user-drawer-header-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
}
.user-drawer-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: #172033;
    margin: 0 0 8px 0;
}
.user-drawer-header p {
    font-size: 14px;
    color: #667085;
    margin: 0;
}
.drawer-close-icon {
    background: none;
    border: none;
    color: #667085;
    cursor: pointer;
    padding: 4px;
}

/* =============================================
   Solicitud Detail Page (sd-*)
   ============================================= */

/* Layout */
.sd-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.sd-topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}
.sd-back-link {
    text-decoration: none;
    color: #172033;
    display: flex;
    align-items: center;
}
.sd-title {
    margin: 0;
    font-size: var(--text-2xl);
}
.sd-subtitle {
    margin: 4px 0 0 0;
    color: #667085;
    font-size: var(--text-sm);
}
.sd-status-wrapper {
    display: flex;
    align-items: center;
    margin-right: 8px;
}
.sd-status-badge {
    font-size: 13px;
    font-weight: 500;
    padding: 6px 16px;
}

.sd-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    align-items: start;
}
.sd-main {}
.sd-sidebar {}

/* Cards */
.sd-card {
    margin-bottom: 24px;
}

/* Info grid */
.sd-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.sd-info-item label {
    display: block;
    font-size: 12px;
    color: #667085;
    margin-bottom: 4px;
    font-weight: var(--font-normal);
}
.sd-info-item span {
    display: block;
    font-size: 14px;
    color: #172033;
    font-weight: 500;
}
.text-uppercase {
    text-transform: uppercase;
}

/* Credit boxes */
.sd-credit-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}
.sd-credit-box {
    border-radius: 8px;
    padding: 16px;
}
.sd-credit-box label {
    display: block;
    font-size: 12px;
    color: #667085;
    margin-bottom: 8px;
    font-weight: var(--font-normal);
}
.sd-credit-box--purple {
    background: #EDE9FE;
    border: 1px solid #EDE9FE;
}
.sd-credit-box--green {
    background: #E8F7F0;
    border: 1px solid #E8F7F0;
}
.sd-credit-amount {
    font-size: 20px;
    font-weight: 700;
    color: #7C3AED;
}
.sd-credit-amount--green {
    color: #22A06B;
}
.sd-credit-term {
    font-size: 18px;
    font-weight: 600;
    color: #7C3AED;
}

/* Tabs */
.sd-tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}
.sd-tab {
    flex: 1;
    padding: 12px;
    text-align: center;
    background: #F0F4F8;
    color: #667085;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
}
.sd-tab--active {
    background: white;
    color: #172033;
    border: 1px solid #DDE4E8;
}
.sd-tab-hidden {
    display: none;
}

/* Documents */
.sd-section-label {
    font-size: 13px;
    font-weight: 600;
    color: #667085;
    margin-bottom: 16px;
}
.sd-section-label--mt {
    margin-top: 24px;
}
.sd-doc-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border: 1px solid #DDE4E8;
    border-radius: 8px;
    margin-bottom: 12px;
}
.sd-doc-item--contract {
    background: #EEF2FF;
    border-color: #DBEAFE;
}
.sd-doc-info {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #667085;
    font-size: 14px;
}
.sd-doc-icon {
    color: #667085;
}
.sd-doc-icon--blue {
    color: #1D4ED8;
}
.sd-doc-link {
    color: #1D4ED8;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
}
.sd-doc-link:hover {
    text-decoration: underline;
}
.sd-contract-name {
    font-size: 14px;
    font-weight: 600;
    color: #1D4ED8;
}
.sd-contract-date {
    font-size: 12px;
    color: #1D4ED8;
    margin-top: 2px;
}
.sd-contract-btn {
    font-size: 13px;
    padding: 6px 16px;
    text-decoration: none;
}

/* Bank section */
.sd-bank-box {
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
}
.sd-bank-box label {
    display: block;
    font-size: 12px;
    color: #667085;
    margin-bottom: 6px;
    font-weight: var(--font-normal);
}
.sd-bank-box--purple {
    background: #EDE9FE;
    border: 1px solid #EDE9FE;
}
.sd-bank-box--blue {
    background: #EEF2FF;
    border: 1px solid #DBEAFE;
}
.sd-bank-label--blue {
    color: #1D4ED8 !important;
}
.sd-bank-value {
    font-size: 14px;
    font-weight: 500;
}
.sd-bank-value--purple {
    color: #7C3AED;
}
.sd-bank-value--blue {
    color: #1D4ED8;
}
.sd-validated-box {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    background: #E8F7F0;
    border: 1px solid #E8F7F0;
    border-radius: 8px;
    padding: 16px;
}
.sd-validated-title {
    color: #22A06B;
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 2px;
}
.sd-validated-desc {
    color: #15803D;
    font-size: 12px;
}

/* Action buttons */
.sd-approved-msg {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    font-weight: 500;
    text-align: center;
    font-size: 14px;
    background: #E8F7F0;
    color: #22A06B;
    border: 1px solid #E8F7F0;
}
.sd-actions-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.sd-btn-approve {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    border: none;
    background: #0B9FA5;
    color: white;
}
.sd-btn-approve:hover {
    background: #17AEAE;
}
.sd-btn-reject {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    background: white;
    border: 1px solid #DDE4E8;
    color: #D64545;
}
.sd-btn-reject:hover {
    background: #FEF2F2;
}

/* Summary */
.sd-summary-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.sd-summary-item {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
}
.sd-summary-label {
    color: #667085;
}
.sd-summary-value {
    color: #172033;
    font-weight: 500;
    text-align: right;
}

/* Risk box */
.sd-risk-box {
    background: #E8F7F0;
    border: 1px solid #E8F7F0;
    border-radius: 8px;
    padding: 16px;
}
.sd-risk-title {
    color: #22A06B;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 14px;
}
.sd-risk-desc {
    color: #15803D;
    font-size: 12px;
    margin-bottom: 12px;
    line-height: 1.5;
}
.sd-risk-stat {
    color: #22A06B;
    font-size: 12px;
    font-weight: 500;
}
.sd-risk-box--high { background: #FEF2F2; border-color: #FEE2E2; }
.sd-risk-box--high .sd-risk-title,
.sd-risk-box--high .sd-risk-stat { color: #D64545; }
.sd-risk-box--high .sd-risk-desc { color: #B91C1C; }
.sd-risk-box--unknown { background: #F3F4F6; border-color: #F3F4F6; }
.sd-risk-box--unknown .sd-risk-title,
.sd-risk-box--unknown .sd-risk-stat,
.sd-risk-box--unknown .sd-risk-desc { color: #6B7280; }

/* =============================================
   Solicitudes List Page (sl-*)
   ============================================= */

/* Search */
.sl-search-box {
    background: white;
    border-radius: 12px;
    border: 1px solid #DDE4E8;
    padding: 20px;
    margin-bottom: 24px;
}
.sl-search-label {
    font-size: 13px;
    font-weight: 600;
    color: #667085;
    margin-bottom: 12px;
}
.sl-search-input-wrapper {
    display: flex;
    align-items: center;
    background: #F7F9FA;
    border-radius: 20px;
    padding: 12px 16px;
    width: 100%;
}
.sl-search-input {
    background: transparent;
    border: none;
    outline: none;
    width: 100%;
    font-size: 14px;
    color: #667085;
    padding: 0;
}

/* Tabs section */
.sl-tabs-section {
    margin-bottom: 16px;
}
.sl-count-label {
    font-size: 12px;
    color: #667085;
    margin-bottom: 16px;
}
.sl-count-value {
    color: #0B9FA5;
    font-weight: 600;
}
.sl-tabs-bar {
    display: flex;
    gap: 16px;
    border-bottom: 1px solid #DDE4E8;
}
.tab-item {
    padding: 12px 16px;
    font-size: 14px;
    color: #667085;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    font-weight: 500;
    text-decoration: none;
}
.tab-item:hover {
    color: #0B9FA5;
    text-decoration: none;
}
.tab-item--active {
    color: #0B9FA5;
    border-bottom: 2px solid #0B9FA5;
}

/* Table wrapper */
.sl-table-wrapper {
    background: white;
    border-radius: 12px;
    border: 1px solid #DDE4E8;
    overflow: hidden;
}
.sl-empty-state {
    padding: 40px;
    text-align: center;
    color: #667085;
}

/* Table */
.solicitud-table {
    width: 100%;
    border-collapse: collapse;
}
.solicitud-table th {
    padding: 16px;
    font-size: 11px;
    font-weight: 600;
    color: #667085;
    border-bottom: 1px solid #DDE4E8;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.solicitud-table td {
    text-align: center;
    padding: 16px;
    font-size: 13px;
    color: #172033;
    border-bottom: 1px solid #F0F4F8;
    vertical-align: middle;
}
.solicitud-table tr:last-child td {
    border-bottom: none;
}
.sl-col-center {
    text-align: center !important;
}
.sl-id-cell {
    display: flex;
    flex-direction: column;
}
.sl-id-code {
    font-weight: 600;
    font-size: 12px;
}
.sl-id-date {
    font-size: 11px;
    color: #667085;
}
.sl-td-bold {
    font-weight: 600;
    font-size: 13px;
}
.sl-td-normal {
    font-size: 13px;
}
.sl-btn-detail {
    background: #0B9FA5;
    color: white;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    padding: 6px 12px;
}
.sl-btn-detail:hover {
    background: #17AEAE;
    color: white;
    text-decoration: none;
}

/* Status badges */
.badge-sol-pending,
.badge-sol-dispersing {
    background-color: #FFF8E6;
    color: #D97706;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}
.badge-sol-approved,
.badge-sol-dispersed,
.badge-sol-paid {
    background-color: #E8F7F0;
    color: #22A06B;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}
.badge-sol-rejected,
.badge-sol-cancelled {
    background-color: #FEF2F2;
    color: #D64545;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

/* Pagination */
.sl-pagination-wrapper {
    margin-top: 16px;
}

/* Utility classes replacing inline styles */
.display-contents { display: contents; }
.mt-4 { margin-top: 1rem; }
.field-error {
    color: var(--color-error);
    font-size: var(--text-xs);
    margin-top: 4px;
}

/* Phase 3 Utilities & Components */
.config-item { background: white; border: 1px solid #DDE4E8; border-radius: 12px; padding: 16px 24px; display: flex; align-items: center; justify-content: space-between; }
.config-item-empty { background: white; border: 1px solid #DDE4E8; border-radius: 12px; padding: 32px; text-align: center; color: #667085; font-size: 14px; }
.icon-circle { width: 32px; height: 32px; background: #F7F9FA; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 16px; }
.config-title { font-size: 14px; font-weight: 600; color: #172033; }
.badge { font-size: 12px; font-weight: 600; padding: 4px 12px; border-radius: 12px; }
.badge-active { background: #DCFCE7; color: #22A06B; }
.badge-inactive { background: #DDE4E8; color: #667085; }
.btn-icon { background: none; border: none; padding: 0; cursor: pointer; transition: opacity 0.2s; }
.text-primary { color: #6366F1; }
.text-danger { color: #D64545; }
.cursor-grab { cursor: grab; }
.invite-input { flex: 1; padding: 10px 14px; border: 1px solid #DDE4E8; border-radius: 20px; font-size: 13px; color: #172033; background: #F7F9FA; }
.reject-textarea { width: 100%; padding: 10px 14px; border: 1px solid #DDE4E8; border-radius: 12px; font-size: 13px; font-family: inherit; resize: vertical; margin-bottom: 14px; }

.empresa-table th.text-center, .empresa-table td.text-center { text-align: center !important; }
.empresa-table th.text-left, .empresa-table td.text-left { text-align: left !important; }

.text-slate-600 { color: #667085 !important; }
.hover-fade { opacity: 1; transition: opacity 0.2s; }
.hover-fade:hover { opacity: 0.7; }

/* Fix for icon button selection/focus/hover overrides — the global
   `button:hover` rule (background-color: var(--color-primary)) beats the
   plain `.btn-icon` reset because a pseudo-class selector outweighs a bare
   class, so icon-only buttons would flash solid teal on hover unless this
   also covers :hover explicitly. */
.btn-icon:focus, .btn-icon:active, .btn-icon:hover {
    outline: none !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}
.btn-icon.text-slate-600.hover-fade:hover {
    color: #172033 !important; /* Darker slate on hover */
    opacity: 1 !important;
    background: transparent !important;
}

/* Spacing between row-action icons; tooltip is the browser's native
   title="" attribute — no custom tooltip here to avoid a duplicate. */
.table-actions {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

/* Company Form Cleaned Styles */
.company-input {
    width: 100%; padding: 12px 14px; background: #F7F9FA; border: 1px solid #DDE4E8; border-radius: 20px; font-size: 14px; outline: none; transition: all 0.2s;
}
.company-input:focus {
    border-color: #0B9FA5; background: white; box-shadow: 0 0 0 3px #E8FAF9;
}
.company-input:disabled {
    background: #F0F4F8; color: #667085;
}
.company-label {
    display: block; font-size: 13px; font-weight: 500; color: #667085; margin-bottom: 6px;
}
.company-section-title {
    font-size: 15px; font-weight: 600; color: #0B9FA5; margin: 0 0 20px 0; border-bottom: 2px solid #E8FAF9; padding-bottom: 8px;
}
.company-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.company-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; margin-top: 16px; }
.company-checkbox-label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: #667085; cursor: pointer; }
.company-checkbox { width: 18px; height: 18px; accent-color: #0B9FA5; cursor: pointer; }
.m-0-p-0-b-none { border: none; padding: 0; margin: 0; }

.uppercase { text-transform: uppercase; }
.mt-6 { margin-top: 32px; }
.mb-4 { margin-bottom: 16px; }
.alert-error-pill { background-color: #FEF2F2; color: #D64545; padding: 12px 16px; border-radius: 20px; font-size: 13px; }
.company-grid-1 { display: grid; grid-template-columns: 1fr; gap: 16px; }
.company-actions-row { display: flex; justify-content: flex-end; gap: 12px; margin-top: 32px; border-top: 2px solid #F0F4F8; padding-top: 24px; }

body {
    font-size: var(--text-base);
    line-height: 1.45;
    color: var(--color-text);
    background-color: var(--color-background);
}

h1, h2, h3, h4, h5, h6 {
    color: var(--color-text);
    font-weight: var(--font-semibold);
    line-height: 1.35;
}
h1 { font-size: var(--text-xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-lg); }
h4, h5, h6 { font-size: var(--text-base); }

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

.app-sidebar {
    width: 260px;
    background-color: var(--color-surface);
    border-right: 1px solid var(--color-border);
}

.app-content {
    background-color: var(--color-background);
}

.app-content main {
    padding: var(--space-6);
}

.page-topbar {
    background-color: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: var(--space-6) var(--space-6) var(--space-5) var(--space-6);
}

.dashboard-title-wrapper { margin-bottom: 0; }

.dashboard-title-wrapper h1 {
    color: var(--color-text);
    font-size: var(--text-xl);
    font-weight: var(--font-semibold);
    margin: 0 0 var(--space-1) 0;
}

.dashboard-title-wrapper p {
    color: var(--color-text-muted);
    font-size: var(--text-base);
    margin: 0;
}

.flex-header:not(.page-topbar) {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

.sidebar-item {
    min-height: 40px;
    padding: var(--space-2-5) var(--space-3);
    border-radius: var(--radius-lg);
    gap: var(--space-3);
    font-size: var(--text-base);
    font-weight: var(--font-normal);
    color: var(--color-text-muted);
    margin-bottom: 2px;
}

.sidebar-item:hover {
    background-color: var(--color-gray-100);
    color: var(--color-text);
}

.sidebar-item--active,
.sidebar-subitem.sidebar-item--active {
    background-color: var(--color-primary-soft);
    color: var(--color-primary-strong);
    font-weight: var(--font-semibold);
}

.sidebar-subitem {
    min-height: 36px;
    font-size: var(--text-base);
    color: var(--color-text-muted);
}

.sidebar-section-title {
    font-size: var(--text-2xs);
    font-weight: var(--font-semibold);
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--color-text-faint);
    padding: var(--space-2) var(--space-3);
    margin-top: var(--space-4);
    margin-bottom: var(--space-1);
}

.sidebar-brand { color: var(--color-text); }

.user-avatar {
    background-color: var(--color-primary-soft);
    color: var(--color-primary-strong);
    font-weight: var(--font-semibold);
    font-size: var(--text-base);
}

.sidebar-version {
    color: var(--color-text-faint);
    font-size: var(--text-sm);
}

button,
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: var(--control-height);
    padding: 0 var(--space-5);
    border-radius: var(--radius-xl);
    background-color: var(--color-primary);
    color: var(--color-white);
    font-family: var(--font-sans);
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    line-height: 1.4;
    border: none;
    cursor: pointer;
}

button:hover,
.btn:hover { background-color: var(--color-primary-hover); }

.btn-sm {
    min-height: var(--control-height-sm);
    padding: 0 var(--space-3);
    border-radius: var(--radius-sm);
    font-size: var(--text-base);
    font-weight: var(--font-medium);
}

.btn-outline,
.btn-outline-gray {
    background-color: var(--color-surface) !important;
    color: var(--color-text-muted) !important;
    border: 1px solid var(--color-border) !important;
    border-radius: var(--radius-xl) !important;
    font-weight: var(--font-semibold) !important;
}

.btn-outline:hover,
.btn-outline-gray:hover {
    background-color: var(--color-gray-50) !important;
    color: var(--color-text) !important;
    border-color: var(--color-border) !important;
}

.btn-teal {
    background-color: var(--color-primary) !important;
    border-radius: var(--radius-xl) !important;
    padding: 0 var(--space-5) !important;
    min-height: var(--control-height);
    font-weight: var(--font-semibold) !important;
}
.btn-teal:hover { background-color: var(--color-primary-hover) !important; }

.btn-danger {
    background-color: var(--color-surface);
    color: var(--color-error);
    border: 1px solid var(--color-error);
}
.btn-danger:hover { background-color: var(--color-error-soft); }

button:disabled,
.btn:disabled {
    background-color: var(--color-border);
    color: var(--color-text-muted);
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-link {
    background: none;
    color: var(--color-text-muted);
    font-weight: var(--font-medium);
    padding: 0;
    min-height: auto;
    border-radius: 0;
}
.btn-link:hover { background: none; color: var(--color-text); }

.btn-icon {
    width: 32px;
    height: 32px;
    min-height: 32px;
    padding: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--color-text-muted);
}

label,
.form-group > label,
.company-label {
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    color: var(--color-text-muted);
    margin-bottom: var(--space-1);
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
input[type="url"],
input[type="tel"],
input[type="date"],
input[type="search"],
select,
textarea,
.company-input,
.invite-input {
    min-height: var(--control-height);
    padding: var(--space-2) var(--space-3);
    background-color: var(--color-field);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: var(--text-base);
    font-family: var(--font-sans);
    color: var(--color-text);
}

textarea {
    min-height: 5rem;
    padding: var(--space-2-5) var(--space-3);
}

input:focus,
select:focus,
textarea:focus,
.company-input:focus {
    outline: none;
    background-color: var(--color-surface);
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-ring);
}

input:disabled,
select:disabled,
textarea:disabled,
.company-input:disabled {
    background-color: var(--color-gray-100);
    color: var(--color-text-muted);
}

/* Phone fields (#228): the country-code dropdown and the number live in one
   row. An option is just the dial code ("+52"), so the select only has to
   hold the widest of those five characters plus its chevron — min-width
   keeps "+1809" from being squeezed, max-width keeps it from ever crowding
   the number out of the cell — and the number takes the rest. An inline
   error below them is a flex item of its own: flex-basis 100% wraps it onto
   its own line, which is what keeps the `hx-target="next .field-error"`
   channel of the phone input aiming at a container that is still its
   sibling. */
.phone-input-group {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: var(--space-2);
}
.phone-input-group select.phone-country {
    flex: 0 1 auto;
    width: auto;
    min-width: 6.5rem;
    max-width: 8rem;
}
.phone-input-group input {
    flex: 1 1 10rem;
    min-width: 0;
}
/* The icon-wrapped number (my company drawer) keeps its wrapper as the
   flex child, so the wrapper grows and the input fills it. */
.phone-input-group .input-icon {
    flex: 1 1 10rem;
    min-width: 0;
}
.phone-input-group .input-icon > input {
    width: 100%;
    box-sizing: border-box;
}
.phone-input-group .field-error {
    flex: 1 0 100%;
}

::placeholder { color: var(--color-text-faint); }

.form-hint,
.field-hint {
    font-size: var(--text-2xs);
    color: var(--color-text-muted);
}

.required-mark,
.form-required { color: var(--color-error); }

.company-section-title,
.form-section-title {
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    letter-spacing: 0.55px;
    text-transform: uppercase;
    color: var(--color-primary);
    border-bottom: none;
    padding-bottom: 0;
    margin: 0 0 var(--space-1) 0;
}

.card,
.config-item,
.config-item-empty,
.form-section {
    background: var(--color-surface);
    border: 1px solid var(--color-border-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
}

.card { padding: var(--space-6); }

.card-title,
.config-title {
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    color: var(--color-text);
}

.stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border-card);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    box-shadow: var(--shadow);
}

.stat-card-label {
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--color-text-muted);
    margin: 0 0 var(--space-4) 0;
}

.stat-card-value {
    font-size: var(--text-3xl);
    font-weight: var(--font-bold);
    color: var(--color-text);
    margin: 0;
    line-height: 1.33;
}

.stat-card-value--success { color: var(--color-success); }
.stat-card-value--primary { color: var(--color-primary); }
.stat-card-value--info    { color: var(--color-info); }
.stat-card-value--violet  { color: var(--color-violet); }
.stat-card-value--blue    { color: var(--color-blue); }

.icon-tile {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-xl);
    background: var(--color-primary-soft);
    color: var(--color-primary-strong);
}
.icon-tile--sm {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-lg);
}
.icon-tile--success { background: var(--color-success-soft); color: var(--color-success); }
.icon-tile--warning { background: var(--color-warning-soft); color: var(--color-warning); }
.icon-tile--error   { background: var(--color-error-soft);   color: var(--color-error); }
.icon-tile--info    { background: var(--color-info-soft);    color: var(--color-info); }

.icon-circle {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--color-primary-soft);
    color: var(--color-primary-strong);
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
}

.table-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border-card);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table,
.empresa-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-base);
}

.table th,
.empresa-table th {
    height: 48px;
    padding: 0 var(--space-4);
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-align: center;
    background: var(--color-gray-50);
    border-bottom: 1px solid var(--color-border-card);
}

.table td,
.empresa-table td {
    height: var(--row-height);
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-base);
    font-weight: var(--font-normal);
    color: var(--color-text);
    vertical-align: middle;
    border-bottom: 1px solid var(--color-border-soft);
}

.table tbody tr:last-child td,
.empresa-table tbody tr:last-child td { border-bottom: none; }

.table tbody tr:hover,
.empresa-table tbody tr:hover,
.hover-row:hover { background-color: var(--color-gray-50); }

.cell-title {
    display: block;
    font-size: var(--text-base);
    color: var(--color-text);
    text-transform: none;
}
.cell-sub {
    display: block;
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    text-transform: none;
}
.cell-strong { font-weight: var(--font-semibold); }
.cell-amount { color: var(--color-primary); font-weight: var(--font-medium); }
.cell-count  { color: var(--color-success); }

.table-actions {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}

.code-chip,
code {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    background: var(--color-gray-50);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: var(--space-1) var(--space-2);
}

.badge,
.badge-status-active,
.badge-status-inactive,
.badge-status-pending {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    padding: 2px var(--space-2);
    border-radius: var(--radius-sm);
    line-height: 1.33;
}

.badge-status-active,
.badge-active,
.badge-success { background: var(--color-success-soft); color: var(--color-success); }

.badge-status-inactive,
.badge-inactive,
.badge-muted { background: var(--color-gray-50); color: var(--color-text-muted); }

.badge-status-pending,
.badge-warning { background: var(--color-warning-soft); color: var(--color-warning); }

.badge-error { background: var(--color-error-soft); color: var(--color-error); }
.badge-info  { background: var(--color-info-soft);  color: var(--color-info); }

.filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    background: var(--color-surface);
    border: 1px solid var(--color-border-card);
    border-radius: var(--radius-xl);
    padding: var(--space-4);
    margin-bottom: var(--space-6);
}

.filter-bar-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.search-field {
    position: relative;
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
}

.search-field svg {
    position: absolute;
    left: var(--space-3);
    color: var(--color-text-faint);
    pointer-events: none;
}

.search-field input {
    width: 100%;
    padding-left: 40px;
}

.pagination { border-top: none; }

.pagination-info {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
}

.pagination-links a,
.pagination-links span,
.pagination-links button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    min-height: 28px;
    padding: 0;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xs);
    background: var(--color-surface);
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    font-weight: var(--font-normal);
    text-decoration: none;
}

.pagination-links a:hover { background: var(--color-gray-50); text-decoration: none; }

.pagination-current {
    background-color: var(--color-primary) !important;
    border-color: var(--color-primary) !important;
    color: var(--color-white) !important;
    font-weight: var(--font-medium) !important;
}

[id$="-drawer-root"] .drawer {
    width: min(500px, 100%);
    box-shadow: var(--shadow-drawer);
}

[id$="-drawer-root"] .drawer-header {
    padding: var(--space-6) var(--space-8);
    border-bottom: 1px solid var(--color-border);
}

[id$="-drawer-root"] .drawer-header h2 {
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    color: var(--color-text-strong);
}

[id$="-drawer-root"] .drawer-header p,
[id$="-drawer-root"] .drawer-subtitle {
    font-size: var(--text-base);
    color: var(--color-text-muted);
    margin: var(--space-1) 0 0 0;
}

[id$="-drawer-root"] .drawer-body {
    padding: var(--space-5) var(--space-8);
    background: var(--color-background);
}

[id$="-drawer-root"] .drawer-body input,
[id$="-drawer-root"] .drawer-body select,
[id$="-drawer-root"] .drawer-body textarea {
    min-height: var(--control-height-sm);
    width: 100%;
}

[id$="-drawer-root"] .drawer-actions,
[id$="-drawer-root"] .drawer-footer {
    padding: var(--space-5) var(--space-8);
    border-top: 1px solid var(--color-border);
    background: var(--color-surface);
}

.drawer-section {
    background: var(--color-surface);
    border: 1px solid var(--color-border-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    padding: var(--space-4) var(--space-5);
    margin-bottom: var(--space-3);
}

.drawer-section-title {
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    letter-spacing: 0.55px;
    text-transform: uppercase;
    color: var(--color-primary);
    margin: 0;
}

.drawer-section-sub {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    margin: 0 0 var(--space-3) 0;
}

.stepper {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.stepper-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-1);
    text-align: center;
}

.stepper-dot {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    background: var(--color-gray-100);
    color: var(--color-text-faint);
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
}

.stepper-step--active .stepper-dot {
    background: var(--color-primary);
    color: var(--color-white);
    box-shadow: 0 0 0 4px var(--color-primary-ring);
}

.stepper-label {
    font-size: var(--text-2xs);
    font-weight: var(--font-medium);
    color: var(--color-text-faint);
}

.stepper-step--active .stepper-label { color: var(--color-primary); }

.stepper-line {
    flex: 1;
    height: 2px;
    background: var(--color-border);
    margin: 15px var(--space-2) 0 var(--space-2);
}

.stepper-caption {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    margin-top: var(--space-4);
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
}

.breadcrumb-item {
    font-size: var(--text-2xs);
    font-weight: var(--font-semibold);
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--color-text-faint);
}

.breadcrumb-item--current {
    font-size: var(--text-sm);
    font-weight: var(--font-normal);
    letter-spacing: normal;
    text-transform: none;
    color: var(--color-primary);
}

.dropzone,
.file-dropzone {
    background: var(--color-gray-50);
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    text-align: center;
}

.dropzone-title {
    font-size: var(--text-base);
    font-weight: var(--font-medium);
    color: var(--color-primary);
    margin: 0;
}

.dropzone-hint {
    font-size: var(--text-2xs);
    color: var(--color-text-faint);
    margin: var(--space-1) 0 0 0;
}

.def-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-2-5) 0;
    border-bottom: 1px solid var(--color-border-soft);
}
.def-row:last-child { border-bottom: none; }

.def-label {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

.def-value {
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    color: var(--color-text);
}

.alert {
    border-radius: var(--radius-sm);
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-base);
}
.alert-info    { background: var(--color-info-soft);    color: var(--color-info); }
.alert-success { background: var(--color-success-soft); color: var(--color-success); }
.alert-warning { background: var(--color-warning-soft); color: var(--color-warning); }
.alert-error,
.alert-danger,
.alert-error-pill { background: var(--color-error-soft); color: var(--color-error); border-radius: var(--radius-sm); }

.tab-btn {
    font-size: var(--text-base);
    font-weight: var(--font-medium);
    border-radius: 0;
    background: none;
    color: var(--color-text-muted);
    min-height: auto;
    padding: var(--space-2-5) var(--space-4);
}
.tab-btn:hover { background: none; color: var(--color-text); }
.tab-btn--active {
    background: none;
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

.modal,
.logout-modal {
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
}

.auth-page {
    background-color: var(--color-background);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    margin: 0;
    padding: var(--space-4);
    box-sizing: border-box;
}

.auth-content {
    width: 100%;
    display: flex;
    justify-content: center;
}

.auth-shell {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 440px;
}

.auth-header {
    text-align: center;
    margin-bottom: var(--space-6);
}

.auth-logo {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: var(--space-4);
}

.auth-header h1 {
    color: var(--color-text);
    font-size: var(--text-3xl);
    font-weight: var(--font-bold);
    margin: 0 0 var(--space-2) 0;
}

.auth-header p {
    color: var(--color-text-muted);
    font-size: var(--text-base);
    margin: 0;
}

.auth-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: var(--space-8);
    box-shadow: var(--shadow);
    width: 100%;
    box-sizing: border-box;
}

.auth-card .form-group { margin-bottom: var(--space-5); }

.auth-card label {
    display: block;
    font-size: var(--text-base);
    font-weight: var(--font-medium);
    color: var(--color-gray-800);
    margin-bottom: var(--space-2);
}

.auth-card input[type="email"],
.auth-card input[type="password"],
.auth-card input[type="text"] {
    width: 100%;
    min-height: var(--control-height-lg);
    padding: var(--space-3) var(--space-4);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    font-size: var(--text-base);
    color: var(--color-gray-800);
    box-sizing: border-box;
}

.auth-card .input-with-icon { position: relative; display: flex; align-items: center; }

.auth-card .input-with-icon > .input-icon {
    position: absolute;
    left: var(--space-4);
    display: flex;
    color: var(--color-text-faint);
    pointer-events: none;
}

.auth-card .input-with-icon input { padding-left: 48px; }

.auth-card .password-wrapper input { padding-right: 44px; }

.auth-card .password-toggle {
    right: var(--space-3);
    min-height: auto;
    border-radius: var(--radius-sm);
    background: none;
    color: var(--color-text-muted);
}
.auth-card .password-toggle:hover { background: none; color: var(--color-text); }

.auth-submit {
    width: 100%;
    min-height: 52px;
    border-radius: var(--radius-xl);
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
}

.auth-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-6);
}

.auth-remember {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-base);
    font-weight: var(--font-normal);
    color: var(--color-text-muted);
    cursor: pointer;
    user-select: none;
    margin-bottom: 0;
}

.auth-remember input[type="checkbox"] {
    width: 16px;
    height: 16px;
    min-height: auto;
    accent-color: var(--color-primary);
    cursor: pointer;
}

.auth-link {
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    color: var(--color-primary-strong);
    text-decoration: none;
}
.auth-link:hover { text-decoration: underline; }

.auth-footnote {
    margin-top: var(--space-6);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    color: var(--color-text-faint);
    font-size: var(--text-sm);
}

.d-flex { display: flex; }
.d-grid { display: grid; }
.d-none { display: none; }
.display-contents { display: contents; }
.flex-col { flex-direction: column; }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }
.flex-nowrap { flex-wrap: nowrap; }
.align-center { align-items: center; }
.align-start { align-items: flex-start; }
.align-baseline { align-items: baseline; }
.justify-end { justify-content: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.m-0 { margin: 0 !important; }
.w-100 { width: 100%; }
.text-left { text-align: left; }
.text-center { text-align: center; }

.cell-media {
    display: inline-flex;
    align-items: center;
    gap: var(--space-4);
    text-align: left;
}

.cell-stack {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.table-empty {
    padding: var(--space-10);
    text-align: center;
    color: var(--color-text-muted);
    font-size: var(--text-base);
}

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

.btn-secondary {
    background-color: var(--color-surface);
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
}
.btn-secondary:hover {
    background-color: var(--color-gray-50);
    color: var(--color-text);
}

.table-container,
.table-card,
.data-table-wrapper {
    background: var(--color-surface);
    border: 1px solid var(--color-border-card);
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.custom-table,
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-base);
}

.custom-table th,
.data-table th {
    height: 48px;
    padding: 0 var(--space-4);
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-align: center;
    background: var(--color-gray-50);
    border-bottom: 1px solid var(--color-border-card);
}

.custom-table td,
.data-table td {
    height: var(--row-height);
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-base);
    color: var(--color-text);
    vertical-align: middle;
    border-bottom: 1px solid var(--color-border-soft);
}

.custom-table tbody tr:last-child td,
.data-table tbody tr:last-child td { border-bottom: none; }

.custom-table tbody tr:hover,
.data-table tbody tr:hover { background-color: var(--color-gray-50); }

.empty-state {
    padding: var(--space-10);
    text-align: center;
    color: var(--color-text-muted);
    font-size: var(--text-base);
}

.metrics-card-label {
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--color-text-muted);
}

.metrics-card-value {
    font-size: var(--text-3xl);
    font-weight: var(--font-bold);
    color: var(--color-text);
    line-height: 1.33;
}

.filter-bar {
    background: var(--color-surface);
    border: 1px solid var(--color-border-card);
    border-radius: var(--radius-xl);
    padding: var(--space-4);
}

.search-input-wrapper {
    background: var(--color-field);
    border-radius: var(--radius-sm);
    padding: 0 var(--space-3);
    min-height: var(--control-height);
    min-width: 0;
    gap: var(--space-2);
}

.search-input-wrapper svg { color: var(--color-text-faint); flex-shrink: 0; }

.search-input {
    background: transparent;
    border: none;
    min-height: auto;
    padding: 0;
    margin-left: 0;
    font-size: var(--text-base);
    color: var(--color-text);
}
.search-input:focus { background: transparent; border-color: transparent; box-shadow: none; }

.role-select,
.filter-select {
    min-height: var(--control-height);
    padding: 0 var(--space-3);
    background: var(--color-field);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: var(--text-base);
    font-weight: var(--font-normal);
    color: var(--color-text);
}

.filter-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.btn-primary-rounded,
.btn-primary-custom {
    background: var(--color-primary) !important;
    color: var(--color-white) !important;
    border-radius: var(--radius-xl) !important;
    min-height: var(--control-height);
    padding: 0 var(--space-5) !important;
    font-size: var(--text-base) !important;
    font-weight: var(--font-semibold) !important;
}
.btn-primary-rounded:hover,
.btn-primary-custom:hover { background: var(--color-primary-hover) !important; }

.user-cell { display: flex; align-items: center; gap: var(--space-3); }

.user-avatar-circle {
    width: 40px;
    height: 40px;
    background: var(--color-primary-soft);
    color: var(--color-primary-strong);
    border-radius: var(--radius-full);
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
}

.user-email-main {
    font-size: var(--text-base);
    font-weight: var(--font-medium);
    color: var(--color-text);
}

.user-email-sub {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
}

.role-badge {
    display: inline-flex;
    align-items: center;
    background: var(--color-info-soft);
    color: var(--color-info);
    padding: 2px var(--space-2);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
}

.department-text,
.access-text,
.status-text {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
}

.toggle-track { background: var(--color-gray-300); }
.toggle-track.active { background: var(--color-success); }

.toggle-btn {
    min-height: auto;
    padding: 0;
    border-radius: 0;
    background: transparent;
}
.toggle-btn:hover { background: transparent; }

.action-btn {
    width: 32px;
    height: 32px;
    min-height: 32px;
    padding: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--color-text-muted);
}
.action-btn:hover { background: var(--color-gray-50); color: var(--color-text); }

.action-disabled { color: var(--color-gray-300); }

.user-header h1 {
    font-size: var(--text-xl);
    font-weight: var(--font-semibold);
    color: var(--color-text);
}
.user-header p {
    font-size: var(--text-base);
    color: var(--color-text-muted);
}

.sidebar-header {
    height: 81px;
    display: flex;
    align-items: center;
    padding: 0 var(--space-6);
    box-sizing: border-box;
}

.sidebar-header .sidebar-brand { padding: 0; }

.sidebar-user-profile {
    background: var(--color-surface);
    padding: var(--space-5) var(--space-6);
    border-radius: 0;
}

.sidebar-user-profile .user-name {
    color: var(--color-text);
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
}

.sidebar-user-profile .user-role {
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    font-weight: var(--font-normal);
    opacity: 1;
    margin-top: 2px;
}

.sidebar-divider { background-color: var(--color-border); }

.sidebar-menu { padding: var(--space-5) var(--space-4) var(--space-4); margin: 0; }

.sidebar-section-label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin: var(--space-4) var(--space-3) var(--space-1) var(--space-3);
    color: var(--color-text-faint);
    font-weight: var(--font-semibold);
    font-size: var(--text-2xs);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar-icon { opacity: 0.8; width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-item--active .sidebar-icon { opacity: 1; color: var(--color-primary-strong); }

.sidebar-subitem { padding-left: 42px; }

.sidebar-footer { padding: 0 var(--space-4) var(--space-4) var(--space-4); }

.sidebar-logout {
    width: 100%;
    min-height: 36px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    color: var(--color-text-muted);
    font-size: var(--text-base);
    font-weight: var(--font-medium);
    gap: var(--space-2);
}
.sidebar-logout:hover {
    background: var(--color-gray-50);
    color: var(--color-text);
}

.brand-mark {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.brand-word {
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    color: var(--color-text);
    letter-spacing: -0.5px;
}

.alert-line {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.alert-text {
    font-size: var(--text-base);
    font-weight: var(--font-medium);
}

.alert-close {
    background: none;
    border: none;
    min-height: auto;
    padding: 0;
    margin-left: var(--space-3);
    border-radius: 0;
    font-size: var(--text-2xl);
    line-height: 1;
    color: inherit;
    cursor: pointer;
}
.alert-close:hover { background: none; }

.stats-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}
@media (max-width: 900px) {
    .stats-grid-3 { grid-template-columns: 1fr; }
}

.stat-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: var(--space-4);
    min-height: 132px;
    padding: var(--space-6);
}

.stat-card-title {
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    margin-bottom: 0;
}

.stat-card-value {
    font-size: var(--text-3xl);
    font-weight: var(--font-bold);
    color: var(--color-text);
    margin-bottom: var(--space-1);
    line-height: 1.33;
}

.stat-card-value.text-orange { color: var(--color-warning); }
.stat-card-value.text-green  { color: var(--color-success); }
.stat-card-value.text-purple { color: var(--color-violet); }
.stat-card-value.text-red    { color: var(--color-error); }
.stat-card-value.text-blue   { color: var(--color-blue); }

.stat-card-subtitle {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.stat-card-subtitle .trend-up { color: var(--color-success); font-weight: var(--font-semibold); }
.stat-card-subtitle .trend-down { color: var(--color-error); font-weight: var(--font-semibold); }

.charts-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}
@media (max-width: 1024px) {
    .charts-grid-2 { grid-template-columns: 1fr; }
}

.chart-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border-card);
    border-radius: var(--radius-xl);
    padding: var(--space-5);
    box-shadow: var(--shadow);
}

.chart-card--spaced { margin-bottom: var(--space-6); }

.chart-card-title {
    color: var(--color-text);
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    margin-bottom: var(--space-4);
}

.chart-container {
    position: relative;
    height: 250px;
    width: 100%;
}

.chart-container--tall { height: 300px; }

.chart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
    color: var(--color-text-faint);
    text-align: center;
}

.chart-empty svg { margin-bottom: var(--space-3); opacity: 0.5; }

.chart-empty-title {
    font-size: var(--text-base);
    font-weight: var(--font-medium);
    color: var(--color-text-muted);
}

.chart-empty-text {
    font-size: var(--text-sm);
    margin-top: var(--space-1);
    max-width: 80%;
}

.chart-split {
    display: flex;
    align-items: center;
    justify-content: space-evenly;
    position: relative;
    height: 300px;
}

.chart-split-canvas { width: 40%; height: 250px; }

.chart-legend {
    width: 40%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: var(--space-4);
}

.chart-legend-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: var(--text-base);
}

.chart-legend-name {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--color-text-muted);
}

.chart-legend-swatch {
    width: 12px;
    height: 12px;
    border-radius: var(--radius-xs);
    flex-shrink: 0;
}

.chart-legend-value {
    font-weight: var(--font-semibold);
    color: var(--color-text);
}

.chart-legend-swatch--a { background-color: #20C3C3; }
.chart-legend-swatch--b { background-color: #6366F1; }
.chart-legend-swatch--c { background-color: #F59E0B; }
.chart-legend-swatch--d { background-color: #F87171; }

.stat-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-3);
}

.icon-box-primary {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-lg);
    background: var(--color-primary-soft);
    color: var(--color-primary-strong);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.icon-box-primary--success { background: var(--color-success-soft); color: var(--color-success); }
.icon-box-primary--info    { background: var(--color-info-soft);    color: var(--color-info); }
.icon-box-primary--blue    { background: #DBEAFE;                   color: var(--color-blue); }
.icon-box-primary--warning { background: var(--color-warning-soft); color: var(--color-warning); }
.icon-box-primary--error   { background: var(--color-error-soft);   color: var(--color-error); }

.drawer-form {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.drawer-form-header {
    flex-shrink: 0;
    padding: var(--space-6) var(--space-6) var(--space-4);
    border-bottom: 1px solid var(--color-border);
}

.drawer-form-titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-4);
}

.drawer-form-titlebar h2 {
    font-size: var(--text-lg);
    font-weight: var(--font-bold);
    color: var(--color-text);
    margin: 0;
}

.drawer-close {
    background: none;
    border: none;
    padding: 0;
    min-height: auto;
    border-radius: 0;
    cursor: pointer;
    color: var(--color-text-muted);
    display: flex;
}
.drawer-close:hover { background: none; color: var(--color-text); }

.drawer-identity {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.drawer-identity-icon {
    width: 40px;
    height: 40px;
    background: var(--color-primary-soft);
    color: var(--color-primary-strong);
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.drawer-identity-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.drawer-identity-name {
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    color: var(--color-text);
}

.drawer-identity-desc {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    margin: 2px 0 0;
}

.drawer-stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
}

.drawer-stat-label {
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--color-text-muted);
    text-transform: none;
    margin-bottom: var(--space-1);
}

.drawer-stat-value {
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    color: var(--color-text);
}

.drawer-form-footer {
    flex-shrink: 0;
    margin: 0;
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
}
.drawer-form-footer > .btn,
.drawer-form-footer > .btn-outline-gray {
    flex: 1 1 0;
}

.auth-back-link {
    display: block;
    text-align: center;
    margin-top: var(--space-4);
    color: var(--color-text-muted);
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    text-decoration: none;
}
.auth-back-link:hover { color: var(--color-text); text-decoration: underline; }
.auth-back-link--primary { color: var(--color-primary-strong); margin-top: var(--space-2); }

.auth-card .form-row { display: flex; gap: var(--space-4); flex-wrap: wrap; }
.auth-card .form-row .form-group { flex: 1; min-width: 150px; }

.tab-nav {
    display: flex;
    gap: var(--space-8);
    border-bottom: 1px solid var(--color-border);
    margin-bottom: var(--space-8);
}

.tab-link {
    text-decoration: none;
    font-size: var(--text-base);
    font-weight: var(--font-medium);
    color: var(--color-text-muted);
    padding-bottom: var(--space-3);
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: color var(--duration-default) var(--ease-default);
}
.tab-link:hover { color: var(--color-text); text-decoration: none; }

.tab-link--active {
    font-weight: var(--font-semibold);
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

.panel {
    background: var(--color-surface);
    border: 1px solid var(--color-border-card);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    box-shadow: var(--shadow);
}

.panel--spaced { margin-bottom: var(--space-6); }

.panel-title {
    margin: 0 0 var(--space-4) 0;
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    color: var(--color-text);
}

.panel-header {
    padding: var(--space-5) var(--space-6);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-4);
    border-bottom: 1px solid var(--color-border-soft);
}

.panel-header h3,
.panel-header h4 {
    margin: 0;
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    color: var(--color-text);
}

.page-intro { margin-bottom: var(--space-6); }
.page-intro p {
    margin: 0;
    color: var(--color-text-muted);
    font-size: var(--text-base);
}

.stat-icon { margin-bottom: var(--space-4); display: flex; }
.stat-icon--primary { color: var(--color-primary); }
.stat-icon--success { color: var(--color-success); }
.stat-icon--warning { color: var(--color-warning); }
.stat-icon--error   { color: var(--color-error); }
.stat-icon--info    { color: var(--color-info); }

.stat-amount {
    font-size: var(--text-3xl);
    font-weight: var(--font-bold);
    margin-bottom: var(--space-1);
    color: var(--color-text);
}
.stat-amount--primary { color: var(--color-primary); }
.stat-amount--success { color: var(--color-success); }
.stat-amount--warning { color: var(--color-warning); }
.stat-amount--error   { color: var(--color-error); }

.stat-note {
    color: var(--color-text-muted);
    font-size: var(--text-sm);
}

.field-row {
    display: flex;
    gap: var(--space-4);
    flex-wrap: wrap;
}
.field-col { flex: 1; min-width: 180px; }
.field-col > select,
.field-col > input { width: 100%; }

.data-panel {
    background: var(--color-surface);
    border: 1px solid var(--color-border-card);
    border-radius: var(--radius-xl);
    overflow: hidden;
    margin-bottom: var(--space-8);
}

.data-panel .table-responsive { margin: 0; border: none; }

.table-head-muted {
    background: var(--color-gray-50);
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    text-transform: none;
}

.table--roomy th {
    padding: 0 var(--space-6);
    height: 40px;
    font-weight: var(--font-medium);
    border-bottom: 1px solid var(--color-border-soft);
}

.table--roomy td {
    padding: var(--space-2) var(--space-6);
    height: var(--row-height);
    border-bottom: 1px solid var(--color-border-soft);
}

.table-note {
    padding: var(--space-8);
    text-align: center;
    color: var(--color-text-faint);
    font-size: var(--text-base);
}

.upload-zone {
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-xl);
    background: var(--color-gray-50);
    padding: var(--space-10);
    text-align: center;
    position: relative;
    transition: background var(--duration-default) var(--ease-default);
}
.upload-zone:hover { background: var(--color-primary-soft); }

.upload-zone input[type="file"] {
    opacity: 0;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.summary-box {
    background: var(--color-gray-50);
    border-radius: var(--radius-xl);
    padding: var(--space-4);
    display: inline-block;
    width: 100%;
    box-sizing: border-box;
}
.summary-box--primary { background: var(--color-primary-soft); width: auto; }

.tag-pill {
    background: var(--color-gray-400);
    color: var(--color-white);
    padding: 2px var(--space-2);
    border-radius: var(--radius-sm);
    font-size: var(--text-2xs);
    font-weight: var(--font-semibold);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.upload-zone-text {
    color: var(--color-text-muted);
    font-size: var(--text-base);
    margin-bottom: var(--space-2);
}

.link-primary {
    color: var(--color-primary-strong);
    font-weight: var(--font-semibold);
    text-decoration: underline;
    cursor: pointer;
}

.btn-icon--outline {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
}
.btn-icon--outline:hover { background: var(--color-gray-50); }

.btn-success { background-color: var(--color-success); }
.btn-success:hover { background-color: #1B8A5B; }

.text-muted { color: var(--color-text-muted); }
.text-muted-sm { color: var(--color-text-muted); font-size: var(--text-sm); }
.font-semibold { font-weight: var(--font-semibold); }
.is-hidden { display: none !important; }
.mx-auto { margin-left: auto; margin-right: auto; }
.margin-bottom-2 { margin-bottom: var(--space-2) !important; }

.catalog-panel {
    background: var(--color-surface);
    border: 1px solid var(--color-border-card);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    margin-bottom: var(--space-6);
    box-shadow: var(--shadow);
}
.catalog-panel--clip { overflow: hidden; }

.catalog-panel h3 {
    margin: 0 0 var(--space-2) 0;
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    color: var(--color-text);
}

.catalog-panel-sub {
    margin: 0 0 var(--space-6) 0;
    color: var(--color-text-muted);
    font-size: var(--text-base);
}

.catalog-search {
    width: 100%;
    max-width: 320px;
    box-sizing: border-box;
}

.table--compact th {
    height: 40px;
    padding: 0 var(--space-4);
    font-weight: var(--font-medium);
    border-bottom: 1px solid var(--color-border-soft);
}
.table--compact td {
    padding: var(--space-2) var(--space-4);
    border-bottom: 1px solid var(--color-border-soft);
}

.table-scroll { margin: 0; border: none; overflow-x: auto; }

.label-caps {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    font-weight: var(--font-semibold);
    text-transform: uppercase;
    letter-spacing: 0.55px;
}

.catalog-panel-heading {
    margin: 0 0 var(--space-2) 0;
    font-size: var(--text-xl);
    font-weight: var(--font-semibold);
    color: var(--color-text);
}

.stepper-container {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-5);
    position: relative;
    padding: 0 var(--space-4);
}

.stepper-container::before {
    content: '';
    position: absolute;
    top: 15px;
    left: 12%;
    right: 12%;
    height: 2px;
    background: #E5E9ED;
    z-index: 0;
}

.stepper-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
    gap: var(--space-1);
    text-align: center;
}

.step-circle {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: var(--color-gray-100);
    color: var(--color-text-faint);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--font-semibold);
    font-size: var(--text-base);
    border: 2px solid var(--color-surface);
    transition: all 0.3s ease;
}

.step-label {
    font-size: var(--text-2xs);
    color: var(--color-text-faint);
    text-align: center;
    font-weight: var(--font-medium);
    max-width: 72px;
    line-height: 1.25;
}

.stepper-step.active .step-circle {
    background: var(--color-primary);
    color: var(--color-white);
    box-shadow: 0 0 0 4px var(--color-primary-ring);
}
.stepper-step.active .step-label {
    color: var(--color-primary);
    font-weight: var(--font-medium);
}
.stepper-step.completed .step-circle {
    background: var(--color-primary);
    color: var(--color-white);
}
.stepper-step.completed .step-circle::after { content: '✓'; }
.stepper-step.completed .step-circle span { display: none; }

.form-step { display: none; }
.form-step.active { display: block; animation: fadeIn 0.3s ease; }
/* Re-rendered on the same step (colony lookup, an error): shown in place. */
.wizard-step-kept .form-step.active { animation: none; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.company-section-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    padding: var(--space-4) var(--space-5);
    margin-bottom: var(--space-3);
}

.section-header { margin-bottom: var(--space-3); }

.section-title {
    color: var(--color-primary);
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    text-transform: uppercase;
    letter-spacing: 0.55px;
    margin: 0 0 2px 0;
}

.section-subtitle {
    color: var(--color-text-muted);
    font-size: var(--text-xs);
    margin: 0;
}

.company-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3) var(--space-4);
    margin-bottom: var(--space-3);
}
.company-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: var(--space-3);
    margin-top: 0;
}
.col-span-2 { grid-column: span 2; }

.company-label {
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    color: var(--color-text-muted);
    margin-bottom: var(--space-1);
}

.company-input {
    background: var(--color-field);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    min-height: var(--control-height-sm);
    padding: var(--space-1) var(--space-3);
    width: 100%;
    font-size: var(--text-base);
    color: var(--color-text);
    box-sizing: border-box;
}
.company-input:focus {
    border-color: var(--color-primary);
    background: var(--color-surface);
    outline: none;
    box-shadow: 0 0 0 3px var(--color-primary-ring);
}
/* A required select still on its empty "Selecciona…" option reads as a
   placeholder, in the same faint tone as the text inputs' placeholders; the
   real options in the open list keep the normal text color. */
select.company-input:invalid,
select.company-input option[value=""] {
    color: var(--color-text-faint);
}
select.company-input option:not([value=""]) {
    color: var(--color-text);
}
/* Suppress the native invalid-state halo on a pristine field the user
   hasn't tried to submit yet — but only until the form is actually
   validated (.was-validated, added on the first failed submit attempt).
   Scoping it this way keeps the red border working once validation runs;
   without :not(.was-validated ...) here it silently hid every "this field
   is required" indicator app-wide, so a blocked "Siguiente" gave no clue
   which field was empty. */

form:not(.was-validated) .company-input:invalid:not(:focus):not(:user-invalid),
form:not(.was-validated) select.company-input:invalid:not(:focus):not(:user-invalid) {
    box-shadow: none !important;
    outline: none !important;
    border-color: transparent;
}
.company-input[disabled] {
    opacity: 0.7;
    background: var(--color-gray-100) !important;
    border-color: transparent !important;
}

.input-with-icon { position: relative; }
.input-with-icon .company-input { padding-right: 32px; }
.input-with-icon .input-icon {
    position: absolute;
    right: var(--space-3);
    top: 50%;
    transform: translateY(-50%);
    left: auto;
    color: var(--color-text-faint);
}

.actions-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: var(--space-5);
    border-top: 1px solid var(--color-border);
    margin-top: var(--space-5);
}

.summary-section {
    background: var(--color-surface);
    border: 1px solid var(--color-border-card);
    border-radius: var(--radius-xl);
    margin-bottom: var(--space-3);
}
.summary-header {
    padding: var(--space-3) var(--space-5);
    border-bottom: 1px solid var(--color-border-soft);
}
.summary-title {
    color: var(--color-primary);
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    text-transform: uppercase;
    letter-spacing: 0.55px;
    margin: 0;
}
.summary-row {
    display: flex;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-2-5) var(--space-5);
    border-bottom: 1px solid var(--color-border-soft);
    font-size: var(--text-xs);
}
.summary-row:last-child { border-bottom: none; }
.summary-label { color: var(--color-text-muted); flex-shrink: 0; }
/* A long value (a razón social, an e-mail with no spaces) wraps inside the
   card instead of pushing it wider than the drawer. */
.summary-value {
    color: var(--color-text);
    font-weight: var(--font-medium);
    text-align: right;
    min-width: 0;
    overflow-wrap: anywhere;
}

#company-drawer-inner aside.drawer {
    width: 100%;
    max-width: 760px;
}

#company-drawer-inner .drawer-header {
    background-color: var(--color-surface);
    border-bottom: none;
    padding: var(--space-6) var(--space-8) 0 var(--space-8);
    position: sticky;
    top: 0;
    z-index: 50;
}

#company-drawer-inner .drawer-header h2 {
    color: var(--color-text-strong);
    font-weight: var(--font-bold);
    font-size: var(--text-2xl);
    letter-spacing: -0.01em;
}

#company-drawer-inner .drawer-header p {
    color: var(--color-text-muted);
    font-size: var(--text-base);
    margin: var(--space-1) 0 0 0;
}

#company-drawer-inner .drawer-close {
    align-self: flex-start;
    background: transparent;
    color: var(--color-text-faint);
    border: none;
    width: auto;
    height: auto;
    min-height: auto;
    padding: 0;
    font-size: var(--text-3xl);
    line-height: 1;
    cursor: pointer;
}
#company-drawer-inner .drawer-close:hover { background: transparent; color: var(--color-text); }

#company-drawer-inner .drawer-body {
    padding: var(--space-8);
    background-color: var(--color-background);
    overflow-x: hidden;
}

#company-drawer-inner .company-grid-2 > *,
#company-drawer-inner .company-grid-3 > *,
#company-drawer-inner .field-col { min-width: 0; }

#company-drawer-inner .company-section-card,
#company-drawer-inner .summary-section { max-width: 100%; box-sizing: border-box; }

#company-drawer-inner .drawer-body::-webkit-scrollbar { width: 8px; }
#company-drawer-inner .drawer-body::-webkit-scrollbar-track {
    background: var(--color-gray-100);
    border-radius: var(--radius-full);
}
#company-drawer-inner .drawer-body::-webkit-scrollbar-thumb {
    background: var(--color-gray-300);
    border-radius: var(--radius-full);
}
#company-drawer-inner .drawer-body::-webkit-scrollbar-thumb:hover { background: var(--color-gray-400); }

.inline-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
}

.inline-table {
    width: 100%;
    border-collapse: collapse;
    text-align: center;
    font-size: var(--text-sm);
}
.inline-table thead {
    background: var(--color-gray-50);
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text-muted);
}
.inline-table th,
.inline-table td { padding: var(--space-3); }
.inline-table th { font-weight: var(--font-medium); }
.inline-table .text-left { text-align: left; }

.inline-cell-input {
    width: 100%;
    border: none;
    text-align: center;
    background: transparent;
    min-height: auto;
    padding: 0;
}
.inline-cell-input:focus { background: transparent; box-shadow: none; border-color: transparent; }

.form-note {
    padding: var(--space-4);
    background: var(--color-primary-soft);
    border: 1px solid #C9F2F1;
    border-radius: var(--radius-sm);
    display: flex;
    gap: var(--space-3);
}
.form-note--top { margin-top: var(--space-6); }
.form-note--bottom { margin-bottom: var(--space-6); align-items: center; }

.form-note-title {
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    color: var(--color-text);
    margin: 0 0 2px 0;
}
.form-note-text {
    margin: 0;
    font-size: var(--text-sm);
    color: var(--color-text-muted);
}

.confirm-badge {
    width: 32px;
    height: 32px;
    background: var(--color-primary);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-white);
    flex-shrink: 0;
}

.required-star { color: var(--color-error); }
.optional-hint { color: var(--color-text-faint); font-weight: var(--font-normal); }

.form-sticky-head {
    position: sticky;
    top: calc(var(--space-8) * -1);
    background: var(--color-surface);
    z-index: 40;
    padding: var(--space-6) var(--space-8) var(--space-4) var(--space-8);
    margin: calc(var(--space-8) * -1) calc(var(--space-8) * -1) var(--space-6) calc(var(--space-8) * -1);
    border-bottom: 1px solid var(--color-border);
}

.inline-table-body { color: var(--color-text); font-weight: var(--font-semibold); }
.inline-table-rowhead { color: var(--color-text-muted); font-weight: var(--font-medium); }
.d-block { display: block; }
.mt-1 { margin-top: var(--space-1); }
.mb-5 { margin-bottom: var(--space-5); }

.info-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border-card);
    border-radius: var(--radius-xl);
    padding: var(--space-5);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.info-label {
    color: var(--color-text-faint);
    font-size: var(--text-2xs);
    margin-bottom: var(--space-1);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: var(--font-semibold);
}

.info-value {
    color: var(--color-text);
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
}

.info-value--sm {
    color: var(--color-text);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
}

.info-rule {
    border-left: 2px solid var(--color-border);
    padding-left: var(--space-3);
}

.info-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-5); }
.info-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--space-3); }
.info-grid-1 { display: grid; grid-template-columns: 1fr; gap: var(--space-4); }
.info-grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--space-6); }
.info-grid-21 { display: grid; grid-template-columns: 2fr 1fr; gap: var(--space-5); }
.info-grid-divided {
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-border-soft);
}
.span-2 { grid-column: span 2; }

.section-caps {
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    margin-bottom: var(--space-2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-heading {
    margin: 0;
    font-size: var(--text-base);
    color: var(--color-text);
    font-weight: var(--font-semibold);
}

.chip-button {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-base);
    font-weight: var(--font-medium);
    color: var(--color-primary-strong);
    border: 1px solid #C9F2F1;
    background: var(--color-primary-soft);
    border-radius: var(--radius-lg);
    min-height: var(--control-height-sm);
    padding: 0 var(--space-4);
    cursor: pointer;
}
.chip-button:hover { background: #D6F5F4; color: var(--color-primary-strong); }

.text-faint { color: var(--color-text-faint); }
.sep-faint { color: var(--color-gray-300); }
.big-number { font-size: 28px; font-weight: 800; }
.big-number--violet { color: var(--color-violet); }

.identity-panel {
    display: flex;
    align-items: center;
    gap: var(--space-5);
    padding: var(--space-5);
}

.identity-avatar {
    background: var(--color-primary-soft);
    border: 1px solid #C9F2F1;
    border-radius: var(--radius-xl);
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary-strong);
    flex-shrink: 0;
}

.code-chip--primary {
    background: var(--color-primary-soft);
    border-color: #C9F2F1;
    color: var(--color-primary-strong);
    font-weight: var(--font-semibold);
}

.mb-12 { margin-bottom: var(--space-12); }

[hidden] { display: none !important; }

.config-tab {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
    font-weight: var(--font-medium);
    border-radius: var(--radius-lg);
    min-height: var(--control-height-sm);
    padding: 0 var(--space-4);
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-base);
    cursor: pointer;
    text-decoration: none;
}
.config-tab:hover { background: var(--color-gray-50); color: var(--color-text); text-decoration: none; }

.config-tab.active {
    background: var(--color-primary-soft);
    border-color: #C9F2F1;
    color: var(--color-primary-strong);
    font-weight: var(--font-semibold);
}

.config-tab-count {
    background: var(--color-gray-100);
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    padding: 2px var(--space-2);
    border-radius: var(--radius-sm);
    margin-left: var(--space-1);
}
.config-tab.active .config-tab-count { background: #C9F2F1; color: var(--color-primary-strong); }

.config-tabs { display: flex; gap: var(--space-3); margin-bottom: var(--space-8); }
.config-layout { display: flex; gap: var(--space-12); align-items: flex-start; }
.config-list { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: var(--space-3); }
.config-preview { width: 220px; flex-shrink: 0; }
.config-item-main { min-width: 0; display: flex; flex-direction: column; gap: var(--space-1-5); }

.config-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: var(--space-6);
}

.config-item-title { font-weight: var(--font-semibold); font-size: var(--text-base); line-height: 1.4; }

.config-item-badge {
    font-size: var(--text-sm);
    padding: 2px var(--space-2);
    border-radius: var(--radius-sm);
    margin-left: var(--space-1);
}

.phone-frame {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    height: 420px;
    overflow: hidden;
    position: relative;
}
.phone-notch {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 64px;
    height: 14px;
    background: var(--color-text);
    border-bottom-left-radius: 7px;
    border-bottom-right-radius: 7px;
}
.phone-screen { padding: var(--space-8) var(--space-3) var(--space-3) var(--space-3); }
.phone-caption {
    text-align: center;
    color: var(--color-text-faint);
    font-size: var(--text-2xs);
    font-weight: var(--font-semibold);
    letter-spacing: 0.5px;
    margin-bottom: var(--space-2);
}
.phone-options { max-height: 275px; overflow-y: auto; padding-right: var(--space-1); }
.phone-options::-webkit-scrollbar { width: 4px; }
.phone-options::-webkit-scrollbar-thumb { background: var(--color-gray-300); border-radius: var(--radius-xs); }

.phone-option {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: var(--space-2-5) var(--space-3);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    color: var(--color-text-muted);
}
.phone-option--clip { overflow: hidden; white-space: nowrap; }

.phone-option-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    border-radius: var(--radius-xs);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.phone-option-icon--warm { background: var(--color-warning-soft); }
.phone-option-icon--cool { background: var(--color-info-soft); }

@media (max-width: 900px) {
    .config-layout { flex-direction: column; gap: var(--space-6); }
    .config-preview { align-self: center; }
}
@media (max-width: 640px) {
    .config-tabs { flex-wrap: wrap; }
    .config-toolbar { align-items: flex-start !important; flex-direction: column; gap: var(--space-3); }
    .config-item { align-items: flex-start !important; gap: var(--space-3); }
    .config-item-actions { margin-left: auto; }
}

.form-note--info {
    background: var(--color-info-soft);
    border-color: #C7D2FE;
    border-radius: var(--radius-xl);
}

.phone-shell {
    background: var(--color-text);
    border-radius: var(--radius-3xl);
    padding: 6px;
    box-shadow: var(--shadow-lg);
}

.phone-banner {
    background: var(--color-primary);
    color: var(--color-white);
    border-radius: var(--radius-lg);
    padding: var(--space-3);
    margin-bottom: var(--space-4);
}

.flex-shrink-0 { flex-shrink: 0; }
.gap-1-5 { gap: var(--space-1-5); }

.detail-topbar {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: var(--space-5) var(--space-6);
}

.detail-back {
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: var(--text-base);
}
.detail-back:hover { color: var(--color-text); text-decoration: none; }

.detail-topbar h1 {
    margin: var(--space-2) 0 2px;
    font-size: var(--text-xl);
    font-weight: var(--font-semibold);
    color: var(--color-text);
}

.detail-topbar p {
    margin: 0;
    color: var(--color-text-muted);
    font-size: var(--text-base);
}

.payment-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.payment-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border-card);
    border-radius: var(--radius-xl);
    padding: var(--space-5);
    box-shadow: var(--shadow);
}
.payment-card span {
    display: block;
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    margin-bottom: var(--space-2);
}
.payment-card strong {
    color: var(--color-text);
    font-size: var(--text-3xl);
    font-weight: var(--font-bold);
}

.payment-panel {
    background: var(--color-surface);
    border: 1px solid var(--color-border-card);
    border-radius: var(--radius-xl);
    margin-bottom: var(--space-6);
    overflow: hidden;
}
.payment-panel h2 {
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    margin: 0;
    padding: var(--space-5);
    border-bottom: 1px solid var(--color-border-soft);
}

.payment-table { width: 100%; border-collapse: collapse; font-size: var(--text-base); }
.payment-table th {
    background: var(--color-gray-50);
    color: var(--color-text-muted);
    font-weight: var(--font-medium);
    padding: 0 var(--space-3);
    height: 40px;
    text-align: left;
    white-space: nowrap;
}
.payment-table td {
    padding: var(--space-2) var(--space-3);
    height: var(--row-height);
    border-top: 1px solid var(--color-border-soft);
    color: var(--color-text);
    white-space: nowrap;
}
.payment-table .money { text-align: right; font-variant-numeric: tabular-nums; }

.payment-status {
    display: inline-flex;
    align-items: center;
    padding: 2px var(--space-2);
    border-radius: var(--radius-sm);
    background: var(--color-gray-50);
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
}
.payment-status.APPLIED { background: var(--color-success-soft); color: var(--color-success); }

.payment-progress {
    height: 8px;
    background: var(--color-border);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-top: var(--space-3);
}
.payment-progress-bar {
    height: 100%;
    background: var(--color-primary);
    width: var(--progress, 0%);
}

.payment-empty {
    padding: var(--space-7);
    text-align: center;
    color: var(--color-text-faint);
}

@media (max-width: 900px) { .payment-summary { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) {
    .payment-summary { grid-template-columns: 1fr; }
    .payment-table-wrap { overflow-x: auto; }
}

.toggle-form--label { cursor: pointer; gap: var(--space-3); }

.stat-card-value.stat-card-value--primary { color: var(--color-primary); }
.stat-card-value.stat-card-value--success { color: var(--color-success); }
.stat-card-value.stat-card-value--info    { color: var(--color-info); }
.stat-card-value.stat-card-value--violet  { color: var(--color-violet); }
.stat-card-value.stat-card-value--blue    { color: var(--color-blue); }
.stat-card-value.text-orange { color: var(--color-warning); }
.stat-card-value.text-green  { color: var(--color-success); }
.stat-card-value.text-purple { color: var(--color-violet); }
.stat-card-value.text-red    { color: var(--color-error); }
.stat-card-value.text-blue   { color: var(--color-blue); }

.metrics-card-value.text-color-primary { color: var(--color-primary); }
.metrics-card-value.text-color-success { color: var(--color-success); }
.metrics-card-value.text-color-indigo  { color: var(--color-info); }
.metrics-card-value.text-color-blue    { color: var(--color-blue); }

.form-sticky-head {
    top: calc(var(--space-8) * -1);
    padding: var(--space-5) var(--space-8);
    margin: calc(var(--space-8) * -1) calc(var(--space-8) * -1) var(--space-6);
}

.stepper-container { margin-bottom: var(--space-4); }
.stepper-caption { margin-top: var(--space-3); margin-bottom: 0; }

.inline-table { table-layout: fixed; }
.inline-table th:first-child,
.inline-table td:first-child { width: 88px; text-align: center; }
.inline-table th:not(:first-child),
.inline-table td:not(:first-child) { width: auto; }
.inline-table th,
.inline-table td { padding: var(--space-2) var(--space-1); }

.inline-cell-input {
    width: 100%;
    min-width: 0;
    height: 32px;
    min-height: 32px;
    padding: 0 2px;
    text-align: center;
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    color: var(--color-text);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-xs);
    -moz-appearance: textfield;
    appearance: textfield;
}
.inline-cell-input::-webkit-outer-spin-button,
.inline-cell-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.inline-cell-input:focus {
    background: var(--color-surface);
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px var(--color-primary-ring);
}

.inline-table-wrap { overflow-x: visible; }


.inline-table input.inline-cell-input {
    height: 36px;
    min-height: 36px;
    padding: 0 var(--space-1);
    background: var(--color-field);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    text-align: center;
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    color: var(--color-text);
}
.inline-table input.inline-cell-input:focus {
    background: var(--color-surface);
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px var(--color-primary-ring);
}

.stat-card {
    display: block;
    padding: var(--space-5) var(--space-5) var(--space-6);
    min-height: 140px;
    background: var(--color-surface);
    border: 1px solid var(--color-border-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
}

.stat-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-3);
    min-height: 36px;
}

.stat-card .stat-card-title {
    margin: 0;
    font-size: var(--text-base);
    font-weight: var(--font-normal);
    color: var(--color-text-muted);
    line-height: 20px;
}

.stat-card .stat-card-value {
    margin: var(--space-2) 0 var(--space-1);
    font-size: var(--text-3xl);
    font-weight: var(--font-bold);
    color: var(--color-text);
    line-height: 32px;
}

.stat-card-foot {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    font-size: var(--text-sm);
    line-height: 16px;
}

.stat-card-note { color: var(--color-text-muted); font-weight: var(--font-normal); }
.stat-card-trend { color: var(--color-success); font-weight: var(--font-medium); }
.stat-card-trend--down { color: var(--color-error); }

.stat-card-head .icon-tile {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-lg);
    flex-shrink: 0;
}

.chart-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border-card);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    box-shadow: var(--shadow);
    min-height: 368px;
    display: flex;
    flex-direction: column;
}

.chart-card-title {
    margin: 0 0 var(--space-6) 0;
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    color: var(--color-text);
    line-height: 20px;
}

.chart-card .chart-container { flex: 1; height: auto; min-height: 250px; }

.icon-tile--primary { background: var(--color-primary-soft); color: var(--color-primary-strong); }

.stat-card {
    display: flex;
    flex-direction: column;
    gap: 0;
    justify-content: flex-start;
    min-height: 140px;
}
.stat-card-foot { margin-top: auto; }

.chart-svg {
    width: 100%;
    height: auto;
    display: block;
    overflow: visible;
}

.chart-grid-line {
    stroke: var(--color-border-soft);
    stroke-width: 1;
}

.chart-axis {
    font-size: 11px;
    fill: var(--color-text-muted);
    font-family: var(--font-sans);
}
.chart-axis--y { text-anchor: end; dominant-baseline: middle; }
.chart-axis--x { text-anchor: middle; }

.chart-bar--approved { fill: var(--color-primary); }
.chart-bar--rejected { fill: #F87171; }

.chart-line {
    fill: none;
    stroke: var(--color-indigo);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.chart-line-dot {
    fill: var(--color-indigo);
    stroke: var(--color-surface);
    stroke-width: 2;
}

.chart-legend-inline {
    display: flex;
    justify-content: center;
    gap: var(--space-5);
    margin-top: var(--space-3);
}

.chart-key {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--color-text-muted);
}

.chart-key-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
}
.chart-key-dot--approved { background: var(--color-primary); }
.chart-key-dot--rejected { background: #F87171; }
.chart-key-dot--amount   { background: var(--color-indigo); }

.dashboard-bottom {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.9fr);
    gap: var(--space-4);
    margin-bottom: var(--space-6);
    align-items: stretch;
}
@media (max-width: 1200px) {
    .dashboard-bottom { grid-template-columns: 1fr; }
}

.panel--flush { padding: 0; overflow: hidden; }
.panel--flush .panel-header { border-bottom: 1px solid var(--color-border-soft); }

.activity-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--color-border-soft);
}
.activity-item:last-child { border-bottom: none; }

.activity-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.activity-action {
    font-size: var(--text-base);
    font-weight: var(--font-medium);
    color: var(--color-text);
}

.activity-subject {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.activity-when {
    font-size: var(--text-sm);
    color: var(--color-text-faint);
    white-space: nowrap;
    flex-shrink: 0;
}

.empty-note {
    margin: 0;
    padding: var(--space-6) 0;
    text-align: center;
    color: var(--color-text-muted);
    font-size: var(--text-base);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.chart-card { min-height: 0; }
.charts-grid-2 { align-items: stretch; }
.chart-card .chart-svg { margin-top: auto; }

.stat-card-head { gap: var(--space-2); }

.dashboard-bottom .table-responsive { overflow-x: auto; }
.dashboard-bottom .custom-table th,
.dashboard-bottom .custom-table td { white-space: nowrap; }

.dashboard-bottom .custom-table th,
.dashboard-bottom .custom-table td {
    padding: var(--space-1) var(--space-2);
    height: 48px;
    font-size: var(--text-sm);
}

.dashboard-bottom .custom-table .cell-title {
    font-size: var(--text-sm);
    max-width: 150px;
    white-space: normal;
}

.dashboard-bottom .code-chip {
    font-size: 10px;
    padding: 2px var(--space-1-5);
}

@media (max-width: 1200px) {
    .stats-grid-4 { grid-template-columns: repeat(2, 1fr); }
    .charts-grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
    .stats-grid-4 { grid-template-columns: 1fr; }
}

.stat-card .stat-card-value.stat-card-value--primary { color: var(--color-primary); }
.stat-card .stat-card-value.stat-card-value--success { color: var(--color-success); }
.stat-card .stat-card-value.stat-card-value--info    { color: var(--color-info); }
.stat-card .stat-card-value.stat-card-value--violet  { color: var(--color-violet); }
.stat-card .stat-card-value.stat-card-value--blue    { color: var(--color-blue); }

td.cell-amount { color: var(--color-primary); font-weight: var(--font-medium); }
td.cell-count  { color: var(--color-success); }

.filter-bar .search-field,
.filter-bar .search-input-wrapper { margin-bottom: 0; }

.btn-icon--danger {
    color: var(--color-error);
    background: transparent;
    border: none;
}
.btn-icon--danger:hover {
    background: var(--color-error-soft);
    color: var(--color-error);
}

.filter-bar-actions select { min-width: 160px; }

.table-cell-bold { font-weight: var(--font-semibold); color: var(--color-text); }
.table-cell-muted { color: var(--color-text-muted); white-space: nowrap; }
.table-cell-muted.table-cell-truncate { white-space: nowrap; }
.table-cell-truncate {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

th.text-left,   td.text-left   { text-align: left; }
th.text-center, td.text-center { text-align: center; }
th.text-right,  td.text-right  { text-align: right; }

.form-actions-end { display: flex; justify-content: flex-end; gap: var(--space-3); }
.form-actions-end > .btn { flex: 1 1 0; }

.employees-page {
    display: flex;
    flex-direction: column;
}
.employees-page > #employees-results { display: contents; }
.employees-page .stat-tiles { order: -1; }
.employees-page > .filter-bar { margin-bottom: var(--space-4); }
.employees-page > #invite-result:empty { display: none; }
.employees-page > #invite-result { margin-bottom: var(--space-4); }

.stat-tiles {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}
.stat-tile {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-5);
    background: var(--color-surface);
    border: 1px solid var(--color-border-card);
    border-radius: var(--radius-xl);
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    min-height: 97px;
}
.stat-tile-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-xl);
    background: var(--color-primary-soft);
    color: var(--color-primary);
}
.stat-tile-icon--indigo { background: #EEF2FF; color: #6366F1; }
.stat-tile-body { min-width: 0; }
.stat-tile-label {
    margin: 0;
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    line-height: 16.5px;
    color: var(--color-text-muted);
}
.stat-tile-value {
    margin: 0;
    font-size: var(--text-3xl);
    font-weight: var(--font-bold);
    line-height: 30px;
    color: var(--color-text);
}

.employees-card {
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
}
.employees-card > .tabs {
    display: flex;
    gap: 0;
    margin: 0;
    padding: 0;
    border-bottom: 1px solid var(--color-border-soft);
    overflow-x: auto;
}
.employees-card > .tabs .tab-btn {
    padding: 12px 16px;
    margin: 0 0 -1px 0;
    font-size: var(--text-base);
    font-weight: var(--font-medium);
    line-height: 20px;
    color: var(--color-text-muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    white-space: nowrap;
    text-decoration: none;
}
.employees-card > .tabs .tab-btn:hover { color: var(--color-text); }
.employees-card > .tabs .tab-btn.tab-btn--active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
    background: none;
}

.employees-card .table-responsive { margin: 0; }
.employees-table thead tr { background: var(--color-background); }
.employees-table th {
    height: 39px;
    padding: 12px;
    font-size: var(--text-2xs);
    font-weight: var(--font-semibold) !important;
    line-height: 14px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--color-text-muted);
    border-bottom: 1px solid var(--color-border-soft);
    white-space: nowrap;
}
.employees-table td {
    height: 65px;
    padding: 12px;
    font-size: var(--text-base);
    color: var(--color-text);
    border-bottom: 1px solid var(--color-border-soft);
    vertical-align: middle;
}
.employees-table th:first-child,
.employees-table td:first-child { padding-left: 20px; }
.employees-table th:last-child,
.employees-table td:last-child { padding-right: 20px; }
.employees-table tbody tr:last-child td { border-bottom: none; }
.employees-table tbody tr { transition: background-color .15s ease; }
.employees-table tbody tr:hover { background: var(--color-background); }

.employees-table .th-checkbox,
.employees-table .td-checkbox { width: 1%; padding-right: 0; }
/* Hand-built like #role-drawer-root .checkbox-custom: with accent-color the
   browser picked a dark checkmark on the turquoise fill instead of white. */
.employees-table .select-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    min-height: 0;
    margin: 0;
    border: 1.5px solid #CBD5E1;
    border-radius: 4px;
    background: white;
    position: relative;
    flex-shrink: 0;
    cursor: pointer;
}
.employees-table .select-checkbox:checked {
    background: #20C3C3;
    border-color: #20C3C3;
}
.employees-table .select-checkbox:checked::after {
    content: "";
    position: absolute;
    left: 4px;
    top: 1px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.employees-table .select-checkbox:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.employees-table .select-checkbox:indeterminate {
    background: var(--color-primary);
    border-color: var(--color-primary);
}
.employees-table .select-checkbox:indeterminate::after {
    content: "";
    position: absolute;
    left: 3px;
    top: 6px;
    width: 7px;
    height: 2px;
    background: var(--color-white);
}

.person-cell {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
/* Keep identity icons and names aligned consistently across table rows. */
.table td > .person-cell,
.dash-table td > .person-cell,
.custom-table td > .user-cell {
    justify-content: flex-start;
    text-align: left;
}

.person-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 9999px;
    font-size: var(--text-xs);
    font-weight: var(--font-bold);
    line-height: 1;
    background: var(--color-primary-soft);
    color: var(--color-primary-strong);
}
.employees-table tbody tr:nth-child(5n+2) .person-avatar { background: #DBEAFE; color: #2563EB; }
.employees-table tbody tr:nth-child(5n+3) .person-avatar { background: #EDE9FE; color: #7C3AED; }
.employees-table tbody tr:nth-child(5n+4) .person-avatar { background: #D1FAE5; color: #065F46; }
.employees-table tbody tr:nth-child(5n+5) .person-avatar { background: #FEE2E2; color: #B91C1C; }
.person-name {
    font-size: var(--text-base);
    font-weight: var(--font-medium);
    line-height: 20px;
    color: var(--color-text);
}

.employees-table td.cell-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    max-width: 160px;
}
.employees-table td.cell-muted-sm {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    max-width: 170px;
}
.employees-table td.cell-phone { color: #303642; white-space: nowrap; }

.employees-table .badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    line-height: 16px;
    white-space: nowrap;
}
.employees-table .badge-active       { background: #ECFDF5; color: #22A06B; }
.employees-table .badge-invited      { background: #FFF8E6; color: #D97706; }
.employees-table .badge-pending      { background: #FEF3C7; color: #D97706; }
.employees-table .badge-inactive     { background: #F3F4F6; color: #6B7280; }
.employees-table .badge-eligible     { background: var(--color-primary-soft); color: var(--color-primary-strong); }
.employees-table .badge-not-eligible { background: #FEE2E2; color: #D64545; }

.drawer--detail .drawer-title-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}
.employees-table .badge-declined,
.drawer--detail .drawer-title-row .badge-declined { background: #FEE2E2; color: #D64545; }
.drawer--detail .drawer-title-row .badge-active   { background: #ECFDF5; color: #22A06B; }
.drawer--detail .drawer-title-row .badge-invited  { background: #FFF8E6; color: #D97706; }
.drawer--detail .drawer-title-row .badge-pending  { background: #FEF3C7; color: #D97706; }
.drawer--detail .drawer-title-row .badge-inactive { background: #F3F4F6; color: #6B7280; }

.employees-table .btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: var(--radius-lg);
    background: transparent;
    color: var(--color-text-muted);
    cursor: pointer;
}
.employees-table .btn-icon:hover { background: var(--color-background); color: var(--color-text); }

.employees-card .selection-bar {
    margin: 0;
    padding: 10px 20px;
    border: none;
    border-bottom: 1px solid rgba(32, 195, 195, 0.3);
    border-radius: 0;
    background: var(--color-primary-soft);
    color: var(--color-primary-strong);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    justify-content: space-between;
}

.employees-card .table-card-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--color-border-soft);
}
.employees-card .table-card-footer:not(:has(.pagination)) { display: none; }
.employees-card .table-card-footer .pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin: 0;
    padding: 0;
    border: none;
}
.employees-card .table-card-footer .pagination-info {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}
.employees-card .table-card-footer .pagination-links { display: flex; gap: 4px; flex-wrap: wrap; }
.employees-card .table-card-footer .pagination-links a,
.employees-card .table-card-footer .pagination-links span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: transparent;
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--color-text-muted);
    white-space: nowrap;
    text-decoration: none;
    box-shadow: none;
}
.employees-card .table-card-footer .pagination-links .pagination-current {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #FFFFFF;
}

[id$="-drawer-root"] .drawer.drawer--form {
    width: min(540px, 100%);
    background: var(--color-surface);
}
[id$="-drawer-root"] .drawer--form .drawer-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
    padding: 20px 24px;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}
[id$="-drawer-root"] .drawer--form .drawer-header h2 {
    margin: 0;
    font-size: var(--text-lg);
    font-weight: var(--font-bold);
    line-height: 24px;
    color: var(--color-text);
}
[id$="-drawer-root"] .drawer--form .drawer-subtitle {
    margin: 2px 0 0;
    font-size: var(--text-xs);
    line-height: 16.5px;
    color: var(--color-text-muted);
}
[id$="-drawer-root"] .drawer--form .drawer-body {
    padding: 20px 24px;
    background: var(--color-surface);
}

.drawer--form .form-stack > * + * { margin-top: 20px; }
.drawer--form fieldset.form-section {
    display: block;
    margin: 0 0 20px;
    padding: 0;
    border: none;
    border-radius: 0;
    background: none;
    box-shadow: none;
    min-width: 0;
}
.drawer--form fieldset.form-section legend {
    float: left;
    width: 100%;
    margin: 0 0 12px;
    padding: 0;
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    line-height: 20px;
    text-transform: none;
    letter-spacing: normal;
    color: var(--color-text);
}
.drawer--form fieldset.form-section legend + * { clear: both; }
.drawer--form .form-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin: 0 0 16px;
}
.drawer--form .form-section > .form-row:last-child,
.drawer--form .form-section > div:last-child > .form-row:last-child { margin-bottom: 0; }
.drawer--form .form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0;
    min-width: 0;
}
.drawer--form .form-group > label,
.drawer--form .form-group label {
    margin: 0;
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    line-height: 16.5px;
    color: var(--color-text-muted);
    text-transform: none;
    letter-spacing: normal;
}
.drawer--form .required-star { color: #D64545; margin-left: 2px; }

[id$="-drawer-root"] .drawer--form .drawer-body input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=hidden]),
[id$="-drawer-root"] .drawer--form .drawer-body select,
[id$="-drawer-root"] .drawer--form .drawer-body .colony-load,
[id$="-drawer-root"] .drawer--form .drawer-body textarea {
    width: 100%;
    height: 36px;
    min-height: 36px;
    padding: 4px 12px;
    font-size: var(--text-base);
    line-height: 20px;
    color: var(--color-text);
    background: var(--color-field);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    box-shadow: none;
}
[id$="-drawer-root"] .drawer--form .drawer-body textarea { height: auto; }
/* "Colonia" before its colonies load (employee drawers): the field box
   above plus the select's chevron, faint until the code is complete. */
[id$="-drawer-root"] .drawer--form .drawer-body .colony-load {
    padding-right: 2.25rem;
    color: var(--color-text-faint);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px;
}
[id$="-drawer-root"] .drawer--form .drawer-body .postal-lookup:has(.postal-lookup-code:invalid:not(:placeholder-shown)) .colony-load { color: var(--color-text); }
[id$="-drawer-root"] .drawer--form .drawer-body input:focus,
[id$="-drawer-root"] .drawer--form .drawer-body select:focus,
[id$="-drawer-root"] .drawer--form .drawer-body textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-ring);
}
[id$="-drawer-root"] .drawer--form .drawer-body input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=hidden]):disabled,
[id$="-drawer-root"] .drawer--form .drawer-body fieldset:disabled input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=hidden]),
[id$="-drawer-root"] .drawer--form .drawer-body select:disabled,
[id$="-drawer-root"] .drawer--form .drawer-body fieldset:disabled select {
    background: var(--color-background);
    color: var(--color-text-muted);
    opacity: 1;
    cursor: default;
}
.drawer--form .field-error:empty { display: none; }
.drawer--form .form-stack > #new-employee-alert:empty,
.drawer--form .form-stack > #upload-result:empty { display: none; }
.drawer--form .form-hint {
    margin: 4px 0 0;
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

[id$="-drawer-root"] .drawer--form .drawer-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: 16px 24px;
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
}
[id$="-drawer-root"] .drawer--form .drawer-body form > .drawer-actions {
    position: sticky;
    bottom: -20px;
    z-index: 1;
    margin: 24px -24px -20px;
}
.drawer--form .btn-text {
    padding: 0;
    border: none;
    background: none;
    font-size: var(--text-base);
    font-weight: var(--font-medium);
    line-height: 20px;
    color: var(--color-text-muted);
    cursor: pointer;
}
.drawer--form .btn-text:hover { color: var(--color-text); }
/* "Cancelar" became a link: same 40px box the button had. The wizard's
   step-only ones keep their display from the step rules. */
.drawer--form a.btn-text {
    align-items: center;
    justify-content: center;
    min-height: var(--control-height);
    text-decoration: none;
}
.drawer--form a.btn-text:not(.wizard-only) { display: inline-flex; }
.drawer--form .drawer-actions .btn {
    height: 36px;
    min-height: 36px;
    padding: 0 24px;
    border-radius: var(--radius-xl);
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    gap: 8px;
}
.drawer--form .drawer-actions .btn-danger-solid {
    background: #D64545;
    border: none;
    color: #FFFFFF;
}
.drawer--form .drawer-actions .btn-danger-solid:hover { background: #B91C1C; }
.drawer--form .drawer-actions .inline-form { margin: 0; }

.employees-page > .filter-bar {
    padding: 0;
    background: none;
    border: none;
    border-radius: 0;
    box-shadow: none;
    gap: 12px;
}
.employees-page > .filter-bar .filter-bar-actions { gap: 12px; }
/* System users also get the company selector: the search keeps a usable
   width and the actions wrap below when the row runs out of room. */
.employees-page > .filter-bar { flex-wrap: wrap; }
.employees-page > .filter-bar .search-field { min-width: 260px; }
.employees-page > .filter-bar .filter-bar-actions { flex-wrap: wrap; }
.employees-page > .filter-bar .search-field input,
.employees-page > .filter-bar select {
    height: 36px;
    min-height: 36px;
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    font-size: var(--text-base);
    box-shadow: none;
}
.employees-page > .filter-bar select { min-width: 208px; }
.employees-page > .filter-bar .btn {
    height: 36px;
    min-height: 36px;
    padding: 0 16px;
    border-radius: var(--radius-xl);
    font-size: var(--text-base);
    gap: 8px;
    white-space: nowrap;
}
.employees-page > .filter-bar .btn-outline {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    color: #303642;
    font-weight: var(--font-medium);
}
.employees-page > .filter-bar .btn-primary { font-weight: var(--font-semibold); }
.employees-card .table-card-footer .pagination-links a,
.employees-card .table-card-footer .pagination-links span { width: auto; }
.drawer--form .form-row:has(> .form-group:nth-child(3)) {
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr);
}

.drawer--wizard .wizard-state { display: none; }
.drawer--wizard .wizard-form {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    margin: 0;
}
[id$="-drawer-root"] .drawer--wizard .wizard-form > .drawer-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}
.drawer--wizard .wizard-panel,
.drawer--wizard .wizard-only { display: none; }

.wizard-stepper {
    display: flex;
    align-items: flex-start;
    margin: 0;
    padding: 20px 24px 16px;
    list-style: none;
    border-bottom: 1px solid var(--color-border-soft);
    background: var(--color-surface);
}
.wizard-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 0 0 64px;
    width: 64px;
    text-align: center;
}
.wizard-step-dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 9999px;
    border: 2px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text-faint);
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    line-height: 1;
}
.wizard-step-check { display: none; }
.wizard-step-label {
    margin-top: 4px;
    font-size: var(--text-2xs);
    font-weight: var(--font-normal);
    line-height: 12.5px;
    color: var(--color-text-muted);
}
.wizard-step-line {
    flex: 1 1 auto;
    height: 2px;
    margin: 15px 4px 0;
    background: var(--color-border);
    list-style: none;
}

.drawer--form .info-note {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0 0 20px;
    padding: 12px 16px;
    background: var(--color-primary-soft);
    border: 1px solid rgba(32, 195, 195, 0.3);
    border-radius: var(--radius-xl);
    color: var(--color-primary);
}
.drawer--form .info-note svg { flex-shrink: 0; margin-top: 2px; }
.drawer--form .info-note p {
    margin: 0;
    font-size: var(--text-xs);
    line-height: 17.875px;
    color: var(--color-primary-strong);
}
.drawer--form .wizard-panel[data-step="4"] .info-note { margin-bottom: 16px; }

.confirm-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border-card);
    border-radius: var(--radius-xl);
    overflow: hidden;
}
.confirm-card:empty { display: none; }
.confirm-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--color-border-soft);
}
.confirm-row:last-child { border-bottom: none; }
.confirm-label {
    flex-shrink: 0;
    font-size: var(--text-xs);
    line-height: 16.5px;
    color: var(--color-text-muted);
}
.confirm-value {
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    line-height: 16.5px;
    color: var(--color-text);
    text-align: right;
    overflow-wrap: anywhere;
}

[id$="-drawer-root"] .drawer--wizard .wizard-footer {
    display: block;
    flex: 0 0 auto;
    margin: 0;
}
.wizard-alert:empty { display: none; }
.wizard-alert { margin: 0 0 12px; }
.wizard-alert .alert { margin: 0; padding: 10px 14px; font-size: var(--text-sm); }
.wizard-errors { margin: 0; padding-left: 16px; }
.wizard-errors li + li { margin-top: 2px; }
.wizard-buttons {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}
.drawer--wizard label.btn-text { cursor: pointer; user-select: none; }

.drawer--wizard:has(#emp-step-1:checked) .wizard-panel[data-step="1"] { display: block; }
.drawer--wizard:has(#emp-step-1:checked) .wizard-buttons [data-step="1"] { display: inline-flex; }
.drawer--wizard:has(#emp-step-1:checked) .wizard-step[data-step="1"] .wizard-step-dot { background: var(--color-primary); border-color: var(--color-primary); color: #FFFFFF; }
.drawer--wizard:has(#emp-step-1:checked) .wizard-step[data-step="1"] .wizard-step-label { color: var(--color-primary); font-weight: var(--font-semibold); }
.drawer--wizard:has(#emp-step-2:checked) .wizard-panel[data-step="2"] { display: block; }
.drawer--wizard:has(#emp-step-2:checked) .wizard-buttons [data-step="2"] { display: inline-flex; }
.drawer--wizard:has(#emp-step-2:checked) .wizard-step[data-step="2"] .wizard-step-dot { background: var(--color-primary); border-color: var(--color-primary); color: #FFFFFF; }
.drawer--wizard:has(#emp-step-2:checked) .wizard-step[data-step="2"] .wizard-step-label { color: var(--color-primary); font-weight: var(--font-semibold); }
.drawer--wizard:has(#emp-step-2:checked) .wizard-step[data-step="1"] .wizard-step-dot { background: var(--color-primary); border-color: var(--color-primary); color: #FFFFFF; }
.drawer--wizard:has(#emp-step-2:checked) .wizard-step[data-step="1"] .wizard-step-num { display: none; }
.drawer--wizard:has(#emp-step-2:checked) .wizard-step[data-step="1"] .wizard-step-check { display: block; }
.drawer--wizard:has(#emp-step-2:checked) .wizard-step[data-step="1"] .wizard-step-label { color: var(--color-primary); font-weight: var(--font-semibold); }
.drawer--wizard:has(#emp-step-2:checked) .wizard-step-line[data-step="1"] { background: var(--color-primary); }
.drawer--wizard:has(#emp-step-3:checked) .wizard-panel[data-step="3"] { display: block; }
.drawer--wizard:has(#emp-step-3:checked) .wizard-buttons [data-step="3"] { display: inline-flex; }
.drawer--wizard:has(#emp-step-3:checked) .wizard-step[data-step="3"] .wizard-step-dot { background: var(--color-primary); border-color: var(--color-primary); color: #FFFFFF; }
.drawer--wizard:has(#emp-step-3:checked) .wizard-step[data-step="3"] .wizard-step-label { color: var(--color-primary); font-weight: var(--font-semibold); }
.drawer--wizard:has(#emp-step-3:checked) .wizard-step[data-step="1"] .wizard-step-dot,
.drawer--wizard:has(#emp-step-3:checked) .wizard-step[data-step="2"] .wizard-step-dot { background: var(--color-primary); border-color: var(--color-primary); color: #FFFFFF; }
.drawer--wizard:has(#emp-step-3:checked) .wizard-step[data-step="1"] .wizard-step-num,
.drawer--wizard:has(#emp-step-3:checked) .wizard-step[data-step="2"] .wizard-step-num { display: none; }
.drawer--wizard:has(#emp-step-3:checked) .wizard-step[data-step="1"] .wizard-step-check,
.drawer--wizard:has(#emp-step-3:checked) .wizard-step[data-step="2"] .wizard-step-check { display: block; }
.drawer--wizard:has(#emp-step-3:checked) .wizard-step[data-step="1"] .wizard-step-label,
.drawer--wizard:has(#emp-step-3:checked) .wizard-step[data-step="2"] .wizard-step-label { color: var(--color-primary); font-weight: var(--font-semibold); }
.drawer--wizard:has(#emp-step-3:checked) .wizard-step-line[data-step="1"],
.drawer--wizard:has(#emp-step-3:checked) .wizard-step-line[data-step="2"] { background: var(--color-primary); }
.drawer--wizard:has(#emp-step-4:checked) .wizard-panel[data-step="4"] { display: block; }
.drawer--wizard:has(#emp-step-4:checked) .wizard-buttons [data-step="4"] { display: inline-flex; }
.drawer--wizard:has(#emp-step-4:checked) .wizard-step[data-step="4"] .wizard-step-dot { background: var(--color-primary); border-color: var(--color-primary); color: #FFFFFF; }
.drawer--wizard:has(#emp-step-4:checked) .wizard-step[data-step="4"] .wizard-step-label { color: var(--color-primary); font-weight: var(--font-semibold); }
.drawer--wizard:has(#emp-step-4:checked) .wizard-step[data-step="1"] .wizard-step-dot,
.drawer--wizard:has(#emp-step-4:checked) .wizard-step[data-step="2"] .wizard-step-dot,
.drawer--wizard:has(#emp-step-4:checked) .wizard-step[data-step="3"] .wizard-step-dot { background: var(--color-primary); border-color: var(--color-primary); color: #FFFFFF; }
.drawer--wizard:has(#emp-step-4:checked) .wizard-step[data-step="1"] .wizard-step-num,
.drawer--wizard:has(#emp-step-4:checked) .wizard-step[data-step="2"] .wizard-step-num,
.drawer--wizard:has(#emp-step-4:checked) .wizard-step[data-step="3"] .wizard-step-num { display: none; }
.drawer--wizard:has(#emp-step-4:checked) .wizard-step[data-step="1"] .wizard-step-check,
.drawer--wizard:has(#emp-step-4:checked) .wizard-step[data-step="2"] .wizard-step-check,
.drawer--wizard:has(#emp-step-4:checked) .wizard-step[data-step="3"] .wizard-step-check { display: block; }
.drawer--wizard:has(#emp-step-4:checked) .wizard-step[data-step="1"] .wizard-step-label,
.drawer--wizard:has(#emp-step-4:checked) .wizard-step[data-step="2"] .wizard-step-label,
.drawer--wizard:has(#emp-step-4:checked) .wizard-step[data-step="3"] .wizard-step-label { color: var(--color-primary); font-weight: var(--font-semibold); }
.drawer--wizard:has(#emp-step-4:checked) .wizard-step-line[data-step="1"],
.drawer--wizard:has(#emp-step-4:checked) .wizard-step-line[data-step="2"],
.drawer--wizard:has(#emp-step-4:checked) .wizard-step-line[data-step="3"] { background: var(--color-primary); }

.stat-tile-trend {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0;
    font-size: var(--text-sm);
    line-height: 16px;
    color: var(--color-text-muted);
}
.stat-tile-delta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: var(--font-medium);
    color: var(--color-text-muted);
}
.stat-tile-delta.is-up { color: var(--color-success); }
.stat-tile-delta.is-down { color: #D64545; }

.employees-card > .tabs .tab-count { font-weight: inherit; }

.wizard-stepper--nav .wizard-step-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    margin: 0;
    cursor: pointer;
    font: inherit;
    text-transform: none;
    letter-spacing: normal;
}
.wizard-stepper--nav .wizard-step-link:hover .wizard-step-dot { border-color: var(--color-primary); }
.drawer--detail .wizard-stepper .wizard-step { flex-basis: 84px; width: 84px; }
.drawer--detail .wizard-buttons-left,
.drawer--detail .wizard-buttons-right {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}
.drawer--detail .wizard-buttons-left .inline-form { margin: 0; }
/* Employee forms have room for two columns and an inline dial code. */
[id$="-drawer-root"] .drawer.drawer--form.drawer--employee {
    width: min(720px, 100%);
}
.drawer--employee .form-row {
    column-gap: 24px;
    margin-bottom: 20px;
}
.drawer--employee .phone-input-group {
    display: grid;
    grid-template-columns: 6.5rem minmax(0, 1fr);
    gap: 8px;
}
.drawer--employee .phone-input-group select.phone-country {
    min-width: 0;
    max-width: none;
}
.drawer--employee .phone-input-group .field-error {
    grid-column: 1 / -1;
}
@media (max-width: 600px) {
    .drawer--employee .form-row,
    .drawer--employee .form-row:has(> .form-group:nth-child(3)) {
        grid-template-columns: minmax(0, 1fr);
    }
}
.drawer--detail .wizard-buttons {
    gap: var(--space-4);
}
.drawer--detail .wizard-buttons-right {
    gap: var(--space-4);
}
[id$="-drawer-root"] .drawer--detail > #employee-detail-content > .wizard-footer {
    display: block;
    flex: 0 0 auto;
    padding: 16px 24px;
}
.drawer--wizard label.btn { display: none; align-items: center; justify-content: center; cursor: pointer; user-select: none; }

.employees-card > .tabs {
    overflow: visible;
    scrollbar-width: none;
}
.employees-card > .tabs::-webkit-scrollbar { display: none; }

.drawer--detail:has(#emp-view-step-1:checked) .wizard-panel[data-step="1"] { display: block; }
.drawer--detail:has(#emp-view-step-1:checked) .wizard-buttons [data-step="1"] { display: inline-flex; }
.drawer--detail:has(#emp-view-step-1:checked) .wizard-step[data-step="1"] .wizard-step-dot { background: var(--color-primary); border-color: var(--color-primary); color: #FFFFFF; }
.drawer--detail:has(#emp-view-step-1:checked) .wizard-step[data-step="1"] .wizard-step-label { color: var(--color-primary); font-weight: var(--font-semibold); }
.drawer--detail:has(#emp-view-step-2:checked) .wizard-panel[data-step="2"] { display: block; }
.drawer--detail:has(#emp-view-step-2:checked) .wizard-buttons [data-step="2"] { display: inline-flex; }
.drawer--detail:has(#emp-view-step-2:checked) .wizard-step[data-step="2"] .wizard-step-dot { background: var(--color-primary); border-color: var(--color-primary); color: #FFFFFF; }
.drawer--detail:has(#emp-view-step-2:checked) .wizard-step[data-step="2"] .wizard-step-label { color: var(--color-primary); font-weight: var(--font-semibold); }
.drawer--detail:has(#emp-view-step-2:checked) .wizard-step[data-step="1"] .wizard-step-dot { background: var(--color-primary); border-color: var(--color-primary); color: #FFFFFF; }
.drawer--detail:has(#emp-view-step-2:checked) .wizard-step[data-step="1"] .wizard-step-num { display: none; }
.drawer--detail:has(#emp-view-step-2:checked) .wizard-step[data-step="1"] .wizard-step-check { display: block; }
.drawer--detail:has(#emp-view-step-2:checked) .wizard-step[data-step="1"] .wizard-step-label { color: var(--color-primary); font-weight: var(--font-semibold); }
.drawer--detail:has(#emp-view-step-2:checked) .wizard-step-line[data-step="1"] { background: var(--color-primary); }
.drawer--detail:has(#emp-view-step-3:checked) .wizard-panel[data-step="3"] { display: block; }
.drawer--detail:has(#emp-view-step-3:checked) .wizard-buttons [data-step="3"] { display: inline-flex; }
.drawer--detail:has(#emp-view-step-3:checked) .wizard-step[data-step="3"] .wizard-step-dot { background: var(--color-primary); border-color: var(--color-primary); color: #FFFFFF; }
.drawer--detail:has(#emp-view-step-3:checked) .wizard-step[data-step="3"] .wizard-step-label { color: var(--color-primary); font-weight: var(--font-semibold); }
.drawer--detail:has(#emp-view-step-3:checked) .wizard-step[data-step="1"] .wizard-step-dot,
.drawer--detail:has(#emp-view-step-3:checked) .wizard-step[data-step="2"] .wizard-step-dot { background: var(--color-primary); border-color: var(--color-primary); color: #FFFFFF; }
.drawer--detail:has(#emp-view-step-3:checked) .wizard-step[data-step="1"] .wizard-step-num,
.drawer--detail:has(#emp-view-step-3:checked) .wizard-step[data-step="2"] .wizard-step-num { display: none; }
.drawer--detail:has(#emp-view-step-3:checked) .wizard-step[data-step="1"] .wizard-step-check,
.drawer--detail:has(#emp-view-step-3:checked) .wizard-step[data-step="2"] .wizard-step-check { display: block; }
.drawer--detail:has(#emp-view-step-3:checked) .wizard-step[data-step="1"] .wizard-step-label,
.drawer--detail:has(#emp-view-step-3:checked) .wizard-step[data-step="2"] .wizard-step-label { color: var(--color-primary); font-weight: var(--font-semibold); }
.drawer--detail:has(#emp-view-step-3:checked) .wizard-step-line[data-step="1"],
.drawer--detail:has(#emp-view-step-3:checked) .wizard-step-line[data-step="2"] { background: var(--color-primary); }
.drawer--wizard .wizard-buttons .wizard-only { gap: 6px; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.chart-card-head {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin-bottom: var(--space-4);
}
.chart-card-head .chart-card-title { margin: 0; }
.chart-range-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-size: var(--text-sm);
    line-height: 16px;
    color: #303642;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
}

.chart-grid-line--dashed { stroke: var(--color-border-soft); stroke-dasharray: 3 3; }
.company-charts .chart-axis { font-size: 12px; }
.chart-bar--total { fill: #93C5FD; }
.chart-line--indigo { stroke: #6366F1; }
.chart-line-dot--indigo { fill: #6366F1; }
.chart-area { stroke: none; }
.chart-key-dot--total { background: #93C5FD; }
.chart-key-dot--indigo { background: #6366F1; }
.company-charts .chart-key--total { color: #93C5FD; }
.company-charts .chart-key--approved { color: var(--color-primary); }
.company-charts .chart-key--rejected { color: #F87171; }
.company-charts .chart-key--amount { color: #6366F1; }

.company-bottom {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-4);
    align-items: stretch;
    margin-bottom: var(--space-6);
}
@media (max-width: 1100px) {
    .company-bottom { grid-template-columns: minmax(0, 1fr); }
}
.dash-table-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.dash-table-card-head {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    min-height: 70px;
    padding: 16px 20px 12px;
}
.dash-table-card-head .chart-card-title { margin: 0; }
.dash-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    line-height: 16px;
    color: var(--color-primary);
    text-decoration: none;
}
.dash-link:hover { color: var(--color-primary-strong); text-decoration: none; }
.dash-table-card .empty-note { padding: 0 20px 20px; margin: 0; }

.dash-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}
.dash-table th {
    padding: 8px 12px;
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    line-height: 16px;
    color: var(--color-text-muted);
    text-align: center;
    text-transform: none;
    letter-spacing: normal;
    border-bottom: 1px solid var(--color-border-soft);
    white-space: nowrap;
    background: none;
    height: auto;
}
.dash-table td {
    height: 53px;
    padding: 12px;
    font-size: var(--text-sm);
    line-height: 16px;
    color: var(--color-text);
    vertical-align: middle;
    border-bottom: 1px solid var(--color-border-soft);
    text-align: center;
}
.dash-table th:first-child,
.dash-table td:first-child { padding-left: 20px; }
.dash-table th:last-child,
.dash-table td:last-child { padding-right: 20px; }
.dash-table tbody tr:last-child td { border-bottom: none; }
.dash-table th.text-right,
.dash-table td.text-right { text-align: center; }
.dash-table .dash-amount { font-weight: var(--font-medium); color: var(--color-text); white-space: nowrap; }
.dash-table .dash-strong { font-weight: var(--font-medium); color: var(--color-text); white-space: nowrap; }
.dash-table .dash-muted { color: var(--color-text-muted); }
.dash-table .dash-nowrap { white-space: nowrap; }
.dash-table .dash-icon-cell { width: 1%; }

.person-cell--sm { display: flex; align-items: center; gap: 8px; min-width: 0; }
.person-avatar--sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 9999px;
    font-size: var(--text-2xs);
    font-weight: var(--font-bold);
    line-height: 1;
    background: #DBEAFE;
    color: #1D4ED8;
}
.dash-table tbody tr:nth-child(5n+2) .person-avatar--sm { background: #FFF8E6; color: #D97706; }
.dash-table tbody tr:nth-child(5n+3) .person-avatar--sm { background: #FEE2E2; color: #D64545; }
.dash-table tbody tr:nth-child(5n+4) .person-avatar--sm { background: #ECFDF5; color: #22A06B; }
.dash-table tbody tr:nth-child(5n+5) .person-avatar--sm { background: #EDE9FE; color: #7C3AED; }
.person-cell--sm .person-name {
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    line-height: 16px;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dash-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    line-height: 15px;
    white-space: nowrap;
    background: #F3F4F6;
    color: #6B7280;
}
.dash-badge--approved   { background: #ECFDF5; color: #22A06B; }
.dash-badge--dispersed,
.dash-badge--dispersing { background: var(--color-primary-soft); color: var(--color-primary-strong); }
.dash-badge--pending    { background: #FFF8E6; color: #D97706; }
.dash-badge--rejected   { background: #FEF2F2; color: #D64545; }

.dash-table .btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: var(--radius-lg);
    background: transparent;
    color: var(--color-text-muted);
}
.dash-table .btn-icon:hover { background: var(--color-background); color: var(--color-text); }

.activity-tile {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-lg);
    background: var(--color-primary-soft);
    color: var(--color-primary);
}
.activity-tile--approved { background: #ECFDF5; color: #22A06B; }
.activity-tile--employee { background: #EEF2FF; color: #6366F1; }
.activity-tile--campaign { background: #FFF8E6; color: #F59E0B; }

.company-profile { display: flex; flex-direction: column; gap: 16px; }

.profile-hero {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 17px 20px;
    background: var(--color-surface);
    border: 1px solid var(--color-border-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
}
.profile-hero-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: var(--radius-xl);
    background: var(--color-primary-soft);
    color: var(--color-primary);
}
.profile-hero-body { flex: 1 1 auto; min-width: 0; }
.profile-hero-name {
    margin: 0;
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    line-height: 24px;
    color: var(--color-text);
}
.profile-hero-meta { display: flex; align-items: center; gap: 8px; margin-top: 2px; flex-wrap: wrap; }
.profile-status {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--radius-xs);
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    line-height: 16.5px;
    background: #F3F4F6;
    color: #6B7280;
}
.profile-status--active  { background: #ECFDF5; color: #22A06B; }
.profile-status--pending { background: #FFF8E6; color: #D97706; }
.profile-hero-date { font-size: var(--text-xs); line-height: 16.5px; color: var(--color-text-muted); }
.profile-hero-stats { display: flex; gap: 32px; flex-shrink: 0; }
.profile-hero-stat-label {
    margin: 0;
    font-size: var(--text-2xs);
    font-weight: var(--font-semibold);
    line-height: 15px;
    letter-spacing: 0.25px;
    text-transform: uppercase;
    color: var(--color-text-muted);
}
.profile-hero-stat-value {
    margin: 2px 0 0;
    font-size: var(--text-3xl);
    font-weight: var(--font-bold);
    line-height: 32px;
    color: var(--color-text);
    text-align: center;
}

.profile-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.profile-card-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border-soft);
}
.profile-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-lg);
}
.profile-card-icon--indigo { background: #EEF2FF; color: #6366F1; }
.profile-card-icon--teal   { background: var(--color-primary-soft); color: var(--color-primary); }
.profile-card-icon--green  { background: #ECFDF5; color: #22A06B; }
.profile-card-icon--red    { background: var(--color-error-soft); color: var(--color-error); }
.profile-card-icon--amber  { background: #FFF8E6; color: #D97706; }
.profile-card-body { padding: 18px 20px; }
.profile-card-body p.text-muted { margin: 0 0 16px; line-height: 1.55; }
.profile-card-body .form-row:last-child,
.profile-card-body form:last-child { margin-bottom: 0; }
.profile-card-titles { flex: 1 1 auto; min-width: 0; }
.profile-card-title {
    margin: 0;
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    line-height: 20px;
    color: var(--color-text);
}
.profile-card-subtitle { margin: 0; font-size: var(--text-xs); line-height: 16.5px; color: var(--color-text-muted); }
.profile-edit-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    padding: 6px 12px;
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    line-height: 16px;
    color: var(--color-primary);
    background: transparent;
    border: 1px solid var(--color-primary);
    border-radius: var(--radius-lg);
    min-height: 0;
    height: 30px;
    box-shadow: none;
    cursor: pointer;
}
.profile-edit-btn:hover { background: var(--color-primary-soft); }

.profile-grid {
    display: grid;
    gap: 16px 32px;
    margin: 0;
    padding: 16px 20px;
}
.profile-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.profile-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.profile-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1000px) {
    .profile-grid--3, .profile-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.profile-subsection {
    padding: 0 20px 16px;
    border-top: 1px solid var(--color-border);
    margin-top: 4px;
    padding-top: 16px;
}
.profile-subsection-title {
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    letter-spacing: 0.55px;
    text-transform: uppercase;
    color: var(--color-primary);
    margin: 0 0 12px;
}
.profile-field { min-width: 0; }
.profile-field--full { grid-column: 1 / -1; }
.profile-field dt {
    margin: 0 0 2px;
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    line-height: 16.5px;
    color: var(--color-text-muted);
}
.profile-field dd {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    font-size: var(--text-base);
    line-height: 20px;
    color: var(--color-text);
    overflow-wrap: anywhere;
}
.profile-readonly-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    font-size: var(--text-2xs);
    line-height: 15px;
    color: var(--color-text-muted);
    background: var(--color-background);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xs);
}

.app-content > .flex-header.page-topbar { margin-bottom: 0; }

[id$="-drawer-root"] .drawer.drawer--company-edit { width: min(520px, 100%); }
.drawer--company-edit .form-group--spaced { margin-bottom: 16px; }
.drawer--company-edit .drawer-section {
    margin: 0 0 12px;
    padding: 11px 20px 16px;
    background: var(--color-surface);
    border: 1px solid var(--color-border-card);
    border-radius: var(--radius-xl);
    box-shadow: none;
}
.drawer--company-edit .drawer-section .drawer-section-sub { margin-bottom: 12px; }
.drawer--company-edit .drawer-section .form-row:last-child { margin-bottom: 0; }

.readonly-field {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    height: 36px;
    padding: 0 12px;
    font-size: var(--text-base);
    color: var(--color-text-muted);
    background: var(--color-background);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
}
.readonly-field-note { font-size: var(--text-2xs); color: var(--color-text-faint); white-space: nowrap; }

.input-icon { position: relative; }
.input-icon > svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    pointer-events: none;
}
[id$="-drawer-root"] .drawer--form .drawer-body .input-icon > input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=hidden]) { padding-left: 32px; }

.input-suffix { position: relative; }
.input-suffix > span {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--color-text-muted);
    pointer-events: none;
}
[id$="-drawer-root"] .drawer--form .drawer-body .input-suffix > input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=hidden]) { padding-right: 28px; -moz-appearance: textfield; appearance: textfield; }
.input-suffix > input::-webkit-outer-spin-button,
.input-suffix > input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* A peso amount: "$" before the number and "MXN" after it, drawn by CSS so
   the input still posts a plain number (no JS formats it while typing; the
   summary step shows it as $10,000.00). */
.input-money { position: relative; }
.input-money > span {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--color-text-muted);
    pointer-events: none;
}
.input-money > .input-money-prefix { left: 12px; }
.input-money > .input-money-suffix { right: 12px; font-size: var(--text-xs); }
[id$="-drawer-root"] .drawer--form .drawer-body .input-money > input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=hidden]) {
    padding-left: 26px;
    padding-right: 48px;
    -moz-appearance: textfield;
    appearance: textfield;
    font-variant-numeric: tabular-nums;
}
.input-money > input::-webkit-outer-spin-button,
.input-money > input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.field-info {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    margin-left: 4px;
    vertical-align: middle;
    font-size: 9px;
    font-weight: var(--font-bold);
    font-style: normal;
    line-height: 1;
    color: var(--color-primary);
    background: var(--color-primary-soft);
    border: 1px solid rgba(32, 195, 195, 0.4);
    border-radius: 9999px;
    cursor: help;
}
.field-info-tip {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 0;
    right: auto;
    z-index: 5;
    width: max-content;
    max-width: 240px;
    padding: 10px 12px;
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    line-height: 1.45;
    color: #FFFFFF;
    text-align: left;
    background: var(--color-text);
    border-radius: var(--radius-xl);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .12s ease;
}
.field-info:hover .field-info-tip,
.field-info:focus .field-info-tip { opacity: 1; visibility: visible; }

.order-arrows {
    display: inline-flex;
    flex-direction: column;
    gap: 2px;
}
.order-arrows .btn-icon {
    padding: 0;
    color: var(--color-text-muted);
}
.order-arrows .btn-icon:disabled {
    opacity: .3;
    cursor: default;
}

.form-row .form-group:not(:first-child) .field-info-tip,
.company-grid-2 > div:nth-child(even):not(.col-span-2) .field-info-tip {
    left: auto;
    right: 0;
}

.wizard-buttons--end { justify-content: flex-end; }
/* Cancelar on the left, the action on the right (Mi Empresa edit drawer). */
.wizard-buttons--split { justify-content: space-between; }
/* A field alone in its row (Antigüedad mínima elegible) keeps its label and
   info icon on one line; the empty column beside it gives the room. */
.drawer--company-edit .form-row > .form-group:only-child > label { white-space: nowrap; }
.drawer--company-edit .drawer-actions .btn-outline {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    color: #303642;
    font-weight: var(--font-medium);
}

.vacation-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--color-border-card);
    border-radius: var(--radius-lg);
}
.vacation-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.vacation-table th,
.vacation-table td {
    border-bottom: 1px solid #E5EAF0;
    border-right: 1px solid #E5EAF0;
    text-align: center;
    height: auto;
}
.vacation-table tr:last-child th,
.vacation-table tr:last-child td { border-bottom: none; }
.vacation-table th:last-child,
.vacation-table td:last-child { border-right: none; }
.vacation-table th {
    width: 78px;
    padding: 8px 12px;
    font-size: var(--text-2xs);
    font-weight: var(--font-semibold);
    color: var(--color-text-muted);
    text-align: center;
    text-transform: none;
    letter-spacing: normal;
    background: var(--color-background);
}
.vacation-table tr:last-child th { color: #303642; padding: 6px 12px; }
.vacation-table tr:first-child td {
    padding: 8px 0;
    font-size: var(--text-2xs);
    font-weight: var(--font-medium);
    color: var(--color-text-muted);
    background: var(--color-background);
}
.vacation-table tr:last-child td { padding: 6px 4px; }
[id$="-drawer-root"] .drawer--form .drawer-body .vacation-table input[type=number]:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=hidden]) {
    width: 100%;
    height: 24px;
    min-height: 0;
    padding: 0;
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    text-align: center;
    color: var(--color-text);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-xs);
    -moz-appearance: textfield;
    appearance: textfield;
}
[id$="-drawer-root"] .drawer--form .drawer-body .vacation-table input[type=number]:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=hidden]):focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px var(--color-primary-ring);
}
.vacation-table input::-webkit-outer-spin-button,
.vacation-table input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.drawer--company-edit .form-row { align-items: end; }
/* Reserve the postal error line so city/state keep their position when a
   lookup message appears. */
.drawer--company-edit .postal-lookup .postal-lookup-anchor {
    align-items: start;
}
.drawer--company-edit .postal-error-slot {
    display: block;
    min-height: 16px;
}

.finance-page { display: flex; flex-direction: column; gap: 16px; }
.finance-page > .stat-tiles { margin-bottom: 0; }
.stat-tiles--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .stat-tiles--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat-tile-icon--success { background: #ECFDF5; color: #22A06B; }
.stat-tile-icon--warning { background: #FFF8E6; color: #D97706; }
.stat-tile-icon--error   { background: #FEF2F2; color: #D64545; }
.stat-tile-body--grow { flex: 1 1 auto; }

.page-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--color-border);
}
.page-tabs .tab-btn {
    padding: 12px 16px;
    margin: 0 0 -1px;
    font-size: var(--text-base);
    font-weight: var(--font-medium);
    line-height: 20px;
    color: var(--color-text-muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    text-decoration: none;
    white-space: nowrap;
}
.page-tabs .tab-btn:hover { color: var(--color-text); text-decoration: none; }
.page-tabs .tab-btn.tab-btn--active { color: var(--color-primary); border-bottom-color: var(--color-primary); background: none; }

.finance-card { box-shadow: var(--shadow); }
.finance-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border-soft);
}
.finance-table--dense td { height: 48px; white-space: nowrap; }
.finance-table .finance-money { white-space: nowrap; font-variant-numeric: tabular-nums; }
.finance-table .finance-money--strong { font-weight: var(--font-semibold); }
.finance-link { color: var(--color-primary); font-weight: var(--font-medium); text-decoration: none; }
.finance-link:hover { color: var(--color-primary-strong); text-decoration: underline; }

.finance-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; flex-wrap: wrap; }
.finance-actions .btn { height: 36px; min-height: 36px; padding: 0 16px; border-radius: var(--radius-xl); font-size: var(--text-base); gap: 8px; white-space: nowrap; }
.finance-actions .btn-outline { background: var(--color-surface); border: 1px solid var(--color-border); color: #303642; font-weight: var(--font-medium); }

.finance-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px 32px;
    padding: 16px 20px 20px;
}
.finance-summary-item { min-width: 0; }
.finance-summary-value {
    margin: 4px 0 0;
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    line-height: 28px;
    color: var(--color-text);
}
.finance-summary-value span { font-size: var(--text-sm); font-weight: var(--font-normal); color: var(--color-text-muted); }
.finance-summary-value--sm { font-size: var(--text-base); font-weight: var(--font-semibold); line-height: 28px; }

.finance-upload-wrap { padding: 4px 20px 20px; }
.finance-upload { display: flex; flex-direction: column; gap: 12px; margin: 0; }
.finance-upload-zone {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 18px 20px;
    text-align: left;
    color: var(--color-text-muted);
    background: var(--color-background);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-xl);
    cursor: pointer;
    transition: border-color 120ms ease, background 120ms ease;
}
.finance-upload-zone:hover,
.finance-upload-zone:focus-within { border-color: var(--color-primary); background: var(--color-primary-soft); }
.finance-upload-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-lg);
    color: var(--color-primary-strong);
    background: var(--color-primary-soft);
}
.finance-upload-zone:hover .finance-upload-badge,
.finance-upload-zone:focus-within .finance-upload-badge { background: var(--color-surface); }
.finance-upload-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.finance-upload-title { font-size: var(--text-base); font-weight: var(--font-semibold); color: var(--color-text); }
.finance-upload-hint { font-size: var(--text-xs); color: var(--color-text-muted); }
.finance-upload-cta {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    height: 34px;
    padding: 0 16px;
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
}
.finance-upload-zone input[type=file] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}
.finance-upload-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.finance-upload-steps {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: upload-step;
    font-size: var(--text-sm);
    color: var(--color-text-muted);
}
.finance-upload-steps li {
    display: flex;
    align-items: center;
    gap: 7px;
    counter-increment: upload-step;
}
.finance-upload-steps li::before {
    content: counter(upload-step);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    font-size: var(--text-2xs);
    font-weight: var(--font-semibold);
    color: var(--color-text-muted);
    background: var(--color-border-soft);
    border-radius: 9999px;
}
.finance-upload-btn { opacity: 0.45; pointer-events: none; }
.finance-upload:has(input[type=file]:valid) .finance-upload-btn { opacity: 1; pointer-events: auto; }
.finance-upload:has(input[type=file]:valid) .finance-upload-zone { border-style: solid; border-color: var(--color-primary); background: var(--color-primary-soft); }
.finance-upload:has(input[type=file]:valid) .finance-upload-cta { color: var(--color-primary-strong); border-color: var(--color-primary); }

.finance-progress {
    display: block;
    width: 100%;
    height: 6px;
    margin-top: 6px;
    border: none;
    border-radius: 9999px;
    overflow: hidden;
    background: var(--color-border-soft);
    appearance: none;
    -webkit-appearance: none;
}
.finance-progress::-webkit-progress-bar { background: var(--color-border-soft); border-radius: 9999px; }
.finance-progress::-webkit-progress-value { background: var(--color-primary); border-radius: 9999px; }
.finance-progress::-moz-progress-bar { background: var(--color-primary); border-radius: 9999px; }

.dash-badge--paid,
.dash-badge--applied { background: #ECFDF5; color: #22A06B; }
.dash-badge--partial { background: #EEF2FF; color: #6366F1; }
.dash-badge--overdue,
.dash-badge--late,
.dash-badge--reversed { background: #FEF2F2; color: #D64545; }
.dash-badge--due-overdue { background: var(--color-error-soft); color: var(--color-error); }
.dash-badge--due-soon { background: var(--color-warning-soft); color: #D97706; }
.dash-badge--due-scheduled { background: var(--color-border-soft); color: var(--color-text-muted); }

/* Descuentos de nomina: one collapsible block per employee, so a payroll run
   with several people reads as a list of people instead of a wall of rows. */
.payroll-card .finance-card-head { flex-wrap: wrap; gap: 12px; }
.payroll-totals { display: flex; align-items: center; gap: 22px; margin-left: auto; }
.payroll-total { display: flex; flex-direction: column; gap: 2px; text-align: right; }
.payroll-total-label {
    font-size: var(--text-2xs);
    font-weight: var(--font-semibold);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-text-faint);
}
.payroll-total-value { font-size: var(--text-lg); font-weight: var(--font-semibold); color: var(--color-text); font-variant-numeric: tabular-nums; }
.payroll-total--amount .payroll-total-value { color: var(--color-primary-strong); }

.payroll-warning {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 20px 4px;
    padding: 9px 12px;
    font-size: var(--text-sm);
    color: var(--color-error);
    background: var(--color-error-soft);
    border-radius: var(--radius-lg);
}

.payroll-groups { display: flex; flex-direction: column; gap: 10px; padding: 12px 20px 20px; }
.payroll-group {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    background: var(--color-surface);
    overflow: hidden;
}
.payroll-group--alert { border-color: #F3C9C9; }
.payroll-group[open] { box-shadow: var(--shadow); }
.payroll-group-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    cursor: pointer;
    list-style: none;
    background: var(--color-surface-muted);
}
.payroll-group-head::-webkit-details-marker { display: none; }
.payroll-group-head:hover { background: var(--color-primary-soft); }
.payroll-group[open] .payroll-group-head { background: var(--color-surface); border-bottom: 1px solid var(--color-border-soft); }
.payroll-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 9999px;
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--color-primary-strong);
    background: var(--color-primary-soft);
}
.payroll-identity { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1 1 180px; }
.payroll-name {
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    color: var(--color-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.payroll-ref { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--color-text-muted); }
.payroll-meta { display: flex; align-items: center; justify-content: flex-end; gap: 6px; min-width: 150px; font-size: var(--text-sm); color: var(--color-text-muted); white-space: nowrap; }
.payroll-meta-sep { color: var(--color-text-faint); }
.payroll-next { display: flex; flex-direction: column; gap: 1px; min-width: 180px; text-align: right; white-space: nowrap; }
.payroll-flag { display: flex; justify-content: flex-end; min-width: 104px; }
.payroll-next-label {
    font-size: var(--text-2xs);
    font-weight: var(--font-semibold);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-text-faint);
}
.payroll-next-value { font-size: var(--text-sm); color: var(--color-text); font-variant-numeric: tabular-nums; }
.payroll-amount {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    color: var(--color-text);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    min-width: 110px;
    text-align: right;
}
.payroll-chevron { display: inline-flex; color: var(--color-text-faint); transition: transform 150ms ease; }
.payroll-group[open] .payroll-chevron { transform: rotate(180deg); }
.payroll-group-body .finance-table { margin: 0; }
.payroll-group-body tfoot td {
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--color-text);
    background: var(--color-surface-muted);
    border-top: 1px solid var(--color-border-soft);
    text-align: left;
}
.payroll-group-body tfoot td.text-center { text-align: center; }
.payroll-group-body .dash-badge { min-width: 104px; justify-content: center; }
.payroll-relative { color: var(--color-text-faint); }

/* Panel de resultado de la importacion de descuentos: va justo debajo de la
   zona de carga, donde el operador acaba de soltar el archivo. */
.import-result-slot:empty { display: none; }
.import-result {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    margin-top: 12px;
    padding: 14px 16px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    background: var(--color-surface);
}
.import-result--ok { border-color: #BFE7D5; background: var(--color-success-soft); }
.import-result--partial { border-color: #F6DCA6; background: var(--color-warning-soft); }
.import-result--error { border-color: #F3C9C9; background: var(--color-error-soft); }
.import-result-icon { display: inline-flex; flex-shrink: 0; margin-top: 1px; }
.import-result--ok .import-result-icon { color: var(--color-success); }
.import-result--partial .import-result-icon { color: #D97706; }
.import-result--error .import-result-icon { color: var(--color-error); }
.import-result-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; }
.import-result-title { margin: 0; font-size: var(--text-base); font-weight: var(--font-semibold); color: var(--color-text); }
.import-result-text { margin: 0; font-size: var(--text-sm); color: var(--color-text-muted); }
.import-result-columns { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 0; }
.import-result-columns span {
    padding: 3px 8px;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
}
.import-result-table {
    margin-top: 6px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.import-result-table .table { margin: 0; }
.import-result-table th,
.import-result-table td { white-space: normal; }
.import-result-table td:last-child { width: 55%; color: var(--color-text); }

@media (max-width: 1000px) {
    .payroll-group-head { flex-wrap: wrap; }
    .payroll-identity { flex-basis: 100%; order: -1; }
    .payroll-next { text-align: left; }
    .payroll-amount { margin-left: auto; }
    .payroll-totals { gap: 16px; }
}

.detail-back {
    display: inline-flex;
    margin-bottom: 4px;
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--color-primary);
    text-decoration: none;
}
.detail-back:hover { color: var(--color-primary-strong); }

.users-page { display: flex; flex-direction: column; gap: 16px; }

.metric-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 1100px) { .metric-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.metric-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 132px;
    padding: 24px;
    background: var(--color-surface);
    border: 1px solid var(--color-border-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
}
.metric-card-label { margin: 0; font-size: var(--text-sm); font-weight: var(--font-medium); line-height: 16px; color: var(--color-text-muted); }
.metric-card-value { margin: 0; font-size: var(--text-3xl); font-weight: var(--font-bold); line-height: 32px; color: var(--color-text); }
.metric-card-value--success { color: #22A06B; }
.metric-card-value--violet  { color: #7C3AED; }
.metric-card-value--blue    { color: #1D4ED8; }

.users-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 24px;
    background: var(--color-surface);
    border: 1px solid var(--color-border-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
}
.users-search { position: relative; flex: 1 1 auto; min-width: 0; }
.users-search > svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--color-text-muted); pointer-events: none; }
.users-toolbar .users-search input {
    width: 100%;
    height: 40px;
    min-height: 40px;
    margin: 0;
    padding: 4px 12px 4px 40px;
    font-size: var(--text-base);
    background: var(--color-field);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    box-shadow: none;
}
.users-toolbar select {
    width: 176px;
    height: 36px;
    min-height: 36px;
    margin: 0;
    padding: 0 12px;
    font-size: var(--text-base);
    background-color: var(--color-field);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
}
.users-toolbar .users-search input:focus,
.users-toolbar select:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-ring); }
.users-toolbar .btn {
    height: 40px;
    min-height: 40px;
    padding: 0 20px;
    border-radius: var(--radius-xl);
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    gap: 8px;
    white-space: nowrap;
    flex-shrink: 0;
}

.users-card { box-shadow: var(--shadow); }
.users-table th {
    height: 40px;
    padding: 0 8px;
    font-size: var(--text-base);
    font-weight: var(--font-medium) !important;
    color: var(--color-text);
    text-transform: none;
    letter-spacing: normal;
    background: none;
    border-bottom: 1px solid var(--color-border);
}
.users-table td { height: 57px; padding: 8px; vertical-align: middle; border-bottom: 1px solid var(--color-border); }
.users-table th:first-child, .users-table td:first-child { padding-left: 20px; }
.users-table th:last-child, .users-table td:last-child { padding-right: 20px; }
.users-table tbody tr:last-child td { border-bottom: none; }
.users-table tbody tr:hover { background: var(--color-background); }

.user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 9999px;
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    background: var(--color-primary-soft);
    color: var(--color-primary-strong);
}
.user-cell-text { min-width: 0; }
.user-cell-name { margin: 0; font-size: var(--text-base); font-weight: var(--font-medium); line-height: 20px; color: var(--color-text); }
.user-cell-email { margin: 0; font-size: var(--text-sm); line-height: 16px; color: var(--color-text-muted); }

.role-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    line-height: 16px;
    white-space: nowrap;
    background: #F3F4F6;
    color: #374151;
}
.role-pill--admin      { background: #EDE9FE; color: #7C3AED; }
.role-pill--analyst    { background: #DCFCE7; color: #15803D; }
.role-pill--supervisor { background: #DBEAFE; color: #1D4ED8; }

.status-toggle-form { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
.status-switch {
    position: relative;
    width: 32px;
    height: 18px;
    min-height: 0;
    padding: 0;
    border: none;
    border-radius: 9999px;
    background: #CBD5E1;
    cursor: pointer;
    transition: background-color .15s ease;
}
.status-switch.is-on { background: var(--color-primary); }
.status-switch:disabled { opacity: .5; cursor: default; }
.status-switch-thumb {
    position: absolute;
    top: 1px;
    left: 1px;
    width: 16px;
    height: 16px;
    border-radius: 9999px;
    background: #FFFFFF;
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.2);
    transition: transform .15s ease;
}
.status-switch.is-on .status-switch-thumb { transform: translateX(14px); }
.status-switch-label { font-size: var(--text-sm); color: var(--color-text-muted); }

.users-table .btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--color-text-muted);
}
.users-table .btn-icon:hover { background: var(--color-background); color: var(--color-text); }
.users-footer { padding: 12px 20px; border-top: 1px solid var(--color-border-soft); }
.users-footer:not(:has(.pagination)) { display: none; }
.users-footer .pagination { margin: 0; padding: 0; border: none; }

[id$="-drawer-root"] .drawer.drawer--user { width: min(440px, 100%); }
[id$="-drawer-root"] .drawer--user .drawer-header { padding: 28px 28px 20px; }
[id$="-drawer-root"] .drawer--user .drawer-header h2 { font-size: var(--text-2xl); line-height: 28px; }
[id$="-drawer-root"] .drawer--user .drawer-subtitle { margin-top: 4px; font-size: var(--text-base); line-height: 1.4; }
[id$="-drawer-root"] .drawer--user .drawer-body { padding: 24px 28px 20px; }
.drawer--user .user-form { display: flex; flex-direction: column; gap: 20px; margin: 0; }
.drawer--user .user-form .form-row { margin: 0; }
.drawer--user .user-form .form-group > label {
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    line-height: 20px;
    color: var(--color-text);
}
.drawer--user .user-form .form-group { gap: 6px; }
[id$="-drawer-root"] .drawer--form.drawer--user .drawer-body input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=hidden]),
[id$="-drawer-root"] .drawer--form.drawer--user .drawer-body select {
    height: 44px;
    min-height: 44px;
    background: var(--color-background);
    border-color: transparent;
}
.drawer--user .form-hint { margin: -12px 0 0; }

.switch-field { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; }
.switch-field input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.switch-track {
    position: relative;
    width: 32px;
    height: 18px;
    border-radius: 9999px;
    background: #CBD5E1;
    transition: background-color .15s ease;
    flex-shrink: 0;
}
.switch-thumb {
    position: absolute;
    top: 1px;
    left: 1px;
    width: 16px;
    height: 16px;
    border-radius: 9999px;
    background: #FFFFFF;
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.2);
    transition: transform .15s ease;
}
.switch-field input:checked + .switch-track { background: var(--color-primary); }
.switch-field input:checked + .switch-track .switch-thumb { transform: translateX(14px); }
.switch-field input:focus-visible + .switch-track { box-shadow: 0 0 0 3px var(--color-primary-ring); }
.switch-text { font-size: var(--text-base); font-weight: var(--font-semibold); color: var(--color-text); }

.invite-note {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    background: #EFF6FF;
    border: 1px solid #BFDBFE;
    border-radius: var(--radius-xl);
}
.invite-note-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    margin-top: 2px;
    border-radius: 9999px;
    background: #3B82F6;
    color: #FFFFFF;
}
.invite-note p { margin: 0; font-size: var(--text-base); line-height: 1.4; color: #1E40AF; }

.user-form-footer {
    position: sticky;
    bottom: -20px;
    z-index: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 4px -28px -20px;
    padding: 20px 28px;
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
}
.user-form-footer .btn {
    height: 44px;
    min-height: 44px;
    border-radius: var(--radius-xl);
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    justify-content: center;
}
.user-form-footer .btn-outline { background: var(--color-surface); border: 1px solid var(--color-border); color: #303642; }
[id$="-drawer-root"] .drawer--user .drawer-body { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.drawer--user #user-form-container { display: flex; flex-direction: column; flex: 1 0 auto; }
.drawer--user .user-form { flex: 1 0 auto; }
.drawer--user .user-form-footer { margin-top: auto; }

.geo-page { display: flex; flex-direction: column; gap: 16px; }
.geo-top-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .geo-top-grid { grid-template-columns: minmax(0, 1fr); } }

.geo-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 24px;
    background: var(--color-surface);
    border: 1px solid var(--color-border-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    min-width: 0;
}
.geo-card--flush { padding: 0; gap: 0; overflow: hidden; }
.geo-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 24px; border-bottom: 1px solid var(--color-border-soft); }
.geo-card-title { margin: 0; font-size: var(--text-base); font-weight: var(--font-semibold); line-height: 20px; color: var(--color-text); }
.geo-card-sub { margin: -12px 0 0; font-size: var(--text-sm); line-height: 16px; color: var(--color-text-muted); }
.geo-card-sub--pad { margin: 0; padding: 20px 24px; }
.geo-count { font-size: var(--text-sm); color: var(--color-text-muted); }

.geo-current { display: flex; align-items: flex-start; gap: 16px; }
.geo-icon-tile {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-xl);
    background: var(--color-primary-soft);
    color: var(--color-primary);
}
.geo-icon-tile--sm { flex-basis: 32px; width: 32px; height: 32px; border-radius: 10px; }

.geo-kv { flex: 1; min-width: 0; margin: 0; }
.geo-kv-row { display: grid; grid-template-columns: 176px minmax(0, 1fr); align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--color-border-soft); }
.geo-kv-row:last-child { border-bottom: none; }
.geo-kv dt { margin: 0; font-size: var(--text-xs); font-weight: var(--font-normal); color: var(--color-text-muted); }
.geo-kv dd { margin: 0; font-size: var(--text-xs); font-weight: var(--font-medium); color: var(--color-text); overflow-wrap: anywhere; }
.geo-kv--sm .geo-kv-row { grid-template-columns: 144px minmax(0, 1fr); padding: 8px 0; }
.geo-kv--sm .geo-kv-row:last-child { border-bottom: 1px solid var(--color-border-soft); }

.geo-pill { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; font-size: var(--text-xs); font-weight: var(--font-medium); line-height: 16px; }
.geo-pill--ok { background: #ECFDF5; color: #22A06B; }
.geo-pill--empty { background: var(--color-gray-100); color: var(--color-text-muted); }

.geo-upload { display: flex; flex-direction: column; gap: 16px; margin: 0; }
label.geo-dropzone {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 146px;
    margin: 0;
    padding: 24px;
    background: var(--color-surface-muted);
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-xl);
    text-align: center;
    cursor: pointer;
    transition: border-color .15s ease, background-color .15s ease;
}
label.geo-dropzone:hover,
label.geo-dropzone:focus-within { border-color: var(--color-primary); background: var(--color-primary-soft); }
.geo-dropzone:has(.geo-file-input:valid) { border-style: solid; border-color: var(--color-primary); background: var(--color-primary-soft); }
.geo-file-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.geo-dropzone-icon { display: inline-flex; margin-bottom: 4px; color: var(--color-text-faint); }
.geo-dropzone:has(.geo-file-input:valid) .geo-dropzone-icon { color: var(--color-primary); }
.geo-dropzone-title { font-size: var(--text-base); font-weight: var(--font-medium); line-height: 20px; color: var(--color-primary); }
.geo-dropzone-hint { font-size: var(--text-xs); line-height: 16px; color: var(--color-text-muted); }
.geo-dropzone-format { font-size: var(--text-2xs); line-height: 14px; color: var(--color-text-faint); }
.geo-dropzone-ready { display: none; }
.geo-dropzone:has(.geo-file-input:valid) .geo-dropzone-idle { display: none; }
.geo-dropzone:has(.geo-file-input:valid) .geo-dropzone-ready { display: inline; }

.geo-submit.btn { width: 100%; min-height: 36px; border-radius: var(--radius-xl); font-size: var(--text-base); font-weight: var(--font-medium); }
.geo-upload:not(:has(.geo-file-input:valid)) .geo-submit.btn { background: var(--color-border); color: var(--color-text-muted); cursor: not-allowed; }

.geo-info-note { display: flex; align-items: flex-start; gap: 8px; padding: 12px; background: #EFF6FF; border: 1px solid #BFDBFE; border-radius: var(--radius-sm); color: #1D4ED8; }
.geo-info-note svg { flex: 0 0 16px; margin-top: 1px; }
.geo-info-note p { margin: 0; font-size: var(--text-xs); line-height: 16px; color: #1E40AF; }
.geo-alert-container:empty { display: none; }
.geo-alert-container .alert { margin: 0; }

.geo-search { display: flex; align-items: center; gap: 12px; margin: 0; }
label.geo-search-field { position: relative; display: flex; align-items: center; flex: 0 1 360px; margin: 0; color: var(--color-text-faint); }
label.geo-search-field svg { position: absolute; left: 12px; pointer-events: none; }
input[type="text"].geo-search-input { width: 100%; height: 40px; min-height: 40px; padding: 0 12px 0 36px; background: var(--color-field); border-radius: var(--radius-sm); font-size: var(--text-base); }
.geo-search-btn.btn { min-height: 40px; padding: 0 20px; border-radius: var(--radius-xl); font-weight: var(--font-medium); }

.geo-result { border: 1px solid var(--color-border); border-radius: var(--radius-xl); padding: 20px; }
.geo-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 180px; text-align: center; }
.geo-empty-icon { display: inline-flex; align-items: center; justify-content: center; width: 56px; height: 56px; margin-bottom: 8px; border-radius: 50%; background: var(--color-gray-100); color: var(--color-text-faint); }
.geo-empty-title { margin: 0; font-size: var(--text-base); font-weight: var(--font-semibold); line-height: 20px; color: var(--color-text); }
.geo-empty-sub { margin: 0; font-size: var(--text-xs); line-height: 16px; color: var(--color-text-muted); }

.geo-result-head { display: flex; align-items: center; gap: 12px; padding-bottom: 16px; margin-bottom: 8px; border-bottom: 1px solid var(--color-border-soft); }
.geo-result-title { margin: 0; font-size: var(--text-base); font-weight: var(--font-semibold); line-height: 20px; color: var(--color-text); }
.geo-result-meta { margin: 2px 0 0; font-size: var(--text-2xs); letter-spacing: .04em; text-transform: uppercase; color: var(--color-text-muted); }
.geo-result-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 32px; }
@media (max-width: 900px) { .geo-result-grid { grid-template-columns: minmax(0, 1fr); } }

.geo-colonies { margin-top: 16px; }
.geo-colonies-label { margin: 0 0 8px; font-size: var(--text-xs); font-weight: var(--font-medium); color: var(--color-text-muted); }
.geo-colony-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.geo-colony { padding: 4px 10px; background: var(--color-surface-muted); border: 1px solid var(--color-border-soft); border-radius: 999px; font-size: var(--text-xs); line-height: 16px; color: var(--color-text); }
.geo-colony-muni { color: var(--color-text-muted); }

.geo-states-scroll { max-height: 420px; overflow-y: auto; }
.geo-states-table { width: 100%; margin: 0; border-collapse: collapse; }
.geo-states-table thead th { position: sticky; top: 0; z-index: 1; padding: 12px 24px; background: var(--color-surface-muted); border-bottom: 1px solid var(--color-border-soft); font-size: var(--text-xs); font-weight: var(--font-medium); color: var(--color-text-muted); text-align: center; }
.geo-states-table tbody td { padding: 12px 24px; border-bottom: 1px solid var(--color-border-soft); font-size: var(--text-sm); color: var(--color-text); text-align: center; }
.geo-states-table tbody tr:last-child td { border-bottom: none; }
.geo-states-table tbody tr:hover td { background: var(--color-surface-muted); }
.geo-states-table th:first-child,
.geo-states-table td:first-child { width: 80px; color: var(--color-text-muted); }
.geo-code { display: inline-flex; padding: 2px 8px; border-radius: 6px; background: var(--color-primary-soft); color: var(--color-primary-strong); font-size: var(--text-xs); font-weight: var(--font-medium); }

.pagination-links a,
.pagination-links span,
.pagination-links button {
    width: auto;
    min-width: 28px;
    padding: 0 8px;
    white-space: nowrap;
    line-height: 1;
}
.users-footer .pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.users-footer .pagination-info { font-size: var(--text-xs); }
.users-footer .pagination-links { gap: 4px; }
.users-footer .pagination-links a,
.users-footer .pagination-links span { height: 28px; border-radius: var(--radius-lg); font-weight: var(--font-medium); }

.app-content > .page-topbar,
.app-content > .flex-header {
    position: sticky;
    top: 0;
    z-index: 15;
    flex-shrink: 0;
}

.auth-shell--login { max-width: 448px; }
.auth-shell--login .auth-header { margin-bottom: 24px; }
.auth-shell--login .auth-brand { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 12px; }
.auth-brand-word { font-size: 24px; font-weight: var(--font-bold); line-height: 32px; letter-spacing: -0.02em; color: var(--color-text); }
.auth-shell--login .auth-header h1 { margin: 0 0 2px; font-size: 20px; font-weight: var(--font-bold); line-height: 28px; color: var(--color-text); }
.auth-shell--login .auth-header p { margin: 0; font-size: var(--text-base); line-height: 20px; color: var(--color-text-muted); }

.auth-restricted { display: flex; justify-content: center; margin-bottom: 24px; }
.auth-restricted-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 9999px;
    background: var(--color-text);
    color: #FFFFFF;
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    line-height: 16px;
}

.auth-shell--login .auth-card-wrapper { max-width: 448px; }
.auth-card.auth-card--login {
    padding: 32px;
    border: 1px solid var(--color-border);
    border-radius: 16px;
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
}
.auth-card--login .auth-login-form { display: flex; flex-direction: column; gap: 20px; margin: 0; }
.auth-card--login .form-group { display: flex; flex-direction: column; gap: 8px; margin: 0; }
.auth-card--login label { margin: 0; font-size: var(--text-base); font-weight: var(--font-medium); line-height: 20px; color: #303642; }
.auth-card--login input[type="email"],
.auth-card--login input[type="password"] {
    height: 48px;
    min-height: 48px;
    padding: 4px 12px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 14px;
    font-size: 16px;
    color: #303642;
}
.auth-card--login input::placeholder { color: var(--color-text-muted); }
.auth-card--login input[type="email"]:focus,
.auth-card--login input[type="password"]:focus { border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-ring); }
.auth-card--login .auth-submit.btn {
    width: 100%;
    height: 52px;
    min-height: 52px;
    padding: 14px 0;
    border-radius: 14px;
    background: var(--color-primary);
    color: #FFFFFF;
    font-size: 16px;
    font-weight: var(--font-semibold);
}
.auth-card--login .auth-submit.btn:hover { background: var(--color-primary-hover); }
.auth-card--login .auth-options { margin: 0; padding-top: 20px; border-top: 1px solid var(--color-border); }
.auth-card--login .auth-remember { font-size: var(--text-sm); color: var(--color-text-muted); }
.auth-card--login .auth-link { font-size: var(--text-sm); font-weight: var(--font-medium); color: var(--color-primary-strong); }
.auth-shell--login .auth-footnote { margin-top: 24px; font-size: var(--text-sm); line-height: 16px; color: var(--color-text-muted); }
.auth-card--login .auth-login-form > * + * { margin-top: 0; }
.auth-card--login .auth-remember { display: inline-flex; align-items: center; gap: 8px; line-height: 16px; }
.auth-card--login .auth-remember input[type="checkbox"] { margin: 0; flex-shrink: 0; }

.emoji-picker-list {
    margin-top: 8px;
    padding: 10px;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    max-height: 160px;
    overflow-y: auto;
}
.emoji-picker-option {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    line-height: 1;
    padding: 6px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--duration-default) var(--ease-default), box-shadow var(--duration-default) var(--ease-default);
}
.emoji-picker-option:hover {
    background: var(--color-surface-hover, #F1F5F9);
}
.emoji-picker-option:has(input:checked) {
    background: var(--color-primary-ring);
    box-shadow: inset 0 0 0 2px var(--color-primary);
}
.emoji-picker-option:has(input:focus-visible) {
    outline: 2px solid var(--color-primary);
    outline-offset: 1px;
}

/* The icon field shows the checked emoji (radios + :has(), no JS): the
   overlay covers the text input while an emoji is checked; clicking it
   checks the "own icon" radio, which uncovers the input to type into. The
   option at position N lights the preview span at position N (pickers hold
   up to 32 emojis). */
.emoji-input { position: relative; }
.emoji-input > input { width: 100%; }
.emoji-preview {
    display: none;
    position: absolute;
    inset: 0;
    align-items: center;
    padding: 0 var(--space-3);
    background-color: var(--color-field);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 18px;
    line-height: 1;
    cursor: text;
}
.emoji-preview > span { display: none; }
.emoji-field:has(.emoji-picker-option input:checked) .emoji-preview { display: flex; }
.emoji-field:has(.emoji-picker-option:nth-child(1) input:checked) .emoji-preview > span:nth-child(1),
.emoji-field:has(.emoji-picker-option:nth-child(2) input:checked) .emoji-preview > span:nth-child(2),
.emoji-field:has(.emoji-picker-option:nth-child(3) input:checked) .emoji-preview > span:nth-child(3),
.emoji-field:has(.emoji-picker-option:nth-child(4) input:checked) .emoji-preview > span:nth-child(4),
.emoji-field:has(.emoji-picker-option:nth-child(5) input:checked) .emoji-preview > span:nth-child(5),
.emoji-field:has(.emoji-picker-option:nth-child(6) input:checked) .emoji-preview > span:nth-child(6),
.emoji-field:has(.emoji-picker-option:nth-child(7) input:checked) .emoji-preview > span:nth-child(7),
.emoji-field:has(.emoji-picker-option:nth-child(8) input:checked) .emoji-preview > span:nth-child(8),
.emoji-field:has(.emoji-picker-option:nth-child(9) input:checked) .emoji-preview > span:nth-child(9),
.emoji-field:has(.emoji-picker-option:nth-child(10) input:checked) .emoji-preview > span:nth-child(10),
.emoji-field:has(.emoji-picker-option:nth-child(11) input:checked) .emoji-preview > span:nth-child(11),
.emoji-field:has(.emoji-picker-option:nth-child(12) input:checked) .emoji-preview > span:nth-child(12),
.emoji-field:has(.emoji-picker-option:nth-child(13) input:checked) .emoji-preview > span:nth-child(13),
.emoji-field:has(.emoji-picker-option:nth-child(14) input:checked) .emoji-preview > span:nth-child(14),
.emoji-field:has(.emoji-picker-option:nth-child(15) input:checked) .emoji-preview > span:nth-child(15),
.emoji-field:has(.emoji-picker-option:nth-child(16) input:checked) .emoji-preview > span:nth-child(16),
.emoji-field:has(.emoji-picker-option:nth-child(17) input:checked) .emoji-preview > span:nth-child(17),
.emoji-field:has(.emoji-picker-option:nth-child(18) input:checked) .emoji-preview > span:nth-child(18),
.emoji-field:has(.emoji-picker-option:nth-child(19) input:checked) .emoji-preview > span:nth-child(19),
.emoji-field:has(.emoji-picker-option:nth-child(20) input:checked) .emoji-preview > span:nth-child(20),
.emoji-field:has(.emoji-picker-option:nth-child(21) input:checked) .emoji-preview > span:nth-child(21),
.emoji-field:has(.emoji-picker-option:nth-child(22) input:checked) .emoji-preview > span:nth-child(22),
.emoji-field:has(.emoji-picker-option:nth-child(23) input:checked) .emoji-preview > span:nth-child(23),
.emoji-field:has(.emoji-picker-option:nth-child(24) input:checked) .emoji-preview > span:nth-child(24),
.emoji-field:has(.emoji-picker-option:nth-child(25) input:checked) .emoji-preview > span:nth-child(25),
.emoji-field:has(.emoji-picker-option:nth-child(26) input:checked) .emoji-preview > span:nth-child(26),
.emoji-field:has(.emoji-picker-option:nth-child(27) input:checked) .emoji-preview > span:nth-child(27),
.emoji-field:has(.emoji-picker-option:nth-child(28) input:checked) .emoji-preview > span:nth-child(28),
.emoji-field:has(.emoji-picker-option:nth-child(29) input:checked) .emoji-preview > span:nth-child(29),
.emoji-field:has(.emoji-picker-option:nth-child(30) input:checked) .emoji-preview > span:nth-child(30),
.emoji-field:has(.emoji-picker-option:nth-child(31) input:checked) .emoji-preview > span:nth-child(31),
.emoji-field:has(.emoji-picker-option:nth-child(32) input:checked) .emoji-preview > span:nth-child(32) { display: inline; }

/* Sidebar collapse (desktop): shrinks the sidebar to icon-only width and
   hides labels/section headers. Nav item labels are bare text nodes next
   to their icon SVG (not wrapped in a span), so font-size:0 collapses just
   the text — the SVG's width/height attributes are unaffected since they
   aren't em-based. */
body.sidebar-is-collapsed .app-sidebar {
    width: 76px;
}
body.sidebar-is-collapsed .sidebar-item {
    font-size: 0;
    justify-content: center;
    gap: 0;
}
body.sidebar-is-collapsed .sidebar-icon {
    margin: 0;
}
body.sidebar-is-collapsed .brand-word,
body.sidebar-is-collapsed .user-info,
body.sidebar-is-collapsed .sidebar-section-label,
body.sidebar-is-collapsed .sidebar-version,
body.sidebar-is-collapsed .sidebar-collapse-label {
    display: none;
}
body.sidebar-is-collapsed .sidebar-user-profile {
    justify-content: center;
}
body.sidebar-is-collapsed .sidebar-logout {
    font-size: 0;
    justify-content: center;
    gap: 0;
}
body.sidebar-is-collapsed .sidebar-collapse-toggle {
    justify-content: center;
}
body.sidebar-is-collapsed .sidebar-collapse-icon {
    transform: rotate(180deg);
}

/* Custom dropdown arrow with breathing room from the border — the native
   browser arrow sits flush against the edge and looks cramped. Several
   filter-select variants (.filter-select, .role-select, .campaign-filter)
   set `background` as a shorthand, which resets any background-image
   added only to the bare `select` rule, so this is applied directly to
   each one (and !important, since it's appended after all of them and
   some load in a different order) rather than chasing every duplicate
   block individually. */
select,
.filter-select,
.role-select,
.campaign-filter {
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    padding-right: 2.25rem !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 0.75rem center !important;
    background-size: 16px !important;
}

/* --- Catálogo geográfico (#196) --------------------------------------------
   Piezas del CRUD de la familia que este repositorio todavía no tenía. Los
   valores usan los tokens de aquí, no los del repo de origen; lo que ya
   existía (.tab-btn, .badge, .filter-bar, .alert, .drawer) no se toca. */
.form-control {
    /* Inputs y selects ya llevan el estilo de campo global; el modificador
       garantiza el ancho completo en el resto de contextos. */
    width: 100%;
}

.filter-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex: 1;
}

.filter-row label {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    white-space: nowrap;
}

.filter-row select.form-control {
    flex: 1;
    max-width: 520px;
}

.tab-container {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    border-bottom: 1px solid var(--color-border);
    margin-bottom: var(--space-4);
}

.button-row {
    display: flex;
    gap: var(--space-2);
    align-items: center;
}

.button-row > form {
    flex: 1;
}

.badge-danger {
    background-color: var(--color-error-soft);
    color: var(--color-error);
}

/* Misma especificidad que la regla base del panel: el modificador es de una
   clase y perdería frente a [id$="-drawer-root"] .drawer. */
[id$="-drawer-root"] .drawer--wide {
    width: min(640px, 94vw);
}
/* Auth layout background (moved from the <style> block in auth_layout.html) */
body.auth-bg {
    background-color: #F7FDFD;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    margin: 0;
    padding: 1rem;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    position: relative;
    /* "Crear cuenta" is taller than a laptop screen: the page scrolls down,
       only the decorative circles stay clipped at the sides. */
    overflow-x: hidden;
    overflow-y: auto;
}
body.auth-bg::before,
body.auth-bg::after {
    content: "";
    position: absolute;
    width: 380px;
    height: 380px;
    border-radius: 50%;
    border: 28px solid #E1F6F6;
    z-index: 0;
}
body.auth-bg::before { top: -140px; left: -160px; }
body.auth-bg::after { bottom: -160px; right: -160px; }
.auth-bg .auth-content { position: relative; z-index: 1; }

/* Login and register pages (moved from inline styles). Selectors carry two
   classes so the global input/button/label/a rules can't override them. */
.auth-header .login-title { color: #0F172A; font-size: 24px; font-weight: 700; margin: 0 0 8px 0; letter-spacing: -0.5px; }
.auth-header .login-subtitle { color: #64748B; font-size: 15px; margin: 0; }
.auth-shell .login-footnote { margin-top: 24px; display: flex; align-items: center; justify-content: center; gap: 8px; color: #94A3B8; font-size: 13px; }

.card.login-card {
    background: white;
    border-radius: 20px;
    padding: 36px 32px;
    box-shadow: 0 20px 40px -12px rgba(15, 23, 42, 0.12), 0 4px 12px rgba(15, 23, 42, 0.04);
}
.login-card .login-alert { margin-bottom: 16px; padding: 12px; background: #FEF2F2; color: #DC2626; border-radius: 8px; font-size: 14px; }
/* "Tu sesión expiró" is a notice, not an error: the info colors. */
.login-card .login-alert.alert-info { background: var(--color-info-soft); color: var(--color-info); }
.login-card .login-field { margin-bottom: 20px; }
.login-card .login-field--password { margin-bottom: 16px; }
.login-card .login-label { display: block; font-size: 14px; font-weight: 600; color: #475569; margin-bottom: 8px; }
.login-card .login-input-wrap { position: relative; }
.login-card .login-input-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: #94A3B8; display: flex; }
.login-card input.login-input {
    width: 100%;
    padding: 12px 16px 12px 44px;
    border: 1px solid #E2E8F0;
    border-radius: 10px;
    outline: none;
    font-size: 15px;
    color: #334155;
    background: #F8FAFC;
    transition: border-color 0.2s;
    box-sizing: border-box;
}
.login-card input.login-input--password { padding: 12px 44px; }
.login-card input.login-input:focus { border-color: #0B9FA5; background: white; }
.login-card .login-password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #64748B;
    padding: 4px;
    display: flex;
    min-height: 0;
    border-radius: var(--radius-sm);
}
/* The eye is an icon: no button fill, ring or press scale. */
.login-card .login-password-toggle:hover,
.login-card .login-password-toggle:focus,
.login-card .login-password-toggle:active {
    background: none;
    box-shadow: none;
    transform: translateY(-50%);
    color: #334155;
}
.login-card .login-password-toggle:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.login-card .login-options { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.login-card .login-remember { display: flex; align-items: center; gap: 8px; font-size: 14px; color: #475569; cursor: pointer; user-select: none; }
.login-card .login-checkbox { width: 16px; height: 16px; accent-color: #0B9FA5; cursor: pointer; }
.login-card .login-link,
.login-card .login-link:hover { font-size: 14px; color: #0B9FA5; text-decoration: none; font-weight: 600; }
.login-card .login-submit {
    width: 100%;
    padding: 14px;
    background: #0B9FA5;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.login-card .login-submit:hover { background: #20C3C3; }

/* Misc backoffice blocks (moved from inline styles) */
.drawer.role-drawer,
.role-drawer #role-form-container { display: flex; flex-direction: column; }
.role-drawer #role-form-container { height: 100%; min-height: 0; }
.form-row.qa-date-row { align-items: flex-end; gap: 12px; }
.qa-date-row .qa-date-form { display: flex; align-items: flex-end; gap: 12px; flex: 1; }
.qa-date-form .form-group.qa-date-field { flex: 1; margin: 0; }

/* Toast raised by showToast() in assets/js/app.js */
.alert.app-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    min-width: 300px;
    max-width: 450px;
    transition: opacity 0.3s ease, transform 0.3s ease;
    transform: translateY(-20px);
    opacity: 0;
}
.alert.app-toast.is-visible { transform: translateY(0); opacity: 1; }

/* "Sin acceso" screen (moved from the <style> block in core/auth/rbac.go) */
.permission-denied-wrap {
    background-color: #F8FAFC;
    background-image: radial-gradient(circle at top right, #E6FFFA, transparent 40%), radial-gradient(circle at bottom left, #B7ECE9, transparent 40%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    margin: 0;
    padding: 1rem;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.permission-denied-card { max-width: 420px; text-align: center; }
.permission-denied-card p { color: var(--color-text-muted); }

/* HTML fragments written by Go handlers (moved from inline styles) */
.field-error-msg { color: var(--color-error); font-size: var(--text-xs); font-weight: 500; }
.alert.is-stacked { margin-bottom: 12px; }

/* Shell pieces that replaced JS (layout.html, confirm_dialog.html,
   flash_toast.html) */
.sidebar-toggle { cursor: pointer; }

/* Confirmation modal on the native popover API: the popover is the white
   box, ::backdrop is the dimmed page; clicking outside or Esc closes it. */
.app-dialog[popover] {
    inset: 0;
    margin: 24px auto auto;
    width: min(calc(100% - 48px), 390px);
    padding: 0;
    border: 0;
    background: transparent;
    overflow: visible;
}
.app-dialog[popover]::backdrop { background: rgba(15, 23, 42, 0.22); }
.app-dialog .logout-modal { width: 100%; box-sizing: border-box; }
/* A dialog often sits inside a table's actions cell, which is nowrap and
   right-aligned: reset both so the message wraps inside the box, and let a
   long e-mail or company name break instead of running past its edge. */
.app-dialog[popover] { white-space: normal; text-align: left; }
.app-dialog .logout-modal p { overflow-wrap: anywhere; }

/* Un popover se pinta en la capa superior, pero la herencia de CSS sigue el
   DOM: estos diálogos se declaran dentro de .table-actions, que fija
   white-space: nowrap para que la fila de iconos no se parta. El texto del
   modal heredaba ese nowrap, no hacía salto de línea y se desbordaba de la
   tarjeta. Se restituye aquí en vez de quitarle el nowrap a la fila, que sí
   lo necesita. */
.app-dialog .logout-modal {
    white-space: normal;
}

/* Un dato largo e insecable dentro del mensaje — el correo del administrador
   en el modal de reenvío — parte de línea en vez de empujar la tarjeta. */
.logout-modal p {
    overflow-wrap: break-word;
}

/* Flash toast: slides in, stays ~5s, fades out — all in CSS. */
@keyframes app-toast-life {
    0%   { opacity: 0; transform: translateY(-20px); }
    6%   { opacity: 1; transform: translateY(0); }
    94%  { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-20px); visibility: hidden; }
}
.alert.app-toast--flash { animation: app-toast-life 5.3s ease forwards; }
.alert.app-toast:has(.app-toast-dismiss:checked) { display: none; }
.app-toast .alert-close { cursor: pointer; }

/* Drawers are rendered open by the server now (no JS adds .open/.visible
   after the fact), so play the same slide/fade on load. */
@keyframes drawer-slide-in { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes drawer-fade-in { from { opacity: 0; } to { opacity: 1; } }
[id$="-drawer-root"] .drawer.open { animation: drawer-slide-in var(--duration-default) var(--ease-default); }
[id$="-drawer-root"] .drawer-backdrop.visible { animation: drawer-fade-in var(--duration-default) var(--ease-default); }
/* Every screen change is a full page load (no JS). Cross-document view
   transitions swap the new page in at once, without the blank flash, and
   with no animation of their own — a re-rendered drawer looks unchanged. */
@view-transition { navigation: auto; }
::view-transition-old(root),
::view-transition-new(root) { animation: none; }
[id$="-drawer-root"] .drawer-backdrop.visible.drawer--settled,
[id$="-drawer-root"] .drawer.open.drawer--settled { animation: none; }
/* A role's group "select all" comes back anchored at its group. */
.permission-group { scroll-margin-top: 16px; }
/* The colony lookup comes back anchored at the postal code row. */
.postal-lookup-anchor { scroll-margin-top: 24px; }
a.drawer-backdrop, a.drawer-close { text-decoration: none; }
@keyframes drawer-slide-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
@media (max-width: 768px) {
    [id$="-drawer-root"] .drawer.open { animation-name: drawer-slide-up; }
}

/* Role drawer permission state (role_form.html) */
/* Live "Permisos asignados": a CSS counter of the ticked permission boxes.
   The stat cards sit after the list in the DOM (counters follow document
   order) and `order` shows them where they always were. */
#roleForm { counter-reset: role-perms; }
#roleForm input[name="permissions"]:checked { counter-increment: role-perms; }
.role-permission-count::before { content: counter(role-perms); }
#roleForm .role-drawer-scroll { display: flex; flex-direction: column; overflow-anchor: none; }
#roleForm .role-drawer-scroll > .role-stats { order: 1; }
#roleForm .role-drawer-scroll > label.d-block,
#roleForm .role-drawer-scroll > .alert-info,
#roleForm .role-drawer-scroll > .flex-col-gap-4 { order: 2; }

/* Group collapse: header label toggles a hidden checkbox. */
.permission-group-toggle {
    display: flex;
    align-items: center;
    flex: 1;
    gap: var(--space-3);
    margin: 0;
    cursor: pointer;
    font: inherit;
    color: inherit;
}
.permission-group:has(> .permission-group-collapse:checked) .group-chevron { transform: rotate(180deg); }
.permission-group:has(> .permission-group-collapse:checked) .card-grid-2 {
    height: 0;
    padding-top: 0;
    padding-bottom: 0;
    overflow: hidden;
    border: 0;
}

/* "Seleccionar todo": a submit button drawn as the group's checkbox; it
   shows ticked while every permission in its group is ticked. */
.select-all-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
}
.select-all-toggle:hover { background: none; }
.select-all-toggle:disabled { opacity: 1; background: none; cursor: not-allowed; }
.select-all-box {
    width: 16px;
    height: 16px;
    box-sizing: border-box;
    border: 1px solid #767676;
    border-radius: 3px;
    background: #fff;
    display: inline-block;
}
.select-all-toggle:disabled .select-all-box { opacity: 0.5; }
.permission-group:not(:has(input[name="permissions"]:not(:checked))) .select-all-box {
    border-color: var(--color-primary);
    background: var(--color-primary) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-7' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 12px no-repeat;
}

/* Solicitud detail tabs (radios + labels, no JS) */
.sd-tab { cursor: pointer; }
.sd-tab-state:checked + .sd-tab {
    background: white;
    color: #172033;
    border: 1px solid #DDE4E8;
}
body:has(#sd-tab-bancarios:checked) #tab-documentos { display: none; }
body:has(#sd-tab-bancarios:checked) #tab-bancarios.sd-tab-hidden { display: block; }

/* "Colonia" before the colonies are loaded: a submit styled as the select
   (company form). It stays inert until a complete postal code is typed,
   then a click on it loads the colonies — no JS. */
.colony-load {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
    font-weight: var(--font-normal);
    font-size: var(--text-base);
    box-shadow: none;
    color: var(--color-text-faint);
    cursor: default;
    pointer-events: none;
    padding-right: 2.25rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px;
}
.colony-load:hover { background-color: var(--color-field); color: inherit; }
.postal-lookup:has(.postal-lookup-code:invalid:not(:placeholder-shown)) .colony-load:hover { color: var(--color-text); }
.colony-load-ready { display: none; }
.postal-lookup:has(.postal-lookup-code:invalid:not(:placeholder-shown)) .colony-load {
    color: var(--color-text);
    cursor: pointer;
    pointer-events: auto;
}
.postal-lookup:has(.postal-lookup-code:invalid:not(:placeholder-shown)) .colony-load-wait { display: none; }
.postal-lookup:has(.postal-lookup-code:invalid:not(:placeholder-shown)) .colony-load-ready { display: inline; }

/* Leaving a new complete postal code loads its colonies (company form, no
   JS): its pattern makes the field :invalid exactly then, and an invisible
   submit covers the drawer; the field itself, "Cancelar" and the close
   button stay above it. */
.postal-blur-catcher {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 20;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    cursor: default;
}
.postal-blur-catcher:hover { background: transparent; }
.postal-blur-catcher:active { transform: none; }
.postal-lookup:has(.postal-lookup-code:invalid:not(:placeholder-shown)) .postal-blur-catcher { display: block; }
.postal-lookup .postal-lookup-code { position: relative; z-index: 21; }
/* The ways out stay clickable above it: close, Cancelar, Atrás and the
   step links. */
.drawer:has(.postal-blur-catcher) .drawer-close,
.drawer:has(.postal-blur-catcher) #btn-cancel,
.drawer:has(.postal-blur-catcher) .wizard-buttons a,
.drawer:has(.postal-blur-catcher) .wizard-buttons label,
.drawer:has(.postal-blur-catcher) .wizard-step-link { position: relative; z-index: 21; }

/* Filter dropdowns: a <select> can't apply itself without JS, so list
   filters are a <details> whose options are links — picking one filters at
   once, and the search box filters on Enter. Looks like the select it
   replaces. */
.filter-dropdown { position: relative; flex-shrink: 0; }
.filter-dropdown > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    min-width: 160px;
    height: 36px;
    padding: 0 2.25rem 0 var(--space-3);
    background-color: var(--color-field);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: var(--text-base);
    color: var(--color-text);
    cursor: pointer;
    list-style: none;
    user-select: none;
    white-space: nowrap;
}
.filter-dropdown > summary::-webkit-details-marker { display: none; }
.filter-dropdown[open] > summary,
.filter-dropdown > summary:focus-visible {
    outline: none;
    background-color: var(--color-surface);
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-ring);
}
.filter-dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 30;
    min-width: 100%;
    max-height: 280px;
    overflow-y: auto;
    padding: 4px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 24px rgba(15, 23, 42, .12);
}
.filter-dropdown-menu a {
    display: block;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    font-size: var(--text-base);
    color: var(--color-text);
    text-decoration: none;
    white-space: nowrap;
}
.filter-dropdown-menu a:hover { background: var(--color-field); }
.filter-dropdown-menu a[aria-current="true"] { color: var(--color-primary); font-weight: var(--font-semibold); }
/* Option labels come from data (a campaign can be named with 100
   characters, spaces optional): the menu stops at a readable width and each
   option wraps inside it instead of running off the screen. The button
   shows the chosen label on one line, cut with an ellipsis. */
.filter-dropdown-menu { max-width: min(360px, calc(100vw - 32px)); }
.filter-dropdown-menu a { white-space: normal; overflow-wrap: anywhere; }
.filter-dropdown > summary { max-width: 280px; }
.filter-dropdown-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.users-toolbar .filter-dropdown > summary { width: 176px; }
.employees-page > .filter-bar .filter-dropdown > summary {
    min-width: 208px;
    background-color: var(--color-surface);
    border-color: var(--color-border);
    border-radius: var(--radius-xl);
}

/* Solicitudes tab totals */
.sl-tabs-bar .tab-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}
.sl-tabs-bar {
    overflow-x: auto;
}


input[type="number"]:user-invalid,
input[type="tel"]:user-invalid,
input[inputmode="numeric"]:user-invalid,
input[inputmode="decimal"]:user-invalid,
input[pattern]:user-invalid {
    border-color: var(--color-error);
    background: var(--color-error-soft);
}

input[type="number"]:user-invalid:focus,
input[type="tel"]:user-invalid:focus,
input[inputmode="numeric"]:user-invalid:focus,
input[inputmode="decimal"]:user-invalid:focus,
input[pattern]:user-invalid:focus {
    border-color: var(--color-error);
    box-shadow: 0 0 0 3px var(--color-error-ring);
}


.inline-cell-input:user-invalid {
    background: var(--color-error-soft);
    outline: 1px solid var(--color-error);
    border-radius: var(--radius-xs);
}


.field-hint-invalid {
    display: none;
    color: var(--color-error);
    font-size: var(--text-xs);
    margin-top: 4px;
}

input:user-invalid ~ .field-hint-invalid,
.input-with-icon:has(input:user-invalid) ~ .field-hint-invalid,
.input-suffix:has(input:user-invalid) ~ .field-hint-invalid,
.phone-input-group:has(input:user-invalid) ~ .field-hint-invalid,
.portal-input-wrap:has(input:user-invalid) ~ .field-hint-invalid,
.journey-input-group:has(input:user-invalid) ~ .field-hint-invalid,
.inline-table-wrap:has(.inline-cell-input:user-invalid) ~ .field-hint-invalid,
.vacation-table-wrap:has(input:user-invalid) ~ .field-hint-invalid {
    display: block;
}


.input-digits::-webkit-outer-spin-button,
.input-digits::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.input-digits {
    -moz-appearance: textfield;
    appearance: textfield;
}

input[type="number"],
input[inputmode="decimal"],
.inline-cell-input {
    font-variant-numeric: tabular-nums;
}
/* Submit backdrops preserve input without inheriting button decoration. */
[id$="-drawer-root"] button.drawer-backdrop {
    border: 0;
    border-radius: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    cursor: default;
}
[id$="-drawer-root"] button.drawer-backdrop:active { transform: none; }

/* Pending registrations are offered before opening the company drawer. */
.company-draft-overlay { z-index: 10000; }
.company-draft-dismiss { position: absolute; inset: 0; cursor: default; }
.company-draft-prompt { position: relative; max-width: 28rem; }
.company-draft-prompt .modal-close { text-decoration: none; font-size: var(--text-2xl); line-height: 1; }
.company-draft-prompt .modal-body p { margin: 0; color: var(--color-text-muted); }
.company-draft-prompt .modal-footer { flex-wrap: wrap; align-items: center; }
.company-draft-prompt .modal-footer form { margin: 0; }

/* The import's company picker fills the same width as its campaign select. */
#import-company > summary { max-width: none; width: 100%; }
#import-company .filter-dropdown-menu { width: 100%; max-width: 100%; }
#import-company-label { color: var(--color-text-muted); font-size: var(--text-sm); }

/* Manual colony entry is only relevant while Otro is selected. */
.postal-other-label,
.postal-other-field {
    display: none;
}
select:has(option[value="__other__"]:checked) ~ .postal-other-label,
select:has(option[value="__other__"]:checked) ~ .postal-other-field {
    display: block;
}


/* Shared footer controls for all backoffice drawers. Keep display untouched:
   wizard step selectors decide which controls are visible. */
.drawer :is(.drawer-actions, .drawer-form-footer, .user-form-footer, .actions-footer, .form-actions-end) .btn {
    min-height: var(--control-height);
    height: auto;
    min-width: 0;
    padding: var(--space-2) var(--space-5);
    margin: 0;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    border-radius: var(--radius-xl);
    font-family: var(--font-sans);
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    line-height: 1.4;
    text-align: center;
    text-decoration: none;
}
.drawer :is(.wizard-buttons, .wizard-buttons-left, .wizard-buttons-right) > .btn {
    flex: 1 1 0;
}
.drawer .actions-footer { gap: var(--space-3); }
.drawer .actions-footer > div { flex: 1 1 0; min-width: 0; }
.drawer .actions-footer > div > .btn { width: 100%; }
.drawer :is(.drawer-actions, .drawer-form-footer, .user-form-footer, .actions-footer, .form-actions-end) .btn:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.drawer :is(.wizard-buttons, .wizard-buttons-left, .wizard-buttons-right, .actions-footer) {
    align-items: stretch;
}
.drawer .wizard-buttons-right { flex-wrap: wrap; }


.drawer--purpose .form-section > .form-group + .form-group {
    margin-top: var(--space-5);
}

.drawer--purpose .form-group .emoji-picker-option {
    font-size: var(--text-xl);
    line-height: 1;
}

#purpose-drawer-root .drawer-body .emoji-field input.sr-only {
    width: 1px;
    height: 1px;
    min-height: 0;
    padding: 0;
    border: 0;
}


.drawer--campaign .form-section > .form-group + .form-group,
.drawer--campaign .form-section > .form-group + .form-row {
    margin-top: var(--space-5);
}
@media (max-width: 480px) {
    .drawer--campaign .form-row { grid-template-columns: minmax(0, 1fr); }
}

/* Employee detail footer: compact, single-line buttons sized to their label
   instead of stretching to fill the row (which wrapped "Editar información"
   onto two lines and left its icon floating). */
.drawer--detail .wizard-buttons,
.drawer--detail .wizard-buttons-left,
.drawer--detail .wizard-buttons-right {
    align-items: center;
}
.drawer--detail .wizard-buttons-right { flex-wrap: nowrap; }
.drawer--detail :is(.wizard-buttons-left, .wizard-buttons-right) > .btn,
.drawer--detail .wizard-buttons-left .inline-form > .btn {
    flex: 0 0 auto;
    min-width: 128px;
    height: 44px;
    min-height: 44px;
    padding: 0 var(--space-5);
    white-space: nowrap;
}
.drawer--detail .btn-edit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    background: var(--color-surface);
    color: var(--color-primary);
    border: 1px solid var(--color-primary);
}
.drawer--detail .btn-edit:hover {
    background: var(--color-primary-soft);
    color: var(--color-primary);
}
.drawer--detail .btn-edit-icon {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
}
@media (max-width: 520px) {
    .drawer--detail .wizard-buttons { flex-wrap: wrap; }
    .drawer--detail .wizard-buttons-left,
    .drawer--detail .wizard-buttons-right { flex: 1 1 100%; }
    .drawer--detail .wizard-buttons-right { flex-wrap: wrap; }
    .drawer--detail :is(.wizard-buttons-left, .wizard-buttons-right) > .btn,
    .drawer--detail .wizard-buttons-left .inline-form,
    .drawer--detail .wizard-buttons-left .inline-form > .btn {
        flex: 1 1 0;
        min-width: 0;
    }
}

/* Propósitos: the owning company under the name (system users only). */
.config-company {
    margin-top: 2px;
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

/* Mis Empleados: the invitation channel beside "Enviar invitaciones". */
.selection-bar-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-3);
}
.selection-bar-channel {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    margin: 0;
    font-weight: var(--font-medium);
}
.selection-bar-channel select {
    width: auto;
    min-height: 32px;
    padding: 4px 28px 4px 10px;
    font-size: var(--text-sm);
}

/* Invitation channel (users, companies): the select comes before the
   contact fields and decides, with :has(), which fields show and which say
   "(opcional)" — no JS. */
.company-channel { margin-bottom: var(--space-5); }
.field-optional {
    margin-left: 4px;
    font-weight: var(--font-normal);
    color: var(--color-text-muted);
}
form:has(.channel-select option[value="email"]:checked) .hide-on-email,
form:has(.channel-select option[value="sms"]:checked) .hide-on-sms,
form:has(.channel-select option[value="both"]:checked) .hide-on-both {
    display: none !important;
}

/* Filter bar with a search and several filter dropdowns (Bolsa de
   migración): the dropdowns wrap below the search when the row runs out of
   room instead of overflowing the screen. */
.filter-bar--wrap { flex-wrap: wrap; }
.filter-bar--wrap .search-field { flex: 1 1 260px; }
.filter-bar--wrap .filter-bar-actions { flex-wrap: wrap; }

/* Migración de empleados (Campañas › Migración de empleados): the
   recycling pool with its selection and migration, without JS — the same
   technique as the invitations of Mis Empleados (#invite-form above). The
   bar is always shown (placed after the table, drawn above it); its
   counters count the ticked boxes; the header box (all=1) means "every
   eligible person of the filter", and then each row shows an inverted box
   to leave someone out. "Migrar campaña" opens a native popover. */
.migration-intro {
    margin: 0 0 var(--space-4);
    color: var(--color-text-muted);
    font-size: var(--text-sm);
}
#migrate-form { counter-reset: migrate-selected migrate-excluded; }
#migrate-form .selection-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
}
.recycling-table .migrate-include:checked { counter-increment: migrate-selected; }
.recycling-table .migrate-exclude:checked { counter-increment: migrate-excluded; }
.migrate-selected-count::before { content: counter(migrate-selected); }
.migrate-excluded-count::before { content: counter(migrate-excluded); }
.migrate-summary--some,
.migrate-summary--all,
.migrate-excluded,
.recycling-table .migrate-exclude { display: none; }
#migrate-form:has(.migrate-include:checked) .migrate-summary--some { display: inline; }
#migrate-form:has(.migrate-include:checked, #migrate-select-all:checked) .migrate-summary--none { display: none; }
#migrate-form:has(#migrate-select-all:checked) .migrate-summary--some,
#migrate-form:has(#migrate-select-all:checked) .recycling-table .migrate-include { display: none; }
#migrate-form:has(#migrate-select-all:checked) .migrate-summary--all { display: inline; }
#migrate-form:has(#migrate-select-all:checked) .recycling-table .migrate-exclude { display: inline-block; }
#migrate-form:has(.migrate-exclude:checked) .migrate-excluded { display: inline; }
/* Nothing chosen yet: the actions read as unavailable and do nothing. */
#migrate-form:not(:has(.migrate-include:checked, #migrate-select-all:checked)) .migrate-open,
#migrate-form:not(:has(.migrate-include:checked, #migrate-select-all:checked)) .migrate-clear {
    opacity: 0.5;
    pointer-events: none;
}
/* An exclude box reads "in" while unticked. */
.recycling-table .migrate-exclude:not(:checked) {
    background: #20C3C3;
    border-color: #20C3C3;
}
.recycling-table .migrate-exclude:not(:checked)::after {
    content: "";
    position: absolute;
    left: 4px;
    top: 1px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.recycling-table .migrate-exclude:checked {
    background: white;
    border-color: #CBD5E1;
}
.recycling-table .migrate-exclude:checked::after { content: none; }
/* People who cannot be migrated keep a box, greyed and inert. */
.recycling-table .select-checkbox:disabled {
    background: var(--color-gray-50);
    border-color: #E2E8F0;
    cursor: not-allowed;
}
.recycling-table td { vertical-align: top; }
.cell-sub--mono { font-family: var(--font-mono); }
/* On a phone the tables keep only their first column; here the first one is
   the checkbox, so the employee stays visible beside it. */
@media (max-width: 48rem) {
    .recycling-table:has(.td-checkbox) th:nth-child(2),
    .recycling-table:has(.td-checkbox) td:nth-child(2) {
        display: table-cell;
        width: 100%;
    }
    .recycling-table:has(.td-checkbox) th:first-child,
    .recycling-table:has(.td-checkbox) td:first-child { width: 1%; }
}
.th-with-info {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
}
.info-hint {
    display: inline-flex;
    color: var(--color-text-muted);
    cursor: help;
}
.icon-info {
    width: 14px;
    height: 14px;
}

/* Migración de empleados — the confirmation dialog: the target campaign
   (step 1), what happens to the eligible people of the page left unpicked
   (step 2, two choice cards; the picked one is tinted, amber for
   "Descartar"), a note and the actions. */
.app-dialog:has(.migrate-modal) { width: min(calc(100% - 48px), 540px); }
.app-dialog .logout-modal.migrate-modal {
    width: 100%;
    padding: var(--space-6);
}
.migrate-modal-header {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    margin-bottom: var(--space-5);
}
.migrate-modal-heading {
    flex: 1;
    min-width: 0;
}
.migrate-modal-heading h2 {
    margin: 0;
    color: var(--color-text-strong);
    font-size: var(--text-lg, 1.0625rem);
    font-weight: var(--font-semibold);
}
.migrate-modal-count {
    display: inline-block;
    margin-top: var(--space-1);
    padding: 2px var(--space-2);
    border-radius: var(--radius-full);
    background: var(--color-primary-soft);
    color: var(--color-primary-strong);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
}
.migrate-modal-step {
    min-width: 0;
    margin: 0 0 var(--space-5);
    padding: 0;
    border: 0;
}
.migrate-modal-label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
    padding: 0;
    color: var(--color-text);
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
}
.migrate-modal-number {
    display: inline-grid;
    width: 20px;
    height: 20px;
    place-items: center;
    border-radius: var(--radius-full);
    background: var(--color-primary);
    color: var(--color-white, #fff);
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
}
.migrate-modal .migrate-modal-hint {
    margin: var(--space-2) 0 0;
    color: var(--color-text-muted);
    font-size: var(--text-sm);
}
.migration-choices {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-3);
}
@media (max-width: 520px) {
    .migration-choices { grid-template-columns: 1fr; }
}
.migration-choice {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    padding: var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    cursor: pointer;
    transition: border-color var(--duration-default) var(--ease-default),
                background-color var(--duration-default) var(--ease-default);
}
.migration-choice:hover { border-color: var(--color-primary); }
/* The radio itself is hidden; the dot in the corner shows the choice. */
.migration-choice::after {
    content: "";
    position: absolute;
    top: var(--space-4);
    right: var(--space-4);
    width: 16px;
    height: 16px;
    box-sizing: border-box;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-full);
    background: var(--color-surface);
}
.migration-choice:has(input:checked) {
    border-color: var(--color-primary);
    background: var(--color-primary-soft);
}
.migration-choice:has(input:checked)::after {
    border: 5px solid var(--color-primary);
}
.migration-choice--warning:hover { border-color: var(--color-warning); }
.migration-choice--warning:has(input:checked) {
    border-color: var(--color-warning);
    background: var(--color-warning-soft);
}
.migration-choice--warning:has(input:checked)::after { border-color: var(--color-warning); }
.migration-choice:has(input:focus-visible) {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}
.migration-choice-icon {
    display: inline-flex;
    width: 32px;
    height: 32px;
    margin-bottom: var(--space-1);
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    background: var(--color-primary-soft);
    color: var(--color-primary-strong);
}
.migration-choice--warning .migration-choice-icon {
    background: var(--color-warning-soft);
    color: var(--color-warning);
}
.migration-choice:has(input:checked) .migration-choice-icon { background: var(--color-surface); }
.migration-choice-title {
    color: var(--color-text);
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
}
.migration-choice-text {
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    line-height: 1.45;
}
.migrate-modal-note {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    margin: 0 0 var(--space-5);
    padding: var(--space-3);
    border-radius: var(--radius-md);
    background: var(--color-surface-muted);
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    line-height: 1.45;
}
.migrate-modal select { width: 100%; box-sizing: border-box; }
.migrate-modal-note svg { flex-shrink: 0; margin-top: 1px; color: var(--color-info); }
.migrate-modal-actions button {
    padding: 9px 16px;
    font-size: var(--text-base);
}

/* Mis Empleados: a closed campaign in the filter carries its state, and a
   warning says which campaigns no longer take invitations. */
.filter-dropdown-menu a.campaign-filter-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
}
.campaign-filter-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.campaign-filter-option .badge { flex-shrink: 0; margin-left: auto; }
.campaign-closed-alert {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
    line-height: 1.5;
}
.campaign-closed-alert svg { flex-shrink: 0; margin-top: 2px; }
/* Its links read as links, like the ones of the purposes warning: the
   blue of every link, not the warning's own colour. */
.campaign-closed-alert a {
    color: var(--color-blue);
    font-weight: var(--font-semibold);
}
#employees-campaign-filter .filter-dropdown-menu { min-width: 300px; }

/* A lifecycle confirmation drawn already open (?abrir=…): the same box as
   the popover, in the same place, over a dimmed page. */
.app-dialog--open {
    position: fixed;
    inset: 0;
    z-index: 1000;
    width: min(calc(100% - 48px), 390px);
    height: fit-content;
    margin: 24px auto auto;
    white-space: normal;
    text-align: left;
    box-shadow: 0 0 0 100vmax rgba(15, 23, 42, 0.22);
    border-radius: var(--radius-xl);
}
.app-dialog--open .logout-modal-cancel {
    display: inline-flex;
    align-items: center;
    padding: 7px 11px;
    border-radius: 7px;
    font-size: 12px;
    text-decoration: none;
}
.app-dialog--open a.logout-modal-close { text-decoration: none; }
