/* =========================
   1. TOKENS / ROOT
========================= */

:root {
    --bg: #0b1020;
    --bg-soft: #121933;
    --bg-deep: #0f1730;
    --panel: #ffffff;
    --panel-soft: #f6f8fc;
    --border: #e6ebf5;
    --text: #182338;
    --muted: #6f7b91;
    --primary: #5b6cff;
    --primary-hover: #4959ea;
    --accent: #19c2b8;
    --danger: #e25555;
    --success: #16a34a;
    --warning: #f59e0b;
    --shadow-sm: 0 4px 14px rgba(17, 24, 39, 0.06);
    --shadow: 0 10px 30px rgba(17, 24, 39, 0.08);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.18);
    --radius-sm: 12px;
    --radius: 18px;
    --radius-lg: 24px;
    --sidebar-width: 280px;
    --topbar-height: 84px;
}

/* =========================
   2. RESET / BASE
========================= */

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    font-family: Inter, Segoe UI, Arial, sans-serif;
    background: #eef2f8;
    color: var(--text);
}

body {
    min-height: 100vh;
}

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

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

button,
input,
select,
textarea {
    font: inherit;
}

/* =========================
   3. LOGIN
========================= */

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: radial-gradient(circle at top left, rgba(91, 108, 255, .22), transparent 30%), radial-gradient(circle at bottom right, rgba(25, 194, 184, .18), transparent 30%), linear-gradient(135deg, #0b1020 0%, #111933 100%);
}

.login-panel {
    width: 100%;
    max-width: 480px;
}

.login-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    color: white;
    margin-top: -60px;
    margin-bottom: 28px;
    gap: 12px;
}

    .login-brand h1 {
        margin: 0;
        font-size: 2rem;
        font-weight: 800;
        letter-spacing: -.02em;
        border: none;
        outline: none;
        box-shadow: none;
    }

    .login-brand p {
        margin: 0;
        opacity: .84;
        font-size: 1rem;
    }

.login-card {
    background: rgba(255, 255, 255, .96);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    padding: 30px;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, .35);
}

    .login-card h2 {
        margin-bottom: 8px;
        font-size: 1.55rem;
        letter-spacing: -.02em;
    }

.login-subtitle {
    color: var(--muted);
    margin-bottom: 24px;
    line-height: 1.5;
}

.login-company-logo {
    max-width: 360px;
    max-height: 120px;
    object-fit: contain;
    border-radius: 14px;
    padding: 10px;
    background: transparent;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.login-error {
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: 12px;
    background: #fff2f2;
    color: var(--danger);
    border: 1px solid #ffd3d3;
    font-weight: 600;
}

/* =========================
   4. FORM
========================= */

.form-group {
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
}

    .form-group label {
        font-size: .95rem;
        font-weight: 700;
        color: #273349;
    }

.form-group-full {
    grid-column: 1 / -1;
}

.form-input {
    width: 100%;
    padding: 13px 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
    font-size: 1rem;
    outline: none;
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

    .form-input:focus {
        border-color: var(--primary);
        box-shadow: 0 0 0 4px rgba(91, 108, 255, .12);
    }

    .form-input::placeholder {
        color: #9aa5ba;
    }

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

.grid-two-form {
    display: grid;
    gap: 18px;
    grid-template-columns: 2fr 1fr;
}

.checks-grid {
    display: grid;
    gap: 10px;
}

.check-line {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.filters-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

.filters-actions {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 20px;
}

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

.auditoria-filters-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

.permisos-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

    .permisos-grid .form-group-full {
        grid-column: 1 / -1;
    }

.permiso-form-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 18px;
    align-items: start;
}

.permiso-saldo-card {
    position: sticky;
    top: 18px;
}

.permiso-saldo-grid {
    display: grid;
    gap: 12px;
}

.permiso-saldo-item {
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
}

.permiso-saldo-label {
    display: block;
    color: var(--muted);
    margin-bottom: 6px;
    font-size: .92rem;
}

.saldo-alerta {
    border-color: #f3b0b0;
    background: #fff7f7;
}

/* =========================
   5. BUTTONS
========================= */

.btn-primary,
.btn-ghost,
.btn-soft {
    border: 0;
    border-radius: 14px;
    padding: 12px 18px;
    font-size: .96rem;
    cursor: pointer;
    transition: transform .15s ease, opacity .15s ease, background .2s ease;
}

    .btn-primary:hover,
    .btn-ghost:hover,
    .btn-soft:hover {
        transform: translateY(-1px);
    }

    .btn-primary:disabled,
    .btn-ghost:disabled,
    .btn-soft:disabled {
        opacity: .7;
        cursor: not-allowed;
        transform: none;
    }

.btn-primary {
    width: 100%;
    background: linear-gradient(135deg, var(--primary), #7a63ff);
    color: white;
    font-weight: 800;
    box-shadow: 0 8px 22px rgba(91, 108, 255, .22);
}

    .btn-primary:hover {
        background: linear-gradient(135deg, var(--primary-hover), #684ff6);
    }

.btn-ghost {
    background: #eef2ff;
    color: var(--primary);
    font-weight: 700;
}

.btn-soft {
    background: #f4f7fd;
    color: var(--text);
    font-weight: 700;
}

.btn-inline {
    width: auto;
    min-width: 160px;
}

.btn-small {
    padding: 8px 12px;
    font-size: .86rem;
    border-radius: 10px;
}

.btn-icon {
    min-width: 46px;
    padding: 12px 14px;
    border-radius: 12px;
}

.btn-action {
    min-width: 92px;
    justify-content: center;
}

.btn-chip-remove {
    padding: 8px 10px;
    font-size: .82rem;
    min-width: 72px;
}

/* =========================
   6. APP SHELL
========================= */

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    background: radial-gradient(circle at top right, rgba(91, 108, 255, .08), transparent 18%), #eef2f8;
}

.main-area {
    display: grid;
    grid-template-rows: auto 1fr;
    min-width: 0;
}

.content-area {
    padding: 26px;
    min-width: 0;
}

/* =========================
   7. SIDEBAR
========================= */

.sidebar {
    background: radial-gradient(circle at top left, rgba(91, 108, 255, .16), transparent 28%), linear-gradient(180deg, #0f1730 0%, #121933 100%);
    color: white;
    padding: 22px 18px;
    border-right: 1px solid rgba(255, 255, 255, .06);
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-brand {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    margin-bottom: 28px;
    gap: 10px;
    padding-bottom: 18px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.sidebar-company-logo {
    width: 100%;
    max-height: 76px;
    object-fit: contain;
    background: white;
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, .18);
}

.sidebar-title {
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: -.01em;
}

.sidebar-subtitle {
    opacity: .72;
    font-size: .92rem;
    line-height: 1.4;
}

.nav-menu {
    display: grid;
    gap: 8px;
}

.nav-link {
    color: rgba(255, 255, 255, .88);
    padding: 12px 14px;
    border-radius: 14px;
    transition: .18s ease;
    font-weight: 600;
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
}

    .nav-link:hover {
        background: rgba(255, 255, 255, .08);
        color: white;
    }

    .nav-link.active,
    .nav-link[aria-current="page"] {
        background: linear-gradient(135deg, rgba(91, 108, 255, .22), rgba(25, 194, 184, .12));
        color: white;
        box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06);
    }

.nav-link-icon {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 18px;
}

.nav-link-icon-svg {
    width: 18px;
    height: 18px;
    display: block;
}

.nav-link-text {
    min-width: 0;
}

.nav-loading {
    color: rgba(255, 255, 255, .72);
    padding: 12px 14px;
    font-size: .92rem;
}

/* =========================
   8. TOPBAR
========================= */

.topbar {
    min-height: var(--topbar-height);
    background: rgba(255, 255, 255, .86);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 18px 26px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    position: sticky;
    top: 0;
    z-index: 5;
}

.topbar-title {
    margin: 0;
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: -.02em;
}

.topbar-subtitle {
    margin: 6px 0 0 0;
    color: var(--muted);
    font-size: .96rem;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-user-info {
    display: grid;
    text-align: right;
}

    .topbar-user-info strong {
        font-weight: 800;
    }

    .topbar-user-info span {
        color: var(--muted);
        font-size: .92rem;
    }

.topbar-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.env-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 140px;
    padding: 10px 14px;
    border-radius: 999px;
    font-size: .82rem;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
    border: 1px solid transparent;
    white-space: nowrap;
}

.env-badge-prod {
    background: #fff1f2;
    color: #be123c;
    border-color: #fecdd3;
}

.env-badge-test {
    background: #fff7ed;
    color: #c2410c;
    border-color: #fed7aa;
}

.env-badge-local {
    background: #eff6ff;
    color: #1d4ed8;
    border-color: #bfdbfe;
}

/* =========================
   9. PAGE / GRID / CARDS
========================= */

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

.page-title {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -.03em;
}

.page-subtitle {
    margin: 8px 0 0 0;
    color: var(--muted);
    line-height: 1.5;
}

.grid-cards {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.grid-two {
    display: grid;
    gap: 18px;
    grid-template-columns: 2fr 1fr;
    margin-top: 18px;
}

.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    min-width: 0;
}

    .card:hover {
        box-shadow: 0 14px 34px rgba(17, 24, 39, 0.10);
    }

    .card h3 {
        margin-bottom: 10px;
        font-size: 1.05rem;
        font-weight: 800;
        letter-spacing: -.01em;
    }

.card-muted {
    color: var(--muted);
    line-height: 1.5;
}

.config-card {
    cursor: pointer;
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

    .config-card:hover {
        transform: translateY(-2px);
        border-color: #cfd8ee;
    }

.stat-card {
    display: grid;
    gap: 12px;
}

.stat-label {
    color: var(--muted);
    font-size: .92rem;
    font-weight: 700;
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -.03em;
}

.stat-trend {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: .9rem;
    font-weight: 700;
}

    .stat-trend.success {
        color: var(--success);
    }

    .stat-trend.warning {
        color: var(--warning);
    }

/* =========================
   10. LISTS / BADGES / TABLES
========================= */

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

.list-item {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #eef2f8;
}

    .list-item:last-child {
        border-bottom: 0;
        padding-bottom: 0;
    }

.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: .82rem;
    font-weight: 700;
}

    .badge.info {
        background: #eef2ff;
        color: var(--primary);
    }

    .badge.success {
        background: #ecfdf3;
        color: var(--success);
    }

    .badge.warning {
        background: #fff7e6;
        color: var(--warning);
    }

    .badge.danger {
        background: #fff1f1;
        color: var(--danger);
    }

.table-shell {
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: white;
    box-shadow: var(--shadow-sm);
}

.table-admin {
    width: 100%;
    border-collapse: collapse;
}

    .table-admin th,
    .table-admin td {
        padding: 14px 12px;
        border-bottom: 1px solid var(--border);
        text-align: left;
        vertical-align: middle;
    }

    .table-admin th {
        font-size: .9rem;
        color: var(--muted);
        font-weight: 800;
        background: #fafbfe;
        position: sticky;
        top: 0;
    }

.table-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.role-modules-table-shell {
    overflow-x: auto;
}

.role-modules-table {
    width: 100%;
    border-collapse: collapse;
}

    .role-modules-table th,
    .role-modules-table td {
        padding: 14px 12px;
        border-bottom: 1px solid var(--border);
        text-align: left;
        vertical-align: middle;
    }

    .role-modules-table th {
        font-size: .9rem;
        color: var(--muted);
        font-weight: 800;
        background: #fafbfe;
    }

/* =========================
   11. EMPTY / UTILITIES
========================= */

.empty-state {
    display: grid;
    gap: 10px;
    place-items: center;
    text-align: center;
    min-height: 220px;
    color: var(--muted);
}

input[type=number].no-spinner::-webkit-outer-spin-button,
input[type=number].no-spinner::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type=number].no-spinner {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* =========================
   12. USERS / EMPLEADOS
========================= */

.user-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar-mini {
    width: 38px;
    height: 38px;
    border-radius: 999px;
    object-fit: cover;
    flex-shrink: 0;
}

.avatar-fallback {
    display: grid;
    place-items: center;
    background: #eef2ff;
    color: var(--primary);
    font-weight: 800;
}

.user-name {
    font-weight: 700;
}

.user-sub {
    color: var(--muted);
    font-size: .88rem;
}

.users-list {
    display: grid;
    gap: 14px;
}

.user-row-card {
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #fff;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.user-row-main {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;
    align-items: center;
    padding: 16px 18px;
}

.user-row-identity {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.user-row-text {
    min-width: 0;
}

.user-row-name {
    font-weight: 800;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-row-meta {
    margin-top: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    color: var(--muted);
    font-size: .9rem;
}

.user-row-right {
    display: flex;
    justify-content: flex-end;
    min-width: 0;
}

.user-row-inline-tools {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
    flex-wrap: nowrap;
}

.user-row-badges-top {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    justify-content: flex-end;
}

.user-row-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    justify-content: flex-end;
}

.user-row-secondary {
    display: grid;
    gap: 10px;
    padding: 12px 18px 16px 18px;
    border-top: 1px solid #eef2f8;
    background: #fafbfe;
}

.user-row-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.user-row-extra {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    color: var(--muted);
    font-size: .9rem;
}

.user-row-extra-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}

.user-info-col {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.user-info-label {
    font-size: .82rem;
    font-weight: 800;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .03em;
}

.user-info-value {
    font-size: .95rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.empleado-foto {
    width: 100%;
    max-width: 240px;
    max-height: 240px;
    object-fit: cover;
    border-radius: 18px;
    border: 1px solid var(--border);
}

.empleado-foto-card {
    width: 100%;
    height: 320px;
    border-radius: 18px;
    overflow: hidden;
    background: #f3f6fb;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

.empleado-foto-cover {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
}

.empleado-foto-empty {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    color: var(--muted);
    text-align: center;
    padding: 20px;
}

.foto-actions {
    margin-top: 14px;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

/* =========================
   13. RESPONSABLES / ROLES
========================= */

.responsables-box {
    margin-top: 16px;
    display: grid;
    gap: 10px;
    max-height: 320px;
    overflow: auto;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fafbfe;
}

.responsables-toolbar {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: end;
    margin-bottom: 12px;
}

.responsables-layout {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 18px;
    align-items: start;
}

.responsables-selected-title {
    font-weight: 800;
    margin-bottom: 10px;
}

.responsables-selected-box {
    min-height: 120px;
    max-height: 320px;
    overflow: auto;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fafbfe;
    display: grid;
    gap: 10px;
}

.responsables-empty {
    color: var(--muted);
    font-size: .92rem;
}

.responsable-chip-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    background: white;
    border: 1px solid var(--border);
}

.roles-user-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    align-items: start;
}

.roles-user-title {
    font-weight: 800;
    margin-bottom: 10px;
}

.module-title-cell {
    display: grid;
    gap: 4px;
}

.module-sub {
    color: var(--muted);
    font-size: .85rem;
}

.module-disabled {
    opacity: .55;
}

/* =========================
   14. LOOKUP / SEARCH PANELS
========================= */

.lookup-dropdown {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 12px 30px rgba(16, 24, 40, .10);
    z-index: 40;
    max-height: 260px;
    overflow: auto;
}

.lookup-panel {
    margin-top: 8px;
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    background: #fff;
    max-height: 260px;
    overflow-y: auto;
}

.lookup-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 12px 14px;
    border: 0;
    border-bottom: 1px solid var(--border);
    background: transparent;
    cursor: pointer;
    font: inherit;
}

    .lookup-item:last-child {
        border-bottom: 0;
    }

    .lookup-item:hover {
        background: #f8fafc;
    }

.selected-help {
    margin-top: 8px;
    color: var(--muted);
    font-size: .94rem;
}

/* =========================
   15. MODALS
========================= */

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

.modal-card {
    width: min(680px, 100%);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
    padding: 22px;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .35);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5000;
}

.modal-window {
    background: white;
    border-radius: 10px;
    padding: 22px;
    width: 420px;
    max-width: 90%;
    box-shadow: 0 15px 40px rgba(0, 0, 0, .25);
}

.modal-header h3 {
    margin: 0 0 10px 0;
}

.modal-body {
    margin-bottom: 18px;
    line-height: 1.5;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
}

/* =========================
   16. DASHBOARD
========================= */

.dashboard-hero {
    margin-bottom: 18px;
}

.dashboard-hero-card {
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.dashboard-hero-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.dashboard-hero-kicker {
    font-size: .82rem;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 6px;
}

.dashboard-hero-title {
    margin: 0;
    font-size: 1.55rem;
    line-height: 1.15;
    color: var(--text);
}

.dashboard-hero-text {
    margin: 10px 0 0 0;
    color: var(--muted);
    line-height: 1.45;
    max-width: 780px;
}

.dashboard-hero-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 110px;
    padding: 10px 14px;
    border-radius: 999px;
    font-weight: 800;
    font-size: .9rem;
    white-space: nowrap;
}

.dashboard-hero-badge-success {
    background: rgba(25, 195, 184, .12);
    color: #0f8d85;
}

.dashboard-hero-badge-warning {
    background: rgba(245, 158, 11, .14);
    color: #b45309;
}

.dashboard-hero-badge-danger {
    background: rgba(226, 85, 85, .14);
    color: #b42318;
}

.dashboard-hero-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.dashboard-hero-stat {
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 14px 16px;
    background: var(--panel-soft);
}

.dashboard-hero-stat-label {
    display: block;
    color: var(--muted);
    font-size: .9rem;
    margin-bottom: 6px;
}

.dashboard-hero-stat-value {
    font-size: 1.35rem;
    color: var(--text);
    line-height: 1;
}

/* =========================
   17. AUDITORIA
========================= */

.audit-table td {
    vertical-align: top;
}

.audit-date-cell {
    display: grid;
    gap: 4px;
    min-width: 118px;
}

    .audit-date-cell span {
        font-size: .86rem;
        color: var(--muted);
    }

.audit-employee,
.audit-record-id,
.audit-ip {
    font-weight: 700;
    white-space: nowrap;
}

.audit-route {
    display: inline-block;
    max-width: 280px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--muted);
}

.audit-description {
    min-width: 280px;
    max-width: 520px;
    line-height: 1.45;
    white-space: normal;
    word-break: break-word;
}

.badge-audit,
.badge-entity {
    border-radius: 999px;
    padding: 7px 11px;
    font-size: .8rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.audit-create {
    background: #ecfdf3;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.audit-edit {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

.audit-delete,
.audit-deactivate {
    background: #fff1f2;
    color: #be123c;
    border: 1px solid #fecdd3;
}

.audit-activate {
    background: #ecfeff;
    color: #0f766e;
    border: 1px solid #a5f3fc;
}

.audit-reset {
    background: #fff7ed;
    color: #c2410c;
    border: 1px solid #fed7aa;
}

.audit-roles {
    background: #f5f3ff;
    color: #6d28d9;
    border: 1px solid #ddd6fe;
}

.audit-permissions {
    background: #fefce8;
    color: #a16207;
    border: 1px solid #fde68a;
}

.audit-default {
    background: #f3f4f6;
    color: #4b5563;
    border: 1px solid #e5e7eb;
}

.audit-responsables {
    background: #ecfeff;
    color: #0f766e;
    border: 1px solid #99f6e4;
}

.entity-user {
    background: #eef2ff;
    color: #4338ca;
    border: 1px solid #c7d2fe;
}

.entity-role {
    background: #fdf2f8;
    color: #be185d;
    border: 1px solid #fbcfe8;
}

.entity-default {
    background: #f3f4f6;
    color: #4b5563;
    border: 1px solid #e5e7eb;
}

/* =========================
   18. REGISTRO
========================= */

.registro-top-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 220px;
    gap: 16px;
    align-items: start;
    margin-bottom: 16px;
}

/* =========================
   19. RESPONSIVE
========================= */

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

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

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

    .auditoria-filters-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 1180px) {
    .user-row-main {
        grid-template-columns: 1fr;
    }

    .user-row-right {
        justify-content: flex-start;
    }

    .user-row-inline-tools {
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .user-row-badges-top,
    .user-row-actions {
        justify-content: flex-start;
        flex-wrap: wrap;
    }
}

@media (max-width: 1100px) {
    .user-row-extra-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .audit-description {
        min-width: 220px;
        max-width: 360px;
    }

    .audit-route {
        max-width: 180px;
    }

    .dashboard-hero-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .permiso-form-layout {
        grid-template-columns: 1fr;
    }

    .permiso-saldo-card {
        position: static;
    }
}

@media (max-width: 920px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: none;
    }

    .content-area {
        padding: 18px;
    }

    .topbar {
        padding: 16px 18px;
    }

    .grid-two-form {
        grid-template-columns: 1fr;
    }

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

    .roles-user-layout {
        grid-template-columns: 1fr;
    }
}

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

        .permisos-grid .form-group-full {
            grid-column: auto;
        }
}

@media (max-width: 860px) {
    .registro-top-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .filters-grid,
    .roles-filters-grid,
    .auditoria-filters-grid {
        grid-template-columns: 1fr;
    }

    .filters-actions,
    .form-actions {
        flex-direction: column;
    }

    .btn-inline {
        width: 100%;
    }

    .dashboard-hero-top {
        flex-direction: column;
    }

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

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

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

    .topbar-user {
        width: 100%;
        justify-content: space-between;
    }

    .login-card {
        padding: 22px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .user-row-extra-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
    }
}



.dashboard-summary-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

.dashboard-hero-stats-5 {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.dashboard-badge {
    min-width: 108px;
    justify-content: center;
    text-align: center;
    white-space: nowrap;
}

.dashboard-bottom-grid {
    align-items: start;
}

@media (max-width: 1400px) {
    .dashboard-summary-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

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

@media (max-width: 900px) {
    .dashboard-summary-grid,
    .dashboard-hero-stats-5 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-badge {
        min-width: 96px;
    }
}

@media (max-width: 640px) {
    .dashboard-summary-grid,
    .dashboard-hero-stats-5 {
        grid-template-columns: 1fr;
    }

    .dashboard-badge {
        min-width: 88px;
    }
}
.dashboard-summary-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

.dashboard-hero-stats-5 {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.dashboard-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 108px;
    text-align: center;
    white-space: nowrap;
}

.dashboard-bottom-grid {
    align-items: start;
}

@media (max-width: 1400px) {
    .dashboard-summary-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

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

@media (max-width: 900px) {
    .dashboard-summary-grid,
    .dashboard-hero-stats-5 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-badge {
        min-width: 96px;
    }
}

@media (max-width: 640px) {
    .dashboard-summary-grid,
    .dashboard-hero-stats-5 {
        grid-template-columns: 1fr;
    }

    .dashboard-badge {
        min-width: 88px;
    }
}
.filters-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(180px, 1fr));
    gap: 14px;
}

@media (max-width: 1200px) {
    .filters-grid {
        grid-template-columns: repeat(3, minmax(180px, 1fr));
    }
}

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

/* =========================
   FILTROS PANEL
   ========================= */

.filters-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(160px, 1fr));
    gap: 14px;
    align-items: end;
}

.filters-span-2 {
    grid-column: span 2;
}

.filters-span-3 {
    grid-column: span 3;
}

.filters-actions {
    display: flex;
    align-items: end;
}

    .filters-actions .btn {
        width: 100%;
    }

/* responsive */

@media (max-width: 1200px) {

    .filters-grid {
        grid-template-columns: repeat(3, minmax(160px, 1fr));
    }

    .filters-span-2,
    .filters-span-3 {
        grid-column: span 1;
    }
}

@media (max-width: 768px) {

    .filters-grid {
        grid-template-columns: 1fr;
    }
}
.filters-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(160px, 1fr));
    gap: 14px;
    align-items: end;
}

.filters-span-2 {
    grid-column: span 2;
}

.filters-actions {
    display: flex;
    align-items: end;
}

    .filters-actions button {
        width: 100%;
    }

@media (max-width: 1200px) {
    .filters-grid {
        grid-template-columns: repeat(3, minmax(160px, 1fr));
    }

    .filters-span-2 {
        grid-column: span 1;
    }
}

@media (max-width: 768px) {
    .filters-grid {
        grid-template-columns: 1fr;
    }
}
.document-row {
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.document-row-selected {
    background: rgba(91, 108, 255, 0.08);
    border-color: rgba(91, 108, 255, 0.35);
    box-shadow: 0 0 0 1px rgba(91, 108, 255, 0.15) inset;
}
