:root {
    color-scheme: light;
}

* {
    box-sizing: border-box;
}

.material-symbols-outlined {
    font-family: 'Material Symbols Outlined', sans-serif;
    font-weight: normal;
    font-style: normal;
    font-size: 1.25rem;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    font-feature-settings: 'liga';
    -webkit-font-smoothing: antialiased;
    font-variation-settings:
        'FILL' 0,
        'wght' 400,
        'GRAD' 0,
        'opsz' 24;
}

.nav-link .nav-icon {
    font-size: 1.22rem;
    width: 1.5rem;
    text-align: center;
    flex-shrink: 0;
}

.metric-icon .material-symbols-outlined {
    font-size: 1.35rem;
}

.btn-action-icon .material-symbols-outlined {
    font-size: 1.125rem;
}

.btn-inline-icon {
    font-size: 1.125rem;
    vertical-align: -3px;
}

body.no-scroll {
    overflow: hidden;
    touch-action: none;
}

.app-bg {
    background:
        radial-gradient(circle at 5% 10%, rgba(56, 189, 248, 0.2), transparent 35%),
        radial-gradient(circle at 85% 20%, rgba(167, 139, 250, 0.18), transparent 35%),
        #f1f5f9;
}

.app-shell {
    min-height: 100vh;
    display: flex;
}

.sidebar {
    width: 16rem;
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 45%, #0f172a 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    overflow-y: auto;
}

.sidebar.open {
    transform: translateX(0);
}

.main-content {
    flex: 1;
    margin-left: 0;
    width: 100%;
    min-width: 0;
}

.auth-main {
    margin-left: 0 !important;
}

.topbar {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 20;
}

.card {
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    background: #fff;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.07);
}

.metric-card {
    border: 1px solid #dbeafe;
    border-radius: 1rem;
    background: #ffffff;
    box-shadow: 0 10px 32px rgba(14, 165, 233, 0.08);
}

.metric-blue {
    background: linear-gradient(180deg, #f0f9ff 0%, #ffffff 100%);
}

.metric-purple {
    border-color: #e9d5ff;
    box-shadow: 0 10px 32px rgba(139, 92, 246, 0.08);
    background: linear-gradient(180deg, #f5f3ff 0%, #ffffff 100%);
}

.metric-green {
    border-color: #bbf7d0;
    box-shadow: 0 10px 32px rgba(16, 185, 129, 0.08);
    background: linear-gradient(180deg, #ecfdf5 0%, #ffffff 100%);
}

.metric-icon {
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 0.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.input {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 0.75rem;
    padding: 0.62rem 0.75rem;
    outline: none;
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input:focus {
    border-color: #0ea5e9;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.18);
}

.btn-primary,
.btn-secondary,
.nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border-radius: 0.75rem;
    transition: all 0.2s ease;
    font-weight: 600;
    cursor: pointer;
}

.btn-primary {
    background: #0ea5e9;
    border: 1px solid #0ea5e9;
    color: #fff;
    padding: 0.62rem 1rem;
}

.btn-primary:hover {
    background: #0284c7;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #fff;
    border: 1px solid #cbd5e1;
    color: #334155;
    padding: 0.55rem 0.9rem;
}

.btn-secondary:hover {
    background: #f8fafc;
    transform: translateY(-1px);
}

.btn-icon {
    width: 2rem;
    height: 2rem;
    border-radius: 0.6rem;
    border: 1px solid #cbd5e1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    color: #334155;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background: #f8fafc;
}

#toggle-menu {
    width: 1.75rem;
    height: 1.75rem;
    font-size: 0.875rem;
    line-height: 1;
    border-radius: 0.45rem;
}

#toggle-menu .material-symbols-outlined {
    font-size: 1.125rem;
}

.btn-action-icon {
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 0.65rem;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #334155;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-action-icon:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.12);
}

.btn-action-edit:hover {
    border-color: #7dd3fc;
    background: #f0f9ff;
    color: #0369a1;
}

.btn-action-delete:hover {
    border-color: #fecaca;
    background: #fff1f2;
    color: #be123c;
}

.btn-action-toggle:hover {
    border-color: #bbf7d0;
    background: #ecfdf5;
    color: #047857;
}

.btn-action-informe:hover {
    border-color: #bae6fd;
    background: #e0f2fe;
    color: #0369a1;
}

.nav-link {
    width: 100%;
    justify-content: flex-start;
    padding: 0.55rem 0.75rem;
    color: #dbeafe;
    border: 1px solid transparent;
}

.nav-link:hover {
    background: rgba(56, 189, 248, 0.15);
    border-color: rgba(56, 189, 248, 0.35);
    color: #ffffff;
}

.fade-in {
    animation: fadeIn 0.35s ease;
}

.hover-lift {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

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

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

.overflow-x-auto table {
    width: 100%;
}

.overflow-x-auto th,
.overflow-x-auto td {
    word-break: break-word;
}

.loading-spinner {
    width: 1rem;
    height: 1rem;
    border-radius: 9999px;
    border: 2px solid rgba(255, 255, 255, 0.6);
    border-top-color: #ffffff;
    animation: spin 0.7s linear infinite;
}

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

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

@media print {
    .no-print {
        display: none !important;
    }

    .print-card {
        box-shadow: none !important;
        border: 1px solid #cbd5e1 !important;
        break-inside: avoid;
    }

    body {
        background: #fff !important;
    }
}

@media (min-width: 768px) {
    .sidebar {
        transform: translateX(0);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .app-shell.has-sidebar .main-content {
        margin-left: 16rem;
        width: calc(100% - 16rem);
    }

    /* Tailwind md:hidden puede perder frente a .btn-icon (inline-flex) por orden de hojas. */
    #toggle-menu {
        display: none !important;
    }
}

@media (max-width: 767px) {
    .topbar {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    .card {
        border-radius: 0.9rem;
    }

    .overflow-x-auto table {
        min-width: 640px;
    }
}
