/* =========================================================
   Barber House Club — Sistema de Gestion
   Tema oscuro premium con identidad champagne/dorado del logo BHC
   ========================================================= */

:root {
    --bg-base:    #0a0a0a;
    --bg-elev:    #0f172a;
    --bg-card:    #1e293b;
    --bg-card-2:  #172033;
    --bg-hover:   #334155;
    --border:     #1e293b;
    --border-2:   #334155;
    --text:       #e2e8f0;
    --text-mute:  #94a3b8;
    --text-dim:   #64748b;
    /* Acento: champagne dorado del isologo BHC */
    --accent:        #C9A24A;
    --accent-hov:    #B8902F;
    --accent-soft:   #3a2e15;
    --accent-bright: #E0B868;

    --st-pendiente:  #fbbf24;
    --st-confirmado: #60a5fa;
    --st-proceso:    #a78bfa;
    --st-finalizado: #10b981;
    --st-cancelado:  #ef4444;
    --st-no-asist:   #6b7280;

    --danger:     #ef4444;
    --success:    #10b981;
    --warning:    #f59e0b;

    --radius-sm: 6px;
    --radius:    10px;
    --radius-lg: 14px;

    --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
    --shadow:    0 4px 12px rgba(0,0,0,.45);
    --shadow-lg: 0 12px 32px rgba(0,0,0,.55);

    --sidebar-w: 232px;
    --header-h:  60px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg-elev);
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hov); }

h1, h2, h3, h4 { margin: 0 0 .5em; color: var(--text); font-weight: 600; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }

/* =========================================================
   Layout: header + sidebar + main
   ========================================================= */

body.app-layout {
    min-height: 100vh;
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    grid-template-rows: var(--header-h) 1fr;
    grid-template-areas:
        "header header"
        "sidebar main";
}

.app-header {
    grid-area: header;
    background: var(--bg-base);
    border-bottom: 1px solid #000;
    display: flex;
    align-items: center;
    padding: 0 18px;
    gap: 14px;
    position: sticky;
    top: 0;
    z-index: 30;
}

.app-menu-toggle {
    display: none;
    background: transparent;
    border: 0;
    color: var(--text);
    padding: 6px;
    cursor: pointer;
    border-radius: var(--radius-sm);
}
.app-menu-toggle:hover { background: var(--bg-hover); }

.app-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 16px;
    letter-spacing: .2px;
    color: var(--text);
}
.app-brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--accent), var(--accent-hov));
    color: #fff;
    font-size: 16px;
}
.app-brand-img {
    height: 36px;
    width: auto;
    object-fit: contain;
    display: block;
}

.app-header-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
}
.app-user-chip {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    background: var(--bg-card-2);
    line-height: 1.2;
}
.app-user-name { font-size: 13px; font-weight: 600; color: var(--text); }
.app-user-role { font-size: 10.5px; color: var(--text-mute); text-transform: uppercase; letter-spacing: .5px; }

.app-logout {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: 1px solid var(--border-2);
    color: var(--text-mute);
    font-size: 12.5px;
    font-weight: 500;
    transition: all .15s;
}
.app-logout:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

/* V17 — Dropdown de enlaces personalizados (topbar) */
.app-links-wrap { position: relative; }
.app-links-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-2);
    background: transparent;
    color: var(--text-mute);
    cursor: pointer;
    font: inherit;
    font-size: 12.5px;
    transition: color .15s, border-color .15s, background .15s;
}
.app-links-trigger:hover,
.app-links-trigger[aria-expanded="true"] {
    color: var(--accent);
    border-color: var(--accent);
    background: rgba(201,162,74,.06);
}
.app-links-caret { font-size: 10px; line-height: 1; }
.app-links-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 220px;
    max-width: 320px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 6px;
    box-shadow: 0 16px 40px rgba(0,0,0,.5);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.app-links-dropdown[hidden] { display: none; }
.app-links-item {
    display: block;
    padding: 8px 12px;
    color: var(--text);
    text-decoration: none;
    border-radius: 6px;
    font-size: 13.5px;
    transition: background .12s, color .12s;
}
.app-links-item:hover {
    background: rgba(201,162,74,.12);
    color: var(--accent-bright);
}

/* Sidebar */
.app-sidebar {
    grid-area: sidebar;
    background: var(--bg-base);
    border-right: 1px solid #000;
    padding: 14px 10px;
    overflow-y: auto;
}

.app-nav { display: flex; flex-direction: column; gap: 2px; }

.app-nav-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-mute);
    font-size: 13.5px;
    font-weight: 500;
    transition: all .12s ease;
}
.app-nav-link:hover {
    background: var(--bg-card);
    color: var(--text);
}
.app-nav-link.is-active {
    background: var(--accent);
    color: #fff;
    box-shadow: var(--shadow-sm);
}
.app-nav-link.is-active .app-nav-ic { color: #fff; }
.app-nav-ic { display: inline-flex; }

/* Main */
.app-main {
    grid-area: main;
    background: var(--bg-elev);
    padding: 22px 26px;
    overflow-y: auto;
    min-height: 0;
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}
.page-head h1 { margin: 0; }
.page-head .page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* =========================================================
   Cards
   ========================================================= */

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(59,130,246,.06), transparent 60%);
    pointer-events: none;
}
.stat-card .stat-label {
    font-size: 11.5px;
    color: var(--text-mute);
    text-transform: uppercase;
    letter-spacing: .6px;
    font-weight: 600;
    margin-bottom: 8px;
}
.stat-card .stat-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.15;
    word-break: break-word;
}
.stat-card .stat-sub {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 4px;
}
.stat-card.is-accent .stat-value { color: var(--accent); }
.stat-card.is-success .stat-value { color: var(--success); }
.stat-card.is-danger .stat-value { color: var(--danger); }

/* Panel generico */
.panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 18px;
    box-shadow: var(--shadow-sm);
}
.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    gap: 10px;
    flex-wrap: wrap;
}
.panel-head h2 { margin: 0; }
.panel-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Grid 2 columnas para charts */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 22px;
}
.chart-box { position: relative; height: 280px; }

/* =========================================================
   Tablas
   ========================================================= */

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

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}
table.data thead th {
    background: var(--bg-card-2);
    color: var(--text-mute);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11.5px;
    letter-spacing: .5px;
    text-align: left;
    padding: 11px 12px;
    border-bottom: 1px solid var(--border-2);
    position: sticky;
    top: 0;
    z-index: 1;
}
table.data tbody td {
    padding: 11px 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
}
table.data tbody tr:hover { background: var(--bg-card-2); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data .col-right { text-align: right; }
table.data .col-center { text-align: center; }
table.data .col-actions { text-align: right; white-space: nowrap; }

.empty-state {
    text-align: center;
    padding: 30px 16px;
    color: var(--text-mute);
    font-size: 13.5px;
}

/* =========================================================
   Filter bar (search + selects en listados)
   ========================================================= */

.filter-bar { padding: 14px 16px; margin-bottom: 14px; }
.filter-bar-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.filter-input,
.filter-select {
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-2);
    background: var(--bg-card-2);
    color: var(--text);
    font: inherit;
    font-size: 13.5px;
    min-height: 38px;
}
.filter-input { flex: 1 1 240px; min-width: 0; }
.filter-input:focus,
.filter-select:focus {
    outline: 0;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(201,162,74,.22);
}
.filter-bar .btn { flex-shrink: 0; }

/* Select inline de Estado del turno (listado de turnos): color segun valor */
.estado-select {
    min-height: 30px;
    padding: 4px 26px 4px 10px;
    border-radius: 999px;
    border: 1px solid currentColor;
    background-color: transparent;
    color: var(--text-mute);
    font: inherit;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
    background-position: calc(100% - 14px) 50%, calc(100% - 9px) 50%;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    transition: filter .12s;
}
.estado-select:hover  { filter: brightness(1.15); }
.estado-select:focus  { outline: 0; box-shadow: 0 0 0 3px rgba(201,162,74,.22); }
.estado-select option { color: var(--text); background: var(--bg-card); font-weight: 500; }

/* V19: Fila destacada en turnos-lista cuando el turno es de HOY y no respondieron WA */
tr.fila-pendiente-hoy td {
    background: rgba(251,191,36,.06);
}
tr.fila-pendiente-hoy td:first-child {
    box-shadow: inset 3px 0 0 var(--st-pendiente);
}
tr.fila-pendiente-hoy:hover td {
    background: rgba(251,191,36,.12);
}

/* V19: Chip "etapas WA enviadas" con tooltip detallado al hover */
.wa-envios-chip {
    display: inline-block;
    padding: 2px 8px;
    background: rgba(96,165,250,.14);
    color: #93c5fd;
    border: 1px solid rgba(96,165,250,.3);
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .3px;
    cursor: help;
    vertical-align: middle;
    margin-right: 2px;
    white-space: nowrap;
}
.wa-envios-chip:hover { background: rgba(96,165,250,.24); color: #b5cdff; }

.estado-select.est-pendiente   { color: var(--st-pendiente);  background-color: rgba(251,191,36,.12); }
.estado-select.est-confirmado  { color: var(--st-confirmado); background-color: rgba(96,165,250,.14); }
.estado-select.est-en_proceso  { color: var(--st-proceso);    background-color: rgba(167,139,250,.14); }
.estado-select.est-finalizado  { color: var(--st-finalizado); background-color: rgba(16,185,129,.14); }
.estado-select.est-cancelado   { color: var(--st-cancelado);  background-color: rgba(239,68,68,.14); }
.estado-select.est-no_asistio  { color: var(--st-no-asist);   background-color: rgba(107,114,128,.18); }

/* =========================================================
   Agenda diaria (grid horas x barberos)
   ========================================================= */

.agenda-wrap {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    max-height: calc(100vh - 240px);
}
.agenda-grid {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 12.5px;
}
.agenda-grid thead th {
    background: var(--bg-card-2);
    color: var(--text-mute);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: .5px;
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-2);
    position: sticky;
    top: 0;
    z-index: 3;
}
.agenda-grid thead .agenda-time-h {
    width: 70px;
    text-align: center;
    background: var(--bg-card);
    z-index: 4;
    left: 0;
}
.agenda-grid tbody td {
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
    padding: 0;
    vertical-align: top;
    min-width: 160px;
    height: 60px;
}
.agenda-grid tbody td.agenda-time {
    background: var(--bg-card);
    color: var(--text-mute);
    text-align: center;
    font-weight: 600;
    font-size: 12px;
    padding: 10px 8px;
    position: sticky;
    left: 0;
    z-index: 2;
    border-right: 1px solid var(--border-2);
    min-width: 70px;
    width: 70px;
    vertical-align: middle;
}
.agenda-cell { background: var(--bg-elev); }
.agenda-cell:hover { background: var(--bg-card-2); }

.agenda-turno {
    display: block;
    text-decoration: none;
    color: var(--text);
    padding: 8px 10px;
    margin: 3px;
    border-radius: 6px;
    border-left: 3px solid var(--text-dim);
    background: rgba(148,163,184,.08);
    transition: transform .12s, background .12s;
    height: calc(100% - 6px);
}
.agenda-turno:hover {
    transform: translateX(2px);
    background: rgba(148,163,184,.14);
    color: var(--text);
}
.agenda-turno.st-pendiente  { border-left-color: var(--st-pendiente);  background: rgba(251,191,36,.10); }
.agenda-turno.st-confirmado { border-left-color: var(--st-confirmado); background: rgba(59,130,246,.10); }
.agenda-turno.st-en_proceso { border-left-color: var(--st-proceso);    background: rgba(167,139,250,.10); }
.agenda-turno.st-finalizado { border-left-color: var(--st-finalizado); background: rgba(16,185,129,.10); }
.agenda-turno.st-cancelado  { border-left-color: var(--st-cancelado);  background: rgba(239,68,68,.10);  opacity: .65; }
.agenda-turno.st-no_asistio { border-left-color: var(--st-no-asist);   background: rgba(107,114,128,.10); opacity: .55; }

.ag-turno-hora { font-size: 11px; color: var(--text-mute); font-weight: 600; margin-bottom: 2px; }
.ag-turno-cli  { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.25; }
.ag-turno-serv { font-size: 11.5px; color: var(--text-mute); margin-top: 2px; }

.agenda-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 56px;
    color: transparent;
    text-decoration: none;
    font-size: 22px;
    font-weight: 300;
    transition: color .12s, background .12s;
}
.agenda-empty:hover {
    color: var(--accent);
    background: rgba(59,130,246,.06);
}

@media (max-width: 700px) {
    .agenda-grid tbody td { min-width: 140px; }
}

/* =========================================================
   Pills de estado de turno
   ========================================================= */

.pill {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .4px;
    line-height: 1.4;
    background: rgba(255,255,255,.06);
    color: var(--text);
}
.pill.st-pendiente   { background: rgba(251,191,36,.18);  color: var(--st-pendiente); }
.pill.st-confirmado  { background: rgba(59,130,246,.18);  color: var(--st-confirmado); }
.pill.st-en_proceso  { background: rgba(167,139,250,.18); color: var(--st-proceso); }
.pill.st-finalizado  { background: rgba(16,185,129,.18);  color: var(--st-finalizado); }
.pill.st-cancelado   { background: rgba(239,68,68,.18);   color: var(--st-cancelado); }
.pill.st-no_asistio  { background: rgba(107,114,128,.22); color: var(--st-no-asist); }

/* =========================================================
   Botones
   ========================================================= */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all .13s;
    text-decoration: none;
    line-height: 1.2;
    min-height: 38px;
}
.btn-primary   { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hov); color: #fff; }
.btn-secondary { background: var(--bg-card); color: var(--text); border-color: var(--border-2); }
.btn-secondary:hover { background: var(--bg-hover); color: var(--text); }
.btn-ghost     { background: transparent; color: var(--text-mute); }
.btn-ghost:hover { background: var(--bg-card); color: var(--text); }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 12px; min-height: 32px; }

/* =========================================================
   Formularios
   ========================================================= */

.form { display: flex; flex-direction: column; gap: 14px; }
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
}
.field { display: flex; flex-direction: column; gap: 5px; }
.field label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: var(--text-mute);
}
.field input,
.field select,
.field textarea {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-2);
    background: var(--bg-card-2);
    color: var(--text);
    font: inherit;
    font-size: 14px;
    min-height: 44px;
    transition: border-color .12s, box-shadow .12s;
}
.field textarea { min-height: 80px; resize: vertical; }
.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: 0;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(201,162,74,.22);
}

/* Inputs/selects DENTRO de tablas (carritos de productos, edicion inline) */
table.data select,
table.data input[type="text"],
table.data input[type="number"],
table.data input[type="tel"],
table.data input[type="email"],
table.data input[type="date"],
table.data input[type="time"],
table.data input[type="datetime-local"] {
    padding: 7px 10px;
    border-radius: 8px;
    border: 1px solid var(--border-2);
    background: var(--bg-card-2);
    color: var(--text);
    font: inherit;
    font-size: 13px;
    min-height: 36px;
    box-sizing: border-box;
    transition: border-color .12s, box-shadow .12s;
}
table.data select { padding-right: 24px; }
table.data select:focus,
table.data input:focus {
    outline: 0;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(201,162,74,.20);
}
.field input::placeholder,
.field textarea::placeholder { color: var(--text-dim); }
.field .hint { font-size: 11.5px; color: var(--text-dim); }
.field .err  { font-size: 12px; color: var(--danger); }

/* =========================================================
   Flash
   ========================================================= */

/* Flash toast: arriba al centro, sobre todo, autodismiss via JS */
.flash {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    min-width: 280px;
    max-width: 520px;
    padding: 12px 18px;
    border-radius: 10px;
    border: 1.5px solid;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 12px 32px rgba(0,0,0,.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: flash-in .25s ease;
}
@keyframes flash-in {
    from { opacity: 0; transform: translate(-50%, -10px); }
    to   { opacity: 1; transform: translate(-50%, 0); }
}
.flash-ok    { background: rgba(16,185,129,.92); border-color: #10b981; color: #fff; }
.flash-error { background: rgba(239,68,68,.92);  border-color: #ef4444; color: #fff; }
.flash-warn  { background: rgba(245,158,11,.92); border-color: #f59e0b; color: #fff; }
.flash-close {
    background: transparent;
    border: 0;
    color: inherit;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    padding: 0 4px;
    opacity: .8;
}
.flash-close:hover { opacity: 1; }

/* =========================================================
   Login (sin layout admin)
   ========================================================= */

body.login-layout {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    background:
        radial-gradient(ellipse at top left, rgba(59,130,246,.15), transparent 50%),
        radial-gradient(ellipse at bottom right, rgba(59,130,246,.08), transparent 50%),
        var(--bg-base);
}
.login-card {
    width: 100%;
    max-width: 380px;
    background: var(--bg-card);
    border: 1px solid var(--border-2);
    border-radius: var(--radius-lg);
    padding: 32px 28px;
    box-shadow: var(--shadow-lg);
}
.login-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 22px;
    text-align: center;
}
.login-brand-mark {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--accent), var(--accent-hov));
    color: #fff;
    font-size: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(201,162,74,.4);
}
.login-brand-name { font-size: 18px; font-weight: 700; }
.login-brand-sub  { font-size: 12.5px; color: var(--text-mute); }
.login-card .field input { background: var(--bg-elev); }
.login-error {
    background: rgba(239,68,68,.12);
    color: #fca5a5;
    border: 1px solid var(--danger);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 14px;
}
.login-foot {
    margin-top: 18px;
    text-align: center;
    font-size: 11.5px;
    color: var(--text-dim);
}

/* =========================================================
   Responsive
   ========================================================= */

@media (max-width: 900px) {
    body.app-layout {
        grid-template-columns: 1fr;
        grid-template-areas:
            "header"
            "main";
    }
    .app-menu-toggle { display: inline-flex; }
    .app-sidebar {
        position: fixed;
        top: var(--header-h);
        left: 0;
        bottom: 0;
        width: 240px;
        z-index: 25;
        transform: translateX(-100%);
        transition: transform .25s ease;
        box-shadow: var(--shadow-lg);
    }
    .app-sidebar.is-open { transform: translateX(0); }
    .app-sidebar-overlay {
        position: fixed;
        inset: var(--header-h) 0 0;
        background: rgba(0,0,0,.55);
        z-index: 24;
        opacity: 0;
        pointer-events: none;
        transition: opacity .2s;
    }
    .app-sidebar-overlay.is-open {
        opacity: 1;
        pointer-events: auto;
    }
    .app-main { padding: 16px 14px; }
    .app-user-chip { display: none; }
    .charts-grid { grid-template-columns: 1fr; }
}

@media (max-width: 540px) {
    .app-brand-name { display: none; }
    .stat-card .stat-value { font-size: 22px; }
    h1 { font-size: 19px; }
    .app-logout span { display: none; }
    .app-logout { padding: 8px; }
    .flash { min-width: auto; max-width: calc(100vw - 24px); top: 12px; padding: 10px 14px; font-size: 13px; }
}

/* ===== V24 Dashboard de decisiones ===== */
.delta { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 999px; margin-left: 6px; vertical-align: middle; letter-spacing: .2px; }
.delta-up   { color: #34d399; background: rgba(16,185,129,.14); }
.delta-down { color: #f87171; background: rgba(239,68,68,.14); }
.delta-flat { color: var(--text-dim); background: rgba(148,163,184,.12); }
.stat-card.stat-hero { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-soft) inset; }
.stat-card.stat-hero .stat-value { color: #fff; }
.cards-grid.mini .stat-card .stat-value { font-size: 20px; }
.kpi-pct { font-size: 12.5px; color: var(--text-mute); font-weight: 500; }
tr.row-link { cursor: pointer; transition: background .12s; }
tr.row-link:hover { background: var(--bg-hover); }
th.sortcol { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortcol:hover { color: var(--text); }
.barb-cell { display: inline-flex; align-items: center; gap: 9px; }
.barb-av { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; flex: none; }
.barb-ini { display: inline-flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent); font-size: 11.5px; font-weight: 700; }
.barmini { height: 8px; background: var(--bg-card-2); border-radius: 4px; overflow: hidden; width: 160px; max-width: 100%; }
.barmini-fill { height: 100%; border-radius: 4px; }
