/* TEMCO-5 Design System V5 — Premium Organic Edition. */
@supports (view-transition-name: none) {
  @view-transition { navigation: auto; }
  ::view-transition-old(root) { animation: 140ms cubic-bezier(0.4, 0, 1, 1) both fade-out; }
  ::view-transition-new(root) { animation: 220ms cubic-bezier(0.16, 1, 0.3, 1) both fade-in, 220ms cubic-bezier(0.16, 1, 0.3, 1) both slide-up; }
}

@keyframes fade-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-up { from { transform: translateY(6px); } to { transform: translateY(0); } }

:root {
  color-scheme: light;
  --bg: #f7faf8;
  --canvas: #f8fbf9;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --surface-hover: #f1f7f4;
  --surface-subtle: #f2f6f4;
  --surface-inverse: #0d1820;

  --text-primary: #12212b;
  --text-secondary: #4a5b65;
  --text-muted: #7e8d94;
  --text-inverse: #f8fbfa;

  --border: rgba(20, 35, 45, 0.08);
  --border-subtle: rgba(20, 35, 45, 0.05);
  --border-strong: rgba(20, 35, 45, 0.15);
  --border-focus: #0c6f68;

  --brand: #0c6f68;
  --brand-hover: #095c57;
  --brand-pressed: #074a46;
  --brand-soft: #e7f4f1;
  --brand-soft-hover: #dcf0ec;
  --brand-glow: rgba(12, 111, 104, 0.16);

  --success: #1e7045;
  --success-soft: #e6f4ec;
  --warning: #8d5b12;
  --warning-soft: #fff3db;
  --danger: #9c3333;
  --danger-soft: #fae8e8;
  --info: #2b617d;
  --info-soft: #e7f1f6;

  --font-sans: -apple-system, BlinkMacSystemFont, "Plus Jakarta Sans", "SF Pro Display", "SF Pro Text", "Inter", "Segoe UI", Roboto, sans-serif;
  --text-display: clamp(2.1rem, 4vw, 3.1rem);
  --text-h1: clamp(1.8rem, 3vw, 2.3rem);
  --text-h2: 1.3rem;
  --text-h3: 1.05rem;
  --text-body: .9375rem;
  --text-small: .8125rem;
  --text-label: .75rem;
  --text-caption: .6875rem;

  --tracking-tight: -.032em;
  --tracking-label: .075em;

  --space-1: .25rem;
  --space-2: .5rem;
  --space-3: .75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  --radius-xs: 7px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 26px;
  --radius-pill: 999px;

  --shadow-xs: 0 1px 2px rgba(16, 28, 37, 0.04);
  --shadow-sm: 0 2px 6px -1px rgba(16, 28, 37, 0.05), 0 1px 3px rgba(16, 28, 37, 0.03);
  --shadow-md: 0 10px 28px -4px rgba(16, 28, 37, 0.07), 0 3px 8px -2px rgba(16, 28, 37, 0.03);
  --shadow-lg: 0 20px 38px -8px rgba(16, 28, 37, 0.10), 0 8px 16px -4px rgba(16, 28, 37, 0.04);
  --shadow-focus: 0 0 0 3px var(--brand-glow), 0 1px 2px rgba(16, 28, 37, 0.04);

  --border-width: 1px;
  --duration-fast: 130ms;
  --duration-normal: 200ms;
  --duration-slow: 320ms;
  --ease-standard: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-exit: cubic-bezier(0.4, 0, 1, 1);

  --z-base: 1;
  --z-sidebar: 40;
  --z-header: 60;
  --z-overlay: 30;
  --z-tooltip: 100;

  --header-height: 60px;
  --sidebar-width: 240px;
  --control-height: 42px;
  --control-height-sm: 34px;
  --content-width: 1220px;
  --breakpoint-mobile: 720px;
  --breakpoint-tablet: 980px;

  --ink-950: var(--text-primary);
  --ink-800: var(--text-primary);
  --ink-700: var(--text-secondary);
  --ink-600: var(--text-secondary);
  --ink-500: var(--text-secondary);
  --ink-400: var(--text-muted);
  --line: var(--border);
  --line-strong: var(--border-strong);
  --surface-soft: var(--surface-subtle);
  --navy: var(--surface-inverse);
  --blue: var(--info);
}

:root[data-theme="dark"],
html.theme-dark,
body.theme-dark {
  color-scheme: dark;
  --bg: #080b0f;
  --canvas: #090d12;
  --surface: #0f161f;
  --surface-raised: #131c26;
  --surface-hover: #192432;
  --surface-subtle: #121922;
  --surface-inverse: #f8fafc;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #080b0f;

  --border: rgba(255, 255, 255, 0.08);
  --border-subtle: rgba(255, 255, 255, 0.05);
  --border-strong: rgba(255, 255, 255, 0.16);
  --border-focus: #14b8a6;

  --brand: #14b8a6;
  --brand-hover: #2dd4bf;
  --brand-pressed: #0d9488;
  --brand-soft: rgba(20, 184, 166, 0.14);
  --brand-soft-hover: rgba(20, 184, 166, 0.22);
  --brand-glow: rgba(20, 184, 166, 0.35);

  --success: #34d399;
  --success-soft: rgba(16, 185, 129, 0.15);
  --warning: #fbbf24;
  --warning-soft: rgba(245, 158, 11, 0.15);
  --danger: #f87171;
  --danger-soft: rgba(239, 68, 68, 0.15);
  --info: #38bdf8;
  --info-soft: rgba(56, 189, 248, 0.15);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 20px 48px rgba(0, 0, 0, 0.75);
  --shadow-focus: 0 0 0 3px var(--brand-glow), 0 1px 2px rgba(0, 0, 0, 0.5);

  --ink-950: var(--text-primary);
  --ink-800: var(--text-primary);
  --ink-700: var(--text-secondary);
  --ink-600: var(--text-secondary);
  --ink-500: var(--text-secondary);
  --ink-400: var(--text-muted);
  --line: var(--border);
  --line-strong: var(--border-strong);
  --surface-soft: var(--surface-subtle);
  --navy: var(--surface-inverse);
  --blue: var(--info);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html {
  min-width: 320px;
  min-height: 100%;
  background: var(--bg);
  scroll-behavior: smooth;
}
body {
  min-height: 100vh;
  margin: 0;
  color: var(--text-primary);
  background: var(--bg);
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a {
  color: var(--brand);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-standard);
}
a:hover { color: var(--brand-hover); }
svg { display: block; }
strong, h1, h2, h3 { font-weight: 650; }
.right, [class*="money"], .total-block strong, td.right, th.right { font-variant-numeric: tabular-nums; }
:where(a, button, input, select, textarea, summary):focus-visible {
  outline: 0;
  box-shadow: var(--shadow-focus);
}
.skip-link {
  position: fixed;
  top: var(--space-3);
  left: var(--space-3);
  z-index: var(--z-tooltip);
  padding: .65rem .95rem;
  color: var(--text-inverse);
  background: var(--surface-inverse);
  border-radius: var(--radius-sm);
  transform: translateY(-160%);
  transition: transform var(--duration-normal) var(--ease-spring);
  box-shadow: var(--shadow-md);
}
.skip-link:focus { transform: translateY(0); }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* App shell */
.topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  display: flex;
  align-items: center;
  min-height: var(--header-height);
  gap: var(--space-3);
  padding: 0 var(--space-6);
  color: var(--text-inverse);
  background: linear-gradient(180deg, #101e27 0%, #0d1820 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 16px rgba(8, 16, 22, 0.25);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.brand {
  display: inline-flex;
  align-items: center;
  min-width: calc(var(--sidebar-width) - var(--space-6));
  gap: .75rem;
  color: var(--text-inverse);
  transition: transform var(--duration-fast) var(--ease-spring);
}
.brand:hover {
  color: var(--text-inverse);
  transform: translateY(-0.5px);
}
.brand-mark {
  display: inline-grid;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  place-items: center;
  color: #e3f8f3;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.14) 0%, rgba(255, 255, 255, 0.06) 100%);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-sm);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}
.brand-mark svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}
.brand-copy { display: grid; gap: 1px; line-height: 1; }
.brand-copy strong { font-size: .94rem; font-weight: 700; letter-spacing: -.01em; }
.brand-copy small {
  color: rgba(248, 251, 250, 0.55);
  font-size: .6rem;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
}
.topbar-spacer { flex: 1; }

.demo-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  min-height: 26px;
  padding: .25rem .65rem;
  color: #dcf7f1;
  background: rgba(12, 111, 104, 0.28);
  border: 1px solid rgba(106, 211, 194, 0.35);
  border-radius: var(--radius-pill);
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .08em;
  box-shadow: 0 0 12px rgba(106, 211, 194, 0.14);
}
.demo-pill > span {
  width: .42rem;
  height: .42rem;
  background: #6ad3c2;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(106, 211, 194, 0.7);
  animation: pulse-dot 2.4s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(1.15); opacity: 0.4; }
}

.demo-pill::after {
  position: absolute;
  top: calc(100% + 9px);
  right: 0;
  z-index: var(--z-tooltip);
  width: max-content;
  max-width: 230px;
  padding: .55rem .75rem;
  content: attr(data-tooltip);
  color: var(--text-inverse);
  background: #172630;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  font-size: .72rem;
  font-weight: 500;
  letter-spacing: 0;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity var(--duration-fast), transform var(--duration-fast) var(--ease-spring);
}
.demo-pill:hover::after, .demo-pill:focus::after { opacity: 1; transform: translateY(0); }

/* Toggle de Modo Oscuro / Claro */
.theme-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  color: rgba(248, 251, 250, 0.85);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  transition: all var(--duration-fast) var(--ease-spring);
}
.theme-toggle:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px) scale(1.04);
}
.theme-toggle svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  transition: transform 0.4s var(--ease-spring), opacity var(--duration-fast);
}

/* En modo oscuro, mostrar el sol para pasar a claro */
:root[data-theme="dark"] .theme-icon-dark,
html.theme-dark .theme-icon-dark {
  display: none !important;
}
:root[data-theme="dark"] .theme-icon-light,
html.theme-dark .theme-icon-light {
  display: block !important;
  color: #fde047;
  animation: rotateThemeIcon 0.45s var(--ease-spring) both;
}

/* En modo claro, mostrar la luna para pasar a oscuro */
:root:not([data-theme="dark"]) .theme-icon-light {
  display: none !important;
}
:root:not([data-theme="dark"]) .theme-icon-dark {
  display: block !important;
  color: #dcf7f1;
  animation: rotateThemeIcon 0.45s var(--ease-spring) both;
}

@keyframes rotateThemeIcon {
  from { transform: rotate(-60deg) scale(0.7); opacity: 0; }
  to { transform: rotate(0) scale(1); opacity: 1; }
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .3rem .6rem;
  color: rgba(248, 251, 250, 0.72);
  font-size: var(--text-small);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.05);
}
.user-chip svg, .button-icon, .menu-toggle svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}
.logout-form { margin: 0; }
.topbar .btn-ghost {
  color: rgba(248, 251, 250, 0.78);
  border-color: transparent;
}
.topbar .btn-ghost:hover {
  color: var(--text-inverse);
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-0.5px);
}
.menu-toggle { display: none; }

.app-shell {
  display: flex;
  min-height: calc(100vh - var(--header-height));
}
.billing-sidebar {
  position: sticky;
  top: var(--header-height);
  z-index: var(--z-sidebar);
  flex: 0 0 var(--sidebar-width);
  width: var(--sidebar-width);
  height: calc(100vh - var(--header-height));
  padding: var(--space-5) var(--space-3);
  overflow-y: auto;
  background: var(--surface);
  border-right: 1px solid var(--border);
  box-shadow: 1px 0 3px rgba(16, 28, 37, 0.02);
}
.sidebar-section { margin: 0 0 var(--space-6); }

.billing-sidebar a, .secondary-nav summary {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 40px;
  gap: .7rem;
  padding: .55rem .75rem;
  color: var(--text-secondary);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: .86rem;
  font-weight: 550;
  transition: color var(--duration-fast), background var(--duration-fast), border-color var(--duration-fast), transform var(--duration-fast) var(--ease-spring);
}
.billing-sidebar a:hover, .secondary-nav summary:hover {
  color: var(--text-primary);
  background: var(--surface-hover);
  transform: translateX(1px);
}
.billing-sidebar a:active, .secondary-nav summary:active {
  transform: scale(.99);
}
.billing-sidebar a.active {
  color: var(--brand);
  background: var(--brand-soft);
  border-color: rgba(12, 111, 104, 0.14);
  font-weight: 650;
  box-shadow: 0 1px 3px rgba(12, 111, 104, 0.06);
}
.billing-sidebar a.active::before {
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: -4px;
  width: 3px;
  content: "";
  background: var(--brand);
  border-radius: var(--radius-pill);
  box-shadow: 0 0 6px rgba(12, 111, 104, 0.4);
}
.nav-icon {
  display: inline-grid;
  flex: 0 0 20px;
  width: 20px;
  place-items: center;
  color: var(--text-muted);
  transition: color var(--duration-fast), transform var(--duration-fast) var(--ease-spring);
}
.nav-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.65;
}
.billing-sidebar a:hover .nav-icon {
  color: var(--text-primary);
  transform: scale(1.05);
}
.billing-sidebar a.active .nav-icon, .active-family > .nav-family-title .nav-icon {
  color: var(--brand);
}

.nav-family {
  margin: var(--space-2) 0;
  padding: var(--space-1) 0 var(--space-2);
  border-radius: var(--radius-md);
  transition: background var(--duration-normal);
}
.nav-family.active-family { background: var(--surface-subtle); }
.nav-family-title {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .45rem .75rem .3rem;
  color: var(--text-primary);
  font-size: .83rem;
  font-weight: 650;
}
.nav-family a {
  min-height: 34px;
  margin: 2px .25rem 2px 2.15rem;
  padding: .4rem .65rem;
  font-size: .8rem;
}
.nav-family a.active::before { left: -2.35rem; }

.secondary-nav {
  margin-top: var(--space-8);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}
.secondary-nav summary { cursor: pointer; list-style: none; }
.secondary-nav summary::-webkit-details-marker { display: none; }
.secondary-nav summary::after {
  width: 7px;
  height: 7px;
  margin-left: auto;
  content: "";
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform var(--duration-normal) var(--ease-spring);
}
.secondary-nav[open] summary::after {
  transform: rotate(225deg) translate(-1px, -1px);
}
.secondary-nav-links {
  display: grid;
  gap: 2px;
  padding: var(--space-1) 0 0 2.15rem;
}
.secondary-nav-links a {
  min-height: 34px;
  padding: .4rem .65rem;
  font-size: .8rem;
}
.sidebar-backdrop { display: none; }
.app-content {
  flex: 1;
  min-width: 0;
  overflow-x: clip;
}

.page {
  width: min(100%, var(--content-width));
  min-width: 0;
  margin: 0 auto;
  padding: clamp(1.6rem, 3vw, 2.85rem) clamp(1rem, 3vw, 2.85rem) var(--space-16);
  animation: page-enter var(--duration-slow) var(--ease-spring) both;
}
@keyframes page-enter {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Typography and layout */
.page-header {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-5);
  margin-bottom: var(--space-6);
}
.eyebrow {
  margin: 0 0 .4rem;
  color: var(--brand);
  font-size: var(--text-caption);
  font-weight: 700;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}
.page-header h1, .home-header h1 {
  margin: 0;
  color: var(--text-primary);
  font-size: var(--text-h1);
  font-weight: 650;
  letter-spacing: var(--tracking-tight);
  line-height: 1.14;
}
.page-header h2 {
  margin: 0;
  font-size: var(--text-h2);
  letter-spacing: -.02em;
}
.subtitle, .home-subtitle {
  max-width: 680px;
  margin: .45rem 0 0;
  color: var(--text-secondary);
  font-size: .92rem;
  line-height: 1.5;
}
.page-actions {
  display: flex;
  min-width: 0;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-2);
}
.stack {
  display: grid;
  min-width: 0;
  gap: var(--space-5);
}
.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, .38fr);
  align-items: start;
  gap: var(--space-5);
}

/* Controls & Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--control-height);
  gap: .5rem;
  padding: .55rem .95rem;
  color: var(--text-primary);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: .84rem;
  font-weight: 600;
  line-height: 1.15;
  transition: all var(--duration-fast) var(--ease-spring);
  box-shadow: var(--shadow-xs);
}
.btn:hover {
  color: var(--text-primary);
  background: var(--surface-hover);
  border-color: rgba(12, 111, 104, 0.35);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1.5px);
}
.btn:active {
  box-shadow: var(--shadow-xs);
  transform: translateY(0) scale(.98);
}
.btn:disabled {
  opacity: .58;
  cursor: wait;
  transform: none;
}
.btn-primary {
  color: #ffffff;
  background: linear-gradient(180deg, #0e7b73 0%, #0c6f68 100%);
  border-color: #0b6760;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 3px 10px rgba(12, 111, 104, 0.22);
}
.btn-primary:hover {
  color: #ffffff;
  background: linear-gradient(180deg, #10877f 0%, #0a645e 100%);
  border-color: #085550;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 5px 14px rgba(12, 111, 104, 0.28);
}
.btn-primary:active {
  background: #085550;
}
.btn-success {
  color: #ffffff;
  background: linear-gradient(180deg, #247c4e 0%, #1e7045 100%);
  border-color: #1a613c;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 3px 10px rgba(30, 112, 69, 0.2);
}
.btn-danger {
  color: #ffffff;
  background: linear-gradient(180deg, #aa3a3a 0%, #9c3333 100%);
  border-color: #8b2b2b;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 3px 10px rgba(156, 51, 51, 0.2);
}
.btn-secondary, .btn-ghost {
  background: transparent;
  box-shadow: none;
}
.btn-secondary {
  border-color: var(--border-strong);
  background: var(--surface);
}
.btn-sm {
  min-height: var(--control-height-sm);
  padding: .42rem .7rem;
  font-size: .77rem;
}
.btn-icon { width: var(--control-height); padding: 0; }
.btn + .btn { margin-left: var(--space-1); }
.btn-back::before {
  width: 7px;
  height: 7px;
  content: "";
  border-bottom: 1.5px solid currentColor;
  border-left: 1.5px solid currentColor;
  transform: rotate(45deg);
}
.inline-form { display: inline; }

/* Surfaces & Dashboard Cards */
.card, .kpi {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--duration-normal) var(--ease-spring), box-shadow var(--duration-normal) var(--ease-spring);
}
.card { padding: clamp(1.1rem, 2vw, 1.5rem); }
.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}
.card-title {
  margin: 0;
  color: var(--text-primary);
  font-size: var(--text-h3);
  font-weight: 650;
}
.card-subtitle {
  margin: .25rem 0 0;
  color: var(--text-secondary);
  font-size: var(--text-small);
}
.workflow-card {
  border-left: 4px solid var(--brand);
}
.workflow-card h2 { margin: 0 0 .35rem; }
.workflow-card p { margin: 0; color: var(--text-secondary); font-size: var(--text-small); }

.simple-start {
  width: min(100%, 1120px);
  margin: clamp(.85rem, 3.5vw, 2.5rem) auto 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}
.home-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-6);
  margin-bottom: 0;
  animation: dashFadeUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.home-header h1 { font-size: var(--text-display); }
.home-subtitle { font-size: 1.05rem; }

.home-status {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: .8rem;
  padding: .7rem .85rem .7rem .95rem;
  color: var(--text-primary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: all var(--duration-normal) var(--ease-spring);
}
.home-status:hover {
  color: var(--text-primary);
  border-color: rgba(12, 111, 104, 0.35);
  box-shadow: var(--shadow-md);
  transform: translateY(-1.5px);
}
.home-status > span:nth-child(2) { display: grid; }
.home-status strong { font-size: .8rem; font-weight: 650; }
.home-status small { color: var(--text-muted); font-size: .7rem; }
.home-status > svg, .home-footnote svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
  transition: transform var(--duration-normal) var(--ease-spring);
}
.home-status:hover > svg, .home-footnote a:hover svg {
  transform: translateX(3px);
}
.status-dot {
  display: inline-block;
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  background: #258f5a;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(37, 143, 90, 0.16);
  animation: pulse-dot 2.5s infinite;
}
.status-dot-warning {
  background: #cf8423;
  box-shadow: 0 0 0 3px rgba(207, 132, 35, 0.16);
}

/* ── Métricas ejecutivas del ciclo ────────────────────────────────────────── */
.dash-metrics-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-4);
  animation: dashFadeUp 0.45s 0.05s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.dash-metric-card {
  position: relative;
  overflow: hidden;
  padding: 1.15rem 1.25rem;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: all var(--duration-normal) var(--ease-spring);
}
.dash-metric-card:hover {
  border-color: rgba(12, 111, 104, 0.32);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.dash-metric-card.highlight-card {
  background: linear-gradient(135deg, rgba(12, 111, 104, 0.045) 0%, var(--surface-raised) 100%);
  border-color: rgba(12, 111, 104, 0.22);
}
.dash-metric-card.highlight-card:hover {
  border-color: var(--brand);
  box-shadow: 0 8px 24px rgba(12, 111, 104, 0.12);
}
.dash-metric-card.is-warning {
  border-color: rgba(207, 132, 35, 0.3);
  background: linear-gradient(135deg, rgba(207, 132, 35, 0.04) 0%, var(--surface-raised) 100%);
}
.dash-metric-card.is-warning .metric-icon {
  background: #fdf3e7;
  color: #cf8423;
}
.dash-metric-card.is-pending {
  border-color: rgba(56, 114, 224, 0.25);
}
.dash-metric-card.is-pending .metric-icon {
  background: #edf3fc;
  color: #3872e0;
}
.metric-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: 0.45rem;
}
.metric-label {
  font-size: 0.74rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.metric-icon {
  display: inline-grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
  color: var(--brand);
  transition: transform var(--duration-fast) var(--ease-spring);
}
.metric-icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.dash-metric-card:hover .metric-icon {
  transform: scale(1.08);
}
.metric-value {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  margin-bottom: 0.45rem;
}
.metric-foot {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.metric-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
}

/* ── Panel de Atención Prioritaria ────────────────────────────────────────── */
.dash-attention-section {
  padding: 1.25rem 1.4rem;
  background: linear-gradient(135deg, rgba(207, 132, 35, 0.05) 0%, var(--surface-raised) 100%);
  border: 1px solid rgba(207, 132, 35, 0.28);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  animation: dashFadeUp 0.5s 0.09s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.dash-attention-header {
  margin-bottom: var(--space-4);
}
.attention-title-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.attention-badge-icon {
  display: inline-grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: var(--radius-sm);
  background: #fdf3e7;
  color: #cf8423;
  flex: 0 0 auto;
}
.attention-badge-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.attention-pill-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: 0.15rem;
}
.attention-count-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #9c6215;
  background: rgba(207, 132, 35, 0.14);
  border: 1px solid rgba(207, 132, 35, 0.28);
  letter-spacing: -0.01em;
}
.dash-attention-header h2 {
  font-size: 1.05rem;
  font-weight: 650;
  margin: 0;
  color: var(--text-primary);
}
.attention-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0;
}
.dash-attention-list {
  display: grid;
  gap: var(--space-2);
}
.dash-attention-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: 0.8rem 1.1rem;
  background: var(--surface);
  border: 1px solid rgba(207, 132, 35, 0.22);
  border-radius: var(--radius-md);
  box-shadow: 0 1px 3px rgba(207, 132, 35, 0.04);
  transition: all var(--duration-fast) var(--ease-spring);
}
.dash-attention-row:hover {
  background: #ffffff;
  border-color: rgba(207, 132, 35, 0.45);
  box-shadow: 0 4px 14px rgba(207, 132, 35, 0.1);
  transform: translateY(-1px);
}
.attention-row-avatar {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(207, 132, 35, 0.18), rgba(207, 132, 35, 0.08));
  border: 1px solid rgba(207, 132, 35, 0.28);
  color: #9c6215;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.attention-row-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.attention-client-line {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.attention-client-line strong {
  font-size: 0.92rem;
  color: var(--text-primary);
  font-weight: 650;
}
.attention-period-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.5rem;
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 550;
  color: var(--text-secondary);
}
.attention-row-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.attention-row-reason {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.76rem;
  color: #9c6215;
  font-weight: 550;
}
.attention-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #cf8423;
  box-shadow: 0 0 6px rgba(207, 132, 35, 0.6);
  animation: pulseAttentionDot 2s infinite ease-in-out;
}
@keyframes pulseAttentionDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}
.attention-row-action .btn {
  white-space: nowrap;
}
.attention-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.48rem 0.9rem;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition: all var(--duration-fast) var(--ease-spring);
}
.attention-action-btn svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  transition: transform var(--duration-fast) var(--ease-spring);
}
.attention-action-btn:hover svg {
  transform: translateX(3px);
}

/* ── Elección Operativa (Vivienda & Local) ─────────────────────────────────── */
.billing-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-6);
  animation: dashFadeUp 0.55s 0.13s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.billing-choice {
  position: relative;
  min-width: 0;
  padding: clamp(1.4rem, 3vw, 2.15rem);
  overflow: hidden;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  transition: all var(--duration-normal) var(--ease-spring);
}
.billing-choice::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle at 100% 0%, var(--brand-glow) 0%, transparent 70%);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-normal) var(--ease-spring);
}
.billing-choice:hover {
  border-color: rgba(12, 111, 104, 0.28);
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}
.billing-choice:hover::after {
  opacity: 1;
}

.choice-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}
.choice-icon {
  display: inline-grid;
  width: 48px;
  height: 48px;
  place-items: center;
  color: var(--brand);
  background: var(--brand-soft);
  border-radius: var(--radius-md);
  box-shadow: 0 2px 8px rgba(12, 111, 104, 0.08);
  transition: all var(--duration-normal) var(--ease-spring);
}
.choice-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.65;
}
.billing-choice:hover .choice-icon {
  color: var(--brand-hover);
  background: var(--brand-soft-hover);
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 4px 12px rgba(12, 111, 104, 0.16);
}
.local-choice .choice-icon {
  color: #725916;
  background: #f7f0d8;
  box-shadow: 0 2px 8px rgba(114, 89, 22, 0.08);
}
.local-choice:hover .choice-icon {
  color: #5c4710;
  background: #f4ebd0;
  box-shadow: 0 4px 12px rgba(114, 89, 22, 0.14);
}

.choice-kicker {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  color: var(--text-muted);
  font-size: .67rem;
  font-weight: 650;
  letter-spacing: .065em;
  text-transform: uppercase;
}
.choice-kicker .status-dot { width: 6px; height: 6px; }

.billing-choice h2 {
  margin: var(--space-6) 0 .3rem;
  font-size: 1.65rem;
  font-weight: 650;
  letter-spacing: -.03em;
}
.billing-choice > p {
  margin: 0 0 var(--space-6);
  color: var(--text-secondary);
  font-size: .93rem;
}

.choice-actions {
  display: grid;
  gap: var(--space-2);
}
.choice-actions a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  gap: var(--space-3);
  padding: .75rem 1rem;
  color: var(--text-primary);
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  transition: all var(--duration-fast) var(--ease-spring);
}
.action-tile-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}
.action-mini-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  color: var(--brand);
  box-shadow: 0 1px 2px rgba(16, 28, 37, 0.04);
  transition: all var(--duration-fast) var(--ease-spring);
}
.action-mini-icon svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.choice-actions a:hover {
  color: var(--text-primary);
  background: #ffffff;
  border-color: rgba(12, 111, 104, 0.35);
  box-shadow: 0 4px 14px rgba(16, 28, 37, 0.06);
  transform: translateY(-1px);
}
.choice-actions a:hover .action-mini-icon {
  background: var(--brand);
  color: #ffffff;
  border-color: var(--brand);
  box-shadow: 0 3px 8px rgba(12, 111, 104, 0.25);
  transform: scale(1.05);
}
.choice-actions a:active { transform: scale(.99); }
.choice-actions span { display: grid; }
.choice-actions strong { font-size: .88rem; font-weight: 650; }
.choice-actions small { color: var(--text-muted); font-size: .73rem; }
.action-chevron,
.choice-actions svg.action-chevron {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  transition: all var(--duration-fast) var(--ease-spring);
}
.choice-actions a:hover .action-chevron {
  color: var(--brand);
  transform: translateX(4px);
}

/* ── Panel de Facturas del Periodo ────────────────────────────────────────── */
.dash-recent-section {
  display: grid;
  gap: var(--space-3);
  animation: dashFadeUp 0.6s 0.17s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.dash-section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
  padding: 0 var(--space-1);
}
.dash-section-header h2 {
  font-size: 1.25rem;
  font-weight: 650;
  margin: 0;
  letter-spacing: -0.02em;
}
.recent-table-card {
  padding: 0;
  overflow: hidden;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface-raised);
}
.recent-table-card .table-wrap {
  border: 0;
  box-shadow: none;
}
.compact-invoice-table {
  width: 100%;
  border-collapse: collapse;
}
.compact-invoice-table th {
  padding: 0.75rem 1rem;
  font-size: 0.73rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--surface-subtle);
  border-bottom: 1px solid var(--border);
}
.compact-invoice-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}
.compact-invoice-table tr:last-child td {
  border-bottom: 0;
}
.compact-invoice-table tr:hover td {
  background: rgba(12, 111, 104, 0.02);
}
.primary-cell {
  font-weight: 650;
  color: var(--text-primary);
  display: block;
}
.primary-cell:hover {
  color: var(--brand);
}
.secondary-cell {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: block;
  margin-top: 0.1rem;
}
.client-cell-wrap strong {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
}
.period-badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
}
.total-figure {
  font-size: 0.95rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}
.action-cell {
  text-align: right;
  width: 90px;
}
.pdf-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: all var(--duration-fast) var(--ease-spring);
}
.pdf-action-btn svg {
  width: 14px;
  height: 14px;
  stroke-width: 1.8;
}
.pdf-action-btn:hover {
  color: var(--brand);
  background: var(--brand-soft);
}

.home-footnote {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-top: var(--space-2);
  margin-bottom: var(--space-4);
  padding: 0 var(--space-1);
  color: var(--text-muted);
  font-size: var(--text-small);
  animation: dashFadeUp 0.65s 0.2s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.home-footnote > span, .home-footnote a {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
}
.home-footnote a { font-weight: 600; }

@keyframes dashFadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Responsive Dashboard ─────────────────────────────────────────────────── */
@media (max-width: 920px) {
  .dash-metrics-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 680px) {
  .home-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
  }
  .billing-choice-grid {
    grid-template-columns: 1fr;
  }
  .dash-metrics-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-3);
  }
  .dash-metric-card {
    padding: 0.9rem 1rem;
  }
  .metric-value {
    font-size: 1.35rem;
  }
  .dash-attention-row {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: var(--space-3);
  }
  .attention-row-action {
    width: 100%;
    margin-top: 0.25rem;
  }
  .dash-attention-row .btn {
    width: 100%;
    justify-content: center;
  }
}

.invoice-ref-group {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

/* Data Tables */
.list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-3);
  color: var(--text-muted);
  font-size: var(--text-small);
}
.list-toolbar > div { display: inline-flex; align-items: center; gap: .5rem; }
.list-toolbar strong { color: var(--text-primary); }

.data-card { padding: 0; overflow: hidden; }
.data-card .table-wrap { border: 0; border-radius: inherit; }
.table-wrap {
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  scrollbar-color: var(--border-strong) transparent;
}
table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
}
th, td {
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
  vertical-align: middle;
  font-size: .83rem;
}
th {
  color: var(--text-muted);
  background: var(--surface-subtle);
  font-size: .67rem;
  font-weight: 650;
  letter-spacing: .065em;
  text-transform: uppercase;
  white-space: nowrap;
}
tbody tr {
  transition: background var(--duration-fast) var(--ease-standard);
}
tbody tr:hover {
  background: var(--surface-hover);
}
tbody tr:last-child td { border-bottom: 0; }
td.right, th.right { text-align: right; }
td.center, th.center { text-align: center; }

.primary-cell { color: var(--text-primary); font-weight: 600; }
.primary-cell:has(.row-avatar) { display: flex; align-items: center; gap: .75rem; }
.primary-cell small {
  display: block;
  margin-top: 1px;
  color: var(--text-muted);
  font-size: .71rem;
  font-weight: 450;
}
.secondary-cell {
  display: block;
  margin-top: .15rem;
  color: var(--text-muted);
  font-size: .73rem;
  font-weight: 450;
}
.row-avatar {
  display: inline-grid;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  place-items: center;
  color: var(--brand);
  background: linear-gradient(135deg, var(--brand-soft) 0%, #d8ece8 100%);
  border: 1px solid rgba(12, 111, 104, 0.12);
  border-radius: var(--radius-sm);
  font-size: .75rem;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(12, 111, 104, 0.08);
}
code { overflow-wrap: anywhere; white-space: pre-wrap; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.badge, .status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  gap: .4rem;
  padding: .22rem .55rem;
  border-radius: var(--radius-pill);
  font-size: .68rem;
  font-weight: 650;
  line-height: 1.15;
  white-space: nowrap;
}
.badge::before, .status-pill::before {
  width: .38rem;
  height: .38rem;
  content: "";
  background: currentColor;
  border-radius: 50%;
}
.badge-fixed, .badge-local { color: #725712; background: #faf2dc; border: 1px solid rgba(114, 87, 18, 0.12); }
.badge-variable, .badge-housing { color: var(--brand); background: var(--brand-soft); border: 1px solid rgba(12, 111, 104, 0.12); }
.status-neutral { color: var(--text-secondary); background: #ebf0ee; }
.status-info { color: var(--info); background: var(--info-soft); border: 1px solid rgba(43, 97, 125, 0.12); }
.status-success { color: var(--success); background: var(--success-soft); border: 1px solid rgba(30, 112, 69, 0.14); }
.status-warning { color: var(--warning); background: var(--warning-soft); border: 1px solid rgba(141, 91, 18, 0.14); }
.status-danger { color: var(--danger); background: var(--danger-soft); border: 1px solid rgba(156, 51, 51, 0.14); }

/* Forms & Inputs */
.filter-bar {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
  padding: var(--space-4) var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.filter-bar .form-group { min-width: 140px; flex: 1 1 140px; }
.filter-search { flex-grow: 1.6 !important; }
.filter-bar .form-actions { margin: 0; padding: 0; border: 0; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4) var(--space-5);
}
.form-grid .full { grid-column: 1 / -1; }
.form-group { display: flex; flex-direction: column; gap: .38rem; }
.form-group label {
  color: var(--text-secondary);
  font-size: .8rem;
  font-weight: 600;
}
.form-group .hint, .hint { color: var(--text-muted); font-size: .73rem; }

input, select, textarea {
  width: 100%;
  min-height: var(--control-height);
  padding: .62rem .8rem;
  color: var(--text-primary);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  outline: 0;
  transition: border-color var(--duration-fast) var(--ease-spring), box-shadow var(--duration-fast) var(--ease-spring), background var(--duration-fast);
}
input:hover, select:hover, textarea:hover {
  border-color: rgba(12, 111, 104, 0.4);
}
input:focus, select:focus, textarea:focus {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-focus);
  background: #ffffff;
}
textarea { min-height: 96px; resize: vertical; }
input::placeholder { color: var(--text-muted); }
input:disabled, select:disabled, textarea:disabled {
  color: var(--text-muted);
  background: var(--surface-subtle);
  cursor: not-allowed;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-6);
  padding-top: var(--space-5);
  border-top: 1px solid var(--border-subtle);
}
.simple-billing-form { width: min(100%, 920px); padding: clamp(1.2rem, 3vw, 2.25rem); }
.form-page { width: min(100%, 880px); }
.constrained-form { width: min(100%, 720px); }
.constrained-form-md { width: min(100%, 820px); }

.simple-billing-form fieldset { margin: 0; padding: 0 0 var(--space-6); border: 0; }
.simple-billing-form fieldset + fieldset {
  padding-top: var(--space-6);
  border-top: 1px solid var(--border-subtle);
}
.simple-billing-form legend {
  margin-bottom: var(--space-4);
  color: var(--text-primary);
  font-size: var(--text-h3);
  font-weight: 650;
}
.simple-billing-form .form-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.simple-billing-form .span-2 { grid-column: span 2; }
.simple-billing-form .span-3 { grid-column: 1 / -1; }

.input-suffix { position: relative; }
.input-suffix input { padding-right: 2.5rem; font-variant-numeric: tabular-nums; }
.input-suffix span {
  position: absolute;
  top: 50%;
  right: .85rem;
  color: var(--text-muted);
  transform: translateY(-50%);
  font-weight: 600;
}

.checkbox-group { justify-content: flex-end; }
.checkbox-group label {
  display: flex;
  align-items: center;
  min-height: var(--control-height);
  gap: var(--space-2);
}
.checkbox-group input {
  width: 1.05rem;
  min-height: 1.05rem;
  accent-color: var(--brand);
}

.section-heading { margin: var(--space-6) 0 var(--space-3); font-size: var(--text-h3); }
.mode-guidance, .next-action-box {
  padding: .95rem 1.05rem;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.mode-guidance { margin-top: var(--space-4); }
.next-action-box {
  margin: 0 0 var(--space-4);
  color: var(--info);
  background: var(--info-soft);
  border-color: rgba(43, 97, 125, 0.18);
}
.next-action-box strong { display: block; }
.next-action-box p { margin: .2rem 0 0; font-size: var(--text-small); }
.next-steps {
  margin: .55rem 0 0;
  padding-left: 1.25rem;
  color: var(--text-secondary);
  font-size: var(--text-small);
}
.next-steps li + li { margin-top: .35rem; }

/* Alerts & Feedback */
.alert {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  margin-bottom: var(--space-5);
  padding: .9rem 1.05rem;
  border: 1px solid;
  border-radius: var(--radius-sm);
  font-size: var(--text-small);
  box-shadow: var(--shadow-xs);
  animation: slide-up var(--duration-fast) var(--ease-spring);
}
.alert-success {
  color: var(--success);
  background: var(--success-soft);
  border-color: rgba(30, 112, 69, 0.2);
}
.alert-error {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: rgba(156, 51, 51, 0.2);
}
.alert-warning {
  color: var(--warning);
  background: var(--warning-soft);
  border-color: rgba(141, 91, 18, 0.2);
}
.alert-info {
  color: var(--info);
  background: var(--info-soft);
  border-color: rgba(43, 97, 125, 0.2);
}

.empty-state {
  display: grid;
  min-height: 240px;
  place-items: center;
  gap: var(--space-4);
  padding: var(--space-10);
  text-align: center;
  background: var(--surface);
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-lg);
}
.empty-icon {
  display: inline-grid;
  width: 52px;
  height: 52px;
  place-items: center;
  color: var(--brand);
  background: var(--brand-soft);
  border-radius: var(--radius-md);
  box-shadow: 0 2px 8px rgba(12, 111, 104, 0.1);
}
.empty-icon svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}
.empty-state h3 { margin: 0; font-size: var(--text-h3); }
.empty-state p {
  max-width: 480px;
  margin: .35rem auto var(--space-4);
  color: var(--text-secondary);
  font-size: var(--text-small);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .95rem var(--space-6);
}
.detail-item dt { color: var(--text-muted); font-size: .71rem; }
.detail-item dd {
  margin: .15rem 0 0;
  color: var(--text-primary);
  font-weight: 600;
}
.total-block {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  color: var(--text-primary);
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}
.total-block strong { color: var(--brand); font-size: 1.35rem; }

.review-context, .replacement-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4) var(--space-8);
  padding: 0 0 var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
}
.replacement-summary {
  margin-bottom: var(--space-4);
  padding: var(--space-4);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.summary-label {
  display: block;
  margin-bottom: .2rem;
  color: var(--text-muted);
  font-size: .68rem;
  font-weight: 650;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.variable-review-card {
  width: min(100%, 780px);
  margin: 0 auto;
  padding: clamp(1.35rem, 4vw, 2.25rem);
}
.single-action-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: var(--space-4);
  margin-top: var(--space-6);
}
.amount-field input {
  min-height: 52px;
  font-size: 1.2rem;
  font-weight: 650;
}
.btn-generate { min-height: 52px; padding-inline: 1.35rem; }

.pending-list, .attention-list { display: grid; gap: var(--space-4); }
.pending-card, .attention-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
}
.pending-card-main { flex: 1 1 auto; min-width: 0; }
.pending-card-action { display: grid; flex: 0 0 220px; gap: var(--space-2); }
.pending-card-action p { margin: 0; color: var(--text-secondary); font-size: var(--text-small); }

.clear-state { display: flex; align-items: center; gap: var(--space-3); }
.clear-state-icon {
  display: inline-grid;
  width: 2.2rem;
  height: 2.2rem;
  place-items: center;
  color: #ffffff;
  background: var(--success);
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(30, 112, 69, 0.2);
}
.clear-state-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}
.clear-state p { margin: .15rem 0 0; color: var(--text-secondary); font-size: var(--text-small); }

/* Utilities */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-top: var(--space-5);
  color: var(--text-muted);
  font-size: var(--text-small);
}
.pagination-actions { display: flex; gap: var(--space-2); }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: var(--text-small); }
.mt-1 { margin-top: var(--space-2); }
.mt-2 { margin-top: var(--space-4); }
.mb-1 { margin-bottom: var(--space-2); }
.mb-2 { margin-bottom: var(--space-4); }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: var(--space-2); }
hr {
  margin: var(--space-6) 0;
  border: 0;
  border-top: 1px solid var(--border-subtle);
}
footer {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 var(--space-10) var(--space-8);
  color: var(--text-muted);
  font-size: .72rem;
  line-height: 1.65;
}
footer a { color: var(--text-secondary); }
.delivery-label { font-weight: 650; }

/* Login Page */
.auth-page {
  display: grid;
  min-height: 100vh;
  grid-template-rows: 1fr auto;
  place-items: center;
  padding: var(--space-6);
  background: radial-gradient(circle at 50% 30%, #ffffff 0%, var(--bg) 100%);
}
.auth-card {
  width: min(100%, 420px);
  padding: clamp(1.8rem, 5vw, 2.75rem);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  animation: page-enter var(--duration-slow) var(--ease-spring) both;
}
.auth-card .brand { min-width: 0; margin-bottom: var(--space-10); color: var(--text-primary); }
.auth-card .brand-mark {
  color: var(--brand);
  background: var(--brand-soft);
  border-color: rgba(12, 111, 104, 0.12);
}
.auth-card .brand-copy small { color: var(--text-muted); }
.auth-card h1 { margin: 0; font-size: 1.65rem; letter-spacing: -.03em; }
.auth-card .subtitle { margin-bottom: var(--space-6); }
.auth-card .form-actions { margin-top: var(--space-5); padding-top: 0; border-top: 0; }
.auth-card .btn { width: 100%; min-height: 46px; }
.auth-help { margin-top: var(--space-6); }
.auth-page > footer { padding: var(--space-4); text-align: center; }

/* Campo de contraseña enriquecido */
.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}
.password-wrapper input {
  padding-right: 2.85rem;
  letter-spacing: .04em;
  transition: border-color var(--duration-fast) var(--ease-spring), box-shadow var(--duration-fast) var(--ease-spring), background var(--duration-fast);
}
.password-wrapper input[type="password"] {
  letter-spacing: .16em;
  font-family: inherit;
}
.password-toggle {
  position: absolute;
  top: 50%;
  right: .5rem;
  display: inline-grid;
  width: 34px;
  height: 34px;
  padding: 0;
  place-items: center;
  color: var(--text-muted);
  background: transparent;
  border: 0;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transform: translateY(-50%);
  transition: color var(--duration-fast), background var(--duration-fast), transform var(--duration-fast) var(--ease-spring);
}
.password-toggle:hover {
  color: var(--brand);
  background: var(--brand-soft);
  transform: translateY(-50%) scale(1.06);
}
.password-toggle:active {
  transform: translateY(-50%) scale(.92);
}
.password-toggle:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 2px var(--brand-glow);
}
.password-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.caps-lock-badge {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  margin-top: .45rem;
  padding: .3rem .65rem;
  color: #8c5710;
  background: #fff6e5;
  border: 1px solid rgba(140, 87, 16, 0.2);
  border-radius: var(--radius-sm);
  font-size: .72rem;
  font-weight: 600;
  animation: slide-up 160ms var(--ease-spring);
  box-shadow: 0 1px 3px rgba(140, 87, 16, 0.08);
}
.caps-lock-badge svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.auth-card:has(.alert-error) {
  animation: auth-shake 340ms cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}
@keyframes auth-shake {
  10%, 90% { transform: translate3d(-1.5px, 0, 0); }
  20%, 80% { transform: translate3d(2.5px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-3.5px, 0, 0); }
  40%, 60% { transform: translate3d(3.5px, 0, 0); }
}

/* Responsive Media Queries */
@media (max-width: 980px) {
  :root { --sidebar-width: 216px; }
  .split { grid-template-columns: 1fr; }
  .simple-billing-form .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .simple-billing-form .span-3 { grid-column: 1 / -1; }
}

@media (max-width: 720px) {
  .topbar { padding: 0 var(--space-4); }
  .brand { min-width: 0; }
  .brand-copy small, .user-chip, .logout-form .button-icon { display: none; }
  .demo-pill { margin-left: auto; }
  .btn.menu-toggle { display: inline-flex; }
  .menu-toggle svg { display: block; }
  .app-shell { display: block; }
  .billing-sidebar {
    position: fixed;
    top: var(--header-height);
    bottom: 0;
    left: 0;
    z-index: var(--z-sidebar);
    display: block;
    width: min(86vw, 290px);
    height: auto;
    padding: var(--space-4);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    pointer-events: none;
    transform: translateX(-102%);
    transition: opacity var(--duration-normal), transform var(--duration-slow) var(--ease-spring);
  }
  .billing-sidebar.is-open {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
  }
  .sidebar-backdrop {
    position: fixed;
    inset: var(--header-height) 0 0;
    z-index: var(--z-overlay);
    display: block;
    padding: 0;
    background: rgba(11, 23, 30, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--duration-normal);
  }
  .sidebar-backdrop.is-open { opacity: 1; pointer-events: auto; }
  .page { padding: var(--space-6) var(--space-4) var(--space-10); }
  .page-header, .home-header { display: grid; gap: var(--space-4); }
  .page-actions { justify-content: flex-start; }
  .home-status { width: 100%; }
  .home-status > svg { margin-left: auto; }
  .billing-choice-grid, .form-grid, .detail-grid, .review-context, .replacement-summary {
    grid-template-columns: 1fr;
  }
  .simple-billing-form .form-grid { grid-template-columns: 1fr; }
  .simple-billing-form .span-2, .simple-billing-form .span-3, .form-grid .full { grid-column: auto; }
  .filter-bar { display: grid; grid-template-columns: 1fr 1fr; }
  .filter-bar .form-group { min-width: 0; }
  .filter-bar .form-actions { grid-column: 1 / -1; }
  .single-action-form { grid-template-columns: 1fr; }
  .scheduled-table, .invoice-library-table { min-width: 0; }
  .scheduled-table thead, .invoice-library-table thead { display: none; }
  .scheduled-table tbody, .invoice-library-table tbody { display: grid; gap: var(--space-3); padding: var(--space-3); }
  .scheduled-table tr, .invoice-library-table tr {
    display: grid;
    padding: var(--space-3);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-xs);
  }
  .scheduled-table td, .invoice-library-table td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 0;
    gap: var(--space-4);
    padding: .55rem 0;
    border-bottom: 1px solid var(--border-subtle);
    text-align: right;
    overflow-wrap: anywhere;
  }
  .scheduled-table td:last-child, .invoice-library-table td:last-child { padding-bottom: 0; border-bottom: 0; }
  .scheduled-table td:first-child, .invoice-library-table td:first-child { padding-top: 0; }
  .scheduled-table td::before, .invoice-library-table td::before {
    flex: 0 0 auto;
    content: attr(data-label);
    color: var(--text-muted);
    font-size: .65rem;
    font-weight: 650;
    letter-spacing: .055em;
    text-transform: uppercase;
  }
  .scheduled-table td:first-child, .invoice-library-table td:nth-child(3) { align-items: flex-start; }
  .scheduled-table td .page-actions, .invoice-library-table td:last-child { justify-content: flex-end; }
  .scheduled-table td .primary-cell { max-width: 70%; text-align: left; }
  .pending-card, .attention-item { align-items: stretch; flex-direction: column; }
  .pending-card-action { width: 100%; flex-basis: auto; }
  .pagination { align-items: flex-start; flex-direction: column; }
  footer { padding-inline: var(--space-4); }
}

@media (max-width: 460px) {
  .topbar { gap: var(--space-2); }
  .logout-form .btn span { display: none; }
  .logout-form .button-icon { display: block; }
  .menu-toggle span { display: none; }
  .home-footnote, .list-toolbar { align-items: flex-start; flex-direction: column; }
  .filter-bar { grid-template-columns: 1fr; }
  .filter-bar .form-actions { grid-column: auto; }
  .form-actions { justify-content: stretch; }
  .form-actions .btn { flex: 1 1 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* ══════════════════════════════════════════════════════════════════════════════
   TEMCO-5 MODO OSCURO & REFINAMIENTO ULTRA PREMIUM (Stripe / Linear / Raycast)
   ══════════════════════════════════════════════════════════════════════════════ */
:root[data-theme="dark"] body,
html.theme-dark body {
  background-color: #080b0f;
  background-image:
    radial-gradient(ellipse 70% 45% at 50% -10%, rgba(20, 184, 166, 0.12), transparent),
    radial-gradient(ellipse 50% 35% at 85% 65%, rgba(14, 165, 233, 0.05), transparent);
  background-attachment: fixed;
  color: #f1f5f9;
}

:root[data-theme="dark"] h1,
:root[data-theme="dark"] #dashboard-title,
html.theme-dark h1,
html.theme-dark #dashboard-title {
  background: linear-gradient(180deg, #ffffff 15%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.035em;
  text-shadow: 0 0 30px rgba(255, 255, 255, 0.1);
}

:root[data-theme="dark"] .choice-kicker,
html.theme-dark .choice-kicker {
  color: #94a3b8;
}

/* Header & Shell */
:root[data-theme="dark"] .topbar,
html.theme-dark .topbar {
  background: rgba(9, 13, 18, 0.88);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.6);
}
:root[data-theme="dark"] .billing-sidebar,
html.theme-dark .billing-sidebar {
  background: #0b1016;
  border-right: 1px solid rgba(255, 255, 255, 0.07);
}
:root[data-theme="dark"] .billing-sidebar a,
html.theme-dark .billing-sidebar a,
:root[data-theme="dark"] .secondary-nav summary,
html.theme-dark .secondary-nav summary {
  color: #94a3b8;
}
:root[data-theme="dark"] .billing-sidebar a:hover,
html.theme-dark .billing-sidebar a:hover,
:root[data-theme="dark"] .secondary-nav summary:hover,
html.theme-dark .secondary-nav summary:hover {
  color: #f8fafc;
  background: #131c26;
}
:root[data-theme="dark"] .billing-sidebar a.active,
html.theme-dark .billing-sidebar a.active {
  color: #2dd4bf;
  background: rgba(20, 184, 166, 0.14);
  border-color: rgba(20, 184, 166, 0.25);
  box-shadow: 0 0 16px rgba(20, 184, 166, 0.12);
}
:root[data-theme="dark"] .nav-family.active-family,
html.theme-dark .nav-family.active-family {
  background: #0e151e;
}
:root[data-theme="dark"] .nav-family-title,
html.theme-dark .nav-family-title {
  color: #cbd5e1;
}

/* Tarjetas Métricas */
:root[data-theme="dark"] .dash-metric-card,
html.theme-dark .dash-metric-card {
  background: linear-gradient(180deg, #101722 0%, #0c1219 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
:root[data-theme="dark"] .dash-metric-card:hover,
html.theme-dark .dash-metric-card:hover {
  border-color: rgba(20, 184, 166, 0.4);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 24px rgba(20, 184, 166, 0.12);
  transform: translateY(-2px);
}
:root[data-theme="dark"] .metric-icon-wrap,
html.theme-dark .metric-icon-wrap {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
}
:root[data-theme="dark"] .metric-subtag,
html.theme-dark .metric-subtag {
  background: #141c26;
  border-color: rgba(255, 255, 255, 0.07);
  color: #94a3b8;
}

/* Atención Requerida */
:root[data-theme="dark"] .dash-attention-section,
html.theme-dark .dash-attention-section {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.08) 0%, #121822 100%);
  border: 1px solid rgba(245, 158, 11, 0.28);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
}
:root[data-theme="dark"] .dash-attention-row,
html.theme-dark .dash-attention-row {
  background: #151e29;
  border: 1px solid rgba(245, 158, 11, 0.22);
}
:root[data-theme="dark"] .dash-attention-row:hover,
html.theme-dark .dash-attention-row:hover {
  background: #1a2533;
  border-color: rgba(245, 158, 11, 0.48);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5), 0 0 16px rgba(245, 158, 11, 0.15);
  transform: translateY(-1px);
}
:root[data-theme="dark"] .attention-row-avatar,
html.theme-dark .attention-row-avatar {
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(245, 158, 11, 0.35);
  color: #fbbf24;
}
:root[data-theme="dark"] .attention-period-pill,
html.theme-dark .attention-period-pill {
  background: #0f1620;
  border-color: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
}
:root[data-theme="dark"] .attention-count-badge,
html.theme-dark .attention-count-badge {
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(245, 158, 11, 0.35);
  color: #fbbf24;
}
:root[data-theme="dark"] .attention-row-reason,
html.theme-dark .attention-row-reason {
  color: #fbbf24;
}

/* Vivienda & Local Operativos */
:root[data-theme="dark"] .billing-choice,
html.theme-dark .billing-choice {
  background: linear-gradient(180deg, #111822 0%, #0d131b 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
:root[data-theme="dark"] .housing-choice:hover,
html.theme-dark .housing-choice:hover {
  border-color: rgba(20, 184, 166, 0.45);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.65), 0 0 28px rgba(20, 184, 166, 0.14);
  transform: translateY(-2px);
}
:root[data-theme="dark"] .local-choice:hover,
html.theme-dark .local-choice:hover {
  border-color: rgba(245, 158, 11, 0.45);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.65), 0 0 28px rgba(245, 158, 11, 0.14);
  transform: translateY(-2px);
}
:root[data-theme="dark"] .housing-choice .choice-icon,
html.theme-dark .housing-choice .choice-icon {
  background: rgba(20, 184, 166, 0.12);
  border: 1px solid rgba(20, 184, 166, 0.25);
  color: #2dd4bf;
  box-shadow: 0 0 16px rgba(20, 184, 166, 0.2);
}
:root[data-theme="dark"] .local-choice .choice-icon,
html.theme-dark .local-choice .choice-icon {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.25);
  color: #fbbf24;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.2);
}
:root[data-theme="dark"] .choice-actions a,
html.theme-dark .choice-actions a {
  background: #151e28;
  border-color: rgba(255, 255, 255, 0.07);
  color: #f1f5f9;
}
:root[data-theme="dark"] .housing-choice .choice-actions a:hover,
html.theme-dark .housing-choice .choice-actions a:hover {
  background: #1b2634;
  border-color: rgba(20, 184, 166, 0.4);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  transform: translateY(-1px);
}
:root[data-theme="dark"] .local-choice .choice-actions a:hover,
html.theme-dark .local-choice .choice-actions a:hover {
  background: #1b2634;
  border-color: rgba(245, 158, 11, 0.4);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  transform: translateY(-1px);
}
:root[data-theme="dark"] .action-mini-icon,
html.theme-dark .action-mini-icon {
  background: #101620;
  border-color: rgba(255, 255, 255, 0.08);
}
:root[data-theme="dark"] .housing-choice .action-mini-icon,
html.theme-dark .housing-choice .action-mini-icon {
  color: #2dd4bf;
}
:root[data-theme="dark"] .local-choice .action-mini-icon,
html.theme-dark .local-choice .action-mini-icon {
  color: #fbbf24;
}

/* Tabla de Facturas Recientes */
:root[data-theme="dark"] .recent-table-card,
html.theme-dark .recent-table-card {
  background: #101620;
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}
:root[data-theme="dark"] .compact-invoice-table th,
html.theme-dark .compact-invoice-table th {
  background: #0d131a;
  border-bottom-color: rgba(255, 255, 255, 0.08);
  color: #94a3b8;
}
:root[data-theme="dark"] .compact-invoice-table td,
html.theme-dark .compact-invoice-table td {
  border-bottom-color: rgba(255, 255, 255, 0.05);
}
:root[data-theme="dark"] .compact-invoice-table tr:hover td,
html.theme-dark .compact-invoice-table tr:hover td {
  background: rgba(20, 184, 166, 0.04);
}
:root[data-theme="dark"] .period-badge,
html.theme-dark .period-badge {
  background: #141c26;
  border-color: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
}
:root[data-theme="dark"] .pdf-action-btn,
html.theme-dark .pdf-action-btn {
  background: #141d27;
  border-color: rgba(255, 255, 255, 0.1);
  color: #f1f5f9;
}
:root[data-theme="dark"] .pdf-action-btn:hover,
html.theme-dark .pdf-action-btn:hover {
  background: #1c2734;
  border-color: rgba(20, 184, 166, 0.45);
  color: #ffffff;
  box-shadow: 0 0 14px rgba(20, 184, 166, 0.2);
}

/* Formularios e Inputs */
:root[data-theme="dark"] input,
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea,
html.theme-dark input,
html.theme-dark select,
html.theme-dark textarea {
  background: #0b1016;
  border-color: rgba(255, 255, 255, 0.12);
  color: #f8fafc;
}
:root[data-theme="dark"] input:focus,
:root[data-theme="dark"] select:focus,
:root[data-theme="dark"] textarea:focus,
html.theme-dark input:focus,
html.theme-dark select:focus,
html.theme-dark textarea:focus {
  background: #0f151e;
  border-color: #14b8a6;
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.3);
}
:root[data-theme="dark"] .card,
html.theme-dark .card {
  background: #101620;
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}
:root[data-theme="dark"] .card-header,
html.theme-dark .card-header {
  border-bottom-color: rgba(255, 255, 255, 0.07);
}

/* Pantalla de Autenticación / Login */
:root[data-theme="dark"] .auth-page,
html.theme-dark .auth-page {
  background: radial-gradient(circle at 50% 25%, #151d27 0%, #080b0f 100%);
}
:root[data-theme="dark"] .auth-card,
html.theme-dark .auth-card {
  background: #101620;
  border-color: rgba(255, 255, 255, 0.09);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 30px rgba(20, 184, 166, 0.08);
}
:root[data-theme="dark"] .auth-card .brand,
html.theme-dark .auth-card .brand {
  color: #f8fafc;
}
:root[data-theme="dark"] .auth-card .brand-mark,
html.theme-dark .auth-card .brand-mark {
  background: rgba(20, 184, 166, 0.15);
  border-color: rgba(20, 184, 166, 0.3);
  color: #2dd4bf;
}

/* Animaciones Escalonadas */
.dash-metrics-strip > *:nth-child(1) { animation-delay: 0.03s; }
.dash-metrics-strip > *:nth-child(2) { animation-delay: 0.07s; }
.dash-metrics-strip > *:nth-child(3) { animation-delay: 0.11s; }
.dash-metrics-strip > *:nth-child(4) { animation-delay: 0.15s; }
.dash-attention-section { animation-delay: 0.19s; }
.billing-choice-grid > *:nth-child(1) { animation-delay: 0.23s; }
.billing-choice-grid > *:nth-child(2) { animation-delay: 0.27s; }
.dash-recent-section { animation-delay: 0.31s; }

.choice-actions a:hover .action-mini-icon {
  transform: scale(1.08) rotate(3deg);
}
.choice-actions a:hover .action-chevron {
  transform: translateX(5px);
}
