/* =====================================================================
   Adherencia · Sistema de diseño compartido (claro / oscuro)
   Usado por index.html y super/*.html. Tailwind se usa solo para layout.
   ===================================================================== */

:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --surface-2: #f9fafb;
    --surface-3: #f1f3f6;
    --border: #e5e8ec;
    --border-strong: #d4d9e0;
    --text: #0f1729;
    --text-2: #4b5567;
    --text-3: #8a94a6;

    --brand: #4f46e5;
    --brand-600: #4338ca;
    --brand-soft: #eef0ff;
    --brand-text: #4338ca;

    --ok: #059669;     --ok-soft: #ecfdf5;     --ok-border: #a7f3d0;
    --warn: #d97706;   --warn-soft: #fffbeb;   --warn-border: #fde68a;
    --danger: #e11d48; --danger-soft: #fff1f2; --danger-border: #fecdd3;

    --bath: #7c3aed;    --bath-soft: #f5f3ff;    --bath-border: #ddd6fe;
    --food: #ea580c;    --food-soft: #fff7ed;    --food-border: #fed7aa;
    --quality: #0284c7; --quality-soft: #f0f9ff; --quality-border: #bae6fd;

    --shadow-sm: 0 1px 2px rgba(15, 23, 41, .05);
    --shadow: 0 1px 2px rgba(15, 23, 41, .04), 0 2px 6px rgba(15, 23, 41, .05);
    --shadow-lg: 0 12px 40px rgba(15, 23, 41, .14);
    --radius: 16px;
    --radius-sm: 10px;
    color-scheme: light;
}

html.dark {
    --bg: #0a0d14;
    --surface: #111622;
    --surface-2: #151b28;
    --surface-3: #1b2232;
    --border: #222a3a;
    --border-strong: #2d3649;
    --text: #e8ecf4;
    --text-2: #a4aec0;
    --text-3: #6c778b;

    --brand: #6366f1;
    --brand-600: #5457e6;
    --brand-soft: rgba(99, 102, 241, .15);
    --brand-text: #a5b4fc;

    --ok: #34d399;     --ok-soft: rgba(16, 185, 129, .12);  --ok-border: rgba(52, 211, 153, .28);
    --warn: #fbbf24;   --warn-soft: rgba(245, 158, 11, .12); --warn-border: rgba(251, 191, 36, .3);
    --danger: #fb7185; --danger-soft: rgba(244, 63, 94, .13); --danger-border: rgba(251, 113, 133, .32);

    --bath: #a78bfa;    --bath-soft: rgba(139, 92, 246, .14);  --bath-border: rgba(167, 139, 250, .3);
    --food: #fb923c;    --food-soft: rgba(249, 115, 22, .13);  --food-border: rgba(251, 146, 60, .3);
    --quality: #38bdf8; --quality-soft: rgba(14, 165, 233, .13); --quality-border: rgba(56, 189, 248, .3);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 2px 8px rgba(0, 0, 0, .2);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, .5);
    color-scheme: dark;
}

/* ---------- Base ---------- */
html, body { background: var(--bg); color: var(--text); }
body {
    font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
    font-feature-settings: 'cv11', 'ss01';
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color .2s ease, color .2s ease;
}
::selection { background: var(--brand-soft); color: var(--brand-text); }
.tnum { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum', 'cv11'; }
.mono { font-family: ui-monospace, 'SF Mono', 'Cascadia Mono', Menlo, Consolas, monospace; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: padding-box; }

/* ---------- Texto ---------- */
.text-1 { color: var(--text); }
.muted { color: var(--text-2); }
.subtle { color: var(--text-3); }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--text-3); }
.h-page { font-size: 22px; font-weight: 700; letter-spacing: -.02em; color: var(--text); line-height: 1.2; }
.h-card { font-size: 15px; font-weight: 600; letter-spacing: -.01em; color: var(--text); }

/* ---------- Superficies ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 20px; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.surface-2 { background: var(--surface-2); }
.surface-3 { background: var(--surface-3); }
.divider { border-color: var(--border); }
.hairline { border-top: 1px solid var(--border); }

/* ---------- Logo ---------- */
.logo { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff;
        background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%); box-shadow: 0 4px 12px rgba(99, 102, 241, .35); flex-shrink: 0; }
.logo-lg { width: 52px; height: 52px; border-radius: 15px; font-size: 26px; }

/* ---------- Botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 14px;
       border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; border: 1px solid transparent; cursor: pointer;
       white-space: nowrap; transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s, transform .1s; user-select: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--brand-soft); }
.btn.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 1px 2px rgba(79, 70, 229, .3); }
.btn.btn-primary:hover:not(:disabled) { background: var(--brand-600); }
.btn.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.btn.btn-secondary:hover:not(:disabled) { background: var(--surface-3); }
.btn.btn-ghost { background: transparent; color: var(--text-2); }
.btn.btn-ghost:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.btn.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-border); }
.btn.btn-danger:hover:not(:disabled) { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.btn-success { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-border); }
.btn.btn-success:hover:not(:disabled) { background: var(--ok); color: #fff; border-color: var(--ok); }
.btn.btn-dark { background: var(--text); color: var(--surface); }
.btn.btn-dark:hover:not(:disabled) { opacity: .9; }
.btn-sm { height: 32px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn-lg { height: 46px; padding: 0 18px; font-size: 15px; border-radius: 12px; }
.btn-icon { width: 38px; padding: 0; }
.btn-icon.btn-sm { width: 32px; }
.btn i { font-size: 1.1em; }

/* Botones de pausa (página del asesor) */
.btn.btn-bath { background: var(--bath-soft); color: var(--bath); border-color: var(--bath-border); }
.btn.btn-bath:hover:not(:disabled) { background: var(--bath); color: #fff; }
.btn.btn-food { background: var(--food-soft); color: var(--food); border-color: var(--food-border); }
.btn.btn-food:hover:not(:disabled) { background: var(--food); color: #fff; }
.btn.btn-quality { background: var(--quality-soft); color: var(--quality); border-color: var(--quality-border); }
.btn.btn-quality:hover:not(:disabled) { background: var(--quality); color: #fff; }

/* ---------- Formularios ---------- */
.label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.hint { font-size: 12px; color: var(--text-3); margin-top: 6px; }
.input { width: 100%; height: 40px; padding: 0 12px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
         background: var(--surface); color: var(--text); font-size: 14px; outline: none; transition: border-color .15s, box-shadow .15s; }
.input::placeholder { color: var(--text-3); }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.input[readonly] { background: var(--surface-3); color: var(--text-2); cursor: not-allowed; }
textarea.input { height: auto; padding: 10px 12px; line-height: 1.5; resize: vertical; }
select.input { appearance: none; padding-right: 32px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 256 256'%3E%3Cpath fill='%238a94a6' d='M213.66 101.66l-80 80a8 8 0 0 1-11.32 0l-80-80a8 8 0 0 1 11.32-11.32L128 164.69l74.34-74.35a8 8 0 0 1 11.32 11.32Z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center; }
input[type="date"].input, input[type="time"].input { cursor: pointer; }
html.dark input[type="date"]::-webkit-calendar-picker-indicator,
html.dark input[type="time"]::-webkit-calendar-picker-indicator { filter: invert(.8); }
.field { position: relative; }
.field > i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-size: 16px; pointer-events: none; }
.field > .input { padding-left: 36px; }
.checkbox { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; }

/* ---------- Chips / badges ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px;
        font-size: 12px; font-weight: 600; border: 1px solid transparent; white-space: nowrap; line-height: 1; }
.chip i { font-size: 13px; }
.chip-neutral { background: var(--surface-3); color: var(--text-2); border-color: var(--border); }
.chip-brand { background: var(--brand-soft); color: var(--brand-text); }
.chip-ok { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-border); }
.chip-warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-border); }
.chip-danger { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-border); }
.chip-bath { background: var(--bath-soft); color: var(--bath); border-color: var(--bath-border); }
.chip-food { background: var(--food-soft); color: var(--food); border-color: var(--food-border); }
.chip-quality { background: var(--quality-soft); color: var(--quality); border-color: var(--quality-border); }

.dot { width: 7px; height: 7px; border-radius: 99px; background: currentColor; flex-shrink: 0; }
.dot-live { position: relative; }
.dot-live::after { content: ''; position: absolute; inset: -3px; border-radius: 99px; background: currentColor; opacity: .35; animation: dotPulse 1.8s ease-out infinite; }
@keyframes dotPulse { 0% { transform: scale(.6); opacity: .5; } 100% { transform: scale(1.8); opacity: 0; } }

/* ---------- Colores semánticos ---------- */
.c-bath { color: var(--bath); }       .bg-bath { background: var(--bath); }       .soft-bath { background: var(--bath-soft); }
.c-food { color: var(--food); }       .bg-food { background: var(--food); }       .soft-food { background: var(--food-soft); }
.c-quality { color: var(--quality); } .bg-quality { background: var(--quality); } .soft-quality { background: var(--quality-soft); }
.c-ok { color: var(--ok); }           .bg-ok { background: var(--ok); }           .soft-ok { background: var(--ok-soft); }
.c-warn { color: var(--warn); }       .bg-warn { background: var(--warn); }       .soft-warn { background: var(--warn-soft); }
.c-danger { color: var(--danger); }   .bg-danger { background: var(--danger); }   .soft-danger { background: var(--danger-soft); }
.c-brand { color: var(--brand-text); } .soft-brand { background: var(--brand-soft); }

/* Ícono en cuadro */
.icon-tile { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-size: 18px; flex-shrink: 0; }
.icon-tile-lg { width: 44px; height: 44px; border-radius: 12px; font-size: 22px; }

/* ---------- Progreso ---------- */
.progress { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress > span, .progress > div { display: block; height: 100%; width: 0; border-radius: inherit; transition: width 1s linear, background-color .3s; }

/* ---------- Tablas ---------- */
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.table thead th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); color: var(--text-3); font-size: 11.5px;
                  font-weight: 600; text-transform: uppercase; letter-spacing: .06em; text-align: left; padding: 10px 16px;
                  border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); color: var(--text); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background-color .12s; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .row-click { cursor: pointer; }
.empty { padding: 56px 16px; text-align: center; color: var(--text-3); font-size: 14px; }
.empty i { font-size: 36px; display: block; margin: 0 auto 10px; opacity: .6; }

/* ---------- Avatar ---------- */
.avatar { width: 36px; height: 36px; border-radius: 99px; display: grid; place-items: center; font-weight: 600; font-size: 13px;
          background: var(--brand-soft); color: var(--brand-text); flex-shrink: 0; letter-spacing: .02em; }
.avatar-sm { width: 30px; height: 30px; font-size: 11.5px; }

/* ---------- Layout del panel (supervisor) ---------- */
.app-shell { display: flex; height: 100vh; overflow: hidden; }
.sidebar { width: 248px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; }
.sidebar-brand { height: 64px; display: flex; align-items: center; gap: 10px; padding: 0 18px; border-bottom: 1px solid var(--border); }
.nav-section { padding: 14px 12px 6px; }
.nav-item { display: flex; align-items: center; gap: 10px; width: 100%; height: 38px; padding: 0 12px; border-radius: 9px;
            color: var(--text-2); font-size: 14px; font-weight: 500; transition: background-color .12s, color .12s; text-align: left; }
.nav-item i { font-size: 18px; }
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item.active { background: var(--brand-soft); color: var(--brand-text); font-weight: 600; }
.topbar { height: 64px; flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 28px;
          border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(10px); z-index: 10; }
.page { flex: 1; overflow-y: auto; padding: 24px 28px 40px; }
.page-inner { max-width: 1400px; margin: 0 auto; }

/* Navegación inferior en móvil (supervisor) */
.mobile-nav { display: none; }
@media (max-width: 767px) {
    .sidebar { display: none; }
    .topbar { padding: 0 16px; }
    .page { padding: 16px 16px 88px; }
    .mobile-nav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; background: var(--surface);
                  border-top: 1px solid var(--border); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around; }
    .mobile-nav a, .mobile-nav button { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10.5px; font-weight: 600;
                  color: var(--text-3); padding: 6px 10px; border-radius: 10px; }
    .mobile-nav i { font-size: 20px; }
    .mobile-nav .active { color: var(--brand-text); background: var(--brand-soft); }
}

/* ---------- KPI ---------- */
.kpi { display: flex; align-items: center; gap: 14px; padding: 18px 20px; }
.kpi-value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; color: var(--text); }

/* ---------- Pestañas segmentadas ---------- */
.segmented { display: inline-flex; padding: 3px; background: var(--surface-3); border-radius: 10px; gap: 2px; }
.segmented button { height: 32px; padding: 0 12px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- Modales / paneles ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(10, 13, 20, .5); backdrop-filter: blur(4px); z-index: 60; transition: opacity .2s ease; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg);
         transition: transform .2s ease, opacity .2s ease; }
.drawer { position: absolute; top: 0; right: 0; bottom: 0; width: 100%; max-width: 420px; background: var(--surface);
          border-left: 1px solid var(--border); box-shadow: var(--shadow-lg); transition: transform .25s ease; display: flex; flex-direction: column; }

/* ---------- Toast ---------- */
.toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; align-items: center; gap: 10px;
         min-width: 280px; max-width: 440px; padding: 12px 16px; border-radius: 12px; font-size: 14px; font-weight: 500;
         background: #111827; color: #f9fafb; box-shadow: var(--shadow-lg); border: 1px solid rgba(255, 255, 255, .08); }
.toast.toast-error { background: #be123c; }
.toast i { font-size: 18px; }
.fade-in { animation: fadeIn .22s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.toast.fade-in { animation: toastIn .22s ease both; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- Spinner ---------- */
.spinner { width: 18px; height: 18px; border-radius: 99px; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; display: inline-block; }
.spinner-lg { width: 28px; height: 28px; border-width: 3px; color: var(--brand); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Login ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px;
             background: radial-gradient(1200px 600px at 10% -10%, var(--brand-soft), transparent 60%),
                         radial-gradient(900px 500px at 110% 110%, var(--bath-soft), transparent 60%), var(--bg); }
.auth-card { width: 100%; max-width: 380px; padding: 32px; }

/* ---------- Anillo de progreso ---------- */
.pring { transform: rotate(-90deg); }
.pring circle { fill: none; stroke-linecap: round; }
.pring .ring-track { stroke: var(--surface-3); }
.pring .ring-value { transition: stroke-dashoffset 1s linear, stroke .3s; }

/* ---------- Varios ---------- */
.kbd { font-size: 11px; font-weight: 600; padding: 2px 6px; border-radius: 6px; background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border); }
.state-card { transition: box-shadow .2s, border-color .2s, background-color .2s; }
.state-card.is-active-bath { border-color: var(--bath); box-shadow: 0 0 0 3px var(--bath-soft); }
.state-card.is-active-food { border-color: var(--food); box-shadow: 0 0 0 3px var(--food-soft); }
.state-card.is-active-quality { border-color: var(--quality); box-shadow: 0 0 0 3px var(--quality-soft); }
.state-card.is-over { border-color: var(--danger-border); background: var(--danger-soft); }
.agent-card { transition: border-color .15s, box-shadow .15s, transform .15s; }
.agent-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.offline { opacity: .62; }
