/* ============================================================
   RECIVO — Dark Premium UI (estilo Linear / Vercel)
   Paleta "Confianza + Sostenibilidad": navy-teal near-black,
   acento verde esmeralda + azul (bicolor de la landing).
   Jerarquía fuerte · mucho aire · sin neón genérico.
   ============================================================ */

:root {
  /* Superficies (navy-teal near-black, elevación por capas) */
  --bg: #061318;
  --surface: #0C1B21;
  --surface-2: #10222A;
  --surface-3: #162B33;
  --border: rgba(150, 230, 205, 0.10);
  --border-strong: rgba(150, 230, 205, 0.22);
  --highlight: rgba(255, 255, 255, 0.05);

  /* Tinta */
  --text-primary: #EAF4F0;
  --text-secondary: #9FB8B2;
  --text-muted: #63797B;

  /* Acento verde (sostenibilidad) + azul (confianza) — bicolor de la landing */
  --accent: #35E0A1;
  --accent-hover: #2BC98F;
  --accent-text: #7FEEC6;
  --accent-soft: rgba(53, 224, 161, 0.12);
  --accent-line: rgba(53, 224, 161, 0.32);
  --accent-2: #52A9FF;
  --accent-2-deep: #2E6FE0;
  --accent-2-soft: rgba(82, 169, 255, 0.12);
  --grad: linear-gradient(115deg, #35E0A1 0%, #52A9FF 100%);
  --grad-soft: linear-gradient(115deg, rgba(53, 224, 161, 0.16), rgba(82, 169, 255, 0.16));
  --on-accent: #04140E; /* tinta oscura sobre fondos degradados (contraste) */

  /* Semánticos — positive en verde-hierba para no confundirse con el acento menta */
  --positive: #55C878;
  --positive-soft: rgba(85, 200, 120, 0.14);
  --alert: #E5787A;
  --alert-soft: rgba(229, 120, 122, 0.14);
  --warn: #E0A34A;

  /* Paleta categórica anclada en la marca (verde + azul + 4 tonos separables en dark) */
  --cat-1: #35E0A1;
  --cat-2: #52A9FF;
  --cat-3: #F2B84B;
  --cat-4: #A78BFA;
  --cat-5: #F2789F;
  --cat-6: #C98A6B;

  --chart-grid: rgba(150, 230, 205, 0.06);
  --chart-axis: rgba(150, 230, 205, 0.12);

  --r-lg: 16px;
  --r-md: 12px;
  --r-sm: 8px;
  --r-xs: 6px;

  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: 'Space Grotesk', 'Inter', sans-serif;
  --font-mono: 'Space Mono', 'SF Mono', 'Roboto Mono', monospace;

  --ease: 150ms cubic-bezier(0.2, 0, 0.2, 1);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 32px -12px rgba(0, 0, 0, 0.55);
  --shadow-pop: 0 24px 64px -12px rgba(0, 0, 0, 0.7);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background-color: var(--bg);
  background-image:
    radial-gradient(1100px 520px at 78% -8%, rgba(53, 224, 161, 0.06), transparent 62%),
    radial-gradient(900px 500px at 10% 110%, rgba(82, 169, 255, 0.05), transparent 60%);
  background-attachment: fixed;
  color: var(--text-primary);
  font-family: var(--font-ui);
  min-height: 100vh;
  line-height: 1.55;
  font-size: 14.5px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* Aurora sutil (firma de la landing, contenida para una herramienta de datos):
   dos blobs verde/azul con deriva lentísima, solo transform (compositor-friendly). */
body::before {
  content: '';
  position: fixed; inset: -20%; z-index: -1; pointer-events: none;
  filter: blur(90px); opacity: 0.30;
  background:
    radial-gradient(38% 42% at 28% 18%, rgba(53, 224, 161, 0.30), transparent 70%),
    radial-gradient(42% 44% at 80% 75%, rgba(82, 169, 255, 0.26), transparent 72%);
  animation: auroraDrift 45s ease-in-out infinite;
}
@keyframes auroraDrift {
  0%, 100% { transform: translate3d(-2%, -1%, 0) scale(1); }
  50% { transform: translate3d(2%, 2%, 0) scale(1.08); }
}
@media (prefers-reduced-motion: reduce) { body::before { animation: none; } }

.grid-left, .grid-right, .bento-2, .card, .kpi-data, .donut-legend, .hero-card { min-width: 0; }
.hero-value { overflow-wrap: anywhere; }

/* ============ TIPO DISPLAY (Space Grotesk — títulos y cifras grandes) ============ */
.logo-text h1,
.wizard h2,
.card-header h3,
.hero-value,
.kpi-value,
.health-score,
.donut-center-num,
.plan-goal-left .v,
.fiscal-total-item .v {
  font-family: var(--font-display);
}

.dashboard-container { max-width: 1280px; margin: 0 auto; padding: 40px 32px 96px; }

/* ============ CABECERA / MARCA ============ */
.app-header {
  display: flex; justify-content: space-between; align-items: center;
  gap: 24px; flex-wrap: wrap;
  margin-bottom: 40px; padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.logo-area { display: flex; align-items: center; gap: 13px; }
.logo-icon {
  width: 40px; height: 40px; border-radius: 11px; flex-shrink: 0;
  background: var(--grad);
  color: var(--on-accent); display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 10px rgba(53, 224, 161, 0.35), inset 0 1px 0 rgba(255,255,255,0.25);
  font-weight: 700;
}
.logo-text h1 { font-size: 1.32rem; font-weight: 650; letter-spacing: -0.02em; line-height: 1; }
.logo-text h1 span { color: var(--accent-text); }
.logo-text p { font-size: 0.76rem; color: var(--text-secondary); margin-top: 4px; }

.header-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.chip-btn, .refresh-btn, .currency-select {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 8px 12px; border-radius: var(--r-sm);
  font-family: var(--font-ui); font-size: 0.8rem; font-weight: 500; cursor: pointer;
  transition: background var(--ease), border-color var(--ease), color var(--ease);
}
.chip-btn:hover, .refresh-btn:hover, .currency-select:hover, .currency-select:focus {
  background: var(--surface-3); border-color: var(--border-strong); color: var(--text-primary); outline: none;
}
.refresh-btn svg { width: 14px; height: 14px; }
.refresh-btn.spinning svg { animation: spin 0.7s cubic-bezier(0.4, 0, 0.2, 1); }
.currency-select { appearance: none; -webkit-appearance: none; }
.currency-select option { background: var(--surface); color: var(--text-primary); }
.refresh-meta { font-size: 0.68rem; color: var(--text-muted); font-family: var(--font-mono); }

.connection-status-pill {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 7px 12px; border-radius: 999px;
  font-size: 0.76rem; font-weight: 500; color: var(--text-secondary);
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; background: var(--text-muted); }
.status-connecting { background: var(--warn); animation: pulse 1.8s infinite; }
.status-connected { background: var(--positive); box-shadow: 0 0 8px var(--positive); }
.status-disconnected { background: var(--alert); }

/* ============ GRID ============ */
.dashboard-grid { display: grid; grid-template-columns: 320px 1fr; gap: 28px; align-items: start; }
.grid-left, .grid-right { display: flex; flex-direction: column; gap: 28px; }
/* Sidebar pegajoso: acompaña el scroll en vez de dejar el carril izquierdo vacío.
   Si su contenido supera el alto de la ventana, scrollea por dentro (barra fina). */
.grid-left {
  position: sticky;
  top: 20px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
.grid-left::-webkit-scrollbar { width: 6px; }
.grid-left::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
.grid-left::-webkit-scrollbar-track { background: transparent; }
/* align-items: start (no stretch) — cada card toma su altura natural; con
   stretch, la card de "Gasto en el tiempo" (gráfica de altura fija) quedaba
   estirada a la altura de la card de categorías (variable, más larga cuantas
   más categorías tenga el perfil), dejando un hueco vacío debajo de la gráfica. */
.bento-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: start; }
.bento-left-col { display: flex; flex-direction: column; gap: 28px; min-width: 0; }
/* La columna izquierda del bento estira su gráfica para casar con la altura del
   donut y no dejar hueco bajo el IVA acumulado. */
.bento-2 > .bento-left-col { align-self: stretch; }
.bento-left-col > .chart-card { flex: 1; display: flex; flex-direction: column; }
.bento-left-col > .chart-card .card-body { flex: 1; display: flex; flex-direction: column; justify-content: center; }

/* ============ CARDS (con profundidad) ============ */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  display: flex; flex-direction: column;
  transition: border-color var(--ease), transform var(--ease);
}
.card::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: inset 0 1px 0 var(--highlight);
}
.card:hover { border-color: var(--border-strong); }

.card-header { padding: 22px 24px 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.card-header h3 { font-size: 0.98rem; font-weight: 600; letter-spacing: -0.01em; }
.list-title p { font-size: 0.75rem; color: var(--text-secondary); margin-top: 4px; }
.card-body { padding: 18px 24px 24px; }
.card-body.no-padding { padding: 0; }

.badge {
  font-size: 0.62rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 4px 8px; border-radius: var(--r-xs); background: var(--accent-soft); color: var(--accent-text);
  border: 1px solid var(--accent-line);
}
.badge.success { background: var(--positive-soft); color: var(--positive); border-color: transparent; }
.badge.alert { background: var(--alert-soft); color: var(--alert); border-color: transparent; }
.fiscal-model-badge { vertical-align: middle; margin-left: 6px; text-transform: none; letter-spacing: normal; font-size: 0.64rem; }

/* ============ VINCULACIÓN WHATSAPP ============ */
.connection-body { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 210px; }
.qr-placeholder { display: flex; flex-direction: column; align-items: center; gap: 14px; color: var(--text-secondary); font-size: 0.82rem; }
.spinner { width: 26px; height: 26px; border: 2px solid var(--border-strong); border-radius: 50%; border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
.qr-container { display: flex; flex-direction: column; align-items: center; gap: 16px; width: 100%; }
.qr-wrapper { background: #fff; padding: 12px; border-radius: var(--r-md); }
.qr-wrapper img { width: 168px; height: 168px; display: block; }
.qr-instruction { font-size: 0.76rem; color: var(--text-secondary); text-align: center; line-height: 1.5; }
.qr-instruction strong { color: var(--text-primary); font-weight: 600; }
.connected-container { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; }
.success-icon { width: 44px; height: 44px; background: var(--positive-soft); color: var(--positive); border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.success-icon svg { width: 22px; height: 22px; }
.connected-container h4 { font-size: 1.05rem; font-weight: 600; letter-spacing: -0.01em; }
.account-info { font-size: 0.78rem; color: var(--text-secondary); font-family: var(--font-mono); }
.whatsapp-badge-action { background: var(--surface-2); border: 1px solid var(--border); padding: 14px; border-radius: var(--r-md); margin-top: 4px; }
.whatsapp-badge-action span { display: inline-block; font-weight: 600; font-size: 0.66rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent-text); margin-bottom: 5px; }
.whatsapp-badge-action p { font-size: 0.78rem; color: var(--text-secondary); }
#connection-card.collapsed .connection-body { min-height: 0; }
#connection-card.collapsed .whatsapp-badge-action { display: none; }
#connection-card.collapsed .success-icon { width: 34px; height: 34px; }
#connection-card.collapsed .success-icon svg { width: 18px; height: 18px; }

/* ============ DETALLE DE GASTO ============ */
.detail-card { min-height: 280px; }
.category-pill { font-size: 0.68rem; font-weight: 600; padding: 4px 10px; border-radius: var(--r-xs); background: var(--accent-soft); color: var(--accent-text); white-space: nowrap; }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: var(--text-muted); gap: 12px; min-height: 190px; padding: 16px; }
.empty-state svg { width: 34px; height: 34px; opacity: 0.5; }
.empty-state p { font-size: 0.84rem; max-width: 230px; line-height: 1.5; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.detail-item { display: flex; flex-direction: column; gap: 6px; }
.detail-item.full-width { grid-column: span 2; }
.detail-item label { font-size: 0.64rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.07em; font-weight: 600; }
.detail-item .value { background: var(--surface-2); border: 1px solid var(--border); padding: 9px 12px; border-radius: var(--r-xs); font-size: 0.86rem; word-break: break-word; }
.detail-item .value.numeric { font-family: var(--font-mono); }
.emisor-value { font-weight: 600; }
.highlight-item .value { font-size: 1.5rem; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--text-primary); background: var(--accent-soft); border-color: var(--accent-line); }
.detail-total-orig { display: block; margin-top: 6px; font-size: 0.74rem; color: var(--text-muted); font-family: var(--font-mono); }
.status-success-badge .value { font-size: 0.78rem; border-color: transparent; background: var(--positive-soft); color: var(--positive); }
.text-success { color: var(--positive); font-weight: 500; }

/* ============ HERO ============ */
.hero-card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-card); padding: 28px 30px; overflow: hidden; }
.hero-card::before { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; box-shadow: inset 0 1px 0 var(--highlight); }
/* Anillo de borde degradado (técnica mask-composite de la landing). El border normal
   queda como red de seguridad si mask-composite no está soportado. */
.hero-card::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  padding: 1px; background: var(--grad); opacity: 0.55; pointer-events: none;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
}
.hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.hero-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.09em; color: var(--text-secondary); font-weight: 600; }
.hero-value {
  font-size: clamp(2.6rem, 6vw, 3.4rem); font-weight: 650; letter-spacing: -0.03em;
  line-height: 1.02; margin: 12px 0 2px; font-variant-numeric: tabular-nums;
  /* Número en degradado de marca (los spans .cents/.curr lo heredan — intencional) */
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  width: fit-content;
}
.hero-value .cents { opacity: 0.55; }
.hero-value .curr { font-size: 0.4em; font-weight: 600; margin-left: 8px; letter-spacing: 0; vertical-align: middle; }
#hero-spark { margin-top: 12px; height: 40px; }
.hero-sub { display: flex; gap: 36px; margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.hero-sub-item { display: flex; flex-direction: column; gap: 4px; }
.hero-sub-item .k { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); font-weight: 600; }
.hero-sub-item .v { font-size: 1.2rem; font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }

/* ============ INSIGHT (coach) ============ */
.insight-card { display: flex; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--accent-line); border-radius: var(--r-md); padding: 16px 18px; box-shadow: var(--shadow-sm); }
.insight-emoji { font-size: 1.6rem; line-height: 1; flex-shrink: 0; }
.insight-text { font-size: 0.9rem; color: var(--text-secondary); }
.insight-text strong { color: var(--text-primary); font-weight: 600; }

/* ============ GRÁFICAS ============ */
.chart-card .card-body { padding-top: 14px; }
.chart-svg { width: 100%; display: block; overflow: visible; }
.chart-axis-label { font-family: var(--font-mono); font-size: 10px; fill: var(--text-muted); }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 2.25; stroke-linecap: round; stroke-linejoin: round; }
.chart-grid-line { stroke: var(--chart-grid); stroke-width: 1; }
.chart-dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2.5; }
.chart-empty { color: var(--text-muted); font-size: 0.82rem; text-align: center; padding: 34px 0; }
.chart-x-axis { position: relative; height: 15px; margin-top: 6px; }
.chart-x-tick { position: absolute; top: 0; font-size: 0.7rem; color: var(--text-secondary); white-space: nowrap; }
.spark-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* --- Interactividad de "Gasto en el tiempo" --- */
.chart-canvas { position: relative; }
.chart-hover-capture { cursor: crosshair; pointer-events: all; }
.chart-hover-line { stroke: var(--accent); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0; transition: opacity 120ms var(--ease); pointer-events: none; }
.chart-hover-line.active { opacity: 0.55; }
.chart-hover-dot { opacity: 0; pointer-events: none; transition: opacity 120ms var(--ease); filter: drop-shadow(0 0 4px rgba(53,224,161,0.55)); }
.chart-hover-dot.active { opacity: 1; }
#end-dot { transition: opacity 120ms var(--ease); }
#end-dot.dimmed { opacity: 0.35; }
.chart-tooltip {
  position: absolute; opacity: 0; pointer-events: none; transition: opacity 120ms var(--ease);
  background: var(--surface-3); border: 1px solid var(--border-strong); border-radius: var(--r-xs);
  padding: 6px 10px; font-size: 0.72rem; white-space: nowrap; box-shadow: 0 4px 14px rgba(0,0,0,0.28);
  display: flex; flex-direction: column; gap: 1px; z-index: 2;
}
.chart-tooltip.visible { opacity: 1; }
.chart-tooltip[data-h-anchor="center"] { transform: translate(-50%, -120%); }
.chart-tooltip[data-h-anchor="left"] { transform: translate(0, -120%); }
.chart-tooltip[data-h-anchor="right"] { transform: translate(-100%, -120%); }
.chart-tooltip[data-v-anchor="below"][data-h-anchor="center"] { transform: translate(-50%, 14%); }
.chart-tooltip[data-v-anchor="below"][data-h-anchor="left"] { transform: translate(0, 14%); }
.chart-tooltip[data-v-anchor="below"][data-h-anchor="right"] { transform: translate(-100%, 14%); }
.chart-tooltip-date { color: var(--text-secondary); font-size: 0.66rem; }
.chart-tooltip-val { color: var(--text-primary); font-family: var(--font-mono); font-weight: 600; }

.donut-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.donut-svg { flex-shrink: 0; }
.donut-center-num { font-size: 21px; font-weight: 650; letter-spacing: -0.02em; fill: var(--text-primary); }
.donut-center-label { font-size: 8.5px; fill: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.donut-legend { display: flex; flex-direction: column; gap: 10px; flex: 1; min-width: 150px; }
.donut-legend-row { display: flex; align-items: center; gap: 9px; font-size: 0.8rem; }
.donut-swatch { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }
.donut-legend-name { color: var(--text-primary); flex: 1; }
.donut-legend-val { font-family: var(--font-mono); font-size: 0.74rem; color: var(--text-secondary); }

/* ============ TU PLAN RECIVO ============ */
.plan-card { border-color: var(--accent-line); }
.health-ring { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 54px; height: 54px; border-radius: 50%; border: 2px solid var(--accent); background: var(--accent-soft); flex-shrink: 0; }
.health-score { font-size: 1.25rem; font-weight: 650; color: var(--accent-text); line-height: 1; font-variant-numeric: tabular-nums; }
.health-label { font-size: 0.5rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-secondary); }
.plan-body { display: flex; flex-direction: column; gap: 22px; }
.plan-resumen { font-size: 0.92rem; color: var(--text-secondary); line-height: 1.6; }
.plan-goal { display: flex; justify-content: space-between; align-items: center; gap: 16px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: 16px 18px; }
.plan-goal-left { display: flex; flex-direction: column; gap: 4px; }
.plan-goal .k { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); font-weight: 600; }
.plan-goal .v { font-size: 1.45rem; font-weight: 650; letter-spacing: -0.02em; color: var(--accent-text); font-variant-numeric: tabular-nums; }
.plan-goal-msg { font-size: 0.78rem; color: var(--text-secondary); text-align: right; max-width: 48%; }
.plan-section h4 { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 14px; }
.plan-budgets { display: flex; flex-direction: column; gap: 16px; }
.plan-budget-row { display: flex; flex-direction: column; gap: 7px; }
.plan-budget-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 0.85rem; }
.plan-budget-name { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.plan-budget-vals { font-family: var(--font-mono); font-size: 0.76rem; color: var(--text-secondary); }
.plan-budget-vals .spent { color: var(--text-primary); }
.plan-budget-vals .over { color: var(--alert); }
.plan-budget-note { font-size: 0.73rem; color: var(--text-muted); }
.plan-budget-track { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.plan-budget-fill { height: 100%; border-radius: 999px; background: var(--accent); transition: width 600ms var(--ease); }
.plan-budget-fill.over { background: var(--alert); }
.plan-insights { list-style: none; display: flex; flex-direction: column; gap: 11px; }
.plan-insights li { position: relative; padding-left: 24px; font-size: 0.88rem; color: var(--text-secondary); line-height: 1.5; }
.plan-insights li::before { content: "→"; position: absolute; left: 0; color: var(--accent); font-weight: 600; }
.plan-action { display: flex; gap: 14px; align-items: flex-start; background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: var(--r-md); padding: 16px 18px; }
.plan-action-icon { font-size: 1.3rem; line-height: 1.2; }
.plan-action .k { font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent-text); font-weight: 600; }
.plan-action p { font-size: 0.9rem; margin-top: 5px; font-weight: 500; color: var(--text-primary); }
.plan-strategic { display: flex; gap: 12px; align-items: flex-start; }
.plan-strategic-icon { font-size: 1.1rem; }
.plan-strategic p { font-size: 0.84rem; color: var(--text-muted); line-height: 1.5; font-style: italic; }

/* Objetivos financieros ("comprar un coche"...) */
.goal-form { display: flex; flex-direction: column; gap: 12px; margin-bottom: 18px; }
.goal-form-row { display: flex; gap: 10px; flex-wrap: wrap; }
.goal-form-row .wizard-input { flex: 1; min-width: 130px; }
.goal-amount-wrap { flex: 1; min-width: 150px; }
.goal-form-row .wizard-btn { flex-shrink: 0; white-space: nowrap; }
#goals-empty { min-height: 0; padding: 20px 16px; }

.goals-list { display: flex; flex-direction: column; gap: 16px; }
.goal-item { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.goal-item-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.goal-item-title { display: flex; gap: 10px; align-items: flex-start; }
.goal-item-title h4 { font-size: 0.98rem; font-weight: 650; letter-spacing: -0.01em; }
.goal-emoji { font-size: 1.1rem; line-height: 1.3; }
.goal-meta { font-size: 0.76rem; color: var(--text-muted); }
.goal-item-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.goal-badge { font-size: 0.64rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; padding: 4px 9px; border-radius: var(--r-xs); white-space: nowrap; }
.goal-badge.ok { background: var(--positive-soft); color: var(--positive); }
.goal-badge.warn { background: var(--alert-soft); color: var(--alert); }
.goal-delete { width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; background: transparent; border: 1px solid var(--border); border-radius: 50%; color: var(--text-muted); font-size: 0.7rem; cursor: pointer; transition: all var(--ease); }
.goal-delete:hover { color: var(--alert); border-color: var(--alert); }
.goal-diagnostico { font-size: 0.86rem; color: var(--text-secondary); line-height: 1.55; }
.goal-stats { display: flex; gap: 24px; }
.goal-stat { display: flex; flex-direction: column; gap: 4px; }
.goal-stat .k { font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); font-weight: 600; }
.goal-stat .v { font-size: 1.15rem; font-weight: 650; letter-spacing: -0.01em; color: var(--accent-text); font-variant-numeric: tabular-nums; }
.goal-section h5 { font-size: 0.68rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 10px; }
.goal-cut-row { display: grid; grid-template-columns: minmax(90px, auto) auto 1fr; gap: 8px 12px; align-items: baseline; font-size: 0.8rem; padding: 6px 0; border-top: 1px solid var(--border); }
.goal-cut-row:first-of-type { border-top: none; }
.goal-cut-cat { font-weight: 500; }
.goal-cut-amt { font-family: var(--font-mono); color: var(--alert); font-weight: 600; white-space: nowrap; }
.goal-cut-note { color: var(--text-muted); font-size: 0.76rem; grid-column: 1 / -1; }
.goal-steps { list-style: none; display: flex; flex-direction: column; gap: 8px; counter-reset: goal-step; }
.goal-steps li { position: relative; padding-left: 26px; font-size: 0.84rem; color: var(--text-secondary); line-height: 1.5; counter-increment: goal-step; }
.goal-steps li::before { content: counter(goal-step); position: absolute; left: 0; top: 0; width: 18px; height: 18px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); font-size: 0.66rem; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.goal-motivador { font-size: 0.84rem; color: var(--text-muted); font-style: italic; background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: var(--r-sm); padding: 10px 14px; }

/* Resumen Fiscal (conector de datos: base imponible + IVA por trimestre) */
.fiscal-nav { display: flex; align-items: center; gap: 8px; }
.fiscal-nav-btn { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; background: var(--surface-2); border: 1px solid var(--border); border-radius: 50%; color: var(--text-secondary); font-size: 0.85rem; cursor: pointer; transition: all var(--ease); }
.fiscal-nav-btn:hover { color: var(--text-primary); border-color: var(--border-strong); }
.fiscal-quarter-pill { font-size: 0.78rem; font-weight: 600; padding: 5px 12px; border-radius: var(--r-xs); background: var(--accent-soft); color: var(--accent-text); white-space: nowrap; }
/* Plegado (solo perfil personal/estudiante — informativo): abre/cierra el cuerpo de la card */
.fiscal-toggle { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; background: var(--surface-2); border: 1px solid var(--border); border-radius: 50%; color: var(--text-secondary); cursor: pointer; transition: all var(--ease); }
.fiscal-toggle:hover { color: var(--text-primary); border-color: var(--border-strong); }
.fiscal-chevron { font-size: 0.8rem; line-height: 1; transition: transform var(--ease); }
.fiscal-card.collapsed .fiscal-chevron { transform: rotate(-90deg); }
.fiscal-card.collapsed .card-body { display: none; }
.fiscal-totals { display: flex; gap: 28px; flex-wrap: wrap; margin-bottom: 18px; }
.fiscal-total-item { display: flex; flex-direction: column; gap: 4px; }
.fiscal-total-item .k { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); font-weight: 600; }
.fiscal-total-item .v { font-size: 1.45rem; font-weight: 650; letter-spacing: -0.02em; color: var(--accent-text); font-variant-numeric: tabular-nums; }
.fiscal-incomplete-banner { display: flex; gap: 10px; align-items: flex-start; background: var(--alert-soft); border: 1px solid rgba(229, 120, 122, 0.32); border-radius: var(--r-sm); padding: 12px 14px; font-size: 0.82rem; color: var(--text-secondary); margin-bottom: 18px; }
.fiscal-section { margin-bottom: 20px; }
.fiscal-section h4 { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 12px; }
.fiscal-breakdown { display: flex; flex-direction: column; gap: 2px; }
.fiscal-breakdown-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 8px 0; border-top: 1px solid var(--border); font-size: 0.84rem; }
.fiscal-breakdown-row:first-child { border-top: none; }
.fiscal-breakdown-label { font-weight: 500; }
.fiscal-breakdown-vals { color: var(--text-secondary); font-family: var(--font-mono); font-size: 0.78rem; text-align: right; white-space: nowrap; }
.fiscal-breakdown-vals strong { color: var(--text-primary); }
.fiscal-breakdown-empty { font-size: 0.82rem; color: var(--text-muted); }

/* ============ MODOS: Gastos · Ventas · Impuestos (feature 006b) ============ */
/* Cada bloque declara su modo con data-mode. Sin pestañas (estudiante) se ve todo menos
   ventas; con pestañas solo se ve el modo activo (y lo que no declara modo: WhatsApp). */
body:not(.has-modes) [data-mode="ventas"] { display: none !important; }
body.has-modes.mode-gastos [data-mode]:not([data-mode="gastos"]),
body.has-modes.mode-ventas [data-mode]:not([data-mode="ventas"]),
body.has-modes.mode-impuestos [data-mode]:not([data-mode="impuestos"]) { display: none !important; }

.mode-switch { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 6px; margin: -16px 0 28px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-sm); }
.mode-tab { position: relative; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center;
  text-align: left; padding: 12px 16px; border-radius: calc(var(--r-md) - 4px); border: 1px solid transparent; background: transparent;
  color: var(--text-secondary); cursor: pointer; transition: all var(--ease); font-family: var(--font-ui); }
.mode-tab:hover { background: var(--surface-2); color: var(--text-primary); }
.mode-tab.active { background: var(--surface-2); border-color: var(--accent-line); color: var(--text-primary); box-shadow: inset 0 0 0 1px var(--accent-line); }
.mode-ico { grid-row: 1 / 3; font-size: 1.35rem; line-height: 1; }
.mode-name { font-family: var(--font-display); font-weight: 650; font-size: 0.98rem; letter-spacing: -0.01em; }
.mode-tab.active .mode-name { background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.mode-desc { font-size: 0.72rem; color: var(--text-muted); }
.mode-dot { position: absolute; top: 10px; right: 12px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
@media (max-width: 640px) { .mode-desc { display: none; } .mode-tab { padding: 10px; column-gap: 8px; } .mode-switch { margin-top: -20px; } }

/* ============ MODO VENTAS (feature 006) ============ */
.sales-hero-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.sales-hero-subtitle { color: var(--text-muted); font-size: 0.82rem; margin-top: 6px; }
.sales-v-neg { color: var(--alert) !important; }
.sales-guide { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.sales-guide-item { display: flex; gap: 12px; padding: 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); }
.sales-guide-item strong { font-size: 0.88rem; }
.sales-guide-item p { font-size: 0.8rem; color: var(--text-secondary); margin-top: 4px; line-height: 1.45; }
.sg-ico { font-size: 1.3rem; line-height: 1.2; }
@media (max-width: 640px) { .sales-guide { grid-template-columns: 1fr; } }
.sales-days { display: flex; align-items: flex-end; gap: 3px; height: 150px; padding-top: 8px; }
.sales-day { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; min-width: 0; }
.sales-day-bar { width: 100%; max-width: 18px; border-radius: 4px 4px 1px 1px; background: var(--grad); min-height: 2px; opacity: 0.9; transition: opacity var(--ease); }
.sales-day.empty .sales-day-bar { background: var(--border); opacity: 1; }
.sales-day:hover .sales-day-bar { opacity: 1; filter: brightness(1.1); }
.sales-day-lbl { font-size: 0.58rem; color: var(--text-muted); margin-top: 5px; font-family: var(--font-mono); height: 10px; }
.sales-pago-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.sales-pago-head { display: flex; justify-content: space-between; font-size: 0.84rem; }
.sales-pago-head span:last-child { font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-secondary); }
.sales-pago-track { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.sales-pago-fill { height: 100%; border-radius: 99px; background: var(--grad); }
.sales-pago-fill.alt { background: var(--accent-2); }
.sales-pago-fill.muted { background: var(--text-muted); }
.sales-mix { display: flex; gap: 18px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 0.8rem; color: var(--text-secondary); flex-wrap: wrap; }
.sales-mix strong { color: var(--text-primary); font-variant-numeric: tabular-nums; }
.sales-export { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.sales-export .wizard-btn { padding: 8px 16px; font-size: 0.8rem; }
.sales-export-hint { font-size: 0.74rem; color: var(--text-muted); margin-top: 14px; }
.sales-more { width: 100%; margin-top: 12px; font-size: 0.8rem; }
.sales-empty-note { font-size: 0.82rem; color: var(--text-muted); }
.sales-row { display: grid; grid-template-columns: 74px 1fr auto auto; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); font-size: 0.84rem; }
.sales-row:first-child { border-top: none; }
.sales-row-date { color: var(--text-muted); font-family: var(--font-mono); font-size: 0.76rem; }
.sales-row-concept { display: flex; align-items: center; gap: 8px; min-width: 0; }
.sales-row-concept span.name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sales-tag { font-size: 0.66rem; font-weight: 600; padding: 2px 7px; border-radius: var(--r-xs); background: var(--accent-2-soft); color: var(--accent-2); white-space: nowrap; }
.sales-tag.cierre { background: var(--accent-soft); color: var(--accent-text); }
.sales-tag.dup { background: var(--alert-soft); color: var(--alert); }
.sales-tag.est { background: rgba(242,184,75,0.12); color: #F2B84B; }
.sales-row-total { font-family: var(--font-mono); font-size: 0.8rem; font-weight: 600; white-space: nowrap; }
.sales-row-actions { display: flex; gap: 4px; }
.sales-act { background: none; border: 1px solid var(--border); color: var(--text-secondary); font-size: 0.72rem; padding: 4px 8px; border-radius: var(--r-xs); cursor: pointer; transition: all var(--ease); white-space: nowrap; text-decoration: none; }
.sales-act:hover { color: var(--text-primary); border-color: var(--border-strong); }
.sales-act.danger:hover { color: var(--alert); border-color: rgba(229,120,122,0.32); }
@media (max-width: 640px) { .sales-row { grid-template-columns: 60px 1fr auto; } .sales-row-actions { grid-column: 1 / -1; justify-content: flex-end; } }
.fiscal-result { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 12px 16px; margin-bottom: 20px; }
.fiscal-result-row { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; font-size: 0.84rem; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.fiscal-result-row.total { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 9px; color: var(--text-primary); font-weight: 650; font-size: 0.95rem; }
.fiscal-result-row.total.favor span:last-child { color: var(--positive); }
.fiscal-result-note { font-size: 0.72rem; color: var(--text-muted); margin-top: 6px; }
.detail-to-sale-btn { width: 100%; font-size: 0.8rem; padding: 9px 14px; }
@media (max-width: 640px) { .sales-row { grid-template-columns: 60px 1fr auto; } .sales-row-actions { grid-column: 1 / -1; justify-content: flex-end; } }
.fiscal-actions { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.fiscal-export-hint { font-size: 0.74rem; color: var(--text-muted); }
.fiscal-disclaimer { font-size: 0.72rem; color: var(--text-muted); line-height: 1.5; margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--border); }

/* ============ KPIs ============ */
.kpi-row { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.kpi-row.single-kpi { grid-template-columns: 1fr; }
.kpi-card { display: flex; align-items: center; gap: 15px; padding: 20px 22px; }
.kpi-icon { width: 42px; height: 42px; border-radius: var(--r-md); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.kpi-icon svg { width: 19px; height: 19px; }
.kpi-icon.doc-count { background: var(--positive-soft); color: var(--positive); }
.kpi-icon.avg-spent { background: var(--accent-soft); color: var(--accent-text); }
.kpi-data { display: flex; flex-direction: column; min-width: 0; }
.kpi-title { font-size: 0.66rem; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.06em; font-weight: 600; }
.kpi-value { font-size: 1.35rem; font-weight: 650; margin-top: 3px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi-extra { font-size: 0.76rem; color: var(--text-muted); margin-top: 4px; font-variant-numeric: tabular-nums; }
.hero-top-nav { align-items: center; flex-wrap: wrap; }
.month-nav { margin-left: auto; }
.month-select { appearance: none; -webkit-appearance: none; cursor: pointer; text-align: center;
  font-family: var(--font-ui); font-size: 0.78rem; font-weight: 600; padding: 6px 28px 6px 14px; border-radius: var(--r-xs);
  background: var(--accent-soft) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%237FEEC6' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/></svg>") no-repeat right 11px center;
  color: var(--accent-text); border: 1px solid var(--accent-line); max-width: 210px; transition: all var(--ease); }
.month-select:hover, .month-select:focus { border-color: var(--accent); outline: none; }
.month-select option { background: var(--surface); color: var(--text-primary); }
.fiscal-nav-btn:disabled { opacity: 0.35; cursor: default; pointer-events: none; }
.hero-delta { font-size: 0.82rem; color: var(--text-secondary); margin: 2px 0 0; min-height: 1.2em; }
.hero-delta.hidden { display: none; }
.kpi-delta { font-weight: 600; }
.kpi-delta.up { color: var(--alert); }      /* gastar más que ayer = alerta */
.kpi-delta.down { color: var(--positive); } /* gastar menos = bien */
.kpi-delta.flat { color: var(--text-secondary); }

/* ============ CATEGORÍAS (barras) ============ */
.cat-list { display: flex; flex-direction: column; gap: 14px; }
.cat-row { display: flex; flex-direction: column; gap: 7px; }
.cat-row-top { display: flex; justify-content: space-between; align-items: center; font-size: 0.85rem; }
.cat-name { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.cat-name .emoji { font-size: 1rem; }
.cat-amount { font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-secondary); }
.cat-bar-track { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.cat-bar-fill { height: 100%; border-radius: 999px; background: var(--accent); transition: width 600ms var(--ease); }

/* ============ TABLA ============ */
.list-card { flex-grow: 1; }
.live-indicator { display: flex; align-items: center; gap: 7px; font-size: 0.62rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--positive); background: var(--positive-soft); padding: 5px 10px; border-radius: var(--r-xs); }
.pulse-ring { width: 6px; height: 6px; background: var(--grad); border-radius: 50%; animation: pulse 2s infinite; }
.table-container { max-height: 440px; overflow-y: auto; overflow-x: auto; margin-top: 18px; }
.invoices-table { width: 100%; border-collapse: collapse; text-align: left; }
.invoices-table th, .invoices-table td { padding: 13px 24px; border-bottom: 1px solid var(--border); }
.invoices-table th { font-size: 0.62rem; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.07em; font-weight: 600; background: var(--surface); position: sticky; top: 0; z-index: 5; }
.invoices-table tbody tr { cursor: pointer; transition: background var(--ease); }
.invoices-table tbody tr:hover { background: var(--surface-2); }
.invoices-table tbody tr.selected { background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); }
.invoices-table td { font-size: 0.86rem; color: var(--text-secondary); }
.invoices-table td strong { color: var(--text-primary); font-weight: 600; }
.invoices-table td.numeric { font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--text-primary); }
.emisor-cell { display: flex; align-items: center; gap: 9px; }
.source-icon { font-size: 0.9rem; opacity: 0.8; }
.text-right { text-align: right; }
.table-empty { padding: 44px 24px !important; }
.table-empty .empty-state { min-height: 0; }
.table-category-pill { font-size: 0.7rem; font-weight: 500; padding: 3px 9px; border-radius: var(--r-xs); background: var(--surface-2); color: var(--text-secondary); border: 1px solid var(--border); display: inline-flex; align-items: center; gap: 5px; }
.invoices-table tbody tr.needs-review { box-shadow: inset 2px 0 0 var(--alert); }
.invoices-table tbody tr.needs-review.selected { background: var(--alert-soft); box-shadow: inset 2px 0 0 var(--alert); }
.review-flag { font-size: 0.66rem; font-weight: 600; padding: 2px 8px; border-radius: var(--r-xs); background: var(--alert-soft); color: var(--alert); white-space: nowrap; }

/* ============ REPETIDOS ============ */
.duplicates-card { border-color: rgba(229, 120, 122, 0.28); }
.duplicates-table tbody tr { opacity: 0.9; }
.duplicates-table tbody tr:hover { background: var(--surface-2); }
.duplicates-table td { font-size: 0.86rem; color: var(--text-secondary); }
.duplicate-reason { display: block; font-size: 0.7rem; color: var(--text-muted); margin-top: 2px; }
.restore-btn {
  font-size: 0.68rem; font-weight: 600; padding: 5px 10px; border-radius: var(--r-xs);
  background: var(--surface-2); color: var(--text-secondary); border: 1px solid var(--border);
  cursor: pointer; white-space: nowrap; transition: background var(--ease), color var(--ease);
}
.restore-btn:hover { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent-line); }
.dup-actions { display: inline-flex; gap: 6px; justify-content: flex-end; }
.dup-delete-btn {
  font-size: 0.68rem; font-weight: 600; padding: 5px 10px; border-radius: var(--r-xs);
  background: var(--surface-2); color: var(--text-secondary); border: 1px solid var(--border);
  cursor: pointer; white-space: nowrap; transition: background var(--ease), color var(--ease), border-color var(--ease);
}
.dup-delete-btn:hover { background: var(--alert-soft); color: var(--alert); border-color: var(--alert); }
.dup-delete-btn:disabled { opacity: 0.5; cursor: default; }

/* ============ COMPROBANTE ============ */
.ticket-body { display: flex; align-items: center; justify-content: center; min-height: 170px; }
.ticket-image { max-width: 100%; max-height: 400px; border-radius: var(--r-md); border: 1px solid var(--border); object-fit: contain; }
.voice-note-visual { display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--text-secondary); text-align: center; }
.voice-note-visual .wave { font-size: 2.2rem; }
.voice-note-visual p { font-size: 0.82rem; max-width: 240px; }

/* ============ SKELETONS ============ */
.skeleton { position: relative; overflow: hidden; background: var(--surface-2); border-radius: var(--r-xs); }
.skeleton::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.06), transparent); transform: translateX(-100%); animation: shimmer 1.4s infinite; }
.sk-line { height: 12px; }
.sk-hero { height: 52px; width: 58%; margin: 12px 0; }

/* ============ MOTION ============ */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes shimmer { to { transform: translateX(100%); } }
@keyframes reveal-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes row-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes streak-bump { 0% { transform: scale(1); } 35% { transform: scale(1.35) rotate(-8deg); } 70% { transform: scale(0.95) rotate(5deg); } 100% { transform: scale(1); } }
@keyframes mascot-bounce { 0% { transform: translateY(0); } 30% { transform: translateY(-6px) scale(1.08); } 60% { transform: translateY(0) scale(0.97); } 100% { transform: translateY(0) scale(1); } }
@keyframes toast-pop { from { opacity: 0; transform: translateX(-50%) translateY(14px) scale(0.94); } to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); } }
@keyframes sparkle-float { 0% { opacity: 0; transform: translateY(0) scale(0.6); } 25% { opacity: 1; } 100% { opacity: 0; transform: translateY(-26px) scale(1.2); } }

.reveal { animation: reveal-in 380ms cubic-bezier(0.2, 0, 0.2, 1) both; }
.grid-right .reveal:nth-child(2) { animation-delay: 40ms; }
.grid-right .reveal:nth-child(3) { animation-delay: 80ms; }
.grid-right .reveal:nth-child(4) { animation-delay: 120ms; }
.grid-right .reveal:nth-child(5) { animation-delay: 160ms; }
.row-new { animation: row-in 400ms cubic-bezier(0.2, 0, 0.2, 1) both; }

/* ============ GAMIFICACIÓN (racha, mascota, confeti) ============ */

/* Mascota: compañero con carita que reacciona a la salud financiera */
.recivo-mascot { display: inline-flex; align-items: center; gap: 8px; margin-left: 4px; }
.recivo-mascot.bounce { animation: mascot-bounce 500ms cubic-bezier(0.2, 0, 0.2, 1); }
.mascot-face {
  width: 34px; height: 34px; flex-shrink: 0; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 1.15rem;
  background: var(--accent-soft); border: 1.5px solid var(--accent);
  transition: background var(--ease), border-color var(--ease);
}
.mascot-bubble {
  position: relative; font-size: 0.74rem; font-weight: 550; color: var(--text-secondary);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 5px 10px; white-space: nowrap;
}
.mascot-bubble::before {
  content: ''; position: absolute; left: -5px; top: 50%; transform: translateY(-50%) rotate(45deg);
  width: 8px; height: 8px; background: var(--surface-2); border-left: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.recivo-mascot.mood-proud   .mascot-face { background: var(--positive-soft); border-color: var(--positive); }
.recivo-mascot.mood-calm    .mascot-face { background: var(--accent-soft); border-color: var(--accent); }
.recivo-mascot.mood-worried .mascot-face { background: var(--alert-soft); border-color: var(--alert); }
@media (max-width: 720px) { .mascot-bubble { display: none; } }

/* Chip de racha de días */
.streak-chip {
  display: inline-flex; align-items: center; gap: 5px; margin-left: 4px;
  padding: 5px 11px; border-radius: 999px; background: var(--surface-2);
  border: 1px solid var(--border-strong); cursor: default; user-select: none;
}
.streak-chip.at-risk { border-color: var(--alert); background: var(--alert-soft); }
.streak-chip.bump .streak-flame { display: inline-block; animation: streak-bump 550ms cubic-bezier(0.2, 0, 0.2, 1); }
.streak-flame { font-size: 0.95rem; line-height: 1; }
.streak-count { font-family: var(--font-mono); font-weight: 700; font-size: 0.9rem; color: var(--text-primary); font-variant-numeric: tabular-nums; }

/* Confeti a pantalla completa */
#confetti-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 9998; }

/* Chispita discreta al registrar un gasto normal */
.recivo-sparkle { position: fixed; z-index: 9997; font-size: 1.1rem; pointer-events: none; animation: sparkle-float 1s ease-out forwards; }

/* Toast dulce de hito / subida de racha */
.milestone-toast {
  position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%);
  z-index: 9999; padding: 12px 20px; border-radius: 999px;
  background: var(--surface-3); border: 1px solid var(--accent); color: var(--text-primary);
  font-size: 0.9rem; font-weight: 600; box-shadow: var(--shadow-pop); white-space: nowrap;
}
.milestone-toast.in { animation: toast-pop 360ms cubic-bezier(0.2, 0, 0.2, 1) both; }
.milestone-toast.out { opacity: 0; transition: opacity 380ms var(--ease); }

@media (prefers-reduced-motion: reduce) {
  *, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

.hidden { display: none !important; }

/* ============ ONBOARDING WIZARD ============ */
.onboarding-overlay { position: fixed; inset: 0; z-index: 100; background: rgba(6, 7, 9, 0.66); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 24px; animation: fade-in 200ms ease-out; }
.wizard { position: relative; width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-lg); padding: 32px 32px 28px; box-shadow: var(--shadow-pop); }
.wizard-close { position: absolute; top: 18px; right: 18px; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; background: var(--surface-2); border: 1px solid var(--border); border-radius: 50%; color: var(--text-secondary); font-size: 0.85rem; line-height: 1; cursor: pointer; transition: all var(--ease); z-index: 1; }
.wizard-close:hover { color: var(--text-primary); border-color: var(--border-strong); background: var(--surface-3); }
.wizard-progress { display: flex; gap: 6px; margin-bottom: 26px; }
.wizard-progress span { flex: 1; height: 3px; border-radius: 999px; background: var(--surface-3); transition: background var(--ease); }
.wizard-progress span.done { background: var(--accent); }
.wizard-step-label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent-text); font-weight: 600; margin-bottom: 8px; }
.wizard h2 { font-size: 1.5rem; font-weight: 650; letter-spacing: -0.02em; margin-bottom: 6px; line-height: 1.15; }
.wizard .wizard-sub { font-size: 0.88rem; color: var(--text-secondary); margin-bottom: 24px; }
.wizard-splash { text-align: center; padding: 8px 0 4px; }
.wizard-splash .brand-mark { width: 62px; height: 62px; border-radius: 17px; background: var(--grad); color: var(--on-accent); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 20px; box-shadow: 0 6px 20px rgba(53,224,161,0.4), inset 0 1px 0 rgba(255,255,255,0.25); }
.wizard-splash .brand-mark svg { width: 34px; height: 34px; }
.wizard-splash h2 { font-size: 1.75rem; }
.wizard-splash .wizard-sub { max-width: 380px; margin: 8px auto 24px; }

.type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.type-option { display: flex; align-items: center; gap: 12px; padding: 15px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); cursor: pointer; transition: all var(--ease); text-align: left; color: var(--text-primary); font-family: var(--font-ui); font-size: 0.9rem; font-weight: 500; }
.type-option:hover { border-color: var(--border-strong); background: var(--surface-3); }
.type-option.selected { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.type-option .type-emoji { font-size: 1.5rem; line-height: 1; }
.type-option .type-desc { font-size: 0.72rem; color: var(--text-secondary); font-weight: 400; display: block; margin-top: 2px; }

.wizard-field { margin-bottom: 20px; }
.wizard-field > label { display: block; font-size: 0.9rem; font-weight: 600; margin-bottom: 10px; }
.wizard-field .hint { font-size: 0.76rem; color: var(--text-muted); font-weight: 400; margin-left: 6px; }
.wizard-input { width: 100%; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 12px 14px; color: var(--text-primary); font-family: var(--font-ui); font-size: 0.95rem; transition: border-color var(--ease); }
.wizard-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.wizard-input::placeholder { color: var(--text-muted); }
.input-currency-wrap { position: relative; display: flex; align-items: center; }
.input-currency-wrap .curr-prefix { position: absolute; left: 14px; color: var(--text-secondary); font-size: 0.9rem; font-weight: 600; pointer-events: none; }
.input-currency-wrap .wizard-input { padding-left: 40px; }

.chip-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 8px 13px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); cursor: pointer; font-size: 0.82rem; color: var(--text-secondary); transition: all var(--ease); user-select: none; }
.chip:hover { border-color: var(--border-strong); }
.chip.selected { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }

/* ---- Modal de categorías (clases con prefijo catmgr- para no chocar con .cat-row
   del desglose por categoría del donut) ---- */
.catmgr-modal { max-width: 540px; }
.catmgr-list-edit { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.catmgr-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px;
  padding: 8px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); position: relative; }
.catmgr-emoji-btn { width: 38px; height: 38px; flex-shrink: 0; border-radius: var(--r-sm); border: 1px solid var(--border);
  background: var(--surface-3); font-size: 1.15rem; cursor: pointer; line-height: 1; transition: border-color var(--ease); }
.catmgr-emoji-btn:hover { border-color: var(--accent); }
.catmgr-name-input { background: transparent; border: 1px solid transparent; border-radius: var(--r-sm); padding: 8px 10px;
  color: var(--text-primary); font-family: var(--font-ui); font-size: 0.92rem; font-weight: 500; transition: all var(--ease); min-width: 0; }
.catmgr-name-input:not(:disabled):hover { border-color: var(--border); background: var(--surface-3); }
.catmgr-name-input:focus { outline: none; border-color: var(--accent); background: var(--surface-3); box-shadow: 0 0 0 3px var(--accent-soft); }
.catmgr-name-input:disabled { color: var(--text-secondary); cursor: default; }
.catmgr-row-actions { display: flex; align-items: center; gap: 6px; }
.catmgr-icon-btn { border: 1px solid var(--border); background: var(--surface-3); color: var(--text-secondary);
  border-radius: var(--r-sm); padding: 7px 10px; font-size: 0.8rem; cursor: pointer; font-family: var(--font-ui); transition: all var(--ease); }
.catmgr-icon-btn.catmgr-save { background: var(--grad); color: var(--on-accent); border-color: transparent; font-weight: 600; }
.catmgr-icon-btn.catmgr-del:hover { border-color: var(--alert); color: var(--alert); }
.catmgr-badge { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted);
  border: 1px solid var(--border); border-radius: 999px; padding: 3px 8px; }
.catmgr-emoji-picker { position: absolute; top: 52px; left: 8px; z-index: 5; display: grid; grid-template-columns: repeat(8, 1fr);
  gap: 4px; padding: 10px; background: var(--surface-3); border: 1px solid var(--border-strong); border-radius: var(--r-md); box-shadow: var(--shadow-pop); max-width: 340px; }
.catmgr-emoji-picker[hidden] { display: none; }
.catmgr-emoji-choice { width: 34px; height: 34px; border: none; background: transparent; font-size: 1.15rem; cursor: pointer; border-radius: var(--r-sm); transition: background var(--ease); }
.catmgr-emoji-choice:hover { background: var(--accent-soft); }
.catmgr-add { margin-bottom: 4px; }
.catmgr-add-btn { width: 100%; }
.catmgr-modal-msg { margin-top: 12px; font-size: 0.82rem; min-height: 1.1em; text-align: center; }
.catmgr-modal-msg.ok { color: var(--positive); }
.catmgr-modal-msg.error { color: var(--alert); }

/* ---- Select de recategorización en el detalle del gasto ---- */
.opt-note { color: var(--text-muted); font-weight: 400; text-transform: none; letter-spacing: 0; }
.detail-cat-select { width: 100%; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-xs);
  padding: 9px 12px; color: var(--text-primary); font-family: var(--font-ui); font-size: 0.86rem; cursor: pointer;
  appearance: none; -webkit-appearance: none; transition: border-color var(--ease);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239FB8B2' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
.detail-cat-select:hover { border-color: var(--border-strong); }
.detail-cat-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.detail-cat-select.input-warn { border-color: var(--alert, #E5787A); }
.detail-cat-select option { background: var(--surface); color: var(--text-primary); }

.option-list { display: flex; flex-direction: column; gap: 9px; }
.option-btn { text-align: left; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); color: var(--text-primary); font-family: var(--font-ui); font-size: 0.9rem; cursor: pointer; transition: all var(--ease); }
.option-btn:hover { border-color: var(--border-strong); background: var(--surface-3); }
.option-btn.selected { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }

.wizard-nav { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 28px; }
.wizard-btn { padding: 11px 22px; border-radius: var(--r-sm); font-family: var(--font-ui); font-size: 0.88rem; font-weight: 600; cursor: pointer; border: 1px solid var(--border); transition: all var(--ease); }
.wizard-btn.ghost { background: transparent; color: var(--text-secondary); }
.wizard-btn.ghost:hover { color: var(--text-primary); border-color: var(--border-strong); }
.wizard-btn.primary { background: var(--grad); color: var(--on-accent); border-color: transparent; box-shadow: 0 2px 12px rgba(53,224,161,0.35); }
.wizard-btn.primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
.wizard-btn.primary:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }
.wizard-skip { background: none; border: none; color: var(--text-muted); font-size: 0.78rem; cursor: pointer; text-decoration: underline; }
.wizard-delete-link {
  background: none; border: 1px solid transparent; color: var(--alert); font-size: 0.8rem; font-weight: 600;
  cursor: pointer; padding: 8px 12px; border-radius: var(--r-xs); transition: all var(--ease);
}
.wizard-delete-link:hover { background: var(--alert-soft); border-color: rgba(229, 120, 122, 0.32); }
.wizard-loading { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 28px 0; text-align: center; }
.wizard-loading p { color: var(--text-secondary); font-size: 0.9rem; }

/* ============ RESPONSIVE ============ */
@media (max-width: 980px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .grid-left { position: static; max-height: none; overflow: visible; }
}
@media (max-width: 640px) {
  .dashboard-container { padding: 24px 16px 64px; }
  .kpi-row, .bento-2 { grid-template-columns: 1fr; }
  .type-grid { grid-template-columns: 1fr; }
  .wizard { padding: 24px 20px; }
  .plan-goal { flex-direction: column; align-items: flex-start; }
  .plan-goal-msg { text-align: left; max-width: 100%; }
  .hero-sub { gap: 24px; }
  .invoices-table th, .invoices-table td { padding: 12px 16px; }
  .donut-wrap { justify-content: center; }
}

/* ============ NÚMEROS AUTORIZADOS (feature 003) ============ */
.phones-help { font-size: 0.82rem; color: var(--text-secondary); line-height: 1.5; margin-bottom: 14px; }
.phones-form { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.phones-input { padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); color: var(--text-primary); font-size: 0.86rem; font-family: inherit; }
.phones-input:focus { outline: none; border-color: var(--accent-line); }
.phones-form .wizard-btn { align-self: flex-start; }
.phones-msg { font-size: 0.8rem; margin-bottom: 10px; min-height: 0; }
.phones-msg.ok { color: var(--positive); }
.phones-msg.error { color: var(--alert); }
.phones-list { display: flex; flex-direction: column; gap: 8px; }
.phones-empty { font-size: 0.82rem; color: var(--text-muted); }
.phone-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 10px 12px; }
.phone-item-info { display: flex; flex-direction: column; gap: 2px; }
.phone-number { font-family: var(--font-mono, 'Space Mono', monospace); font-size: 0.86rem; color: var(--text-primary); }
.phone-label { font-size: 0.74rem; color: var(--text-muted); }
.phone-item-right { display: flex; align-items: center; gap: 8px; }
.phone-badge { font-size: 0.7rem; padding: 3px 8px; border-radius: 20px; white-space: nowrap; }
.phone-badge.verified { background: var(--positive-soft); color: var(--positive); }
.phone-badge.pending { background: var(--alert-soft); color: var(--warn); }
.phone-delete { width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; background: transparent; border: 1px solid var(--border); border-radius: 50%; color: var(--text-muted); font-size: 0.7rem; cursor: pointer; transition: all var(--ease); }
.phone-delete:hover { color: var(--alert); border-color: var(--alert); }

/* ============================================================
   INTERACTIVIDAD PREMIUM (v2) — micro-interacciones, anillo de
   salud animado, barras de presupuesto vivas y dona con hover.
   Todo respeta prefers-reduced-motion (bloque al final).
   ============================================================ */

/* --- Elevación sutil en tiles al pasar el cursor (Linear-style) --- */
.kpi-card, .chart-card {
  transition: border-color var(--ease), transform var(--ease), box-shadow var(--ease);
}
.kpi-card:hover, .chart-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-card), 0 18px 40px -20px rgba(0, 0, 0, 0.6);
}
.insight-card { transition: border-color var(--ease), transform var(--ease); }
.insight-card:hover { transform: translateY(-1px); }

/* --- Anillo de salud: arco SVG animado (reemplaza el borde estático) --- */
.health-ring {
  position: relative; border: none; background: transparent;
  width: 60px; height: 60px;
}
.health-ring-svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.health-ring-track { fill: none; stroke: var(--surface-3); stroke-width: 4; }
.health-ring-prog {
  fill: none; stroke: var(--accent); stroke-width: 4; stroke-linecap: round;
  stroke-dasharray: 163.36; stroke-dashoffset: 163.36;
  transition: stroke-dashoffset 1100ms cubic-bezier(0.2, 0, 0.2, 1), stroke 450ms ease;
  /* rgba explícito: currentColor deja de funcionar cuando el stroke es url(#ringGrad) */
  filter: drop-shadow(0 0 5px rgba(53, 224, 161, 0.5));
}
.health-ring .health-score, .health-ring .health-label { position: relative; z-index: 1; }

/* --- Barras de presupuesto: hover + relleno con brillo --- */
.plan-budget-row {
  padding: 8px; margin: 0 -8px; border-radius: var(--r-sm);
  transition: background var(--ease);
}
.plan-budget-row:hover { background: var(--surface-2); }
.plan-budget-fill {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 8px -1px var(--accent-line);
}
.plan-budget-fill.over { background: linear-gradient(90deg, var(--alert), #F0999A); box-shadow: none; }
.plan-budget-pct {
  font-family: var(--font-mono); font-size: 0.68rem; color: var(--text-muted);
  opacity: 0; transition: opacity var(--ease); margin-left: 8px;
}
.plan-budget-row:hover .plan-budget-pct { opacity: 1; }

/* --- Dona de categorías: hover sincronizado segmento <-> leyenda --- */
.donut-seg { transition: stroke-width 180ms var(--ease), opacity 180ms var(--ease); cursor: pointer; }
.donut-seg.active { stroke-width: 25; }
.donut-wrap.hovering .donut-seg:not(.active) { opacity: 0.32; }
.donut-legend-row {
  cursor: pointer; padding: 4px 6px; margin: 0 -6px; border-radius: var(--r-xs);
  transition: background var(--ease), opacity var(--ease);
}
.donut-legend-row:hover, .donut-legend-row.active { background: var(--surface-2); }
.donut-wrap.hovering .donut-legend-row:not(.active) { opacity: 0.45; }
.donut-center-num, .donut-center-label { transition: fill 150ms var(--ease); }

/* --- Accesibilidad: sin movimiento si el usuario lo pide --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ============================================================
   PLAN RECIVO INTERACTIVO — pestañas + mosaico de medidores
   (menos texto, más gráfico; la estructura elegida por el usuario)
   ============================================================ */

/* --- Pestañas (control segmentado) --- */
.plan-tabs {
  display: flex; gap: 2px; padding: 3px; margin-bottom: 18px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.plan-tab {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 6px; border: none; background: transparent; cursor: pointer;
  color: var(--text-secondary); font-family: var(--font-ui); font-size: 0.82rem; font-weight: 500;
  border-radius: var(--r-sm); transition: background var(--ease), color var(--ease);
}
.plan-tab:hover { color: var(--text-primary); }
.plan-tab.active {
  background: var(--surface-3); color: var(--text-primary);
  box-shadow: var(--shadow-sm), inset 0 1px 0 var(--highlight);
}
.plan-tab-badge {
  min-width: 17px; height: 17px; padding: 0 5px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 0.64rem; font-weight: 700;
  background: var(--accent-soft); color: var(--accent-text);
}
.plan-tab-badge.alert { background: var(--alert-soft); color: var(--alert); }

.plan-panel { animation: fade-in 260ms var(--ease) both; }

/* --- Mosaico de medidores --- */
.plan-gauges { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 10px; }
.plan-gauge {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 16px 10px 13px; border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface); cursor: pointer; text-align: center;
  transition: border-color var(--ease), transform var(--ease), background var(--ease);
}
.plan-gauge:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.plan-gauge.active { border-color: var(--gauge-color); background: var(--surface-2); }

.plan-gauge-ring { position: relative; width: 52px; height: 52px; }
.plan-gauge-svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.plan-gauge-track { fill: none; stroke: var(--surface-3); stroke-width: 5; }
.plan-gauge-prog {
  fill: none; stroke: var(--gauge-color); stroke-width: 5; stroke-linecap: round;
  stroke-dasharray: 138.23;
  transition: stroke-dashoffset 900ms cubic-bezier(0.2, 0, 0.2, 1);
}
.plan-gauge-pct {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 0.74rem; font-weight: 700; color: var(--gauge-color);
}
.plan-gauge-name {
  font-size: 0.76rem; font-weight: 500; color: var(--text-primary);
  max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.plan-gauge-vals { font-family: var(--font-mono); font-size: 0.66rem; color: var(--text-muted); }

/* --- Panel de detalle del medidor seleccionado --- */
.plan-gauge-detail {
  margin-top: 14px; padding: 0 14px; max-height: 0; overflow: hidden; opacity: 0;
  border-radius: var(--r-md); background: var(--surface-2); border: 1px solid transparent;
  transition: max-height 320ms var(--ease), opacity 240ms var(--ease), padding 320ms var(--ease), border-color var(--ease);
}
.plan-gauge-detail.visible { max-height: 220px; opacity: 1; padding: 14px; border-color: var(--border); }
.plan-gauge-detail-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.plan-gauge-detail-cat { font-size: 0.86rem; font-weight: 600; color: var(--text-primary); }
.plan-gauge-tag { font-family: var(--font-mono); font-size: 0.68rem; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.plan-gauge-tag.over { background: var(--alert-soft); color: var(--alert); }
.plan-gauge-tag.ok { background: var(--positive-soft); color: var(--positive); }
.plan-gauge-detail-note { font-size: 0.8rem; color: var(--text-secondary); line-height: 1.5; }
.plan-gauge-detail-note.muted { color: var(--text-muted); font-style: italic; }

/* --- Acción de la semana: checkbox que celebra --- */
.plan-action-main { display: flex; flex-direction: column; gap: 4px; }
.plan-action-check {
  align-self: flex-start; margin-top: 10px; display: inline-flex; align-items: center; gap: 9px;
  padding: 7px 14px 7px 10px; border: 1px solid var(--border-strong); border-radius: 999px;
  background: var(--surface); color: var(--text-secondary); cursor: pointer;
  font-family: var(--font-ui); font-size: 0.8rem; font-weight: 500;
  transition: all var(--ease);
}
.plan-action-check:hover { border-color: var(--accent-line); color: var(--text-primary); }
.plan-check-box {
  width: 18px; height: 18px; border-radius: 6px; border: 2px solid var(--text-muted);
  display: inline-flex; align-items: center; justify-content: center; transition: all var(--ease);
}
.plan-action-check.done { background: var(--positive-soft); border-color: var(--positive); color: var(--positive); }
.plan-action-check.done .plan-check-box { background: var(--positive); border-color: var(--positive); }
.plan-action-check.done .plan-check-box::after {
  content: '✓'; color: #0A0B0D; font-size: 0.7rem; font-weight: 800; line-height: 1;
}

/* Aviso de email sin verificar */
.verify-banner { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; padding: 10px 16px; font-size: 0.84rem; color: var(--accent-text, #7FEEC6); background: var(--accent-soft, rgba(53,224,161,0.12)); border-bottom: 1px solid var(--accent-line, rgba(53,224,161,0.32)); }
.verify-banner .wizard-btn { padding: 6px 14px; font-size: 0.8rem; }
