/*
 * Sistema de diseño Atlas, estilo «Visión», tal como lo usa Finanzas by ATLAS.
 * Fuente: Desktop/Sistema de Diseno Atlas (GUIA-DE-DISENO.md y codigo/app/globals.css), vía el port a Django de LeadTrack.
 * Cristal solo en navegación y controles; datos sobre superficies casi sólidas; fondo ambiental cálido;
 * botón principal monocromático; acento azul sobrio para enlaces, estados y foco; Inter para la interfaz, Sora para títulos y cifras.
 * La marca (esmeralda) vive solo en el logo.
 */

/* Tipografías servidas por la propia app (core/static/core/fonts, licencia OFL): sin dependencias externas */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/inter-latin-var.woff2") format("woff2");
}
@font-face {
  font-family: "Sora";
  font-style: normal;
  font-weight: 500 600;
  font-display: swap;
  src: url("../fonts/sora-latin-var.woff2") format("woff2");
}

:root {
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Sora", "Inter", system-ui, sans-serif;
  --radius-window: 32px;
  --radius-panel: 28px;
  --radius-card: 22px;
  --radius-control: 14px;
  --ease-glass: cubic-bezier(0.23, 1, 0.32, 1);

  --bg: #e6e3de;
  --surface: rgb(255 255 255 / 0.84);
  --label: #16171a;
  --label-2: #62646c;
  --separator: rgb(20 20 25 / 0.09);
  --primary: #16171a;
  --on-primary: #f5f3ef;
  --on-color: #ffffff;
  --accent: #2f62c9;
  --success: #138a4b;
  --warning: #b86e00;
  --danger: #d0312d;
  --popover-bg: rgb(255 255 255 / 0.95);
  --glass-tint: rgb(255 255 255 / 0.46);
  --glass-tint-strong: rgb(255 255 255 / 0.72);
  --glass-edge: rgb(255 255 255 / 0.85);
  --glass-edge-low: rgb(255 255 255 / 0.2);
  --glass-sheen: rgb(255 255 255 / 0.55);
  --glass-shadow: 0 30px 60px -30px rgb(40 30 20 / 0.35), 0 2px 8px -2px rgb(40 30 20 / 0.08);
  --panel-shadow: 0 24px 50px -32px rgb(40 30 20 / 0.3), 0 1px 2px rgb(40 30 20 / 0.05);
  --nav-hover: rgb(255 255 255 / 0.45);
  --nav-active: rgb(255 255 255 / 0.78);
  --aura-1: #f3ebdd;
  --aura-2: #cfe0e3;
  --aura-3: #e7d9cf;
  --aura-opacity: 0.9;
  --brand: var(--accent);
  --brand-text: var(--accent);
  --brand-soft: color-mix(in srgb, var(--accent) 12%, transparent);
  --user-card: rgb(255 255 255 / 0.32);
  /* Gráficos: serie 1 (ingresos) = primario, serie 2 (egresos) = bronce; categorías validadas para daltonismo */
  --series-1: #16171a;
  --series-2: #c47a3e;
  --eq-1: #1baf7a;
  --eq-2: #2a78d6;
  --eq-3: #eb6834;
  --eq-4: #6250d6;
  --eq-5: #e87ba4;
  --eq-6: #b5b0a8;
  --twin-out: #a8a299;
  --orb-dark: 0;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17181b;
    --surface: rgb(44 46 52 / 0.86);
    --label: #f5f5f7;
    --label-2: #9c9da5;
    --separator: rgb(255 255 255 / 0.09);
    --primary: #f5f5f7;
    --on-primary: #17181b;
    --on-color: #121418;
    --accent: #8db4ff;
    --success: #4fd08a;
    --warning: #f5b84a;
    --danger: #ff6b66;
    --popover-bg: rgb(40 42 48 / 0.97);
    --glass-tint: rgb(70 72 80 / 0.38);
    --glass-tint-strong: rgb(90 92 100 / 0.56);
    --glass-edge: rgb(255 255 255 / 0.18);
    --glass-edge-low: rgb(255 255 255 / 0.04);
    --glass-sheen: rgb(255 255 255 / 0.1);
    --glass-shadow: 0 30px 60px -28px rgb(0 0 0 / 0.8), 0 2px 8px -2px rgb(0 0 0 / 0.4);
    --panel-shadow: 0 30px 60px -32px rgb(0 0 0 / 0.75), inset 0 1px 0 rgb(255 255 255 / 0.06);
    --nav-hover: rgb(255 255 255 / 0.07);
    --nav-active: rgb(255 255 255 / 0.13);
    --aura-1: #3b4048;
    --aura-2: #2c3a3d;
    --aura-3: #463d38;
    --aura-opacity: 0.85;
    --user-card: rgb(255 255 255 / 0.05);
    --series-1: #f5f5f7;
    --series-2: #e0a26b;
    --eq-1: #199e70;
    --eq-2: #3987e5;
    --eq-3: #d95926;
    --eq-4: #9085e9;
    --eq-5: #d55181;
    --eq-6: #6e6a64;
    --twin-out: #6e6a64;
    --orb-dark: 1;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #17181b;
  --surface: rgb(44 46 52 / 0.86);
  --label: #f5f5f7;
  --label-2: #9c9da5;
  --separator: rgb(255 255 255 / 0.09);
  --primary: #f5f5f7;
  --on-primary: #17181b;
  --on-color: #121418;
  --accent: #8db4ff;
  --success: #4fd08a;
  --warning: #f5b84a;
  --danger: #ff6b66;
  --popover-bg: rgb(40 42 48 / 0.97);
  --glass-tint: rgb(70 72 80 / 0.38);
  --glass-tint-strong: rgb(90 92 100 / 0.56);
  --glass-edge: rgb(255 255 255 / 0.18);
  --glass-edge-low: rgb(255 255 255 / 0.04);
    --glass-sheen: rgb(255 255 255 / 0.1);
  --glass-shadow: 0 30px 60px -28px rgb(0 0 0 / 0.8), 0 2px 8px -2px rgb(0 0 0 / 0.4);
  --panel-shadow: 0 30px 60px -32px rgb(0 0 0 / 0.75), inset 0 1px 0 rgb(255 255 255 / 0.06);
  --nav-hover: rgb(255 255 255 / 0.07);
  --nav-active: rgb(255 255 255 / 0.13);
  --aura-1: #3b4048;
  --aura-2: #2c3a3d;
  --aura-3: #463d38;
  --aura-opacity: 0.85;
  --user-card: rgb(255 255 255 / 0.05);
  --series-1: #f5f5f7;
  --series-2: #e0a26b;
  --eq-1: #199e70;
  --eq-2: #3987e5;
  --eq-3: #d95926;
  --eq-4: #9085e9;
  --eq-5: #d55181;
  --eq-6: #6e6a64;
  --twin-out: #6e6a64;
  --orb-dark: 1;
  color-scheme: dark;
}

/* ───────── Base ───────── */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--label);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
img,
svg {
  display: block;
}
a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
h1,
h2,
h3 {
  margin: 0;
}
p {
  margin: 0;
}
::selection {
  background: color-mix(in srgb, var(--accent) 30%, transparent);
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
* {
  scrollbar-width: none;
}
*::-webkit-scrollbar {
  display: none;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.display {
  font-family: var(--font-display);
  font-weight: 600;
}
.num {
  font-variant-numeric: tabular-nums;
}
.muted {
  color: var(--label-2);
}

/* Logo: versión clara u oscura según el tema */
.logo-on-dark {
  display: none;
}
:root[data-theme="dark"] .logo-on-light {
  display: none;
}
:root[data-theme="dark"] .logo-on-dark {
  display: block;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-on-light {
    display: none;
  }
  :root:not([data-theme="light"]) .logo-on-dark {
    display: block;
  }
}

/* ───────── Fondo ambiental ───────── */
.aura {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.aura i {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: var(--aura-opacity);
  animation: aura-drift 70s linear infinite alternate;
}
.aura i:nth-child(1) {
  width: 52vw;
  height: 52vw;
  left: -12vw;
  top: -18vw;
  background: var(--aura-1);
}
.aura i:nth-child(2) {
  width: 40vw;
  height: 40vw;
  right: -10vw;
  top: 20vh;
  background: var(--aura-2);
  animation-duration: 84s;
  animation-direction: alternate-reverse;
}
.aura i:nth-child(3) {
  width: 34vw;
  height: 34vw;
  left: 32vw;
  bottom: -16vw;
  background: var(--aura-3);
  animation-duration: 96s;
}
@media (max-width: 640px) {
  .aura i:nth-child(1) {
    width: 110vw;
    height: 110vw;
    left: -40vw;
    top: -30vw;
  }
  .aura i:nth-child(2) {
    width: 90vw;
    height: 90vw;
    right: -40vw;
    top: 45vh;
  }
  .aura i:nth-child(3) {
    width: 80vw;
    height: 80vw;
    left: -20vw;
    bottom: -30vw;
  }
}
@keyframes aura-drift {
  to {
    transform: translate3d(6vw, 4vh, 0) scale(1.08);
  }
}

/* ───────── Materiales ───────── */
.glass {
  position: relative;
  background: var(--glass-tint);
  backdrop-filter: blur(24px) saturate(170%);
  -webkit-backdrop-filter: blur(24px) saturate(170%);
  box-shadow: inset 0 1px 0 0 var(--glass-edge), var(--glass-shadow);
  isolation: isolate;
}
.glass::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(160deg, var(--glass-edge), var(--glass-edge-low) 40%, var(--glass-edge-low) 60%, var(--glass-edge));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.glass-strong {
  background: var(--glass-tint-strong);
  backdrop-filter: blur(40px) saturate(190%);
  -webkit-backdrop-filter: blur(40px) saturate(190%);
}
.panel {
  background: var(--surface);
  border-radius: var(--radius-panel);
  box-shadow: var(--panel-shadow);
}
.panel-pad {
  padding: 24px;
}
.card {
  background: var(--surface);
  border-radius: var(--radius-card);
  box-shadow: var(--panel-shadow);
}
@media (prefers-reduced-transparency: reduce) {
  .glass,
  .glass-strong {
    background: var(--surface) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
  .aura {
    display: none;
  }
}

/* ───────── Página ───────── */
.page,
.page-narrow {
  width: 100%;
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.page {
  max-width: 1400px;
}
.page-narrow {
  max-width: 880px;
}
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 24px;
  padding: 4px 6px 0;
}
.page-head h1 {
  font-family: var(--font-display);
  font-size: 32px;
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -0.025em;
}
.page-head .lead {
  margin-top: 6px;
  color: var(--label-2);
  font-size: 14px;
}
.page-head .eyebrow {
  margin-bottom: 4px;
  color: var(--label-2);
  font-size: 14px;
}
.section-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.015em;
}
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.grid-kpi {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (min-width: 1280px) {
  .grid-kpi {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
.grid-2 {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 1024px) {
  .grid-2 {
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  }
  .grid-2.even {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.grid-2 > *,
.grid-kpi > * {
  min-width: 0;
}
@media (max-width: 640px) {
  .page-head h1 {
    font-size: 26px;
  }
  .panel-pad {
    padding: 20px;
  }
}

/* Tarjeta de cifra */
.kpi {
  padding: 20px;
}
.kpi .k {
  font-size: 12px;
  color: var(--label-2);
}
.kpi .v {
  margin: 4px 0 2px;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.kpi .n {
  font-size: 12px;
  color: var(--label-2);
}
.kpi .n.brand {
  color: var(--brand-text);
  font-weight: 500;
}
@media (max-width: 640px) {
  .kpi {
    padding: 16px;
    border-radius: var(--radius-card);
  }
  .kpi .v {
    font-size: 22px;
  }
}

/* ───────── Botones ───────── */
.btn-primary,
.btn-secondary,
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 20px;
  border: 0;
  border-radius: 9999px;
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none !important;
  cursor: pointer;
  transition:
    transform 140ms var(--ease-glass),
    opacity 150ms ease,
    color 160ms var(--ease-glass),
    background-color 160ms var(--ease-glass),
    box-shadow 160ms ease;
}
.btn-primary:active,
.btn-secondary:active,
.btn-danger:active {
  transform: scale(0.97);
}
.btn-primary:disabled,
.btn-secondary:disabled,
.btn-danger:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--primary);
  color: var(--on-primary);
  box-shadow: 0 10px 24px -12px rgb(0 0 0 / 0.55);
}
@media (hover: hover) {
  .btn-primary:not(:disabled):hover {
    opacity: 0.9;
  }
}
.btn-secondary {
  background: var(--surface);
  color: var(--label);
  box-shadow: inset 0 0 0 1px var(--separator);
}
@media (hover: hover) {
  .btn-secondary:hover {
    box-shadow: inset 0 0 0 1px var(--label-2);
  }
}
.btn-danger {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger);
}
.btn-sm {
  height: 36px;
  padding: 0 14px;
  font-size: 13.5px;
}
.btn-block {
  width: 100%;
}
.btn-primary svg,
.btn-secondary svg,
.btn-danger svg {
  width: 16px;
  height: 16px;
  flex: none;
}

/* ───────── Campos ───────── */
.field + .field {
  margin-top: 16px;
}
.field-label {
  display: block;
  margin-bottom: 6px;
  color: var(--label-2);
  font-size: 13px;
  font-weight: 500;
}
.field-label small {
  font-weight: 400;
}
.field-help {
  margin-top: 6px;
  color: var(--label-2);
  font-size: 12px;
}
.field-error {
  margin-top: 6px;
  color: var(--danger);
  font-size: 12.5px;
}
.input-field,
.field input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.field select,
.field textarea {
  width: 100%;
  height: 44px;
  border-radius: var(--radius-control);
  padding: 0 14px;
  background: var(--surface);
  border: 1px solid var(--separator);
  color: var(--label);
  font-size: 15px;
  outline: none;
  transition:
    box-shadow 160ms ease,
    border-color 160ms ease;
}
.field textarea,
textarea.input-field {
  height: auto;
  min-height: 96px;
  padding: 12px 14px;
  resize: vertical;
}
/* Campo activo: borde en el acento con un anillo suave. */
.input-field:focus,
.field input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent);
}
.field select,
select.input-field {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px;
  cursor: pointer;
  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 1.5l5 5 5-5' fill='none' stroke='%238e8e93' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}
.field.has-error input,
.field.has-error select {
  border-color: var(--danger);
}
.pw-wrap {
  position: relative;
}
.pw-wrap input {
  padding-right: 46px !important;
}
.pw-toggle {
  position: absolute;
  right: 6px;
  top: 6px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--label-2);
  cursor: pointer;
}
.pw-toggle svg {
  width: 18px;
  height: 18px;
}

/* Casillas y radios: círculo que se rellena con la palomita */
input:is([type="checkbox"], [type="radio"]):not(.sr-only) {
  appearance: none;
  -webkit-appearance: none;
  display: inline-grid;
  place-content: center;
  flex: none;
  width: 22px;
  height: 22px;
  margin: 0;
  border-radius: 50%;
  border: 1.5px solid color-mix(in srgb, var(--label-2) 70%, transparent);
  background: transparent;
  vertical-align: middle;
  cursor: pointer;
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    transform 140ms var(--ease-glass);
}
input:is([type="checkbox"], [type="radio"]):not(.sr-only)::before {
  content: "";
  width: 13px;
  height: 13px;
  background: var(--on-primary);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5' fill='none' stroke='black' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5' fill='none' stroke='black' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  opacity: 0;
  transform: scale(0.6);
  transition:
    opacity 160ms ease,
    transform 200ms var(--ease-glass);
}
input:is([type="checkbox"], [type="radio"]):not(.sr-only):checked {
  background: var(--primary);
  border-color: transparent;
}
input:is([type="checkbox"], [type="radio"]):not(.sr-only):checked::before {
  opacity: 1;
  transform: none;
}
input:is([type="checkbox"], [type="radio"]):not(.sr-only):active:not(:disabled) {
  transform: scale(0.9);
}

/* ───────── Avisos ───────── */
.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-card);
  background: var(--brand-soft);
  color: var(--brand-text);
  font-size: 14px;
  font-weight: 500;
}
.notice svg {
  width: 20px;
  height: 20px;
  flex: none;
  margin-top: 1px;
}
.notice.danger {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger);
}
.notice.warning {
  background: color-mix(in srgb, var(--warning) 15%, transparent);
  color: var(--warning);
}
.notice-band {
  border-radius: 0;
  padding: 14px 24px;
}
.messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ───────── Pestañas (segmentadas) ───────── */
.tabs {
  display: inline-flex;
  gap: 2px;
  padding: 6px;
  border-radius: 9999px;
  max-width: 100%;
  overflow-x: auto;
}
.tab {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 9999px;
  background: none;
  color: var(--label-2);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none !important;
  cursor: pointer;
  transition:
    background-color 240ms var(--ease-glass),
    color 160ms ease;
}
.tab small {
  margin-left: 6px;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  color: var(--label-2);
}
.tab[aria-current="page"],
.tab[aria-selected="true"],
.tab.on {
  background: var(--surface);
  color: var(--label);
  box-shadow: 0 4px 12px -6px rgb(0 0 0 / 0.3);
}

/* ───────── Tablas ───────── */
.table-wrap {
  overflow: hidden;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th {
  padding: 10px 12px;
  border-bottom: 1px solid var(--separator);
  color: var(--label-2);
  font-size: 12px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
}
.data-table td {
  padding: 12px;
  border-bottom: 1px solid var(--separator);
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}
.data-table th:first-child,
.data-table td:first-child {
  padding-left: 20px;
}
.data-table th:last-child,
.data-table td:last-child {
  padding-right: 20px;
}
.data-table tbody tr:last-child td {
  border-bottom: 0;
}
.data-table tbody tr {
  transition: background-color 160ms ease;
}
@media (hover: hover) {
  .data-table tbody tr:hover > td {
    background-color: var(--nav-hover);
  }
}
.data-table .t-title {
  font-weight: 500;
}
.data-table .t-sub {
  color: var(--label-2);
  font-size: 13px;
}
.data-table .right {
  text-align: right;
}
.empty {
  padding: 28px 20px;
  color: var(--label-2);
  text-align: center;
}
/* Celular: las tablas pasan a tarjetas (cada celda lleva data-label) */
@media (max-width: 640px) {
  .data-table.cards thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .data-table.cards,
  .data-table.cards tbody {
    display: block;
  }
  .data-table.cards tr {
    display: grid;
    gap: 4px;
    padding: 14px 18px;
  }
  .data-table.cards tr + tr {
    border-top: 1px solid var(--separator);
  }
  .data-table.cards td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 0 !important;
    border: 0;
    text-align: right;
  }
  .data-table.cards td[data-label]::before {
    content: attr(data-label);
    color: var(--label-2);
    font-size: 12.5px;
    text-align: left;
  }
  .data-table.cards td.t-cell-title {
    display: block;
    text-align: left;
    margin-bottom: 4px;
    font-size: 15px;
  }
}

/* Punto de estado / tipo */
.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--dot, var(--label-2));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--dot, var(--label-2)) 18%, transparent);
  vertical-align: 1px;
  margin-right: 8px;
}
/* Barras horizontales */
.bar {
  height: 8px;
  border-radius: 9999px;
  background: var(--separator);
  overflow: hidden;
}
.bar > b {
  display: block;
  height: 100%;
  border-radius: 9999px;
  background: var(--bar, var(--primary));
}
.bar-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.bar-row-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  font-size: 13.5px;
}
.bar-row-head b {
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-top: 14px;
  font-size: 12px;
  color: var(--label-2);
}
.legend .dot {
  margin-right: 6px;
}
/* ───────── Estructura interna: menú lateral + barra del celular ───────── */
.app-shell {
  min-height: 100vh;
}
.app-main {
  padding: 16px 16px 40px;
}
@media (min-width: 768px) {
  .app-main {
    padding: 24px 32px 40px;
  }
}
@media (min-width: 1024px) {
  .app-shell {
    padding-left: 276px;
    transition: padding-left 320ms cubic-bezier(0.2, 0.8, 0.2, 1);
  }
  .app-shell[data-nav="rail"] {
    padding-left: 88px;
  }
}
.sidebar {
  position: fixed;
  z-index: 40;
  top: 12px;
  bottom: 12px;
  left: 12px;
  width: 252px;
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  border-radius: var(--radius-window);
  overflow: hidden;
  transition:
    width 320ms cubic-bezier(0.2, 0.8, 0.2, 1),
    padding 320ms cubic-bezier(0.2, 0.8, 0.2, 1),
    transform 320ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.nav-brand {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 4px 10px 14px;
  border: 0;
  background: none;
  cursor: pointer;
}
.nav-brand img {
  height: 36px;
  width: auto;
}
.nav-brand .nav-only-rail img {
  height: 22px;
}
.nav-only-rail {
  display: none;
}
.nav-event {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 16px;
  background: var(--nav-hover);
}
.nav-event .badge {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 12px;
  background: var(--primary);
  color: var(--on-primary);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
}
.nav-event .t {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-event .s {
  font-size: 12px;
  color: var(--label-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  margin: 8px -4px 0;
  padding: 0 4px;
}
.nav-grp {
  padding: 14px 12px 4px;
  color: color-mix(in srgb, var(--label-2) 80%, transparent);
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
}
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 12px;
  border-radius: var(--radius-control);
  color: var(--label);
  font-size: 14px;
  white-space: nowrap;
  text-decoration: none !important;
  transition: background-color 260ms var(--ease-glass);
}
.nav-item svg {
  width: 18px;
  height: 18px;
  flex: none;
  color: var(--label-2);
}
@media (hover: hover) {
  .nav-item:hover {
    background: var(--nav-hover);
  }
}
.nav-item[aria-current="page"] {
  background: var(--nav-active);
  font-weight: 500;
  box-shadow: 0 6px 16px -10px rgb(0 0 0 / 0.35);
}
.nav-item[aria-current="page"] svg {
  color: var(--label);
}
.nav-foot {
  border-top: 1px solid var(--separator);
  margin-top: 8px;
  padding: 12px 4px 0;
}
.nav-user {
  display: flex;
  align-items: center;
  gap: 10px;
}
.nav-user .avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 50%;
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
}
.nav-user .t {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-user .s {
  font-size: 12px;
  color: var(--label-2);
}
.icon-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--label-2);
  cursor: pointer;
}
.icon-btn svg {
  width: 18px;
  height: 18px;
}
@media (hover: hover) {
  .icon-btn:hover {
    background: var(--nav-hover);
    color: var(--label);
  }
}
.nav-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 10px;
}
.theme-switch {
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 9999px;
  background: var(--nav-hover);
}
.theme-switch button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 28px;
  border: 0;
  border-radius: 9999px;
  background: none;
  color: var(--label-2);
  cursor: pointer;
}
.theme-switch button svg {
  width: 15px;
  height: 15px;
}
.theme-switch button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--label);
}
.logout-btn {
  border: 0;
  background: none;
  padding: 4px;
  color: var(--danger);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

/* Menú recogido en riel (escritorio) */
@media (min-width: 1024px) {
  .sidebar[data-rail="1"] {
    width: 64px;
    padding-left: 0;
    padding-right: 0;
  }
  .sidebar[data-rail="1"] .nav-only-full,
  .sidebar[data-rail="1"] .nav-lbl,
  .sidebar[data-rail="1"] .nav-grp,
  .sidebar[data-rail="1"] .nav-event > div:not(.badge),
  .sidebar[data-rail="1"] .nav-user > :not(.avatar),
  .sidebar[data-rail="1"] .nav-actions .theme-switch {
    display: none;
  }
  .sidebar[data-rail="1"] .nav-only-rail {
    display: block;
  }
  .sidebar[data-rail="1"] .nav-brand {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
  }
  .sidebar[data-rail="1"] .nav-event {
    justify-content: center;
    padding: 0;
    background: transparent;
  }
  .sidebar[data-rail="1"] .nav-scroll {
    margin: 12px 0 0;
    padding: 0 8px;
  }
  .sidebar[data-rail="1"] .nav-item {
    justify-content: center;
    gap: 0;
    height: 42px;
    padding: 0;
  }
  .sidebar[data-rail="1"] .nav-item svg {
    width: 20px;
    height: 20px;
  }
  .sidebar[data-rail="1"] .nav-item[aria-current="page"]::before {
    content: "";
    position: absolute;
    left: -8px;
    top: 12px;
    bottom: 12px;
    width: 3px;
    border-radius: 9px;
    background: var(--accent);
  }
  .sidebar[data-rail="1"] .nav-foot {
    padding: 12px 0 0;
  }
  .sidebar[data-rail="1"] .nav-user,
  .sidebar[data-rail="1"] .nav-actions {
    justify-content: center;
  }
  .sidebar[data-rail="1"] .logout-btn .nav-lbl {
    display: none;
  }
}
.logout-btn .rail-ico {
  display: none;
}
@media (min-width: 1024px) {
  .sidebar[data-rail="1"] .logout-btn .rail-ico {
    display: block;
    width: 18px;
    height: 18px;
  }
}

/* Barra superior del celular y menú como panel */
.mbar {
  position: sticky;
  top: 12px;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 16px 0;
  padding: 6px;
  border-radius: 9999px;
}
.mbar .round {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border: 0;
  border-radius: 50%;
  background: var(--surface);
  color: var(--label);
  cursor: pointer;
}
.mbar .round svg {
  width: 20px;
  height: 20px;
}
.mbar .title {
  flex: 1;
  min-width: 0;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-backdrop {
  display: none;
}
@media (min-width: 1024px) {
  .mbar {
    display: none;
  }
}
@media (max-width: 1023.98px) {
  .sidebar {
    top: 0;
    bottom: 0;
    left: 0;
    width: min(18rem, 85vw);
    border-radius: 0 var(--radius-window) var(--radius-window) 0;
    background: var(--popover-bg);
    transform: translateX(-105%);
  }
  .app-shell[data-menu="open"] .sidebar {
    transform: none;
  }
  .app-shell[data-menu="open"] .nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgb(0 0 0 / 0.25);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
  }
}

/* ───────── Atlas IA · Próximamente ───────── */
.atlas-soon-row {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 4px;
}
.atlas-soon {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 12px 0 6px;
  border-radius: 9999px;
  cursor: not-allowed;
  user-select: none;
}
.atlas-soon b {
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--label-2);
}
.atlas-soon-tag {
  border-radius: 9999px;
  background: var(--bg);
  color: var(--label-2);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  text-transform: uppercase;
}
.atlas-soon-tip {
  position: absolute;
  right: 0;
  top: 50px;
  z-index: 40;
  width: 250px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--panel-shadow);
  color: var(--label-2);
  font-size: 12.5px;
  line-height: 1.45;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition:
    opacity 160ms ease,
    transform 170ms var(--ease-glass);
}
.atlas-soon:hover .atlas-soon-tip,
.atlas-soon:focus .atlas-soon-tip {
  opacity: 1;
  transform: none;
}
.atlas-orb {
  display: block;
  flex: none;
}

/* ───────── Pantallas públicas e inicio de sesión ───────── */
.public-main {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}
.auth-card {
  width: 100%;
  max-width: 384px;
  padding: 32px;
  border-radius: var(--radius-window);
}
.auth-card .logo-vertical {
  display: flex;
  justify-content: center;
}
.auth-card .logo-vertical img {
  height: 150px;
  width: auto;
}
.auth-card .intro {
  margin: 14px 0 22px;
  text-align: center;
  color: var(--label-2);
  font-size: 14px;
}
.auth-card .foot {
  margin-top: 18px;
  text-align: center;
  color: var(--label-2);
  font-size: 13px;
}
@media (max-width: 420px) {
  .auth-card {
    padding: 26px 20px;
  }
  .auth-card .logo-vertical img {
    height: 120px;
  }
}

/* Movimiento reducido */
@media (prefers-reduced-motion: reduce) {
  .aura i {
    animation: none;
  }
  .sidebar,
  .app-shell,
  .btn-primary,
  .btn-secondary,
  .tab,
  .nav-item,
  .atlas-soon-tip {
    transition: none;
  }
}

@media print {
  .aura,
  .sidebar,
  .mbar,
  .atlas-soon-row {
    display: none !important;
  }
  .app-shell {
    padding: 0 !important;
  }
}

/* Celular: campos a 16 px para que iOS no acerque la página y sin resaltado gris al tocar */
@media (pointer: coarse) {
  .input-field,
  .field input:not([type="checkbox"]):not([type="radio"]),
  .field select,
  .field textarea {
    font-size: 16px;
  }
  a,
  button,
  label,
  summary {
    -webkit-tap-highlight-color: transparent;
  }
}

/* Etiqueta neutra (la misma .profit-tag de Finanzas) */
.profit-tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--label-2);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
