/**
 * Design system — Sistema Tributario Municipal (mobile-first, institucional)
 *
 * Reset al inicio del archivo: un @import() bloqueaba la aplicación de reglas posteriores hasta resolver
 * la hoja importada; el margen por defecto del UA podía pintarse antes del resto del CSS (FOUC gris).
 * Inter se carga vía <link> en views/layouts/app.php (no duplicar con @import aquí).
 */

html {
    margin: 0;
    padding: 0;
}

/* -------------------------------------------------------------------------- */
/* Variables                                                                  */
/* -------------------------------------------------------------------------- */

:root {
    --color-primary: #1a3a5c;
    --color-primary-light: #2d5a8e;
    --color-accent: #f0a500;
    --color-accent-dark: #c8880a;
    --color-surface: #ffffff;
    --color-bg: #f4f6fa;
    --color-border: #dde2ed;
    --color-text: #1e2a3a;
    --color-text-secondary: #5a6478;
    --color-text-muted: #8892a4;
    --color-success: #1a7f4b;
    --color-warning: #b45309;
    --color-danger: #c0392b;
    --color-info: #1a5fa3;
    --font-base: 'Inter', system-ui, -apple-system, sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.375rem;
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --space-7: 48px;
    --space-8: 64px;
    --border-radius-sm: 4px;
    --border-radius-md: 8px;
    --border-radius-lg: 12px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06);
    --sidebar-w: 256px;
    --header-h: 56px;
    --bottom-nav-h: 56px;
    --z-backdrop: 100;
    --z-drawer: 110;
    --z-header: 120;
    --z-bottom-nav: 115;
    --z-user-dropdown: 125;
    --z-actions-dropdown: 130;
    --drawer-shadow: 8px 0 32px rgba(15, 23, 42, 0.12);
}

/* -------------------------------------------------------------------------- */
/* Utilities                                                                  */
/* -------------------------------------------------------------------------- */

.text-muted {
    color: var(--color-text-secondary);
}

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

.text-xs {
    font-size: var(--font-size-xs);
}

.text-danger {
    color: var(--color-danger);
}

.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;
}

.mt-1 {
    margin-top: var(--space-1);
}
.mt-2 {
    margin-top: var(--space-2);
}
.mt-3 {
    margin-top: var(--space-3);
}
.mt-4 {
    margin-top: var(--space-4);
}
.mt-5 {
    margin-top: var(--space-5);
}
.mt-6 {
    margin-top: var(--space-6);
}

.mb-1 {
    margin-bottom: var(--space-1);
}
.mb-2 {
    margin-bottom: var(--space-2);
}
.mb-3 {
    margin-bottom: var(--space-3);
}
.mb-4 {
    margin-bottom: var(--space-4);
}
.mb-5 {
    margin-bottom: var(--space-5);
}
.mb-6 {
    margin-bottom: var(--space-6);
}

/* -------------------------------------------------------------------------- */
/* Reset / base                                                               */
/* -------------------------------------------------------------------------- */

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

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-base);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

/* -------------------------------------------------------------------------- */
/* Auth (login)                                                               */
/* -------------------------------------------------------------------------- */

body.auth-body {
    min-height: 100dvh;
    margin: 0;
    background: linear-gradient(135deg, #1a3a5c, #2d5a8e);
}

.auth-shell {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-5) var(--space-4);
    padding-bottom: max(var(--space-5), env(safe-area-inset-bottom, 0px));
}

.auth-flash-stack {
    width: 100%;
    max-width: 440px;
    margin-bottom: var(--space-4);
}

.auth-flash-stack .alert:last-child {
    margin-bottom: 0;
}

/* -------------------------------------------------------------------------- */
/* Layout principal                                                           */
/* -------------------------------------------------------------------------- */

.app-shell {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    background: var(--color-bg);
}

.app-header {
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: var(--z-header);
    width: 100%;
    margin: 0;
    /* Relleno superior = zona segura (notch); el fondo blanco cubre hasta el borde del viewport con viewport-fit=cover */
    padding: env(safe-area-inset-top, 0px) 0 0;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
}

.app-header__inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: var(--space-2) var(--space-3);
    min-height: var(--header-h);
    width: 100%;
    max-width: none;
    margin: 0;
    padding: var(--space-2) var(--space-4);
    box-sizing: border-box;
}

.app-header__start {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-width: 0;
    justify-self: start;
}

.app-header__center {
    justify-self: center;
    text-align: center;
    min-width: 0;
    max-width: 46vw;
}

.app-header__page-title {
    margin: 0;
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--color-text);
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-header__end {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-2);
    flex-shrink: 0;
    justify-self: end;
}

.app-header__brand {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-width: 0;
}

.app-header__brand-mark {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 2px;
    border-radius: var(--border-radius-md);
    background: rgba(240, 165, 0, 0.12);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
}

.app-header__logo {
    display: block;
    width: 30px;
    height: 30px;
    max-width: none;
    object-fit: contain;
    border-radius: var(--border-radius-sm);
}

.app-header__titles {
    display: none;
    flex-direction: column;
    gap: 0;
    min-width: 0;
}

.app-header__title {
    margin: 0;
    font-size: var(--font-size-sm);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--color-primary);
    line-height: 1.2;
}

.app-header__tagline {
    display: none;
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
}

.app-header__nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    margin: 0;
    padding: 0 var(--space-2);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-md);
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    color: var(--color-primary);
    font-size: var(--font-size-xs);
    font-weight: 600;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.app-header__nav-toggle:hover {
    background: rgba(240, 165, 0, 0.08);
    border-color: var(--color-accent);
}

.app-header__nav-toggle:focus-visible {
    outline: none;
    box-shadow: var(--shadow-sm), 0 0 0 3px rgba(240, 165, 0, 0.35);
}

.app-header__nav-toggle-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 20px;
    margin-right: var(--space-2);
}

.app-header__nav-toggle-label {
    font-size: var(--font-size-xs);
    font-weight: 600;
    letter-spacing: 0.02em;
}

.app-header__nav-toggle-bar {
    display: block;
    width: 100%;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    transition: transform 0.2s ease, opacity 0.2s ease;
    transform-origin: center;
}

body.nav-drawer-open .app-header__nav-toggle-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

body.nav-drawer-open .app-header__nav-toggle-bar:nth-child(2) {
    opacity: 0;
}

body.nav-drawer-open .app-header__nav-toggle-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

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

.app-header__identity {
    display: none;
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
    min-width: 0;
    max-width: 200px;
}

.app-header__name {
    font-weight: 600;
    color: var(--color-text);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: var(--font-size-sm);
}

.app-header__role {
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-transform: capitalize;
    color: var(--color-text-secondary);
}

.app-header__user-menu {
    position: relative;
    flex-shrink: 0;
}

@media (min-width: 1024px) {
    .app-header__user-menu {
        display: none;
    }
}

.app-header__avatar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin: 0;
    padding: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    color: var(--color-surface);
    font-size: var(--font-size-sm);
    font-weight: 700;
    letter-spacing: 0.02em;
    flex-shrink: 0;
    border: 2px solid rgba(240, 165, 0, 0.35);
    cursor: pointer;
    font-family: inherit;
    line-height: 1;
    -webkit-tap-highlight-color: transparent;
}

.app-header__avatar-btn:hover {
    filter: brightness(1.05);
}

.app-header__avatar-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(240, 165, 0, 0.45);
}

.app-header__avatar-letters {
    pointer-events: none;
}

.app-header__user-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: min(100vw - 24px, 260px);
    padding: var(--space-3) 0;
    margin: 0;
    list-style: none;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-md);
    z-index: var(--z-user-dropdown);
}

.app-header__user-dropdown[hidden] {
    display: none !important;
}

.app-header__user-dropdown-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 var(--space-4) var(--space-3);
    border-bottom: 1px solid var(--color-border);
    margin-bottom: var(--space-2);
}

.app-header__user-dropdown-name {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--color-text);
    word-break: break-word;
}

.app-header__user-dropdown-role {
    font-size: var(--font-size-xs);
    text-transform: capitalize;
}

.app-header__user-dropdown-logout {
    display: block;
    padding: var(--space-3) var(--space-4);
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--color-primary);
    text-decoration: none;
}

.app-header__user-dropdown-logout:hover {
    background: rgba(240, 165, 0, 0.1);
    text-decoration: none;
}

.app-header__user-dropdown-logout:focus-visible {
    outline: none;
    box-shadow: inset 0 0 0 2px rgba(240, 165, 0, 0.45);
}

.app-header__logout {
    display: none;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 var(--space-4);
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--color-primary);
    text-decoration: none;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
    transition: background 0.15s ease, border-color 0.15s ease;
}

.app-header__logout:hover {
    text-decoration: none;
    background: rgba(240, 165, 0, 0.1);
    border-color: var(--color-accent);
}

.app-header__logout:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(240, 165, 0, 0.3);
}

.app-header__guest {
    color: var(--color-text-secondary);
    font-size: var(--font-size-sm);
}

.nav-drawer__backdrop {
    position: fixed;
    inset: 0;
    z-index: var(--z-backdrop);
    background: rgba(22, 28, 45, 0.45);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.22s ease, visibility 0.22s ease;
}

body.nav-drawer-open .nav-drawer__backdrop {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.app-container {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    position: relative;
}

.app-sidebar {
    flex: 0 0 var(--sidebar-w);
    width: var(--sidebar-w);
    max-width: 100%;
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    padding: var(--space-4) 0 var(--space-5);
    box-shadow: 2px 0 16px rgba(15, 23, 42, 0.04);
}

.app-sidebar__inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    padding: 0 var(--space-3) var(--space-3);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.app-sidebar__user {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3);
    margin-bottom: var(--space-4);
    border-radius: var(--border-radius-md);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
}

.app-sidebar__user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    color: var(--color-surface);
    font-weight: 700;
    font-size: var(--font-size-sm);
    flex-shrink: 0;
}

.app-sidebar__user-text {
    min-width: 0;
}

.app-sidebar__user-name {
    margin: 0 0 var(--space-1);
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--color-text);
    line-height: 1.3;
    word-break: break-word;
}

.app-sidebar__user-role {
    margin: 0;
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-transform: capitalize;
    color: var(--color-text-secondary);
}

.app-sidebar__section {
    margin: 0 0 var(--space-4);
}

.app-sidebar__section:last-of-type {
    margin-bottom: 0;
}

.app-sidebar__section-title {
    margin: 0 0 var(--space-2);
    padding: 0 var(--space-1);
    font-size: var(--font-size-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-muted);
}

.app-sidebar__empty {
    margin: 0 var(--space-2);
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    line-height: 1.5;
}

.app-sidebar__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.app-sidebar__item {
    margin: 0;
}

.app-sidebar__link {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-height: 48px;
    padding: var(--space-3) var(--space-3) var(--space-3) var(--space-2);
    border-radius: var(--border-radius-md);
    color: var(--color-text);
    text-decoration: none;
    border: 1px solid transparent;
    font-weight: 600;
    font-size: var(--font-size-sm);
    line-height: 1.3;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.app-sidebar__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 24px;
    color: var(--color-primary-light);
}

.app-sidebar__icon-svg {
    display: block;
}

.app-sidebar__link:hover {
    text-decoration: none;
    background: rgba(26, 58, 92, 0.06);
    color: var(--color-primary);
}

.app-sidebar__link:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(240, 165, 0, 0.28);
}

.app-sidebar__item.is-active .app-sidebar__link {
    background: rgba(240, 165, 0, 0.12);
    border-color: rgba(240, 165, 0, 0.25);
    border-left: 3px solid var(--color-accent);
    padding-left: calc(var(--space-2) - 2px);
    color: var(--color-primary);
}

.app-sidebar__item.is-active .app-sidebar__icon {
    color: var(--color-accent-dark);
}

.app-sidebar__link-text {
    flex: 1 1 auto;
    min-width: 0;
}

.app-main {
    flex: 1 1 auto;
    min-width: 0;
    padding: var(--space-4);
    padding-bottom: var(--space-5);
}

.app-main--with-bottom-nav {
    padding-bottom: calc(var(--bottom-nav-h) + var(--space-4) + env(safe-area-inset-bottom, 0px));
}

.content-wrapper {
    max-width: 1120px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
}

.app-footer {
    flex-shrink: 0;
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    padding: var(--space-3) var(--space-4);
    padding-bottom: max(var(--space-3), env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -1px 0 rgba(15, 23, 42, 0.04);
}

.app-footer__text {
    margin: 0;
    text-align: center;
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
    line-height: 1.4;
}

/* Bottom navigation (mobile / tablet) */
.bottom-nav {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: var(--z-bottom-nav);
    min-height: var(--bottom-nav-h);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.08);
}

.bottom-nav__inner {
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    max-width: 1120px;
    margin: 0 auto;
    min-height: var(--bottom-nav-h);
}

.bottom-nav__link {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: 0;
    min-height: 44px;
    padding: var(--space-2) var(--space-1);
    font-size: 0.625rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    color: var(--color-text-secondary);
    border: none;
    background: transparent;
    border-top: 3px solid transparent;
    transition: color 0.15s ease, background 0.15s ease;
}

.bottom-nav__link:hover {
    text-decoration: none;
    color: var(--color-primary);
    background: rgba(26, 58, 92, 0.04);
}

.bottom-nav__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    color: inherit;
}

.bottom-nav__icon svg {
    width: 22px;
    height: 22px;
}

.bottom-nav__glyph {
    display: block;
    width: 22px;
    height: 22px;
}

.bottom-nav__link.is-active {
    color: var(--color-primary);
    border-top-color: var(--color-accent);
    background: rgba(240, 165, 0, 0.08);
}

/* Page header & filters */
.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-5);
}

.page-header__title {
    margin: 0 0 var(--space-1);
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--color-primary);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.page-header__subtitle {
    margin: 0;
    font-size: var(--font-size-sm);
    line-height: 1.45;
}

.page-header__subtitle:empty {
    display: none;
}

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

.filter-bar {
    margin-bottom: var(--space-4);
    padding: var(--space-4);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-sm);
}

.filter-bar form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: var(--space-3);
}

.filter-bar .form-control {
    flex: 1 1 180px;
    min-width: 0;
}

.filter-bar .btn {
    flex: 0 0 auto;
}

.empty-state {
    text-align: center;
    padding: var(--space-7) var(--space-4);
    background: var(--color-bg);
    border: 1px dashed var(--color-border);
    border-radius: var(--border-radius-lg);
    color: var(--color-text-secondary);
}

.empty-state__title {
    margin: 0 0 var(--space-2);
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--color-text);
}

.empty-state__text {
    margin: 0;
    font-size: var(--font-size-sm);
    max-width: 28rem;
    margin-left: auto;
    margin-right: auto;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-5);
}

.kpi-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-md);
    padding: var(--space-4);
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--color-accent);
}

.kpi-card__label {
    margin: 0 0 var(--space-2);
    font-size: var(--font-size-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-secondary);
}

.kpi-card__value {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--color-primary);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

/* -------------------------------------------------------------------------- */
/* Responsive layout                                                          */
/* -------------------------------------------------------------------------- */

@media (max-width: 1023px) {
    body.nav-drawer-open {
        overflow: hidden;
    }

    .bottom-nav {
        display: block;
    }

    .app-header__page-title {
        display: block;
    }

    .app-header__center {
        display: block;
    }

    .app-header__titles {
        display: none;
    }

    .app-header__identity {
        display: none;
    }

    .app-header__logout {
        display: none;
    }

    .app-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(18rem, 88vw);
        max-width: 300px;
        z-index: var(--z-drawer);
        flex: none;
        padding-top: max(var(--space-4), env(safe-area-inset-top, 0px));
        padding-bottom: max(var(--space-4), env(safe-area-inset-bottom, 0px));
        border-right: none;
        border-radius: 0 var(--border-radius-lg) var(--border-radius-lg) 0;
        box-shadow: var(--drawer-shadow);
        transform: translate3d(-104%, 0, 0);
        transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1);
        overflow: hidden;
    }

    body.nav-drawer-open .app-sidebar {
        transform: translate3d(0, 0, 0);
    }

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

@media (min-width: 768px) and (max-width: 1023px) {
    :root {
        --header-h: 60px;
    }

    .app-header__inner {
        min-height: 60px;
    }
}

@media (min-width: 1024px) {
    :root {
        --header-h: 64px;
    }

    .app-header__inner {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        justify-content: space-between;
        align-items: center;
        gap: var(--space-4);
        min-height: 64px;
        padding: var(--space-3) var(--space-5);
    }

    .app-header__start {
        flex: 0 1 auto;
        min-width: 0;
        justify-self: auto;
    }

    .app-header__end {
        flex: 0 0 auto;
        justify-self: auto;
    }

    .app-header__center {
        display: none;
    }

    .app-header__page-title {
        display: none;
    }

    .app-header__titles {
        display: flex;
    }

    .app-header__title {
        font-size: var(--font-size-lg);
    }

    .app-header__tagline {
        display: block;
    }

    .app-header__brand-mark {
        width: 44px;
        height: 44px;
    }

    .app-header__logo {
        width: 36px;
        height: 36px;
    }

    .app-header__nav-toggle {
        display: none;
    }

    .nav-drawer__backdrop {
        display: none !important;
    }

    .app-header__identity {
        display: flex;
    }

    .app-header__logout {
        display: inline-flex;
    }

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

    .app-main--with-bottom-nav {
        padding-bottom: var(--space-6);
    }

    .app-sidebar {
        position: relative;
        top: auto;
        left: auto;
        bottom: auto;
        transform: none !important;
        transition: none;
        border-radius: 0;
        overflow: visible;
    }

    .app-sidebar__link {
        min-height: 46px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .app-sidebar,
    .nav-drawer__backdrop,
    .app-header__nav-toggle-bar {
        transition: none !important;
    }
}

/* -------------------------------------------------------------------------- */
/* Tipografía                                                                 */
/* -------------------------------------------------------------------------- */

h1,
h2,
h3 {
    color: var(--color-primary);
    line-height: 1.22;
    margin: 0 0 0.55em;
    font-weight: 700;
    letter-spacing: -0.02em;
}

h1 {
    font-size: clamp(1.35rem, 2.2vw, 1.75rem);
}

h2 {
    font-size: clamp(1.15rem, 1.8vw, 1.35rem);
    font-weight: 600;
}

h3 {
    font-size: var(--font-size-lg);
    font-weight: 600;
}

ul {
    margin: 0 0 1em;
    padding-left: 1.25rem;
}

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

a:hover {
    text-decoration: underline;
}

.app-sidebar__link:hover,
.app-header__logout:hover,
.btn:hover,
.pagination a:hover {
    text-decoration: none;
}

img {
    max-width: 100%;
    height: auto;
    vertical-align: middle;
}

button,
input,
select,
textarea {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
}

/* Auth card (shared) */
.auth-layout {
    width: 100%;
    max-width: 440px;
}

.auth-card {
    width: 100%;
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

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

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

.auth-card__logo-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    margin-bottom: var(--space-3);
    border-radius: var(--border-radius-lg);
    background: rgba(26, 58, 92, 0.08);
    border: 1px solid var(--color-border);
}

.auth-card__logo {
    display: block;
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: var(--border-radius-sm);
}

.auth-card__system-name {
    margin: 0;
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--color-primary);
    letter-spacing: -0.02em;
}

.auth-card__title {
    margin: 0;
    text-align: center;
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--color-primary);
    letter-spacing: -0.02em;
}

.auth-card__subtitle {
    margin: var(--space-2) 0 var(--space-5);
    text-align: center;
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    font-weight: 500;
}

.auth-card .btn-primary.btn-block {
    min-height: 48px;
    font-size: var(--font-size-base);
}
