@import url("https://fonts.googleapis.com/css2?family=Urbanist:wght@400..700&display=swap");

/* Kiro Finance — mint glass ledger (Verdelo-inspired Operate shell) */

:root {
  --font: "Urbanist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-brand: var(--font);
  /* Verdelo-clean: canvas airy, barely mint — not heavy sage */
  --bg: #fafcfb;
  --bg-glow: transparent;
  --tint: rgba(250, 252, 251, 0.78);
  --surface: rgba(255, 255, 255, 0.78);
  --surface-2: #f1f5f3;
  --sidebar-bg: transparent;
  --panel: #f7faf8f5;
  --ink: #0f1d17;
  --ink-2: #26362e;
  --muted: #4a5b52;
  --line: #0f281c1a;
  --line-2: #0f281c2b;
  --glass-rim: #ffffff9e;
  --glass-hi: #ffffff80;
  --glass-edge: #1432221a;
  --accent: #137a50;
  --accent-from: #1a8f5f;
  --accent-to: #0f6b45;
  --accent-soft: #137a501f;
  --accent-ink: #0f6c46;
  --accent-glow: #137a5073;
  --on-accent: #f2fbf6;
  --mint: #2fb877;
  --mint-soft: #2fb87733;
  --good: #12764a;
  --bad: #b13b22;
  --warn: #85560a;
  --warn-bg: #c8841429;
  --family: #23609a;
  --family-bg: #2864aa1f;
  --biz: #8a4b16;
  --biz-bg: #c8841429;
  /* Doughnut / categorías: vivos sin rosa */
  --chart-1: #22c55e;
  --chart-2: #38bdf8;
  --chart-3: #fbbf24;
  --chart-4: #14b8a6;
  --chart-5: #6366f1;
  --chart-6: #84cc16;
  --shadow: 0 1px 2px #1432220f, 0 18px 40px -26px #14322261;
  --shadow-lg: 0 2px 6px #1432221a, 0 34px 70px -28px #1432227a;
  --blur: blur(22px) saturate(150%);
  --radius: 22px;
  --radius-sm: 12px;
  --r-xl: 28px;
  --side-w: 84px;
  --sidebar: var(--side-w);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-move: cubic-bezier(0.77, 0, 0.175, 1);
  --duration: 200ms;
  --max: 1640px;
  --bs-body-bg: var(--bg);
  --bs-body-color: var(--ink);
  --bs-border-color: var(--line);
  --focus-ring: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent);
  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #0c1210;
  --tint: rgba(30, 40, 36, 0.55);
  --surface: rgba(6, 11, 9, 0.55);
  --surface-2: #1a221e;
  --panel: #111916f0;
  --ink: #eef4ee;
  --ink-2: #d7e2da;
  --muted: #a8b9af;
  --line: #dcffec17;
  --line-2: #dcffec29;
  --glass-rim: #e1ffee1a;
  --glass-hi: #e1ffee0f;
  --glass-edge: #00000040;
  --accent: #6ee0a1;
  --accent-from: #8ceab6;
  --accent-to: #55cf8c;
  --accent-soft: #6ee0a124;
  --accent-ink: #8ee9b7;
  --accent-glow: #6ee0a161;
  --on-accent: #062a16;
  --mint: #6ee0a1;
  --mint-soft: #6ee0a133;
  --good: #8ee9b7;
  --bad: #f6a38e;
  --warn: #f2c770;
  --warn-bg: #f2c77024;
  --family: #a3cbf0;
  --family-bg: #a3cbf021;
  --biz: #fdba74;
  --biz-bg: #fdba7424;
  --chart-1: #4ade80;
  --chart-2: #7dd3fc;
  --chart-3: #fde047;
  --chart-4: #2dd4bf;
  --chart-5: #a5b4fc;
  --chart-6: #a3e635;
  --shadow: 0 1px 2px #00000040, 0 22px 44px -26px #000000b3;
  --shadow-lg: 0 2px 6px #0006, 0 34px 80px -26px #000000d9;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: auto; }
::selection {
  background: color-mix(in srgb, var(--accent) 32%, transparent);
  color: var(--ink);
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01" on, "tnum" on;
  position: relative;
}

/* Atmospheric scene — Verdelo smoked glass, clean not verdoso */
.scene {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 55% at 10% 0%, #e7f5ee66, transparent 58%),
    radial-gradient(ellipse 55% 45% at 100% 100%, #eef4f066, transparent 52%),
    linear-gradient(180deg, #fafcfb 0%, #f5f8f6 55%, #f2f5f3 100%);
}
html[data-theme="dark"] .scene {
  background:
    radial-gradient(ellipse 70% 50% at 12% 0%, #6ee0a114, transparent 55%),
    radial-gradient(ellipse 50% 40% at 100% 100%, #1a2a2218, transparent 50%),
    linear-gradient(180deg, #0c1210 0%, #080d0b 55%, #060908 100%);
}

/* Theme circle expand (View Transitions API + fallback) */
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}
::view-transition-old(root) { z-index: 1; }
::view-transition-new(root) {
  z-index: 9999;
  animation: kiro-theme-circle 0.58s var(--ease) both;
}
@keyframes kiro-theme-circle {
  from { clip-path: circle(0px at var(--theme-x, 50%) var(--theme-y, 50%)); }
  to { clip-path: circle(var(--theme-r, 120vmax) at var(--theme-x, 50%) var(--theme-y, 50%)); }
}
.theme-burst {
  position: fixed;
  z-index: 10000;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  background: var(--theme-burst-bg, #0c1210);
  transition: transform 0.55s var(--ease), opacity 0.2s ease 0.35s;
  will-change: transform;
}
.theme-burst.is-on {
  transform: translate(-50%, -50%) scale(var(--theme-burst-scale, 80));
  opacity: 0;
}

/* Buttons */
.btn {
  font-family: var(--font);
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition:
    background var(--duration) var(--ease),
    color var(--duration) var(--ease),
    border-color var(--duration) var(--ease),
    transform var(--duration) var(--ease),
    box-shadow var(--duration) var(--ease),
    filter var(--duration) var(--ease);
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
.btn-accent {
  background: linear-gradient(135deg, var(--accent-from), var(--accent) 55%, var(--accent-to));
  border-color: transparent;
  color: var(--on-accent);
  box-shadow: inset 0 1px 0 #ffffff59, 0 10px 22px -12px var(--accent-glow);
}
.btn-accent:hover {
  filter: brightness(1.04);
  background: linear-gradient(135deg, var(--accent-from), var(--accent) 55%, var(--accent-to));
  color: var(--on-accent);
  border-color: transparent;
}
.btn-outline-accent {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  color: var(--accent-ink);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
}
.btn-outline-accent:hover {
  background: var(--accent-soft);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.btn-outline-secondary, .btn-outline-danger {
  border-color: var(--line-2);
  color: var(--ink-2);
  background: color-mix(in srgb, var(--surface) 80%, transparent);
}
.btn-outline-secondary:hover {
  background: var(--surface-2);
  color: var(--ink);
  border-color: var(--line-2);
}
.btn-outline-danger:hover {
  background: color-mix(in srgb, var(--bad) 12%, var(--surface));
  color: var(--bad);
  border-color: var(--bad);
}
.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 75%, transparent);
  color: var(--ink-2);
}
.btn-icon:hover { background: var(--surface-2); color: var(--ink); }
.btn-icon.btn-accent {
  border: 0;
  width: 44px;
  height: 44px;
  font-size: 1.45rem;
  font-weight: 600;
  line-height: 1;
  color: var(--on-accent);
  background: linear-gradient(135deg, var(--accent-from), var(--accent) 55%, var(--accent-to));
  box-shadow: 0 10px 22px -12px var(--accent-glow);
}
.btn-icon.btn-accent:hover {
  color: var(--on-accent);
  filter: brightness(1.05);
}
.btn-fab-mov {
  font-size: 1.65rem;
  font-weight: 600;
  line-height: 1;
  border: 0;
  color: var(--on-accent);
  background: linear-gradient(135deg, var(--accent-from), var(--accent) 55%, var(--accent-to));
}
.btn-icon svg { width: 18px; height: 18px; }
.btn-icon.theme-btn--sun {
  color: #f5b942;
  border-color: color-mix(in srgb, #f5b942 45%, var(--line));
  background: color-mix(in srgb, #f5b942 16%, var(--surface));
  box-shadow: 0 0 0 1px color-mix(in srgb, #f5b942 25%, transparent);
}
.btn-icon.theme-btn--sun:hover {
  color: #ffd56a;
  background: color-mix(in srgb, #f5b942 26%, var(--surface));
}
.btn-icon.theme-btn--moon {
  color: var(--ink-2);
  border-color: var(--line-2);
}
.btn-icon.theme-btn--moon:hover {
  color: var(--ink);
  background: var(--surface-2);
}
.theme-ico { width: 18px; height: 18px; display: block; }
.theme-ico--sun { color: #f5b942; filter: drop-shadow(0 0 6px #f5b94288); }

.form-control, .form-select {
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border-color: var(--line);
  color: var(--ink);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}
.form-control:focus, .form-select:focus {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

/* —— Shell —— */
#app:not(.d-none) { display: block; min-height: 100vh; padding: 12px; }
.app-shell {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  max-width: var(--max);
  margin: 0 auto;
  min-height: calc(100vh - 24px);
  background: var(--tint);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border-radius: var(--r-xl);
  border: 1px solid var(--glass-rim);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.sidebar {
  position: sticky;
  top: 0;
  width: 84px;
  height: calc(100vh - 24px);
  max-height: calc(100vh - 24px);
  padding: 14px 8px 14px;
  border-right: 1px solid var(--line);
  background: transparent;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
  box-sizing: border-box;
  overflow-x: hidden;
  overflow-y: auto;
  min-width: 0;
}
html.is-wide .sidebar {
  width: 248px;
  padding: 14px 14px 14px;
}
.brand {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0 0 4px;
  width: 100%;
  flex: 0 0 auto;
}
.brand-text { display: none; }
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent-from), var(--accent) 55%, var(--accent-to));
  color: var(--on-accent);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.03em;
  box-shadow: 0 10px 24px -12px var(--accent-glow);
}
.brand h1, .brand p { display: none; }

.nav-group-label { display: none; }
.nav-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  overflow: auto;
  scrollbar-width: none;
  align-items: center;
}
.nav-stack::-webkit-scrollbar { display: none; }
.nav-item {
  display: grid;
  grid-template-columns: 1fr;
  width: 100%;
  position: relative;
}
.nav-item.is-dragging { opacity: 0.45; }
.nav-item.drag-over .nav-link { outline: 2px solid var(--accent); outline-offset: 2px; }
.nav-drag {
  position: absolute;
  left: -2px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  color: var(--muted);
  cursor: grab;
  opacity: 0;
  z-index: 2;
  transition: opacity var(--duration) var(--ease);
}
.nav-item:hover .nav-drag { opacity: 0.7; }
.nav-drag:active { cursor: grabbing; }
.nav-drag-pinned { display: none !important; }
.nav-grip { width: 10px; height: 14px; opacity: 0.55; }
.nav-ico {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: currentColor;
  stroke-width: 1.7;
}
.nav-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.nav-reset {
  border: 0;
  background: transparent;
  color: var(--muted);
  width: 36px;
  height: 36px;
  margin: 6px auto 0;
  padding: 0;
  border-radius: 12px;
  display: grid;
  place-items: center;
  opacity: 0.65;
  cursor: pointer;
  transition:
    opacity var(--duration) var(--ease),
    background var(--duration) var(--ease),
    color var(--duration) var(--ease);
}
.nav-reset:hover {
  opacity: 1;
  color: var(--ink);
  background: color-mix(in srgb, var(--surface) 80%, transparent);
}
.nav-reset:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.nav-reset .nav-ico { width: 16px; height: 16px; }
.nav-stack .nav-link {
  border: 0;
  background: transparent;
  color: var(--ink-2);
  border-radius: 14px;
  width: 44px;
  height: 44px;
  margin: 0 auto;
  padding: 0;
  display: grid;
  place-items: center;
  transition:
    background var(--duration) var(--ease),
    color var(--duration) var(--ease),
    box-shadow var(--duration) var(--ease);
  font-size: 0.875rem;
  font-weight: 600;
  position: relative;
}
.nav-stack .nav-link:hover {
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  color: var(--ink);
}
.nav-stack .nav-link.active {
  background: linear-gradient(135deg, var(--accent-from), var(--accent) 55%, var(--accent-to));
  color: var(--on-accent) !important;
  box-shadow: 0 4px 10px -6px var(--accent-glow);
  justify-self: stretch;
  align-self: stretch;
}
.nav-stack .nav-link.active .nav-label,
.nav-stack .nav-link.active .nav-ico,
.nav-stack .nav-link.active .tag-plan {
  color: var(--on-accent) !important;
  opacity: 1;
}
/* Rail desktop: pill centrado bajo el ícono (no en móvil drawer) */
@media (min-width: 992px) {
  html.is-rail .nav-stack .nav-item {
    display: flex;
    justify-content: center;
    width: 100%;
  }
  html.is-rail .nav-stack .nav-link {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    margin: 0;
  }
  html.is-rail .nav-stack .nav-link.active {
    width: 44px;
    height: 44px;
  }
}
.nav-stack .nav-link-quiet { opacity: 0.92; }
.nav-stack .nav-link[disabled],
.nav-stack .nav-link.is-locked { opacity: 0.4; cursor: not-allowed; }
.nav-stack .nav-link:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.nav-stack .nav-link .tag-plan {
  position: absolute;
  top: 2px;
  right: 2px;
  margin: 0;
  font-size: 0.45rem;
  padding: 1px 3px;
  border-radius: 4px;
}
.tag-pro, .tag-plan {
  font-size: 0.6rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--warn-bg);
  color: var(--warn);
  letter-spacing: 0.02em;
}
.tag-plan.family { background: var(--family-bg); color: var(--family); }
.tag-plan.business { background: var(--biz-bg); color: var(--biz); }
.tag-plan.personal { background: var(--accent-soft); color: var(--accent-ink); }

.user-chip {
  border: 0;
  background: transparent;
  border-radius: 999px;
  padding: 4px;
  display: flex;
  justify-content: center;
  gap: 0;
  align-items: center;
  width: 100%;
  cursor: pointer;
  color: inherit;
  font: inherit;
  text-align: left;
}
.user-chip:hover { background: color-mix(in srgb, var(--surface) 70%, transparent); }
.user-chip .min-w-0 { display: none; }
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: var(--mint-soft);
  color: var(--accent-ink);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.8rem;
  border: 1px solid var(--line);
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: transparent;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  padding: 18px 22px 12px;
  border-bottom: 1px solid transparent;
  background: transparent;
}
.topbar h2 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: -0.03em;
  font-weight: 650;
}
.topbar p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.content {
  padding: 8px 22px 40px;
  max-width: none;
  flex: 1;
}

.note {
  margin-bottom: 1rem;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 0.84rem;
  line-height: 1.45;
}

.card-panel {
  background: var(--surface);
  border: 1px solid var(--glass-rim);
  border-radius: var(--radius);
  padding: 18px 20px 20px;
  height: 100%;
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, #fff 40%, transparent),
    var(--shadow);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  position: relative;
}
html[data-theme="dark"] .card-panel {
  box-shadow: inset 0 0 0 1px var(--glass-rim), var(--shadow);
}
.card-panel:hover { border-color: var(--line-2); }

.section-title {
  font-size: 1rem;
  letter-spacing: -0.02em;
  text-transform: none;
  color: var(--ink);
  font-weight: 650;
  margin: 0;
}
.section-sub {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
}
.chead {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
}
.chead__text { min-width: 0; }

.kpi .label {
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--muted);
  font-weight: 600;
}
.kpi .value {
  font-size: 1.55rem;
  font-weight: 650;
  letter-spacing: -0.025em;
  margin-top: 0.3rem;
  font-variant-numeric: tabular-nums;
}
.kpi .hint { margin-top: 0.3rem; font-size: 0.72rem; color: var(--muted); }
.text-good { color: var(--good) !important; }
.text-bad { color: var(--bad) !important; }
.muted { color: var(--muted); }
.empty {
  padding: 1.25rem 1rem;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-2) 45%, transparent);
}
.empty strong { display: block; color: var(--ink); margin-bottom: 0.3rem; font-weight: 600; }

.chip {
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  font-size: 0.8rem;
  color: var(--ink-2);
  font-weight: 600;
  transition:
    background var(--duration) var(--ease),
    color var(--duration) var(--ease),
    border-color var(--duration) var(--ease);
}
.chip:hover { border-color: var(--line-2); color: var(--ink); }
.chip:active { transform: scale(0.97); }
.chip.active {
  background: var(--ink);
  color: var(--bg);
  border-color: transparent;
}
html[data-theme="dark"] .chip.active {
  background: var(--ink);
  color: #0c1210;
}
.seg {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-2) 80%, transparent);
  border: 1px solid var(--line);
}
.seg button {
  border: 0;
  background: transparent;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
  transition: background var(--duration) var(--ease), color var(--duration) var(--ease);
}
.seg button.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px #14322214;
}
.seg button:active { transform: scale(0.97); }

.bars {
  height: 180px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 6px;
  align-items: end;
  margin-top: 0.5rem;
}
.bar {
  border-radius: 6px 6px 2px 2px;
  min-height: 0;
  position: relative;
  background: var(--accent);
  transition: height 0.3s var(--ease);
}
.bar span {
  position: absolute;
  bottom: -16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.58rem;
  color: var(--muted);
  white-space: nowrap;
}
.donut-wrap { display: grid; grid-template-columns: 120px 1fr; gap: 1rem; align-items: center; }
.donut {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: conic-gradient(var(--accent) 0 100%);
  -webkit-mask: radial-gradient(circle 36px at center, transparent 98%, #000 100%);
  mask: radial-gradient(circle 36px at center, transparent 98%, #000 100%);
}
.legend-row { display: flex; justify-content: space-between; gap: 0.5rem; font-size: 0.84rem; margin-bottom: 0.4rem; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 0.4rem; background: var(--accent); }

.filter-panel {
  display: grid;
  grid-template-columns: 1.4fr repeat(5, 1fr) auto;
  gap: 0.5rem;
  padding: 0.9rem;
  margin-bottom: 1rem;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--glass-rim);
  box-shadow: var(--shadow);
}
.filter-panel label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 600;
}
.table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--ink);
  --bs-table-color-state: var(--ink);
  --bs-table-striped-color: var(--ink);
  --bs-table-hover-color: var(--ink);
  --bs-table-border-color: var(--line);
  color: var(--ink) !important;
}
.table thead th {
  font-size: 0.7rem;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--muted) !important;
  font-weight: 650;
  border-bottom-color: var(--line);
  background: transparent !important;
}
.table td,
.table tbody td,
.table tbody th {
  border-color: var(--line);
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
  color: var(--ink) !important;
  background: transparent !important;
}
.table .muted,
.table .text-muted {
  color: var(--muted) !important;
}
html[data-theme="dark"] .table td,
html[data-theme="dark"] .table tbody th {
  color: var(--ink) !important;
}
html[data-theme="dark"] .table thead th {
  color: var(--muted) !important;
}
.muted,
.text-muted {
  color: var(--muted) !important;
}
html[data-theme="dark"] .muted,
html[data-theme="dark"] .text-muted {
  color: #b7c8be !important;
}
html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select {
  color: var(--ink);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
}
html[data-theme="dark"] .form-control::placeholder {
  color: color-mix(in srgb, var(--muted) 80%, transparent);
}
.list-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
}
.list-row:last-child { border-bottom: 0; }
.progress-thin {
  height: 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 8%, transparent);
  overflow: hidden;
}
.progress-thin i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-from), var(--accent));
  border-radius: inherit;
}

/* Reportes / overview */
.home-kicker { display: none !important; }
.ov-hero {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-end;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.home-title {
  margin: 0;
  font-size: 1.85rem;
  letter-spacing: -0.035em;
  line-height: 1.15;
  font-weight: 650;
}
.home-sub {
  margin: 0.4rem 0 0;
  color: var(--ink-2);
  max-width: 48ch;
  font-size: 0.92rem;
  line-height: 1.45;
}
.ov-hero-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.ov-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1rem;
}
.ov-toolbar .ms-auto { margin-left: auto; display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }

.ov-balance .balance-value {
  font-size: 2rem;
  font-weight: 650;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.ov-pace {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.55rem;
  margin-top: 1rem;
}
.ov-pace .kpi-lite { padding: 0.7rem 0.75rem; }
.ov-pace .kpi-lite strong { font-size: 1rem; }

.chart-card { min-height: 260px; }
.chart-shell { position: relative; height: 210px; }
.chart-shell .chart-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 1rem;
}
.doughnut-wrap {
  display: grid;
  grid-template-columns: minmax(160px, 200px) 1fr;
  gap: 1rem;
  align-items: center;
}
.doughnut-shell {
  position: relative;
  width: 100%;
  max-width: 200px;
  height: 200px;
  margin: 0 auto;
}
.doughnut-shell canvas { position: relative; z-index: 1; }
.doughnut-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  pointer-events: none;
  z-index: 0;
}
.doughnut-center b {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.doughnut-center small {
  display: block;
  margin-top: 2px;
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
  max-width: 7.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chart-legend { font-size: 0.82rem; }
.chart-legend .legend-row {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  align-items: center;
}
.chart-legend-compact .legend-row:nth-child(n+6) { display: none; }

.insight-rail {
  border: 1px solid var(--glass-rim);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.insight-summary {
  list-style: none;
  cursor: pointer;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.65rem;
  align-items: center;
  padding: 0.85rem 1rem;
  user-select: none;
}
.insight-summary::-webkit-details-marker { display: none; }
.insight-mark {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 0 4px var(--mint-soft);
  animation: breathe-ring 2.2s ease-in-out infinite;
}
@keyframes breathe-ring {
  0%, 100% { box-shadow: 0 0 0 3px var(--mint-soft); opacity: 0.85; }
  50% { box-shadow: 0 0 0 6px var(--mint-soft); opacity: 1; }
}
.insight-line {
  font-size: 0.9rem;
  color: var(--ink);
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.insight-more {
  font-size: 0.7rem;
  letter-spacing: 0.02em;
  font-weight: 650;
  color: var(--muted);
}
.insight-rail[open] .insight-more { color: var(--accent-ink); }
.insight-panel {
  padding: 0 1rem 1rem 1.85rem;
  border-top: 1px solid var(--line);
}
.brief-body { margin: 0.7rem 0 0; color: var(--ink-2); line-height: 1.5; font-size: 0.88rem; }
.brief-actions { margin: 0.5rem 0 0; padding-left: 1.05rem; color: var(--ink-2); font-size: 0.85rem; }
.brief-actions li { margin-bottom: 0.2rem; }

.kpi-lite {
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-2) 70%, transparent);
  border-radius: 16px;
  padding: 0.85rem 1rem;
}
.kpi-lite span {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
}
.kpi-lite strong {
  display: block;
  margin-top: 0.25rem;
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.inbox-list { display: flex; flex-direction: column; gap: 0.55rem; }
.inbox-item {
  border: 1px solid var(--glass-rim);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  align-items: start;
  box-shadow: var(--shadow);
  transition: border-color var(--duration) var(--ease);
}
.inbox-item:hover { border-color: var(--line-2); }
.inbox-item.needs-review {
  border-color: color-mix(in srgb, var(--warn) 40%, var(--line));
  background: color-mix(in srgb, var(--warn-bg) 40%, var(--surface));
}
.inbox-meta { font-size: 0.75rem; color: var(--muted); margin-top: 0.25rem; }
.inbox-raw { font-size: 0.82rem; color: var(--ink-2); margin-top: 0.35rem; font-style: italic; }
.inbox-actions { display: flex; flex-direction: column; gap: 0.3rem; align-items: stretch; min-width: 104px; }
.badge-src {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted);
  margin-right: 0.3rem;
}
.badge-src.wa { background: var(--accent-soft); color: var(--accent-ink); }
.badge-review { background: var(--warn-bg); color: var(--warn); }

/* Plans */
.plans-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
}
.billing-switch {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  gap: 2px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.billing-switch button {
  border: 0;
  background: transparent;
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}
.billing-switch button.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px #14322214;
}
.billing-switch .bill-save {
  margin-left: 0.2rem;
  font-size: 0.62rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--good);
  font-weight: 700;
}
.plan-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.85rem; }
.plan-card {
  border: 1px solid var(--glass-rim);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-height: 100%;
  box-shadow: var(--shadow);
  transition: border-color var(--duration) var(--ease);
}
.plan-card:hover { border-color: var(--line-2); }
.plan-card.current {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent), var(--shadow);
}
.plan-card h3 {
  margin: 0;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
  font-weight: 650;
}
.plan-card .price { font-size: 0.82rem; color: var(--muted); }
.plan-price-block { display: flex; flex-direction: column; gap: 0.15rem; }
.plan-price {
  font-size: 1.4rem;
  letter-spacing: -0.025em;
  font-weight: 650;
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  font-variant-numeric: tabular-nums;
}
.plan-save {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--good);
  background: color-mix(in srgb, var(--good) 12%, transparent);
  padding: 2px 6px;
  border-radius: 6px;
}
.plan-card ul { margin: 0; padding-left: 1.05rem; color: var(--ink-2); font-size: 0.88rem; }
.plan-card li { margin-bottom: 0.22rem; }
.plan-card[data-plan="family"].current {
  border-color: var(--family);
  box-shadow: inset 0 0 0 1px var(--family), var(--shadow);
}
.plan-card[data-plan="business"].current {
  border-color: var(--biz);
  box-shadow: inset 0 0 0 1px var(--biz), var(--shadow);
}
.upgrade-modal .modal-title { letter-spacing: -0.02em; font-weight: 650; }
.upgrade-options { display: flex; flex-direction: column; gap: 0.55rem; }
.upgrade-option {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  text-align: left;
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 0.8rem 0.95rem;
  color: var(--ink);
  transition: border-color var(--duration) var(--ease);
}
.upgrade-option:hover { border-color: var(--accent); }
.upgrade-option:active { transform: scale(0.99); }
.upgrade-price { font-weight: 700; color: var(--accent-ink); white-space: nowrap; }
.accounts-limit-hint { font-size: 0.8rem; color: var(--muted); margin: -0.25rem 0 0.9rem; }
.gate-feature {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 1.5rem 1.35rem;
  text-align: center;
  background: var(--surface);
}
.gate-feature h3 { margin: 0 0 0.45rem; font-weight: 650; }
.space-hero {
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  margin-bottom: 1rem;
  border: 1px solid var(--glass-rim);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.space-hero.family { background: color-mix(in srgb, var(--family-bg) 55%, var(--surface)); }
.space-hero.business { background: color-mix(in srgb, var(--biz-bg) 55%, var(--surface)); }

/* Auth gate */
.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  position: relative;
  z-index: 1;
}
.gate-card {
  width: min(400px, 100%);
  background: var(--surface);
  border: 1px solid var(--glass-rim);
  border-radius: var(--r-xl);
  padding: 1.5rem;
  text-align: center;
  box-shadow: var(--shadow-lg);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
}
.qr-box {
  width: 168px;
  height: 168px;
  margin: 0 auto 1rem;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  background: #fff;
  color: #999;
}
.qr-box img { width: 100%; height: 100%; object-fit: cover; }
.scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 29, 23, 0.28);
  z-index: 28;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.scrim.on { display: block; }
html.menu-open #app {
  position: relative;
  z-index: 30;
}

.modal-content {
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--glass-rim);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.modal-header, .modal-footer { border-color: var(--line); }
.btn-close { filter: invert(0.2); }
html[data-theme="dark"] .btn-close { filter: invert(0.85); }

.linkbtn {
  border: 0;
  background: none;
  color: var(--accent-ink);
  font-weight: 650;
  font-size: 0.82rem;
  padding: 0;
}
.linkbtn:hover { text-decoration: underline; }

@media (max-width: 991px) {
  #app:not(.d-none) { padding: 0; }
  .app-shell {
    grid-template-columns: 1fr;
    border-radius: 0;
    min-height: 100vh;
    border: 0;
    /* backdrop-filter atrapa el drawer fixed → scrim lo tapa; en móvil sin blur */
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    background: var(--bg);
  }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 40;
    width: min(86vw, 280px) !important;
    height: 100vh;
    max-height: none;
    transform: translateX(-105%);
    transition: transform 0.28s var(--ease);
    /* Opaco en drawer: evita “difuminado” sobre el contenido */
    background: color-mix(in srgb, var(--bg) 92%, #ffffff);
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    padding: 18px 14px;
    align-items: stretch;
    pointer-events: auto;
    box-shadow: var(--shadow-lg);
    overflow-y: auto;
    overflow-x: hidden;
  }
  html[data-theme="dark"] .sidebar {
    background: color-mix(in srgb, var(--bg) 94%, #000000);
  }
  html.is-wide .sidebar { width: min(86vw, 280px) !important; }
  .sidebar.open {
    transform: none;
    pointer-events: auto;
  }
  .sidebar .nav-stack,
  .sidebar .nav-link {
    pointer-events: auto;
    position: relative;
    z-index: 1;
  }
  .brand { justify-content: flex-start; gap: 0.7rem; align-items: center; }
  .brand-text { display: block; }
  .brand h1 {
    display: block;
    font-size: 1.05rem;
    margin: 0;
    letter-spacing: -0.02em;
    font-weight: 700;
  }
  .brand p { display: block; margin: 2px 0 0; font-size: 0.7rem; color: var(--muted); }
  .nav-stack { align-items: stretch; }
  /* En móvil: sin grips de drag (solo ensucian); Reportes a ancho completo */
  .nav-item,
  .nav-item--pinned {
    grid-template-columns: minmax(0, 1fr);
  }
  .nav-drag { display: none !important; }
  .nav-label {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    clip: auto;
    overflow: visible;
    white-space: normal;
  }
  .nav-stack .nav-link {
    width: 100%;
    max-width: 100%;
    height: auto;
    min-height: 42px;
    margin: 0;
    padding: 0.55rem 0.7rem;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 0.55rem;
    border-radius: 14px;
    grid-column: 1;
    justify-self: stretch;
  }
  .nav-stack .nav-link.active {
    width: 100%;
    height: auto;
    min-height: 42px;
  }
  .nav-stack .nav-link .tag-plan { position: static; margin-left: auto; }
  .user-chip {
    justify-content: flex-start;
    gap: 0.65rem;
    border: 1px solid var(--line);
    padding: 0.65rem;
    border-radius: var(--radius);
  }
  .user-chip .min-w-0 { display: block; }
  .filter-panel { grid-template-columns: 1fr 1fr; }
  .plan-grid { grid-template-columns: 1fr; }
  .donut-wrap, .doughnut-wrap { grid-template-columns: 1fr; justify-items: center; }
  .ov-pace { grid-template-columns: 1fr 1fr; }
  .content { padding: 8px 16px 96px; }
  /* Menú móvil: mismo lenguaje visual que el fold de escritorio */
  .side-fold { display: none !important; }
  .side-fold-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid color-mix(in srgb, var(--ink) 14%, var(--line));
    background: color-mix(in srgb, var(--ink) 5%, var(--surface));
    color: var(--ink);
    box-shadow: none;
  }
  .side-fold-btn:hover,
  .side-fold-btn:focus-visible {
    background: var(--surface-2);
    color: var(--ink);
  }
  .side-fold-btn.is-open {
    background: color-mix(in srgb, var(--accent) 14%, var(--surface));
    border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
    color: var(--accent-ink);
  }
  html[data-theme="dark"] .side-fold-btn {
    background: color-mix(in srgb, var(--surface) 80%, transparent);
    border-color: var(--line-2);
    color: var(--ink);
  }
  html[data-theme="dark"] .side-fold-btn.is-open {
    background: color-mix(in srgb, var(--mint) 18%, var(--surface));
    border-color: color-mix(in srgb, var(--mint) 40%, var(--line));
    color: var(--mint);
  }
  .side-fold-btn .nav-ico { width: 18px; height: 18px; }
  html.is-wide,
  html.is-rail {
    --side-w: 0px;
  }
  .app-shell { transition: none; }
  .metrics-tabs { gap: 0.85rem; overflow-x: auto; }
  .seg { flex-wrap: wrap; }
  .ov-hero { flex-direction: column; align-items: stretch; gap: 0.85rem; }
  .ov-hero-actions { display: flex; gap: 0.5rem; }
  .ov-hero-actions .btn { flex: 1; }
  .topbar-actions .btn-outline-accent { display: none; }
  .btn-fab-mov {
    position: fixed;
    right: 18px;
    bottom: 22px;
    z-index: 25;
    width: 56px;
    height: 56px;
    border-radius: 999px;
    box-shadow: var(--shadow-lg);
  }
}
@media (max-width: 640px) {
  .home-title { font-size: 1.55rem; }
  .ov-pace { grid-template-columns: 1fr 1fr; }
  .inbox-item { grid-template-columns: 1fr; }
  .inbox-actions { flex-direction: row; }
  .topbar { padding: 14px 16px 8px; }
  .pots, .budget-grid, .member-grid { grid-template-columns: 1fr; }
  .pot { flex-direction: column; }
  .pot__glass { width: 100%; min-height: 140px; height: 140px; }
  .heat__dows { font-size: 0.7rem; }
}

/* —— Metrics tabs (Verdelo Insights) —— */
.metrics-tabs {
  display: flex;
  gap: 1.5rem;
  align-items: flex-end;
  margin: 0.35rem 0 1.15rem;
  border-bottom: 1px solid var(--line);
  padding: 0 2px;
}
.metrics-tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 650;
  font-size: 0.95rem;
  padding: 0.45rem 0.15rem 0.75rem;
  position: relative;
  cursor: pointer;
  line-height: 1.2;
}
.metrics-tab:hover { color: var(--ink); }
.metrics-tab.active {
  color: var(--accent-ink);
}
.metrics-tab.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2.5px;
  border-radius: 2px 2px 0 0;
  background: var(--mint);
}
.insight-tiles {
  align-items: stretch;
}
.icon-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.icon-picker button {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.icon-picker button.is-on {
  border-color: var(--accent);
  color: var(--accent-ink);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.icon-picker .nav-ico { width: 18px; height: 18px; }
.acc-card__ico {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--mint) 18%, var(--surface-2));
  color: var(--accent-ink);
  flex: 0 0 auto;
}
.acc-card__ico .nav-ico { width: 18px; height: 18px; }
.member-card--empty {
  width: 100%;
  cursor: pointer;
}
.member-card--empty:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.metrics-panel { animation: metrics-in 0.28s var(--ease); }
@keyframes metrics-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.heat-host { overflow-x: auto; padding: 0.35rem 0 0.2rem; width: 100%; }
.heat {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  width: 100%;
  min-width: 0;
}
.heat__months {
  display: grid;
  grid-template-columns: repeat(var(--heat-cols, 12), minmax(0, 1fr));
  gap: 5px;
  margin-left: 40px;
  font-size: 0.72rem;
  font-weight: 650;
  color: var(--muted);
  height: 1.05rem;
}
.heat__body { display: flex; gap: 10px; align-items: stretch; width: 100%; }
.heat__dows {
  display: grid;
  grid-template-rows: repeat(7, minmax(28px, 1fr));
  gap: 5px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
  align-content: stretch;
  flex: 0 0 36px;
}
.heat__dows span { display: grid; place-items: center; min-height: 28px; }
.heat__grid {
  flex: 1 1 auto;
  display: grid;
  grid-template-rows: repeat(7, minmax(28px, 1fr));
  grid-template-columns: repeat(var(--heat-cols, 12), minmax(0, 1fr));
  grid-auto-flow: column;
  gap: 5px;
  min-width: 0;
  width: 100%;
  min-height: 220px;
}
.heat__cell {
  width: 100%;
  min-width: 0;
  min-height: 28px;
  height: 100%;
  border-radius: 6px;
  background: color-mix(in srgb, var(--mint) 10%, var(--surface-2));
  display: block;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 10%, transparent);
  transition: transform 0.15s ease, filter 0.15s ease;
}
.heat__cell:hover:not(.is-out) {
  transform: scale(1.06);
  filter: brightness(1.08);
  z-index: 1;
}
.heat__cell.is-out {
  opacity: 0.35;
  cursor: default;
  background: color-mix(in srgb, var(--ink) 6%, var(--surface-2));
}
/* Escala viva de gasto: menta → celeste → azul → ámbar (sin rosa) */
.heat__cell--0 { background: color-mix(in srgb, var(--ink) 6%, var(--surface-2)); }
.heat__cell--1 { background: #86efac; }
.heat__cell--2 { background: #38bdf8; }
.heat__cell--3 { background: #3b82f6; }
.heat__cell--4 { background: #f59e0b; }
html[data-theme="dark"] .heat__cell--0 { background: color-mix(in srgb, #fff 8%, var(--surface-2)); }
html[data-theme="dark"] .heat__cell--1 { background: #4ade80; }
html[data-theme="dark"] .heat__cell--2 { background: #38bdf8; }
html[data-theme="dark"] .heat__cell--3 { background: #60a5fa; }
html[data-theme="dark"] .heat__cell--4 { background: #fbbf24; }
.heat__legend {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
  font-size: 0.72rem;
  font-weight: 650;
  color: var(--muted);
}
.heat__legend .heat__cell {
  cursor: default;
  width: 14px;
  min-width: 14px;
  height: 14px;
  min-height: 14px;
  flex: 0 0 14px;
  aspect-ratio: auto;
}

/* —— Verdelo-adapted: insight tiles —— */
.insight-tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.insight-tiles-nav,
.insight-tiles-dots { display: none; }
.insight-tile {
  --tile: var(--surface-2);
  --tile-ink: var(--ink);
  --tile-muted: var(--muted);
  border-radius: var(--radius);
  padding: 1rem 1.05rem 0.85rem;
  min-height: 118px;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(160deg, var(--glass-hi), transparent 46%),
    linear-gradient(var(--tile), var(--tile));
  border: 1px solid var(--glass-rim);
  box-shadow: var(--shadow);
  color: var(--tile-ink);
}
/* Carrusel móvil DESPUÉS del grid base (cascade) */
@media (max-width: 991px) {
  .insight-tiles {
    display: flex !important;
    grid-template-columns: none !important;
    gap: 0.85rem;
    overflow-x: auto;
    overflow-y: visible;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 16px;
    padding: 0.25rem 16px 0.55rem;
    margin: 0 -16px 0.35rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    touch-action: pan-x;
  }
  .insight-tiles::-webkit-scrollbar { display: none; }
  .insight-tile {
    flex: 0 0 calc(100vw - 52px);
    width: calc(100vw - 52px);
    max-width: 360px;
    min-height: 172px;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    transform: none !important;
    opacity: 1 !important;
    padding: 1.15rem 1.15rem 1rem;
  }
  .insight-tile.is-focus {
    box-shadow: var(--shadow-lg);
    border-color: color-mix(in srgb, var(--mint) 32%, var(--line-2));
  }
  .insight-tile .insight-tile__value {
    font-size: 1.85rem;
    margin: 0.55rem 0 0.85rem;
  }
  .insight-tile .insight-tile__foot {
    margin-top: auto;
    flex-direction: column;
    align-items: stretch;
    gap: 0.55rem;
  }
  .insight-tile .spark {
    width: 100%;
    max-width: none;
    height: 36px;
  }
  .insight-tiles-nav {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin: 0 0 1rem;
    padding: 0 2px;
  }
  .insight-tiles-hint {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--muted);
    letter-spacing: 0.01em;
  }
  .insight-tiles-dots {
    display: flex !important;
    justify-content: flex-end;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
  }
  .insight-tiles-dots button {
    width: 7px;
    height: 7px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: color-mix(in srgb, var(--ink) 18%, transparent);
    cursor: pointer;
  }
  .insight-tiles-dots button.is-on {
    width: 18px;
    background: var(--accent);
  }
}
@media (max-width: 640px) {
  .insight-tile {
    flex-basis: calc(100vw - 44px);
    width: calc(100vw - 44px);
    min-height: 180px;
  }
}
/* Verdelo mint family — soft glass tiles, same world as the page */
.insight-tile--1 { --tile: #e7f5ee; --tile-ink: #0f3d2a; --tile-muted: #3d6b56; }
.insight-tile--2 { --tile: #eef7f2; --tile-ink: #143528; --tile-muted: #4a6b5c; }
.insight-tile--3 { --tile: #e3f1ea; --tile-ink: #0f3d2a; --tile-muted: #3d6b56; }
.insight-tile--4 { --tile: #f0f7f3; --tile-ink: #163528; --tile-muted: #456656; }
html[data-theme="dark"] .insight-tile--1 { --tile: #163528; --tile-ink: #d8ffe8; --tile-muted: #9bc4ae; }
html[data-theme="dark"] .insight-tile--2 { --tile: #1a352a; --tile-ink: #dff0e8; --tile-muted: #97b3a8; }
html[data-theme="dark"] .insight-tile--3 { --tile: #132f24; --tile-ink: #d8ffe8; --tile-muted: #9bc4ae; }
html[data-theme="dark"] .insight-tile--4 { --tile: #1c2a25; --tile-ink: #dff0e8; --tile-muted: #97b3a8; }
.tiles-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  margin: 0 0 0.85rem;
}
.tiles-toolbar__label { font-weight: 650; }
.spend-toolbar { margin-bottom: 0.65rem; }
.spend-custom {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.65rem;
  margin: 0 0 1rem;
  padding: 0.75rem 0.85rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
}
.spend-custom.d-none { display: none !important; }
.spend-custom__field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: min(42vw, 160px);
  flex: 1;
}
.spend-custom__field .form-control {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}
.insight-tile__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.insight-tile__label { font-size: 0.8rem; font-weight: 650; color: var(--tile-muted); }
.insight-tile__ico {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: var(--tile-ink);
  background: rgba(255, 255, 255, 0.55);
  flex: 0 0 auto;
}
html[data-theme="dark"] .insight-tile__ico { background: rgba(255, 255, 255, 0.07); }
.insight-tile__ico .nav-ico { width: 18px; height: 18px; }
.insight-tile__value {
  margin-top: 0.55rem;
  font-size: 1.55rem;
  font-weight: 650;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.insight-tile__foot {
  margin-top: auto;
  padding-top: 0.45rem;
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--tile-muted);
}
.insight-tile__meta {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}
.insight-tile__hint {
  opacity: 0.9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 14ch;
}
.delta {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.12rem 0.4rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  flex: 0 0 auto;
}
html[data-theme="dark"] .delta { background: rgba(0, 0, 0, 0.25); }
.delta--up { color: var(--good); }
.delta--down { color: var(--bad); }
.delta--flat { color: var(--muted); }

.lift-card {
  transition:
    transform 0.32s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.32s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.28s ease,
    background 0.28s ease;
}
.lift-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 2px 6px #14322212, 0 22px 40px -24px #14322255;
  border-color: color-mix(in srgb, var(--mint) 28%, var(--line-2));
}
.card-panel.lift-card:hover,
.insight-tile.lift-card:hover,
.budget-card.lift-card:hover,
.pot.lift-card:hover,
.cat-chip.lift-card:hover {
  transform: translateY(-3px);
}
.nav-stack .nav-link {
  transition:
    background 0.22s var(--ease),
    color 0.22s var(--ease),
    box-shadow 0.22s var(--ease),
    transform 0.18s var(--ease);
}
.nav-stack .nav-link:active:not(.active) { transform: scale(0.97); }
.btn:active { transform: scale(0.97); }

/* Categorías — chips Verdelo */
.cat-group { margin-bottom: 1.1rem; }
.cat-group__label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.55rem;
}
.cat-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.45rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
}
.cat-chip__name { font-weight: 650; color: var(--ink); min-width: 0; }
.cat-chip__actions { display: flex; gap: 0.35rem; flex-shrink: 0; }
.cats-panel__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}
.cats-list { max-height: min(62vh, 560px); overflow: auto; padding-right: 2px; }
.tiles-toolbar .seg {
  flex-wrap: wrap;
  justify-content: flex-end;
}
.tiles-toolbar .seg button {
  font-size: 0.78rem;
  padding: 0.28rem 0.55rem;
}

.hbars { display: flex; flex-direction: column; gap: 12px; }
.hbars__row {
  display: grid;
  grid-template-columns: minmax(96px, 150px) minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
}
.hbars__name {
  font-size: 0.9rem;
  font-weight: 650;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.hbars__name small {
  display: block;
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--muted);
}
.hbars__track {
  height: 10px;
  border-radius: 10px;
  background: var(--card-2);
  box-shadow: inset 0 0 0 1px var(--line);
  position: relative;
  overflow: hidden;
}
.hbars__ghost, .hbars__bar {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  transform-origin: left center;
}
.hbars__ghost { background: color-mix(in srgb, var(--ink) 6%, transparent); width: 100%; }
.hbars__bar {
  width: 0;
  background: linear-gradient(90deg, color-mix(in srgb, var(--hb, var(--mint)) 55%, transparent), var(--hb, var(--mint)));
  box-shadow: 0 0 14px -4px var(--hb, var(--mint));
  transition: width 0.55s var(--ease);
}
.hbars__val {
  font-weight: 700;
  font-size: 0.9rem;
  text-align: right;
  min-width: 54px;
  font-variant-numeric: tabular-nums;
}
.spark { display: block; width: 92px; height: 30px; margin-left: auto; color: var(--tile-ink); opacity: 0.85; overflow: visible; }
.spark path { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.spark__area { fill: currentColor; stroke: none; opacity: 0.16; }
.spark__dot {
  fill: currentColor;
  stroke: color-mix(in srgb, var(--tile) 70%, #fff);
  stroke-width: 1.2;
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 0.15s ease, r 0.15s ease;
}
.spark__dot:hover { opacity: 1; }
.spark--live { cursor: crosshair; }
.bal-dough-wrap { width: 100%; min-height: 220px; }
.spark path { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.spark .spark__area { stroke: none; fill: currentColor; opacity: 0.14; }

/* —— Tubes (money in/out bases) —— */
:root { --out: #9aa7a0; --mint-deep: #0f6b45; --card-2: color-mix(in srgb, var(--ink) 6%, transparent); }
html[data-theme="dark"] {
  --out: #6b7871;
  --mint-deep: #3aa873;
  --card-2: rgba(225, 255, 238, 0.055);
}
.tubes__sum {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: -4px 0 14px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}
.tubes__sum span { display: inline-flex; align-items: center; gap: 7px; }
.tubes__sum span > span { color: var(--ink); }
.tubes__kept > span { color: var(--accent-ink) !important; }
.tubes__key { width: 10px; height: 10px; border-radius: 4px; display: inline-block; }
.tubes__key--in { background: var(--mint); }
.tubes__key--out { background: var(--out); }
.tubes__plot { padding-left: 44px; position: relative; }
.tubes__grid {
  pointer-events: none;
  position: absolute;
  inset: 0 0 26px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.tubes__grid div {
  border-top: 1px dashed var(--line);
  height: 0;
  position: relative;
}
.tubes__grid div:last-child { border-top-style: solid; border-color: var(--line-2); }
.tubes__grid span {
  position: absolute;
  top: -8px;
  left: 0;
  font-size: 0.65rem;
  font-weight: 650;
  color: var(--muted);
}
.tubes__cols {
  display: flex;
  gap: 4px;
  height: 100%;
  position: relative;
  outline: none;
}
.tube {
  flex: 1 1 0;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  position: relative;
}
.tube__pair {
  flex: 1 1 0;
  width: 100%;
  display: flex;
  justify-content: center;
  gap: 4px;
  padding: 0 2px;
  min-height: 0;
}
.tube__sleeve {
  flex: 0 1 18px;
  height: 100%;
  border-radius: 99px;
  position: relative;
  overflow: hidden;
  background: var(--card-2);
  box-shadow:
    inset 0 0 0 1px var(--glass-rim),
    inset 0 -10px 18px -12px #00000033,
    inset 6px 0 14px -10px #ffffff40;
}
html[data-theme="dark"] .tube__sleeve {
  box-shadow:
    inset 0 0 0 1px var(--glass-rim),
    inset 0 -12px 20px -10px #00000088,
    inset 5px 0 12px -8px #e1ffee14;
}
.tube__fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  top: auto;
  height: 0%;
  border-radius: 99px;
  transition: height 0.55s var(--ease);
  will-change: height;
}
.tube__fill--in {
  background: linear-gradient(180deg, var(--accent-from), var(--mint) 40%, var(--mint-deep));
  box-shadow: 0 0 18px -2px var(--mint-soft);
}
.tube__fill--out {
  background: linear-gradient(180deg, #ffffff80, var(--out));
  opacity: 0.75;
}
.tube__label {
  height: 26px;
  padding-top: 8px;
  font-size: 0.65rem;
  font-weight: 650;
  color: var(--muted);
  white-space: nowrap;
}
.tube.is-hi .tube__label { color: var(--ink); }
.tube.is-hi .tube__sleeve {
  box-shadow: inset 0 0 0 1px var(--line-2), 0 0 0 3px var(--accent-soft);
}
.tube__flag {
  position: absolute;
  top: 8px;
  left: 50%;
  translate: -50% 0;
  z-index: 3;
  background: var(--panel);
  border: 1px solid var(--glass-rim);
  border-radius: 12px;
  padding: 0.45rem 0.65rem;
  box-shadow: var(--shadow);
  text-align: center;
  min-width: 88px;
}
.tube__flag b {
  display: block;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.tube__flag small { color: var(--muted); font-weight: 600; }
.tube:first-child .tube__flag { left: 0; translate: 0 0; }
.tube:last-child .tube__flag { left: auto; right: 0; translate: 0 0; }

/* —— Goal pots —— */
.pots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 0.85rem;
}
.pot { display: flex; gap: 1.1rem; align-items: stretch; }
.pot__glass {
  width: 74px;
  min-height: 220px;
  flex: 0 0 auto;
  border-radius: 99px;
  position: relative;
  overflow: hidden;
  background: var(--card-2);
  box-shadow:
    inset 0 0 0 1px var(--glass-rim),
    inset 6px 0 14px -8px #ffffff40,
    inset 0 -14px 22px -12px #00000040;
}
.pot__level {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  top: auto;
  height: 0%;
  border-radius: 0 0 99px 99px;
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--pc) 70%, white),
    var(--pc) 22%,
    color-mix(in srgb, var(--pc) 70%, black)
  );
  box-shadow: 0 0 24px -4px color-mix(in srgb, var(--pc) 50%, transparent);
  transition: height 0.65s var(--ease);
  will-change: height;
}
.pot__auto {
  background: var(--card-2);
  box-shadow: inset 0 0 0 1px var(--line);
  border-radius: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  padding: 10px 12px;
}
.pot__auto small { display: block; font-size: 0.68rem; color: var(--muted); font-weight: 650; }
.pot__auto b { font-weight: 650; font-variant-numeric: tabular-nums; }
.stepper {
  display: inline-flex;
  gap: 4px;
}
.stepper button {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
}
.stepper button:hover { border-color: var(--accent); color: var(--accent-ink); }
.base-track i { transition: width 0.55s var(--ease); }
.pot__target { display: none !important; }
.pot__ico {
  position: absolute;
  bottom: 16px;
  left: 0;
  right: 0;
  margin: auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #f3faf5;
  background: rgba(0, 0, 0, 0.22);
}
.pot__ico .nav-ico { width: 18px; height: 18px; }
.pot__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.45rem; }
.pot__head { display: flex; justify-content: space-between; gap: 0.6rem; align-items: center; }
.pot__head b { font-size: 1.05rem; font-weight: 650; letter-spacing: -0.02em; }
.pot__fig { display: flex; align-items: baseline; gap: 0.45rem; }
.pot__fig > span {
  font-size: 1.65rem;
  font-weight: 650;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
}
.pot__fig small { color: var(--muted); font-weight: 650; }
.pot__pct { font-size: 0.82rem; color: var(--muted); font-weight: 650; }
.pot__actions { margin-top: auto; display: flex; flex-wrap: wrap; gap: 0.45rem; }

.pill {
  display: inline-flex;
  align-items: center;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
}
.pill--good { background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good); }
.pill--warn { background: var(--warn-bg); color: var(--warn); }
.pill--bad { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }

/* —— Budget cards + base track —— */
.budget-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.85rem;
}
.budget-card__head { display: flex; justify-content: space-between; gap: 0.75rem; align-items: flex-start; }
.budget-card__value {
  margin: 0.85rem 0 0.7rem;
  font-size: 1.45rem;
  font-weight: 650;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.budget-card__meta {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.55rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
}
.base-track {
  height: 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 8%, transparent);
  box-shadow: inset 0 1px 2px #00000018;
  overflow: hidden;
}
.base-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-from), var(--accent));
  box-shadow: 0 0 12px -4px var(--accent-glow);
}

/* —— Member / profile slots —— */
.member-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
}
.member-card__top { display: flex; gap: 0.7rem; align-items: center; margin-bottom: 0.75rem; }
.member-card__spark { color: var(--accent); opacity: 0.85; }
.member-card--empty { border-style: dashed; background: color-mix(in srgb, var(--mint-soft) 35%, var(--surface)); }
.avatar--ghost {
  background: transparent;
  border: 1px dashed var(--line-2);
  color: var(--muted);
  font-size: 1.1rem;
}

/* —— Account cards with spark —— */
.acc-card .acc-card__spark { margin-top: 0.75rem; color: var(--accent); }
.acc-card .value { font-size: 1.45rem; }

/* —— Expandable sidebar —— */
html.is-wide {
  --side-w: 248px;
}
html.is-wide .brand { justify-content: flex-start; gap: 0.65rem; align-items: center; padding: 0 4px; }
html.is-wide .brand-text { display: block; }
html.is-wide .brand h1 {
  display: block;
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  white-space: nowrap;
}
html.is-wide .brand p { display: block; margin: 2px 0 0; font-size: 0.7rem; color: var(--muted); }
html.is-wide .nav-stack { align-items: stretch; }
html.is-wide .nav-item { grid-template-columns: 14px 1fr; }
html.is-wide .nav-label {
  position: static;
  width: auto;
  height: auto;
  margin: 0;
  clip: auto;
  overflow: visible;
  white-space: nowrap;
}
html.is-wide .nav-stack .nav-item {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  align-items: center;
  width: 100%;
}
html.is-wide .nav-stack .nav-item--pinned {
  grid-template-columns: minmax(0, 1fr);
}
html.is-wide .nav-stack .nav-link {
  width: 100%;
  max-width: 100%;
  height: auto;
  min-height: 42px;
  margin: 0;
  padding: 0.55rem 0.7rem;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 0.55rem;
  border-radius: 14px;
  grid-column: 2;
  justify-self: stretch;
}
html.is-wide .nav-stack .nav-item--pinned .nav-link {
  grid-column: 1;
}
html.is-wide .nav-stack .nav-link.active {
  width: 100%;
  height: auto;
  min-height: 42px;
}
html.is-wide .nav-stack .nav-link .tag-plan { position: static; margin-left: auto; }
html.is-wide .nav-drag {
  position: static;
  transform: none;
  opacity: 0.45;
  grid-column: 1;
  width: 14px;
  justify-self: center;
}
html.is-wide .user-chip {
  justify-content: flex-start;
  gap: 0.65rem;
  border: 1px solid var(--line);
  padding: 0.55rem;
  border-radius: 16px;
  width: 100%;
}
html.is-wide .user-chip .min-w-0 { display: block; }
html.is-wide .nav-reset { margin-left: 0; margin-right: auto; }
.side-fold {
  border: 0;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--ink);
  background: color-mix(in srgb, var(--ink) 5%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 14%, transparent);
  cursor: pointer;
  flex: 0 0 32px;
  position: relative !important;
  inset: auto !important;
  right: auto !important;
  left: auto !important;
  top: auto !important;
  transform: none !important;
  z-index: 2;
  margin: 0 auto;
  padding: 0;
  pointer-events: auto;
}
.side-fold:hover { background: var(--surface-2); }
.side-fold:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
.side-fold .nav-ico { width: 16px; height: 16px; pointer-events: none; }
@media (min-width: 992px) {
  .btn-fab-mov { display: none !important; }
}
.brand-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  margin-bottom: 2px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  position: relative;
  overflow: hidden;
}
html.is-rail .brand-row .side-fold { order: 2; margin: 0 auto; }
html.is-rail .brand-row .brand { order: 1; }
/* Wide: logo+texto arriba, fold debajo centrado (nunca fuera del rail) */
html.is-wide .brand-row {
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  width: 100%;
  gap: 0.45rem;
  padding: 0;
}
html.is-wide .brand-row .brand {
  order: 1;
  flex: 0 1 auto;
  min-width: 0;
  justify-content: flex-start;
  overflow: hidden;
  width: 100%;
}
html.is-wide .brand-row .side-fold {
  order: 2;
  margin: 0 0 0 auto;
  flex: 0 0 32px;
  align-self: flex-end;
}

/* —— Profile menu —— */
.user-menu-wrap { position: relative; }
.profile-menu {
  position: absolute;
  left: 8px;
  bottom: calc(100% + 8px);
  width: min(240px, 70vw);
  background: var(--panel);
  border: 1px solid var(--glass-rim);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 0.4rem;
  z-index: 40;
  display: none;
}
.profile-menu.open { display: block; }
html.is-wide .profile-menu { left: 0; right: 0; width: auto; }
.profile-menu button {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  font-size: 0.86rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.profile-menu button:hover { background: var(--surface-2); }
.profile-menu button.is-active { color: var(--accent-ink); }
.profile-menu .pm-sep {
  height: 1px;
  background: var(--line);
  margin: 0.3rem 0.4rem;
}
.profile-menu .pm-danger { color: var(--bad); }
.safe-chip {
  display: none;
  border-radius: 16px;
  padding: 0.75rem 0.85rem;
  background: var(--surface);
  border: 1px solid var(--glass-rim);
  box-shadow: var(--shadow);
  margin-top: auto;
}
html.is-wide .safe-chip { display: block; }
.safe-chip small { display: block; color: var(--muted); font-weight: 650; font-size: 0.72rem; }
.safe-chip b {
  display: block;
  margin-top: 0.25rem;
  font-size: 1.25rem;
  letter-spacing: -0.03em;
  color: var(--accent-ink);
  font-variant-numeric: tabular-nums;
}
