/* ============================================================
   MoicroFit — Sistema de diseño (identidad Moicro)
   Fintech moderno · verde · modo oscuro · Inter + JetBrains Mono
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
    --moi-green-400: #34d399;
    --moi-green-500: #10b981;
    --moi-green-600: #059669;
    --moi-green-700: #047857;
    --moi-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);

    --bg: #0a0f0d;
    --surface: #111815;
    --surface-2: #18211d;
    --surface-3: #1f2a25;
    --border: #233029;
    --border-strong: #2f4138;

    --text: #e8f0ec;
    --text-muted: #9fb3a9;
    --text-dim: #6b8278;

    --primary: var(--moi-green-500);
    --primary-hover: var(--moi-green-400);
    --on-primary: #04150e;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #38bdf8;

    --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
    --sp-5: 24px; --sp-6: 32px; --sp-8: 48px;

    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 18px;

    --shadow-1: 0 1px 2px rgba(0,0,0,.4);
    --shadow-2: 0 4px 16px rgba(0,0,0,.45);
    --shadow-glow: 0 0 0 1px rgba(16,185,129,.15), 0 8px 30px rgba(16,185,129,.10);

    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }

html, body {
    margin: 0; padding: 0;
    font-family: var(--font-sans);
    background: var(--bg); color: var(--text);
    font-size: 16px; line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-weight: 600; line-height: 1.25; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 28px; } h2 { font-size: 22px; } h3 { font-size: 18px; }

h1:focus { outline: none; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

.mono, .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* Layout shell */
.app-shell { display: flex; min-height: 100dvh; }
.sidebar {
    width: 248px; flex-shrink: 0;
    background: var(--surface); border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    padding: var(--sp-5) var(--sp-3);
    position: sticky; top: 0; height: 100dvh;
}
.brand {
    display: flex; align-items: center; gap: var(--sp-3);
    padding: 0 var(--sp-3) var(--sp-5);
    font-weight: 700; font-size: 19px; letter-spacing: -0.02em;
}
.brand-logo {
    width: 34px; height: 34px; border-radius: 9px;
    background: var(--moi-gradient);
    display: grid; place-items: center;
    color: var(--on-primary); font-weight: 700;
    box-shadow: var(--shadow-glow);
}
.brand span.accent { color: var(--primary); }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
    display: flex; align-items: center; gap: var(--sp-3);
    padding: 10px var(--sp-3); border-radius: var(--radius-sm);
    color: var(--text-muted); font-size: 14px; font-weight: 500;
    cursor: pointer; transition: background .15s ease, color .15s ease;
    min-height: 44px;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--surface-3); color: var(--text); }
.nav-item.active .nav-icon { color: var(--primary); }
.nav-icon { width: 20px; height: 20px; flex-shrink: 0; }
.nav-section { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-dim); padding: var(--sp-4) var(--sp-3) var(--sp-2); }
.sidebar-footer { margin-top: auto; padding-top: var(--sp-4); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    height: 64px; flex-shrink: 0;
    border-bottom: 1px solid var(--border);
    background: rgba(10,15,13,.7); backdrop-filter: blur(12px);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 var(--sp-6); position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 20px; }
.content { padding: var(--sp-6); flex: 1; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--sp-5); }
.card-2 { background: var(--surface-2); }

/* KPI */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--sp-4); margin-bottom: var(--sp-6); }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--sp-5); position: relative; overflow: hidden; }
.kpi::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--moi-gradient); }
.kpi-label { font-size: 13px; color: var(--text-muted); margin-bottom: var(--sp-2); }
.kpi-value { font-family: var(--font-mono); font-size: 30px; font-weight: 600; letter-spacing: -0.02em; }
.kpi-delta { font-size: 12px; margin-top: var(--sp-2); display: flex; align-items: center; gap: 4px; }
.kpi-delta.up { color: var(--success); }
.kpi-delta.down { color: var(--danger); }

/* Tablas */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data thead th { text-align: left; padding: var(--sp-3) var(--sp-4); background: var(--surface-2); color: var(--text-muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--border); }
table.data tbody td { padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border); }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr { background: var(--surface); transition: background .12s; }
table.data tbody tr:hover { background: var(--surface-2); }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; }
.badge-dot { width: 6px; height: 6px; border-radius: 50%; }
.badge.activo { background: rgba(16,185,129,.12); color: var(--moi-green-400); }
.badge.activo .badge-dot { background: var(--moi-green-400); }
.badge.lead { background: rgba(56,189,248,.12); color: var(--info); }
.badge.lead .badge-dot { background: var(--info); }
.badge.pausado { background: rgba(245,158,11,.12); color: var(--warning); }
.badge.pausado .badge-dot { background: var(--warning); }
.badge.baja { background: rgba(239,68,68,.12); color: var(--danger); }
.badge.baja .badge-dot { background: var(--danger); }

/* Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2); height: 44px; padding: 0 var(--sp-5); border-radius: var(--radius-sm); border: 1px solid transparent; font-family: var(--font-sans); font-size: 14px; font-weight: 600; cursor: pointer; transition: all .15s ease; white-space: nowrap; }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); box-shadow: var(--shadow-glow); }
.btn-ghost { background: transparent; color: var(--text-muted); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-sm { height: 34px; padding: 0 var(--sp-3); font-size: 13px; }

/* Avatar */
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--surface-3); color: var(--text); display: grid; place-items: center; font-size: 13px; font-weight: 600; flex-shrink: 0; }
.user-cell { display: flex; align-items: center; gap: var(--sp-3); }

/* Inputs */
.input, .select {
    width: 100%; height: 44px; padding: 0 var(--sp-3);
    background: var(--surface-2); border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm); color: var(--text); font-family: var(--font-sans); font-size: 14px;
}
.input:focus, .select:focus { outline: none; border-color: var(--primary); }
.field { margin-bottom: var(--sp-4); }
.field label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }

/* Utilidades */
.row { display: flex; align-items: center; }
.between { justify-content: space-between; }
.gap-2 { gap: var(--sp-2); } .gap-3 { gap: var(--sp-3); } .gap-4 { gap: var(--sp-4); }
.mt-4 { margin-top: var(--sp-4); } .mt-6 { margin-top: var(--sp-6); }
.mb-4 { margin-bottom: var(--sp-4); } .mb-2 { margin-bottom: var(--sp-2); }
.muted { color: var(--text-muted); }
.dim { color: var(--text-dim); font-size: 13px; }
.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: var(--sp-5); }
.section-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-4); }

@media (max-width: 980px) {
    .sidebar { position: fixed; left: -260px; z-index: 100; transition: left .25s ease; }
    .sidebar.open { left: 0; }
    .grid-2 { grid-template-columns: 1fr; }
    .content { padding: var(--sp-4); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

.login-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 24px; background: radial-gradient(1200px 600px at 50% -10%, rgba(16,185,129,.08), transparent), var(--bg); }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 32px; box-shadow: var(--shadow-2); }

.valid.modified:not([type=checkbox]) { outline: 1px solid var(--primary); }
.invalid { outline: 1px solid var(--danger); }
.validation-message { color: var(--danger); }

#blazor-error-ui { background: var(--danger); color: white; bottom: 0; box-shadow: var(--shadow-2); display: none; left: 0; padding: 12px 18px; position: fixed; width: 100%; z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 12px; top: 8px; }
.blazor-error-boundary { background: var(--danger); padding: 1rem; color: white; border-radius: var(--radius-sm); }
.blazor-error-boundary::after { content: "Se ha producido un error."; }

/* ============================================================
   v3 — capa de tokens y componentes alineados con MoicroFit v3
   (handoff de Claude Design · blue-cool dark + multi-color)
   ============================================================ */
:root {
    /* Superficies v3 (más azuladas y profundas que el verde original) */
    --v3-bg:      #0b0f14;
    --v3-bg-2:    #0f141b;
    --v3-card:    #151c25;
    --v3-card-2:  #1c2530;
    --v3-card-3:  #232e3b;
    --v3-border:  #243040;
    --v3-border-strong: #324050;
    --v3-divider: rgba(255,255,255,.06);

    --v3-text:   #f1f5f9;
    --v3-text-2: #94a3b8;
    --v3-text-3: #64748b;

    --v3-em:    #10b981;
    --v3-em-2:  #34d399;
    --v3-em-d:  #047857;

    /* Paleta multi-color de acento */
    --v3-c-protein: #60a5fa;   /* azul */
    --v3-c-carb:    #f97316;   /* naranja */
    --v3-c-fat:     #fbbf24;   /* ámbar */
    --v3-c-fiber:   #a78bfa;   /* púrpura */
    --v3-c-cardio:  #ef4444;   /* rojo */
    --v3-c-rest:    #38bdf8;   /* cian */

    --v3-warn:   #f59e0b;
    --v3-danger: #ef4444;
    --v3-info:   #38bdf8;
    --v3-purple: #a78bfa;
    --v3-orange: #fb923c;
}

/* Modo claro — se activa con <html data-theme="light"> */
html[data-theme="light"] {
    --v3-bg:      #f8fafc;
    --v3-bg-2:    #f1f5f9;
    --v3-card:    #ffffff;
    --v3-card-2:  #f1f5f9;
    --v3-card-3:  #e2e8f0;
    --v3-border:  #e2e8f0;
    --v3-border-strong: #cbd5e1;
    --v3-divider: rgba(0,0,0,.06);

    --v3-text:   #0f172a;
    --v3-text-2: #475569;
    --v3-text-3: #94a3b8;

    /* Verdes esmeralda ajustados un punto más oscuros para contraste */
    --v3-em:    #059669;
    --v3-em-2:  #10b981;
    --v3-em-d:  #065f46;
}

/* Botón flotante de toggle de tema */
.theme-toggle {
    position: fixed; bottom: 16px; right: 16px;
    width: 42px; height: 42px; border-radius: 50%;
    background: var(--v3-card); border: 1px solid var(--v3-border);
    color: var(--v3-text); display: grid; place-items: center;
    cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.2);
    z-index: 1000; font-size: 18px;
}
.theme-toggle:hover { background: var(--v3-card-2); }

/* Aplicamos los tokens v3 al shell de la app (overrides) */
html, body { background: var(--v3-bg); color: var(--v3-text); }
.app-shell { background: var(--v3-bg); }

/* Sidebar v3 — 240px, fondo bg-2, item activo con barra esmeralda */
.sidebar {
    width: 240px;
    background: var(--v3-bg-2);
    border-right: 1px solid var(--v3-border);
    padding: 20px 12px 16px;
}
.brand { padding: 6px 12px 24px; gap: 10px; font-size: 17px; font-weight: 800; letter-spacing: -0.02em; }
.brand-logo {
    width: 34px; height: 34px; border-radius: 10px;
    background: linear-gradient(135deg, #10b981, #047857);
    color: #fff; font-weight: 800;
    filter: drop-shadow(0 4px 12px rgba(16,185,129,0.30));
}
.brand span.accent { color: var(--v3-em-2); }

.nav { gap: 2px; }
.nav-section { font-size: 10px; color: var(--v3-text-3); padding: 14px 12px 6px; }
.nav-item {
    height: 40px; min-height: 40px; padding: 0 12px; border-radius: 10px;
    color: var(--v3-text-2); font-size: 13px; font-weight: 600;
    position: relative; gap: 12px;
}
.nav-item:hover { background: rgba(255,255,255,.04); color: var(--v3-text); }
.nav-item.active {
    background: linear-gradient(90deg, rgba(16,185,129,0.18), rgba(16,185,129,0.04));
    color: var(--v3-em-2);
}
.nav-item.active::before {
    content: ''; position: absolute; left: 0; top: 8px; bottom: 8px;
    width: 3px; border-radius: 2px; background: var(--v3-em-2);
}
.nav-item.active .nav-icon { color: var(--v3-em-2); }
.nav-icon { width: 18px; height: 18px; stroke-width: 1.8; }
.nav-item.active .nav-icon { stroke-width: 2; }
.nav-count {
    margin-left: auto; font-family: var(--font-mono); font-size: 10px;
    color: var(--v3-text-3); font-weight: 600;
}
.nav-badge {
    margin-left: auto; background: var(--v3-em); color: #021712;
    font-size: 10px; font-weight: 700; border-radius: 8px; padding: 1px 6px;
    font-family: var(--font-mono);
}

/* Tarjeta "Mejorar plan" en el sidebar */
.side-upgrade {
    padding: 14px; border-radius: 14px; margin: auto 0 10px;
    background: linear-gradient(135deg, rgba(167,139,250,0.14), rgba(56,189,248,0.08));
    border: 1px solid rgba(167,139,250,0.22);
}
.side-upgrade .icon { color: #a78bfa; }
.side-upgrade .title { font-size: 13px; font-weight: 700; color: var(--v3-text); margin-top: 6px; }
.side-upgrade .sub { font-size: 11px; color: var(--v3-text-3); margin-top: 2px; line-height: 1.4; }
.side-upgrade button {
    width: 100%; height: 32px; margin-top: 10px;
    background: rgba(255,255,255,.06); color: var(--v3-text);
    border: 1px solid var(--v3-border); border-radius: 8px;
    font-family: var(--font-sans); font-size: 11px; font-weight: 600; cursor: pointer;
}

/* Fila de usuario al pie */
.side-user {
    padding: 10px; border-radius: 12px;
    background: var(--v3-card); border: 1px solid var(--v3-border);
    display: flex; align-items: center; gap: 10px;
}
.side-user .avatar {
    width: 32px; height: 32px; border-radius: 10px;
    background: linear-gradient(135deg, #a78bfa, #7c3aed);
    color: #fff; font-size: 12px; font-weight: 700;
}
.side-user .meta { flex: 1; min-width: 0; }
.side-user .name { font-size: 12px; font-weight: 700; color: var(--v3-text); }
.side-user .role { font-size: 10px; color: var(--v3-text-3); }

/* Topbar v3 — 64px, search 320, bell con punto */
.topbar {
    height: 64px; background: var(--v3-bg); backdrop-filter: none;
    border-bottom: 1px solid var(--v3-border);
    padding: 0 28px; gap: 20px;
}
.topbar h1 { font-size: 18px; font-weight: 800; letter-spacing: -0.01em; }
.topbar .sub { font-size: 12px; color: var(--v3-text-3); margin-top: 2px; }
.topbar-search {
    position: relative; width: 320px;
}
.topbar-search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--v3-text-3); }
.topbar-search input {
    width: 100%; height: 38px; border-radius: 10px;
    background: var(--v3-card); border: 1px solid var(--v3-border);
    color: var(--v3-text); font-family: var(--font-sans); font-size: 13px;
    padding: 0 12px 0 36px; outline: none;
}
.topbar-bell {
    position: relative; width: 38px; height: 38px; border-radius: 10px;
    background: var(--v3-card); border: 1px solid var(--v3-border);
    color: var(--v3-text-2); display: grid; place-items: center; cursor: pointer;
}
.topbar-bell::after {
    content: ''; position: absolute; top: 8px; right: 8px;
    width: 8px; height: 8px; border-radius: 4px;
    background: var(--v3-danger); border: 2px solid var(--v3-card);
}

/* Contenido — fondo bg v3 */
.content { padding: 28px; background: var(--v3-bg); }

/* Cards v3 */
.v3-card {
    background: var(--v3-card);
    border: 1px solid var(--v3-border);
    border-radius: 16px;
    padding: 22px;
    position: relative;
}
.v3-card.tight { padding: 14px; border-radius: 14px; }

/* Botones v3 */
.v3-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 38px; padding: 0 16px; border-radius: 10px;
    border: 0; cursor: pointer; user-select: none;
    font-family: var(--font-sans); font-size: 13px; font-weight: 600;
    transition: transform .1s, box-shadow .2s;
}
.v3-btn.primary {
    background: linear-gradient(135deg, #10b981, #047857);
    color: #fff;
    box-shadow: 0 6px 20px rgba(16,185,129,0.30), inset 0 1px 0 rgba(255,255,255,0.15);
}
.v3-btn.primary:hover { box-shadow: 0 8px 26px rgba(16,185,129,0.40), inset 0 1px 0 rgba(255,255,255,0.20); }
.v3-btn.ghost { background: var(--v3-card); color: var(--v3-text); border: 1px solid var(--v3-border); }
.v3-btn.ghost:hover { background: var(--v3-card-2); }
.v3-btn:active { transform: scale(0.98); }
.v3-btn.sm { height: 32px; padding: 0 12px; font-size: 12px; border-radius: 8px; }

/* Chip v3 — píldora con tinte */
.v3-chip {
    display: inline-flex; align-items: center; gap: 6px;
    height: 24px; padding: 0 10px; border-radius: 999px;
    font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
}
.v3-chip .dot { width: 5px; height: 5px; border-radius: 3px; background: currentColor; }
.v3-chip.em     { background: rgba(16,185,129,0.18);  color: var(--v3-em-2); }
.v3-chip.info   { background: rgba(56,189,248,0.16);  color: var(--v3-info); }
.v3-chip.warn   { background: rgba(245,158,11,0.16);  color: var(--v3-warn); }
.v3-chip.danger { background: rgba(239,68,68,0.16);   color: var(--v3-danger); }
.v3-chip.purple { background: rgba(167,139,250,0.18); color: var(--v3-purple); }
.v3-chip.orange { background: rgba(251,146,60,0.18);  color: var(--v3-orange); }

/* KPI cards v3 — acento por color, icono caja */
.kpi-grid-v3 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 1100px) { .kpi-grid-v3 { grid-template-columns: repeat(2, 1fr); } }
.kpi-card {
    padding: 18px; border-radius: 16px;
    background: var(--v3-card);
    border: 1px solid var(--v3-border);
}
.kpi-card .head { display: flex; align-items: center; justify-content: space-between; }
.kpi-card .label { font-size: 11px; font-weight: 700; color: var(--v3-text-2); text-transform: uppercase; letter-spacing: 0.06em; }
.kpi-card .icon-box {
    width: 34px; height: 34px; border-radius: 10px;
    display: grid; place-items: center;
}
.kpi-card .value-row { display: flex; align-items: baseline; gap: 8px; margin-top: 12px; }
.kpi-card .value { font-family: var(--font-mono); font-size: 32px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; color: var(--v3-text); }
.kpi-card .delta { font-family: var(--font-mono); font-size: 12px; font-weight: 700; }
.kpi-card .delta.up { color: var(--v3-em-2); }
.kpi-card .delta.down { color: var(--v3-danger); }
.kpi-card .sub { font-size: 12px; color: var(--v3-text-3); margin-top: 6px; }

/* Tinte por accent */
.kpi-card.em     { background: linear-gradient(140deg, color-mix(in oklab, #10b981 10%, var(--v3-card)), var(--v3-card)); border-color: color-mix(in oklab, #10b981 22%, var(--v3-border)); }
.kpi-card.em     .icon-box { background: rgba(16,185,129,0.20);  color: #10b981; }
.kpi-card.info   { background: linear-gradient(140deg, color-mix(in oklab, #38bdf8 10%, var(--v3-card)), var(--v3-card)); border-color: color-mix(in oklab, #38bdf8 22%, var(--v3-border)); }
.kpi-card.info   .icon-box { background: rgba(56,189,248,0.20); color: #38bdf8; }
.kpi-card.orange { background: linear-gradient(140deg, color-mix(in oklab, #fb923c 10%, var(--v3-card)), var(--v3-card)); border-color: color-mix(in oklab, #fb923c 22%, var(--v3-border)); }
.kpi-card.orange .icon-box { background: rgba(251,146,60,0.20); color: #fb923c; }
.kpi-card.purple { background: linear-gradient(140deg, color-mix(in oklab, #a78bfa 10%, var(--v3-card)), var(--v3-card)); border-color: color-mix(in oklab, #a78bfa 22%, var(--v3-border)); }
.kpi-card.purple .icon-box { background: rgba(167,139,250,0.20); color: #a78bfa; }

/* Tabla v3 — headers en mayúsculas, fondo bg-2 */
.v3-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.v3-table thead tr { background: var(--v3-bg-2); }
.v3-table thead th {
    padding: 10px 16px; text-align: left;
    font-size: 10px; font-weight: 700; color: var(--v3-text-3);
    text-transform: uppercase; letter-spacing: 0.08em;
    border-bottom: 1px solid var(--v3-border);
}
.v3-table tbody td { padding: 12px 16px; border-top: 1px solid var(--v3-divider); }
.v3-table tbody tr:hover { background: rgba(255,255,255,.02); }

/* Barra de adherencia inline (60×4) */
.adh-bar { display: inline-flex; align-items: center; gap: 8px; }
.adh-bar .track { width: 60px; height: 4px; border-radius: 2px; background: var(--v3-card-2); overflow: hidden; }
.adh-bar .fill { height: 100%; }
.adh-bar .fill.good { background: var(--v3-em); }
.adh-bar .fill.warn { background: var(--v3-warn); }
.adh-bar .fill.bad  { background: var(--v3-danger); }
.adh-bar .val { font-family: var(--font-mono); font-size: 12px; font-weight: 600; color: var(--v3-text); }

/* Avatar con gradiente (32 por defecto) */
.v3-avatar {
    display: inline-grid; place-items: center; color: #fff; font-weight: 700;
    border-radius: 12px;
    width: 32px; height: 32px; font-size: 12px;
    background: linear-gradient(135deg, #10b981, #047857);
}
.v3-avatar.lg { width: 76px; height: 76px; font-size: 26px; border-radius: 22px; }
.v3-avatar.md { width: 44px; height: 44px; font-size: 16px; border-radius: 14px; }
.v3-avatar.sm { width: 30px; height: 30px; font-size: 11px; border-radius: 10px; }
.v3-avatar.violet { background: linear-gradient(135deg, #a78bfa, #7c3aed); }
.v3-avatar.blue   { background: linear-gradient(135deg, #60a5fa, #2563eb); }
.v3-avatar.amber  { background: linear-gradient(135deg, #f59e0b, #d97706); }
.v3-avatar.rose   { background: linear-gradient(135deg, #fb7185, #e11d48); }
.v3-avatar.cyan   { background: linear-gradient(135deg, #34d399, #10b981); }

/* Próximas sesiones (lista en sidebar derecho del dashboard) */
.next-list { display: flex; flex-direction: column; gap: 8px; }
.next-row {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: 10px;
    border: 1px solid transparent;
}
.next-row.next {
    background: linear-gradient(90deg, rgba(16,185,129,0.10), transparent);
    border-color: rgba(16,185,129,0.22);
}
.next-row .when { text-align: center; min-width: 44px; }
.next-row .time { font-family: var(--font-mono); font-size: 13px; font-weight: 700; color: var(--v3-text); }
.next-row.next .time { color: var(--v3-em-2); }
.next-row .day { font-size: 9px; color: var(--v3-text-3); text-transform: uppercase; letter-spacing: 0.08em; margin-top: 2px; font-weight: 600; }
.next-row .who { flex: 1; min-width: 0; }
.next-row .who .name { font-size: 12px; font-weight: 600; color: var(--v3-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.next-row .who .desc { font-size: 11px; color: var(--v3-text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Profile hero (cliente detalle) */
.profile-hero {
    padding: 24px 28px;
    border-bottom: 1px solid var(--v3-border);
    background: var(--v3-bg-2);
    display: flex; gap: 22px; align-items: center;
}
.profile-hero .title { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.profile-hero .meta { display: flex; gap: 12px; margin-top: 8px; align-items: center; font-size: 12px; color: var(--v3-text-2); flex-wrap: wrap; }
.profile-hero .meta .sep { opacity: 0.4; }
.profile-stats { display: flex; gap: 24px; margin-left: auto; }
.profile-stat { text-align: center; }
.profile-stat .v { font-family: var(--font-mono); font-size: 22px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.profile-stat .l { font-size: 10px; color: var(--v3-text-3); text-transform: uppercase; letter-spacing: 0.08em; margin-top: 4px; font-weight: 600; }
.profile-stat.text   .v { color: var(--v3-text); }
.profile-stat.info   .v { color: var(--v3-info); }
.profile-stat.em     .v { color: var(--v3-em-2); }
.profile-stat.orange .v { color: var(--v3-orange); }

/* Tab bar v3 */
.v3-tabs { padding: 0 28px; border-bottom: 1px solid var(--v3-border); background: var(--v3-bg); display: flex; gap: 4px; }
.v3-tabs .tab {
    height: 46px; padding: 0 18px; border: 0; background: transparent; cursor: pointer;
    font-family: var(--font-sans); font-size: 13px; font-weight: 600;
    color: var(--v3-text-2); border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.v3-tabs .tab:hover { color: var(--v3-text); }
.v3-tabs .tab.active { color: var(--v3-em-2); border-bottom-color: var(--v3-em-2); }

/* Cards de medidas con número grande + delta */
.measure-card { padding: 22px; border-radius: 16px; background: var(--v3-card); border: 1px solid var(--v3-border); }
.measure-card .top { display: flex; align-items: baseline; justify-content: space-between; }
.measure-card .label { font-size: 11px; font-weight: 700; color: var(--v3-text-3); text-transform: uppercase; letter-spacing: 0.08em; }
.measure-card .num-row { display: flex; align-items: baseline; gap: 8px; margin-top: 8px; }
.measure-card .num { font-family: var(--font-mono); font-size: 32px; font-weight: 800; letter-spacing: -0.03em; }
.measure-card .unit { font-size: 13px; color: var(--v3-text-3); }
.measure-card .delta { font-family: var(--font-mono); font-size: 12px; font-weight: 700; margin-left: 8px; }
.measure-card .delta.info { color: var(--v3-info); }
.measure-card .delta.em { color: var(--v3-em-2); }

/* Grid 6 mediciones corporales */
.body-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
@media (max-width: 1200px) { .body-grid { grid-template-columns: repeat(3, 1fr); } }
.body-cell {
    padding: 14px; border-radius: 12px;
    background: var(--v3-bg-2); border: 1px solid var(--v3-divider);
}
.body-cell .lbl { font-size: 10px; font-weight: 700; color: var(--v3-text-3); text-transform: uppercase; letter-spacing: 0.06em; }
.body-cell .row { display: flex; align-items: baseline; gap: 4px; margin-top: 8px; }
.body-cell .v { font-family: var(--font-mono); font-size: 20px; font-weight: 800; letter-spacing: -0.02em; color: var(--v3-text); }
.body-cell .u { font-size: 10px; color: var(--v3-text-3); }
.body-cell .delta { font-family: var(--font-mono); font-size: 11px; font-weight: 700; margin-top: 4px; }
.body-cell .delta.em   { color: var(--v3-em-2); }
.body-cell .delta.info { color: var(--v3-info); }
