/**
 * Sistema FUEC ? tema operativo de flota
 * Azul noche + asfalto + ?mbar vial
 */

:root {
    --font: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
    --font-display: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
    --font-mono: "IBM Plex Mono", ui-monospace, monospace;

    --night: #0b1f33;
    --night-2: #12283f;
    --asphalt: #1a2332;
    --asphalt-2: #243044;
    --amber: #f5a623;
    --amber-hover: #e09412;
    --amber-soft: rgba(245, 166, 35, 0.16);
    --amber-glow: rgba(245, 166, 35, 0.28);

    --bg-app: #e8eef4;
    --bg-main: #eef3f8;
    --bg-card: #ffffff;
    --bg-input: #f4f7fb;
    --bg-muted: #dce5ef;
    --border: #c5d0dc;
    --border-strong: #8fa0b3;
    --text: #0b1f33;
    --text-muted: #5a6b7d;
    --accent: #f5a623;
    --accent-hover: #e09412;
    --on-accent: #0b1f33;
    --link: #1a5f8f;
    --error: #c62828;
    --error-soft: #fdecea;
    --ok: #1b7a4e;
    --ok-soft: #e6f6ee;
    --warn: #b86e00;
    --warn-soft: #fff4e0;
    --info: #1a5f8f;
    --info-soft: #e7f1f8;

    --sidebar-bg: linear-gradient(180deg, #0b1f33 0%, #12283f 55%, #1a2332 100%);
    --sidebar-border: rgba(245, 166, 35, 0.12);
    --sidebar-text: #eef3f8;
    --sidebar-text-muted: #9aafc2;
    --sidebar-w: 260px;

    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 8px 28px rgba(11, 31, 51, 0.08);
    --shadow-lg: 0 18px 48px rgba(11, 31, 51, 0.14);
}

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

html {
    font-size: 17px;
}

body {
    margin: 0;
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.55;
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--link);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ??? Auth ??? */

.auth-body {
    min-height: 100vh;
    background-color: var(--night);
    background-image:
        linear-gradient(90deg, transparent 0, transparent calc(50% - 1px), rgba(245, 166, 35, 0.18) calc(50% - 1px), rgba(245, 166, 35, 0.18) calc(50% + 1px), transparent calc(50% + 1px)),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 46px,
            rgba(255, 255, 255, 0.03) 46px,
            rgba(255, 255, 255, 0.03) 48px
        ),
        radial-gradient(ellipse 80% 60% at 15% 10%, rgba(245, 166, 35, 0.18), transparent 55%),
        radial-gradient(ellipse 70% 50% at 90% 90%, rgba(26, 95, 143, 0.35), transparent 50%),
        linear-gradient(165deg, #0b1f33 0%, #12283f 45%, #1a2332 100%);
    background-size: auto, auto, auto, auto, auto;
}

.auth-main {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1.5rem;
}

.auth-shell {
    width: min(100%, 420px);
}

.auth-brand {
    text-align: center;
    margin-bottom: 1.25rem;
    color: #fff;
}

.auth-brand__mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 3.25rem;
    height: 3.25rem;
    padding: 0 0.55rem;
    border-radius: 12px;
    background: var(--amber);
    color: var(--night);
    font-weight: 800;
    font-size: 0.85rem;
    letter-spacing: 0.04em;
    margin-bottom: 0.85rem;
    box-shadow: 0 0 0 6px rgba(245, 166, 35, 0.15);
}

.auth-brand__name {
    font-family: var(--font-display);
    font-size: 1.85rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin: 0;
}

.auth-brand__tag {
    margin: 0.4rem 0 0;
    color: rgba(238, 243, 248, 0.78);
    font-size: 1rem;
}

.auth-body .card {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: var(--shadow-lg);
}

.auth-body .card--narrow {
    width: 100%;
    max-width: none;
}

.auth-card__badge {
    display: none;
}

/* ??? App shell ??? */

.app-body {
    min-height: 100vh;
    background:
        linear-gradient(180deg, #dfe8f1 0%, var(--bg-main) 28%, #e8eef4 100%);
}

.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    grid-template-areas: "sidebar main";
    min-height: 100vh;
}

.app-main {
    min-width: 0;
    grid-area: main;
}

.app-main__inner {
    padding: 1.5rem 1.75rem 2.5rem;
    max-width: 1180px;
}

.sidebar {
    grid-area: sidebar;
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 1.15rem 0.9rem 1rem;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    border-right: 1px solid var(--sidebar-border);
    overflow: auto;
}

.sidebar__brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.35rem 0.45rem 1.1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 1rem;
}

.sidebar__mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.6rem;
    height: 2.6rem;
    padding: 0 0.35rem;
    border-radius: 10px;
    background: var(--amber);
    color: var(--night);
    font-weight: 800;
    font-size: 0.68rem;
    letter-spacing: 0.03em;
}

.sidebar__title {
    font-weight: 600;
    font-size: 1.12rem;
    letter-spacing: -0.015em;
    line-height: 1.25;
}

.sidebar__subtitle {
    color: var(--sidebar-text-muted);
    font-size: 0.86rem;
    margin-top: 0.15rem;
}

.sidebar__nav {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    flex: 1;
}

.sidebar__link {
    display: block;
    padding: 0.72rem 0.85rem;
    border-radius: 9px;
    color: var(--sidebar-text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 1rem;
    border-left: 3px solid transparent;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.sidebar__link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    text-decoration: none;
}

.sidebar__link--active {
    background: var(--amber-soft);
    color: #fff;
    border-left-color: var(--amber);
}

.sidebar__footer {
    margin-top: 1rem;
    padding-top: 0.9rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar__user {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0 0.35rem 0.7rem;
    font-size: 0.95rem;
}

.sidebar__user strong {
    color: #fff;
    font-weight: 600;
}

.sidebar__user span {
    color: var(--sidebar-text-muted);
    text-transform: capitalize;
}

.sidebar .btn--ghost {
    color: var(--sidebar-text);
    border-color: rgba(255, 255, 255, 0.18);
    background: transparent;
}

.sidebar .btn--ghost:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--amber);
    color: #fff;
}

/* ??? Page ??? */

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.35rem;
}

.page-title {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1.85rem;
    font-weight: 600;
    letter-spacing: -0.025em;
    color: var(--night);
}

.page-sub {
    margin: 0.35rem 0 0;
    color: var(--text-muted);
    font-size: 1.02rem;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
    gap: 1rem;
    margin-bottom: 1.35rem;
}

.kpi {
    position: relative;
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.1rem 1.05rem;
    box-shadow: var(--shadow);
}

.kpi::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--amber);
}

.kpi__label {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.01em;
}

.kpi__value {
    margin-top: 0.4rem;
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: -0.03em;
    color: var(--night);
    line-height: 1.1;
}

/* ??? Cards / forms / buttons ??? */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.15rem 1.25rem;
    box-shadow: var(--shadow);
}

.card--narrow {
    max-width: 480px;
}

.card__title {
    margin: 0 0 0.75rem;
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.015em;
    color: var(--night);
}

.card__muted {
    color: var(--text-muted);
    margin: 0 0 1rem;
    font-size: 0.98rem;
}

.card__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.85rem;
}

.form {
    display: grid;
    gap: 0.85rem;
}

.form__label {
    display: grid;
    gap: 0.4rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--night-2);
}

.form__input,
.form select,
.form textarea {
    width: 100%;
    font: inherit;
    font-size: 1rem;
    color: var(--text);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.7rem 0.8rem;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form__input:focus,
.form select:focus,
.form textarea:focus {
    border-color: var(--amber);
    box-shadow: 0 0 0 3px var(--amber-glow);
    background: #fff;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    font: inherit;
    font-size: 0.98rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    padding: 0.65rem 1.05rem;
    cursor: pointer;
    text-decoration: none;
    line-height: 1.25;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.btn:hover {
    text-decoration: none;
}

.btn:active {
    transform: translateY(1px);
}

.btn--primary {
    background: var(--amber);
    color: var(--on-accent);
    border-color: var(--amber);
}

.btn--primary:hover {
    background: var(--amber-hover);
    border-color: var(--amber-hover);
    color: var(--on-accent);
}

.btn--ghost {
    background: #fff;
    color: var(--night);
    border-color: var(--border);
}

.btn--ghost:hover {
    border-color: var(--amber);
    color: var(--night);
    background: #fffaf0;
}

.btn--sm {
    padding: 0.48rem 0.8rem;
    font-size: 0.92rem;
}

/* ??? Tables ??? */
/* ~10 filas visibles; scroll vertical + horizontal si hay m?s registros */

.table-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem 1rem;
    margin-bottom: 0.75rem;
}

.table-toolbar__input {
    max-width: 22rem;
    width: 100%;
}

.table-toolbar__meta {
    font-size: 0.88rem;
    margin: 0;
}

.table-toolbar__filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
    align-items: center;
    font-size: 0.95rem;
}

.table-toolbar__filters a {
    color: var(--text-muted);
    text-decoration: none;
}

.table-toolbar__filters a:hover,
.table-toolbar__filters a.is-active {
    color: var(--navy, #0b1f33);
    font-weight: 600;
}

.table-wrap {
    overflow: auto;
    max-height: min(32rem, 55vh);
    margin: 0 -0.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    -webkit-overflow-scrolling: touch;
    background: #fff;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 1rem;
}

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

.table th {
    position: sticky;
    top: 0;
    z-index: 2;
    font-size: 0.84rem;
    text-transform: uppercase;
    letter-spacing: 0.045em;
    color: var(--text-muted);
    font-weight: 600;
    background: #f7fafc;
    box-shadow: 0 1px 0 var(--border);
}

.table tbody tr:hover {
    background: #f8fafc;
}

.table__row--est-success td:first-child {
    box-shadow: inset 3px 0 0 var(--ok);
}

.table__row--est-warn td:first-child {
    box-shadow: inset 3px 0 0 var(--amber);
}

.table__row--est-danger td:first-child {
    box-shadow: inset 3px 0 0 var(--error);
}

.table__row--est-info td:first-child {
    box-shadow: inset 3px 0 0 var(--info);
}

/* ??? Badges / alerts ??? */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.22rem 0.6rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

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

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

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

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

.alert {
    padding: 0.8rem 0.95rem;
    border-radius: var(--radius-sm);
    margin: 0 0 1rem;
    font-size: 0.92rem;
}

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

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

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

/* Calendario de vigencias */
.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 4px;
}
.cal-grid__head {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted, #64748b);
    text-align: center;
    padding: 0.25rem;
}
.cal-grid__cell {
    min-height: 72px;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 6px;
    padding: 4px 5px;
    background: var(--card, #fff);
    font-size: 0.72rem;
}
.cal-grid__cell--empty {
    border-color: transparent;
    background: transparent;
    min-height: 0;
}
.cal-grid__cell--hoy {
    outline: 2px solid var(--accent, #0ea5e9);
    outline-offset: -1px;
}
.cal-grid__cell--evento {
    background: #f8fafc;
}
.cal-grid__num {
    font-weight: 700;
    font-size: 0.8rem;
    margin-bottom: 2px;
}
.cal-grid__ev {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-decoration: none;
    border-radius: 3px;
    padding: 1px 3px;
    margin-top: 1px;
    color: inherit;
}
.cal-grid__ev--warn { background: #fef3c7; color: #92400e; }
.cal-grid__ev--info { background: #e0f2fe; color: #075985; }
.cal-grid__ev--muted { background: #f1f5f9; color: #64748b; }
.cal-grid__more { color: var(--muted, #64748b); font-size: 0.7rem; }

/* Manual de usuario */
.manual-toc { margin-bottom: 1rem; }
.manual-toc ul {
    margin: 0.5rem 0 0;
    padding-left: 1.2rem;
    columns: 2;
    gap: 1.5rem;
}
.manual-toc a { color: var(--accent, #0b1f33); text-decoration: none; }
.manual-toc a:hover { text-decoration: underline; }
.manual-section { margin-bottom: 1rem; scroll-margin-top: 1rem; }
.manual-list { margin: 0; padding-left: 1.2rem; }
.manual-list li { margin: 0.35rem 0; }

@media (max-width: 720px) {
    .cal-grid__cell { min-height: 52px; }
    .cal-grid__ev { display: none; }
    .cal-grid__cell--evento .cal-grid__num::after {
        content: " ·";
        color: var(--accent);
    }
    .manual-toc ul { columns: 1; }
}

/* ??? Public verify ??? */

.public-verify {
    width: min(100%, 560px);
}

.public-verify .card__title {
    font-size: 1.35rem;
}

/* ??? Toasts (reuse epn class names used by JS) ??? */

.epn-toast-root {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    width: min(360px, calc(100vw - 2rem));
    pointer-events: none;
}

.epn-toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    padding: 0.8rem 0.9rem;
    border-radius: var(--radius-sm);
    background: var(--night);
    color: #fff;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.epn-toast--visible {
    opacity: 1;
    transform: translateY(0);
}

.epn-toast--hide {
    opacity: 0;
    transform: translateY(8px);
}

.epn-toast--ok {
    border-left: 4px solid var(--amber);
}

.epn-toast--error {
    border-left: 4px solid #ff6b6b;
}

.epn-toast--warn {
    border-left: 4px solid var(--amber);
}

.epn-toast__icon {
    font-weight: 700;
}

.epn-toast__text {
    flex: 1;
    font-size: 0.9rem;
}

.epn-toast__close {
    border: 0;
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
}

.btn--warn {
    background: #fff4e0;
    color: var(--warn);
    border-color: #f0c36a;
}

.btn--warn:hover {
    background: #ffe8b8;
    border-color: var(--amber);
    color: var(--night);
}

.row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
}

.modal {
    border: 0;
    padding: 0;
    background: transparent;
    max-width: calc(100vw - 2rem);
}

.modal::backdrop {
    background: rgba(11, 31, 51, 0.55);
}

.modal__card {
    width: min(440px, 100%);
    margin: auto;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.2rem 1.25rem;
    box-shadow: var(--shadow-lg);
}

.modal__actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.35rem;
}

/* ??? Responsive ??? */

.topbar {
    display: none;
}

.sidebar__close {
    display: none;
}

.sidebar-backdrop {
    display: none;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.form-grid--2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 960px) {
    .topbar {
        display: flex;
        grid-area: topbar;
        align-items: center;
        gap: 0.75rem;
        position: sticky;
        top: 0;
        z-index: 40;
        min-height: 3.4rem;
        padding: 0.55rem 0.85rem;
        padding-left: max(0.85rem, env(safe-area-inset-left));
        padding-right: max(0.85rem, env(safe-area-inset-right));
        background: #0b1f33;
        color: #fff;
        border-bottom: 1px solid rgba(245, 166, 35, 0.2);
    }

    .topbar__menu {
        width: 2.6rem;
        height: 2.6rem;
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: 9px;
        background: transparent;
        display: inline-flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 5px;
        cursor: pointer;
        flex-shrink: 0;
    }

    .topbar__menu span {
        display: block;
        width: 1.15rem;
        height: 2px;
        background: #fff;
        border-radius: 2px;
    }

    .topbar__brand {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        min-width: 0;
        flex: 1;
    }

    .topbar__brand strong {
        font-size: 1rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .topbar__mark {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 2rem;
        height: 2rem;
        padding: 0 0.3rem;
        border-radius: 8px;
        background: var(--amber);
        color: var(--night);
        font-size: 0.62rem;
        font-weight: 800;
        flex-shrink: 0;
    }

    .topbar__page {
        display: none;
        font-size: 0.92rem;
        color: rgba(255, 255, 255, 0.75);
        max-width: 40%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .app-shell {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        grid-template-areas:
            "topbar"
            "main";
    }

    .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 50;
        background: rgba(11, 31, 51, 0.5);
    }

    .sidebar-backdrop[hidden] {
        display: none !important;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(86vw, 300px);
        max-width: 300px;
        height: 100vh;
        height: 100dvh;
        z-index: 60;
        transform: translateX(-105%);
        transition: transform 0.22s ease;
        border-right: 1px solid var(--sidebar-border);
        padding-top: max(1rem, env(safe-area-inset-top));
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }

    .app-shell.nav-open .sidebar {
        transform: translateX(0);
    }

    .sidebar__brand {
        position: relative;
        padding-right: 2.5rem;
    }

    .sidebar__close {
        display: inline-flex;
        position: absolute;
        right: 0.2rem;
        top: 0.2rem;
        width: 2.2rem;
        height: 2.2rem;
        border: 0;
        border-radius: 8px;
        background: rgba(255, 255, 255, 0.08);
        color: #fff;
        font-size: 1.4rem;
        line-height: 1;
        cursor: pointer;
        align-items: center;
        justify-content: center;
    }

    .sidebar__nav {
        display: flex;
        flex-direction: column;
        gap: 0.2rem;
    }

    .sidebar__link {
        min-height: 2.75rem;
        display: flex;
        align-items: center;
    }

    .app-main__inner {
        padding: 1rem 0.9rem 2rem;
        padding-left: max(0.9rem, env(safe-area-inset-left));
        padding-right: max(0.9rem, env(safe-area-inset-right));
        max-width: none;
    }

    body.nav-lock {
        overflow: hidden;
    }

    .page-head {
        flex-direction: column;
        align-items: stretch;
    }

    .page-head .btn {
        width: 100%;
    }

    .page-title {
        font-size: 1.55rem;
    }

    .kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.75rem;
    }

    .kpi__value {
        font-size: 1.65rem;
    }

    .card {
        padding: 1rem;
    }

    .table-wrap {
        margin: 0 -0.15rem;
        max-height: min(24rem, 48vh);
        -webkit-overflow-scrolling: touch;
    }

    .table th,
    .table td {
        padding: 0.7rem 0.55rem;
        font-size: 0.95rem;
    }

    .row-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .row-actions .btn,
    .row-actions form {
        width: 100%;
    }

    .row-actions form .btn {
        width: 100%;
    }

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

    .modal__card {
        width: min(100vw - 1.25rem, 440px);
        max-height: calc(100dvh - 2rem);
        overflow: auto;
    }

    .modal__actions {
        flex-direction: column-reverse;
    }

    .modal__actions .btn {
        width: 100%;
    }

    .epn-toast-root {
        left: 0.75rem;
        right: 0.75rem;
        bottom: max(0.75rem, env(safe-area-inset-bottom));
        width: auto;
    }

    .auth-main {
        padding: 1rem;
        align-items: flex-start;
        padding-top: 2rem;
    }

    .auth-brand__name {
        font-size: 1.55rem;
    }
}

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

    html {
        font-size: 16px;
    }

    .topbar__page {
        display: none;
    }
}

@media (min-width: 561px) and (max-width: 960px) {
    .topbar__page {
        display: block;
    }
}

@media (min-width: 961px) and (max-width: 1200px) {
    .app-main__inner {
        padding: 1.25rem 1.25rem 2rem;
    }

    :root {
        --sidebar-w: 240px;
    }
}

/* Preferencias de accesibilidad / touch */
@media (hover: none) and (pointer: coarse) {
    .btn,
    .sidebar__link,
    .form__input,
    .form select,
    .form textarea {
        min-height: 2.75rem;
    }
}
