:root {
    --nav: #0F2260;
    --nav2: #1A3A8F;
    --teal: #00C9A7;
    --teal-light: #E0FAF5;
    --page: #F0F4FA;
    --card: #ffffff;
    --border: #E2E8F0;
    --t1: #0F2260;
    --t2: #4A5568;
    --t3: #8896A8;
    --green-bg: #E0FAF5;
    --green-t: #00695C;
    --amber-bg: #FEF6E4;
    --amber-t: #7B4F12;
    --red-bg: #FEE8EA;
    --red-t: #7B1E1E;
    --blue-bg: #E8EEFB;
    --blue-t: #1A3A8F;
    --sidebar-width: 200px;
    --topbar-height: 48px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; background: var(--page); font-family: system-ui, -apple-system, sans-serif; }

/* ── Layout principal ── */
.app-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.app-sidebar {
    width: var(--sidebar-width);
    background: var(--nav);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow-y: auto;
    z-index: 100;
}

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.app-topbar {
    height: var(--topbar-height);
    background: #ffffff;
    border-bottom: 0.5px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    flex-shrink: 0;
    z-index: 50;
}

.app-content {
    flex: 1;
    overflow: hidden;
    padding: 18px 20px;
    background: var(--page);
    display: flex;
    flex-direction: column;
}

/* ── Sidebar ── */
.sb-logo {
    padding: 14px 16px;
    border-bottom: 0.5px solid rgba(255,255,255,0.1);
}

.sb-logo-title { font-size: 13px; font-weight: 500; color: #fff; margin: 0; }
.sb-logo-sub { font-size: 10px; color: var(--teal); margin-top: 2px; }

.sb-nav { flex: 1; padding: 8px; }

.sb-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    margin-bottom: 2px;
    text-decoration: none;
    transition: background .15s;
}

.sb-item:hover { background: rgba(255,255,255,0.08); }
.sb-item.active { background: rgba(0,201,167,0.18); }
.sb-item.active .sb-label { color: #fff; font-weight: 500; }
.sb-label { font-size: 12px; color: rgba(255,255,255,0.65); flex: 1; }
.sb-badge {
    background: #E53E3E;
    color: #fff;
    font-size: 9px;
    padding: 1px 5px;
    border-radius: 20px;
    font-weight: 500;
}
.sb-badge.warn { background: #F6A623; }
.sb-sep { height: 0.5px; background: rgba(255,255,255,0.1); margin: 6px 8px; }

.sb-user {
    padding: 10px 14px;
    border-top: 0.5px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 8px;
}

.sb-avatar {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--teal);
    display: flex; align-items: center; justify-content: center;
    font-size: 10px; font-weight: 500; color: var(--nav);
    flex-shrink: 0;
}

.sb-uname { font-size: 11px; color: #fff; font-weight: 500; }
.sb-urole { font-size: 10px; color: rgba(255,255,255,0.45); }

/* ── Topbar ── */
.topbar-title { font-size: 15px; font-weight: 500; color: var(--t1); }
.topbar-right { display: flex; gap: 8px; align-items: center; }

/* ── Hamburguesa — oculta en escritorio ── */
.topbar-hamburger {
    display: none;
}

/* ── Overlay — oculto por defecto ── */
.sidebar-overlay {
    display: none;
}

/* ── Cards ── */
.hta-card {
    background: #fff;
    border-radius: 10px;
    border: 0.5px solid var(--border);
    padding: 12px 14px;
    margin-bottom: 8px;
}

.hta-card.buena { border-left: 3px solid var(--teal); border-radius: 0 10px 10px 0; }
.hta-card.mtto { border-left: 3px solid #F6A623; border-radius: 0 10px 10px 0; }
.hta-card.baja { border-left: 3px solid #E53E3E; border-radius: 0 10px 10px 0; }

/* ── Badges ── */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 500;
}
.badge-green { background: var(--green-bg); color: var(--green-t); }
.badge-amber { background: var(--amber-bg); color: var(--amber-t); }
.badge-red { background: var(--red-bg); color: var(--red-t); }
.badge-blue { background: var(--blue-bg); color: var(--blue-t); }
.badge-gray { background: #F4F6F9; color: #4A5568; }

/* ── Botones ── */
.btn-primary {
    background: var(--nav2);
    color: #fff;
    padding: 7px 16px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    white-space: nowrap;
}

.btn-secondary {
    background: var(--blue-bg);
    color: var(--blue-t);
    padding: 7px 16px;
    border-radius: 7px;
    font-size: 13px;
    border: 0.5px solid #C5D4E8;
    cursor: pointer;
    white-space: nowrap;
}

.btn-teal {
    background: var(--teal-light);
    color: #009E84;
    padding: 7px 16px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 500;
    border: 0.5px solid #9FE1CB;
    cursor: pointer;
}

/* ── Tabla ── */
.mud-table-head .mud-table-cell {
    background: var(--blue-bg) !important;
    color: var(--nav2) !important;
    font-weight: 500 !important;
}

/* ── Login ── */
.login-page {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.login-left {
    flex: 1;
    background: var(--nav);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.login-right {
    width: 360px;
    background: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

/* ── Responsive Mobile ── */
@media (max-width: 768px) {

    /* Login */
    .login-left { display: none; }
    .login-right { width: 100%; }

    /* Visibilidad escritorio/móvil */
    .desktop-only { display: none !important; }
    .mobile-only { display: block !important; }

    /* Contenido */
    .app-content { padding: 12px; }

    /* Hamburguesa visible */
    .topbar-hamburger { display: flex; }

    /* Sidebar: oculto fuera de pantalla por defecto */
    .app-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: var(--sidebar-width);
        height: 100%;
        transform: translateX(-100%);
        transition: transform .25s ease;
        z-index: 200;
    }

    /* Sidebar abierto */
    .app-sidebar.open {
        transform: translateX(0);
    }

    /* Overlay visible cuando sidebar está abierto */
    .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.45);
        z-index: 199;
    }
}

/* ── Responsive Desktop ── */
@media (min-width: 769px) {
    .mobile-only { display: none !important; }
    .desktop-only { display: block !important; }
}

.app-topbar-mobile {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: #fff;
    border-bottom: 0.5px solid #E2E8F0;
}

@media (max-width: 768px) {
    .app-topbar-mobile {
        display: flex;
    }
}