/* ============================================================
   WaService · Portal de clientes
   Tema "Cyan Logic" (Stitch · Design Optimization Framework)
   Citric Cyan #0097b2 · Primary teal #006578 · Aether Cyan #19c2d6
   Tipografía: Hanken Grotesk
   ============================================================ */

:root {
    /* --- Colores de marca (Cyan Logic) --- */
    --icarus-blue: #0097b2;   /* Citric Cyan (marca principal) */
    --sky-blue: #008097;      /* primary-container */
    --aether-cyan: #19c2d6;   /* acento */
    --icarus-gradient: linear-gradient(135deg, #006578 0%, #0097b2 55%, #19c2d6 100%);

    /* --- Escala primaria (Icarus Blue) --- */
    --primary-50: #fbf8ff;
    --primary-100: #cfcfff;
    --primary-200: #a3a6ff;
    --primary-300: #777dff;
    --primary-400: #4b54ff;
    --primary-500: #0076ae;
    --primary-600: #1922db;
    --primary-700: #00608f;
    --primary-800: #004a6e;
    --primary-900: #060970;
    --primary-950: #00004c;

    /* --- Escala secundaria (Sky Blue) --- */
    --sky-50: #faf8ff;
    --sky-100: #cfdcff;
    --sky-200: #a4c0ff;
    --sky-300: #7aa3ff;
    --sky-400: #4f87ff;
    --sky-500: #0091c7;
    --sky-600: #1d58d6;
    --sky-700: #1646ae;
    --sky-800: #0e3385;
    --sky-900: #07215d;
    --sky-950: #000e34;

    /* --- Escala de acento (Aether Cyan) --- */
    --cyan-50: #f6feff;
    --cyan-100: #caf2f7;
    --cyan-200: #71dae6;
    --cyan-300: #45cede;
    --cyan-500: #19c2d6;
    --cyan-600: #149fb0;
    --cyan-700: #0f7c8a;
    --cyan-800: #0a5a63;
    --cyan-900: #05373d;
    --cyan-950: #001417;

    --ink: #0b1c30; /* on-surface (títulos) */
    --surface: #f8f9ff; /* surface / fondo general */

    /* --- Overrides de Bootstrap --- */
    --bs-primary: #0097b2;
    --bs-primary-rgb: 0,151,178;
    --bs-link-color: #0097b2;
    --bs-link-color-rgb: 0,151,178;
    --bs-link-hover-color: #006578;
    --bs-link-hover-color-rgb: 0,101,120;
    --bs-body-color: #0b1c30;
    --bs-body-font-family: 'Hanken Grotesk', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --bs-border-radius: .5rem;
}

html {
    font-size: 14px;
    position: relative;
    min-height: 100%;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

body {
    margin-bottom: 60px;
    font-family: var(--bs-body-font-family);
    color: var(--bs-body-color);
    background-color: var(--surface);
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-weight: 700;
    color: var(--ink);
    letter-spacing: -.01em;
}

/* Foco accesible en azul de marca */
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus,
.form-control:focus, .form-check-input:focus, .form-select:focus {
    border-color: var(--sky-400);
    box-shadow: 0 0 0 .1rem #fff, 0 0 0 .25rem rgba(0, 145, 199, .5);
}

/* ---------- Utilidades de marca ---------- */
.text-brand { color: var(--icarus-blue) !important; }
.bg-brand-gradient { background: var(--icarus-gradient) !important; }
.text-gradient {
    background: var(--icarus-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: var(--icarus-blue); /* fallback */
}

/* ---------- Mapeo de "primary" al azul Icarus ---------- */
.btn-primary {
    --bs-btn-bg: #0097b2;
    --bs-btn-border-color: #0097b2;
    --bs-btn-hover-bg: #006578;
    --bs-btn-hover-border-color: #006578;
    --bs-btn-active-bg: #00525f;
    --bs-btn-active-border-color: #00525f;
    --bs-btn-disabled-bg: #0097b2;
    --bs-btn-disabled-border-color: #0097b2;
}

/* Botón de acción (Cyan Logic): relleno Citric Cyan sólido con texto blanco. */
.btn-acc {
    --bs-btn-color: #fff;
    --bs-btn-hover-color: #fff;
    --bs-btn-active-color: #fff;
    background-color: var(--icarus-blue);
    border: 1px solid var(--icarus-blue);
    color: #fff;
    font-weight: 600;
}
.btn-acc:hover { background-color: #006578; border-color: #006578; color: #fff; }
.btn-acc:active { background-color: #00525f; color: #fff; }

.bg-primary { background-color: var(--icarus-blue) !important; }
.text-primary { color: var(--icarus-blue) !important; }
.text-bg-primary { background-color: var(--icarus-blue) !important; color: #fff !important; }
.badge.bg-primary, .badge.text-bg-primary { background-color: var(--icarus-blue) !important; }
.link-primary { color: var(--icarus-blue) !important; }

/* ---------- Botones de marca (gradiente) ---------- */
.btn-wa, .btn-brand {
    --bs-btn-color: #fff;
    --bs-btn-hover-color: #fff;
    --bs-btn-active-color: #fff;
    background: var(--icarus-gradient);
    border: 0;
    color: #fff;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 118, 174, .25);
}
.btn-wa:hover, .btn-brand:hover {
    color: #fff;
    filter: brightness(1.07);
    box-shadow: 0 4px 14px rgba(0, 118, 174, .32);
}
.btn-wa:active, .btn-brand:active { filter: brightness(.94); }

.btn-outline-brand {
    color: var(--icarus-blue);
    border: 1px solid var(--icarus-blue);
    background: transparent;
    font-weight: 600;
}
.btn-outline-brand:hover { background: var(--icarus-blue); color: #fff; }

/* ---------- Navbar de marca ---------- */
.navbar-wa { background: var(--icarus-gradient); }
.navbar-wa .navbar-brand,
.navbar-wa .nav-link { color: rgba(255, 255, 255, .9) !important; }
.navbar-wa .nav-link:hover { color: #fff !important; }
.navbar-wa .nav-link.active { color: #fff !important; border-bottom: 2px solid #fff; }
.navbar-wa .dropdown-menu { border: 0; box-shadow: 0 8px 24px rgba(6, 9, 112, .18); }

/* ---------- Lockup de marca (ala + wordmark) ---------- */
.brand-lockup {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    text-decoration: none;
}
.brand-lockup .brand-wing { height: 1.9rem; width: auto; display: block; }
.brand-lockup .brand-logo { height: 5.4rem; width: auto; display: block; }
.brand-lockup .brand-name {
    font-family: var(--bs-body-font-family);
    font-weight: 800;
    font-size: 1.35rem;
    letter-spacing: -.02em;
    line-height: 1;
}
.brand-name-light { color: #fff; }
.brand-name-color {
    background: var(--icarus-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: var(--icarus-blue); /* fallback */
}

/* ---------- Tarjetas ---------- */
.card {
    border: 1px solid rgba(6, 9, 112, .08);
    border-radius: .85rem;
}
.card.shadow-sm {
    box-shadow: 0 1px 3px rgba(6, 9, 112, .06), 0 6px 18px rgba(6, 9, 112, .05) !important;
}
.card-metric .display-6 { color: var(--icarus-blue); font-weight: 700; }

/* ---------- Misceláneos ---------- */
.progress-bar { background: var(--icarus-gradient); }
.form-control, .form-select { border-color: #d7ddf0; }
hr { color: rgba(6, 9, 112, .2); }
code, kbd, pre { color: var(--primary-700); }

/* ============================================================
   Responsive / móvil (Android + iOS)
   ============================================================ */
/* Ícono de hamburguesa visible (blanco) sobre el navbar de marca */
.navbar-wa .navbar-toggler {
    border-color: rgba(255, 255, 255, .55);
    padding: .35rem .55rem;
}
.navbar-wa .navbar-toggler:focus {
    box-shadow: 0 0 0 .2rem rgba(255, 255, 255, .25);
}
.navbar-wa .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(255,255,255,0.9)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2.2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

@media (max-width: 767.98px) {
    /* Logo del navbar más pequeño para no agrandar la barra en móvil */
    .navbar .brand-lockup .brand-logo { height: 2.6rem; }
    /* Menú colapsado: aire entre enlaces */
    .navbar-collapse { padding: .5rem 0 .25rem; }
    .navbar-nav .nav-link { padding-top: .55rem; padding-bottom: .55rem; }
    .navbar-wa .navbar-nav .nav-link.active { border-bottom: 0; border-left: 3px solid #fff; padding-left: .6rem; }
    /* Encabezados un poco más compactos */
    h1, .h1 { font-size: 1.6rem; }
    h2, .h2 { font-size: 1.35rem; }
    .container { padding-left: 1rem; padding-right: 1rem; }
}

/* Tablas con scroll horizontal en pantallas chicas (site.js las envuelve) */
.table-responsive { -webkit-overflow-scrolling: touch; }

/* ============================================================
   Layout con sidebar (Cyan Logic · Stitch)
   Sidebar vertical fijo en escritorio; cajón deslizante en móvil.
   ============================================================ */
.app-shell { display: flex; align-items: stretch; min-height: 100vh; }
body { margin-bottom: 0; } /* el sidebar ocupa el alto; sin margen inferior global */

.app-sidebar {
    flex: 0 0 240px;
    width: 240px;
    background: var(--icarus-gradient);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 1045;
}
.app-sidebar::-webkit-scrollbar { width: 6px; }
.app-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.25); border-radius: 10px; }

.app-brand {
    padding: 1rem 1rem .5rem;
    display: flex; align-items: center; justify-content: center;
}
.app-sidebar .brand-lockup .brand-logo { height: 3rem; }

.app-nav { display: flex; flex-direction: column; gap: 2px; padding: .5rem .6rem; flex: 1 1 auto; }
.app-link {
    display: flex; align-items: center; gap: .6rem;
    padding: .6rem .75rem;
    border-radius: .6rem;
    color: rgba(255,255,255,.88);
    text-decoration: none;
    font-weight: 600;
    font-size: .95rem;
    transition: background-color .15s, color .15s;
}
.app-link:hover { background: rgba(255,255,255,.12); color: #fff; }
.app-link.active { background: rgba(255,255,255,.20); color: #fff; }
.app-ic { width: 1.3rem; text-align: center; font-size: 1rem; flex: 0 0 1.3rem; }

.app-user { padding: .85rem 1rem 1.1rem; border-top: 1px solid rgba(255,255,255,.18); }
.app-user-name { font-weight: 700; font-size: .95rem; }
.app-user-acct { color: rgba(255,255,255,.75); font-size: .8rem; }

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

/* Modo ancho completo: el contenido (bandeja) llena el alto restante del .app-main, sin .container. */
.app-fullbleed { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }

/* Barra superior: solo en móvil (en escritorio la marca vive en el sidebar) */
.app-topbar {
    display: none;
    align-items: center;
    gap: .75rem;
    padding: .5rem .9rem;
    background: #fff;
    border-bottom: 1px solid rgba(6,9,112,.08);
    box-shadow: 0 1px 3px rgba(6,9,112,.05);
    position: sticky; top: 0; z-index: 1030;
}
.app-topbar-brand .brand-logo { height: 2.4rem; }
.app-burger {
    border: 0; background: transparent; padding: .3rem .35rem;
    display: inline-flex; flex-direction: column; gap: 4px; cursor: pointer;
}
.app-burger span { width: 22px; height: 2.5px; border-radius: 2px; background: var(--icarus-blue); display: block; }

.app-backdrop { display: none; }

@media (max-width: 991.98px) {
    .app-topbar { display: flex; }
    .app-sidebar {
        position: fixed; top: 0; left: 0; height: 100vh;
        transform: translateX(-100%);
        transition: transform .25s ease;
        box-shadow: 0 0 40px rgba(0,0,0,.35);
    }
    .app-sidebar.open { transform: none; }
    .app-backdrop {
        position: fixed; inset: 0; background: rgba(6,9,112,.45);
        z-index: 1040;
    }
    .app-backdrop.show { display: block; }
}

/* ============================================================
   Modo nocturno (se guarda en el perfil; cookie "tema")
   ============================================================ */
html.theme-dark body { background-color: #0f1720; color: #e6edf3; }
html.theme-dark .bg-light { background-color: #0f1720 !important; }
html.theme-dark h1, html.theme-dark h2, html.theme-dark h3,
html.theme-dark h4, html.theme-dark h5, html.theme-dark h6 { color: #e6edf3; }
html.theme-dark .text-muted { color: #9fb0c0 !important; }
html.theme-dark hr { color: rgba(255,255,255,.2); }
html.theme-dark .card { background-color: #161f2b; border-color: #26303c; color: #e6edf3; }
html.theme-dark .card.shadow-sm { box-shadow: 0 1px 3px rgba(0,0,0,.45) !important; }
html.theme-dark .table { --bs-table-bg: transparent; color: #e6edf3; }
html.theme-dark .table-light, html.theme-dark .table-light > * { --bs-table-bg: #1b2735; color: #e6edf3; }
html.theme-dark .table-hover > tbody > tr:hover > * { --bs-table-bg: #22303f; color: #fff; }
html.theme-dark .modal-content { background-color: #161f2b; color: #e6edf3; }
html.theme-dark .form-control, html.theme-dark .form-select {
    background-color: #0f1720; border-color: #2b3947; color: #e6edf3;
}
html.theme-dark .form-control::placeholder { color: #6b7b8a; }
html.theme-dark .dropdown-menu { background-color: #161f2b; border-color: #26303c; }
html.theme-dark .dropdown-item { color: #e6edf3; }
html.theme-dark .dropdown-item:hover { background-color: #22303f; color: #fff; }
html.theme-dark .app-topbar { background: #161f2b; border-color: #26303c; }
html.theme-dark .kpi { background: #161f2b; border-color: #26303c; color: #e6edf3; }
html.theme-dark .btn-outline-secondary { color: #cdd9e5; border-color: #3a4756; }
html.theme-dark .btn-outline-secondary:hover { background: #22303f; color: #fff; }
