:root {
    --primary: #2952e3;
    --primary-dark: #1c3aa9;
    --sidebar-bg: #10163a;
    --sidebar-hover: #1b2358;
    --bg-soft: #f4f6fb;
}

* { font-family: 'Poppins', sans-serif; }

body {
    background: var(--bg-soft);
    margin: 0;
}

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

/* SIDEBAR */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, var(--sidebar-bg) 0%, #171e4d 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; bottom: 0; left: 0;
    z-index: 1000;
    transition: transform .25s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: .85rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand i { font-size: 1.8rem; color: #6ea8fe; }
.sidebar-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    flex-shrink: 0;
}

/* Celulares y sidebar en modo overlay: logo aún más compacto */
@media (max-width: 576px) {
    .sidebar-brand { padding: .6rem; }
    .sidebar-logo { width: 32px; height: 32px; }
}

.sidebar-nav {
    padding: 1rem .75rem;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}
/* Scrollbar delgada y discreta, a tono con el menú oscuro (solo aparece si hace falta) */
.sidebar-nav {
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.18) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 5px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb {
    background-color: rgba(255,255,255,.18);
    border-radius: 10px;
}
.sidebar-nav::-webkit-scrollbar-thumb:hover { background-color: rgba(255,255,255,.32); }
.nav-section-title {
    text-transform: uppercase;
    font-size: .7rem;
    letter-spacing: .08em;
    color: #8891c9;
    margin: 1.25rem .5rem .4rem;
}
.sidebar .nav-link {
    color: #c7cdf0;
    padding: .65rem .9rem;
    border-radius: .6rem;
    display: flex;
    align-items: center;
    gap: .7rem;
    margin-bottom: .2rem;
    font-weight: 500;
    font-size: .92rem;
}
.sidebar .nav-link i { font-size: 1.1rem; width: 20px; }
.sidebar .nav-link:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar .nav-link.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(41,82,227,.4);
}
.sidebar-footer { padding: 1rem .75rem 1.5rem; border-top: 1px solid rgba(255,255,255,.08); }

/* MAIN */
.app-main {
    margin-left: 260px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    background: #fff;
    padding: .85rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 2px 10px rgba(0,0,0,.04);
    position: sticky;
    top: 0;
    z-index: 900;
    flex-wrap: wrap;
}

.agency-badge {
    display: flex;
    align-items: center;
    gap: .5rem;
    background: #eef2ff;
    color: var(--primary-dark);
    padding: .45rem .9rem;
    border-radius: 2rem;
    font-weight: 600;
    font-size: .88rem;
}

@media (max-width: 576px) {
    .topbar { padding: .5rem .75rem; gap: .5rem; }
    .agency-badge {
        padding: .3rem .6rem;
        font-size: .72rem;
        gap: .3rem;
        max-width: 100%;
    }
    .agency-badge .btn { padding: .15rem .5rem; font-size: .72rem; }
    .agency-badge .btn-texto { display: none; } /* en celular solo se ve el ícono de "cambiar" */
    .agency-badge span:not(.btn-texto) {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 110px;
    }
}

.content { padding: 1.75rem; }

.card { border: none; border-radius: 1rem; box-shadow: 0 4px 18px rgba(20,20,60,.06); }
.stat-card {
    border-radius: 1rem;
    padding: 1.4rem;
    color: #fff;
    position: relative;
    overflow: hidden;
}
.stat-card i { font-size: 2.2rem; opacity: .35; position: absolute; right: 1rem; top: 1rem; }
.stat-card h3 { font-weight: 700; font-size: 2rem; margin: 0; }
.stat-card p { margin: 0; opacity: .9; font-size: .85rem; }
.bg-grad-blue { background: linear-gradient(135deg, #2952e3, #6ea8fe); }
.bg-grad-green { background: linear-gradient(135deg, #12b886, #63e6be); }
.bg-grad-orange { background: linear-gradient(135deg, #f59f00, #ffd43b); }
.bg-grad-purple { background: linear-gradient(135deg, #7048e8, #b197fc); }

.table thead th { text-transform: uppercase; font-size: .72rem; letter-spacing: .04em; color: #7a7f9a; border-bottom-width: 1px; }

.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top left, #2952e3, #10163a 65%);
    padding: 1rem;
}
.auth-card { max-width: 420px; width: 100%; border-radius: 1.25rem; }
.agency-pick-card {
    border: 2px solid #e7e9f5;
    border-radius: 1rem;
    padding: 1.5rem;
    cursor: pointer;
    transition: .15s;
    text-align: center;
    height: 100%;
}
.agency-pick-card:hover { border-color: var(--primary); transform: translateY(-3px); box-shadow: 0 8px 20px rgba(41,82,227,.15); }

@media (max-width: 991px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.show { transform: translateX(0); }
    .app-main { margin-left: 0; }

    .sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.45);
        z-index: 999; /* debajo del sidebar (que suele ir en 1000+) */
    }
    .sidebar-backdrop.show { display: block; }
}

@media (max-width: 360px) {
    .sidebar { width: 85vw; max-width: 260px; }
}

/* Campos de solo lectura: fondo distinto para que se note a simple vista que
   no se pueden editar. El navegador ya bloquea escribir en ellos por el
   propio atributo readonly/disabled — aquí solo ajustamos que también SE
   VEAN bloqueados: sin el cursor de texto parpadeando y con el puntero
   mostrando que no admite edición (el texto sigue pudiéndose seleccionar
   y copiar, que es útil, por ejemplo, para la clave de acceso). */
input[readonly], textarea[readonly], select[disabled], input[disabled] {
    background-color: #e9ecef !important;
    color: #495057;
    cursor: not-allowed;
    caret-color: transparent; /* oculta el cursor de texto parpadeante */
}

