/* ─── Tributabien V2 — design tokens ─── */
:root{
  /* type */
  --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* neutrals — cool slate-tinted */
  --bg: #F4F5F7;
  --surface: #FFFFFF;
  --surface-2: #FAFAFB;
  --surface-3: #F0F1F4;
  --border: #E5E7EB;
  --border-strong: #D1D5DB;
  --text: #0E1620;
  --text-2: #4A5562;
  --text-3: #8390A0;
  --text-4: #B0B8C4;

  /* brand — refined teal */
  --brand-50:  #ECFBF9;
  --brand-100: #CDF3EE;
  --brand-200: #98E5DD;
  --brand-400: #2BC4B0;
  --brand-500: #11AC97;
  --brand-600: #069083;
  --brand-700: #0B7268;
  --brand-900: #0B3F3A;

  /* category accents — same chroma family */
  --ventas:     oklch(0.62 0.16 245);  /* blue */
  --ventas-bg:  oklch(0.96 0.03 245);
  --compras:    oklch(0.60 0.18 295);  /* purple */
  --compras-bg: oklch(0.96 0.03 295);
  --honor:      oklch(0.68 0.15 50);   /* orange */
  --honor-bg:   oklch(0.96 0.03 50);
  --ppm:        oklch(0.72 0.14 85);   /* amber */
  --ppm-bg:     oklch(0.97 0.03 85);
  --sueldos:    oklch(0.62 0.18 15);   /* rose */
  --sueldos-bg: oklch(0.96 0.03 15);
  --costos:     oklch(0.62 0.18 28);   /* red-orange */
  --costos-bg:  oklch(0.96 0.03 28);
  --utilidad:   oklch(0.58 0.14 165);  /* emerald */
  --utilidad-bg:oklch(0.95 0.04 165);

  /* status */
  --green: #10B981;
  --red:   #EF4444;
  --amber: #F59E0B;

  --shadow-1: 0 1px 2px rgba(15,22,32,.04);
  --shadow-2: 0 1px 2px rgba(15,22,32,.04), 0 4px 12px rgba(15,22,32,.04);
  --shadow-3: 0 4px 16px rgba(15,22,32,.06), 0 12px 32px rgba(15,22,32,.08);

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;

  --sidebar-w: 240px;
  --header-h: 60px;
  --ticker-h: 36px;
}

/* palette: blue */
body[data-palette="blue"]{
  --brand-50:#EEF2FF; --brand-100:#DBE4FE; --brand-200:#BAC8FD;
  --brand-400:#6E89F5; --brand-500:#4C6EF5; --brand-600:#3854D9;
  --brand-700:#2B41AB; --brand-900:#142057;
}
/* palette: indigo + warm */
body[data-palette="indigo"]{
  --brand-50:#F5F1FF; --brand-100:#E5DBFF; --brand-200:#CDB8FF;
  --brand-400:#9C7BFA; --brand-500:#7A5AE0; --brand-600:#5E3DBE;
  --brand-700:#472D94; --brand-900:#241253;
  --bg:#FAF7F2; --surface-2:#FAF6EF;
}
/* palette: graphite (pro mode, mono accents) */
body[data-palette="graphite"]{
  --brand-50:#F3F4F6; --brand-100:#E5E7EB; --brand-200:#D1D5DB;
  --brand-400:#6B7280; --brand-500:#374151; --brand-600:#1F2937;
  --brand-700:#111827; --brand-900:#030712;
}

/* density */
body[data-density="compact"]{ --pad-card: 14px; --pad-row: 8px; --gap-grid: 12px; }
body[data-density="regular"]{ --pad-card: 18px; --pad-row: 12px; --gap-grid: 16px; }
body[data-density="comfy"]  { --pad-card: 24px; --pad-row: 16px; --gap-grid: 20px; }

*{ box-sizing: border-box; }
html, body{ margin:0; padding:0; }
body{
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01","cv11";
}

.mono{ font-family: var(--font-mono); font-feature-settings: "tnum","zero"; }
button{ font-family: inherit; cursor: pointer; }
a{ color: inherit; text-decoration: none; }

/* ─── App shell ─── */
.app{
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: 1fr auto;
  min-height: 100vh;
}
.app.no-ticker{ --ticker-h: 0px; }

/* ─── Sidebar ─── */
.sidebar{
  grid-row: 1 / 3;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
body[data-sidebar="dark"] .sidebar{
  background: #0E1620;
  border-right: 1px solid #1B2530;
  color: #C3CCD8;
}
.sb-brand{
  display: flex; align-items: center; gap: 10px;
  padding: 18px 20px 16px;
  border-bottom: 1px solid var(--border);
}
body[data-sidebar="dark"] .sb-brand{ border-color: #1B2530; }
.sb-logo{
  width: 28px; height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand-400), var(--brand-600));
  display: grid; place-items: center;
  color: white; font-weight: 700; font-size: 13px;
  letter-spacing: -0.02em;
  box-shadow: 0 1px 2px rgba(0,0,0,.08), inset 0 1px 0 rgba(255,255,255,.2);
}
.sb-name{ font-weight: 600; letter-spacing: -0.01em; font-size: 15px; }
.sb-name-sub{ font-size: 10.5px; color: var(--text-3); margin-top: 1px; letter-spacing: 0.04em; text-transform: uppercase; }
body[data-sidebar="dark"] .sb-name-sub{ color: #6B7B8A; }

.sb-nav{ flex: 1; overflow-y: auto; padding: 12px 10px 16px; }
.sb-group{ margin-top: 14px; }
.sb-group:first-child{ margin-top: 4px; }
.sb-grp-label{
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  padding: 0 10px;
  margin-bottom: 4px;
  font-weight: 600;
}
body[data-sidebar="dark"] .sb-grp-label{ color: #6B7B8A; }
.sb-item{
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 450;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
  position: relative;
  margin-bottom: 1px;
  transition: background .14s ease, color .14s ease;
}
.sb-item:hover{ background: var(--surface-3); color: var(--text); }
.sb-item:active{ transform: scale(0.99); }
.sb-item .sb-icon{ width: 16px; height: 16px; flex: none; opacity: .85; transition: transform .2s cubic-bezier(.16,1,.3,1); }
.sb-item:hover .sb-icon{ transform: scale(1.08); }
body[data-sidebar="dark"] .sb-item{ color: #9DA9B6; }
body[data-sidebar="dark"] .sb-item:hover{ background: #1B2530; color: #FFF; }

.sb-item.active{
  background: var(--brand-50);
  color: var(--brand-700);
  font-weight: 550;
}
.sb-item.active::before{
  content: "";
  position: absolute;
  left: -10px; top: 4px; bottom: 4px;
  width: 3px;
  background: var(--brand-600);
  border-radius: 0 3px 3px 0;
  animation: pillIn .22s cubic-bezier(.16,1,.3,1);
}
@keyframes pillIn{ from{ transform: scaleY(0); opacity: 0; } to{ transform: none; opacity: 1; } }
.sb-item.active .sb-icon{ opacity: 1; color: var(--brand-600); }
body[data-sidebar="dark"] .sb-item.active{
  background: rgba(17,172,151,.12);
  color: var(--brand-200);
}
.sb-badge{
  margin-left: auto;
  font-size: 10.5px;
  font-weight: 600;
  background: var(--brand-100);
  color: var(--brand-700);
  padding: 1px 6px;
  border-radius: 999px;
  font-family: var(--font-mono);
}
body[data-sidebar="dark"] .sb-badge{ background: rgba(17,172,151,.18); color: var(--brand-200); }

.sb-foot{
  padding: 10px 14px 16px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
body[data-sidebar="dark"] .sb-foot{ border-color: #1B2530; }
.sb-avatar{
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, #2BC4B0, #069083);
  color: white; display: grid; place-items: center;
  font-size: 11px; font-weight: 600;
}
.sb-foot-name{ font-size: 12.5px; font-weight: 500; line-height: 1.2; }
.sb-foot-sub { font-size: 10.5px; color: var(--text-3); }

/* ─── Header ─── */
.header{
  grid-column: 2;
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky; top: 0; z-index: 10;
}
.hd-breadcrumb{
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-3);
}
.hd-breadcrumb b{ color: var(--text); font-weight: 550; }
.hd-search{
  flex: 1;
  max-width: 420px;
  margin-left: 20px;
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px;
  background: var(--surface-3);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  font-size: 13px;
  color: var(--text-3);
  transition: all .12s ease;
}
.hd-search:hover{ background: var(--surface-2); border-color: var(--border); }
.hd-search input{
  flex: 1; border: 0; outline: 0; background: transparent;
  font: inherit; color: var(--text);
}
.hd-search kbd{
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 2px 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-3);
}
.hd-actions{ display: flex; align-items: center; gap: 6px; margin-left: auto; }
.icon-btn{
  width: 34px; height: 34px;
  display: grid; place-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  color: var(--text-2);
  transition: background .14s ease, color .14s ease, transform .08s ease;
  position: relative;
  outline: 0;
}
.icon-btn:hover{ background: var(--surface-3); color: var(--text); }
.icon-btn:active{ transform: scale(0.94); }
.icon-btn:focus-visible{ box-shadow: 0 0 0 3px color-mix(in oklch, var(--brand-500) 26%, transparent); }
.icon-btn .dot{
  position: absolute; top: 8px; right: 8px;
  width: 7px; height: 7px;
  background: var(--red);
  border: 2px solid var(--surface);
  border-radius: 50%;
}
.hd-profile{
  display: flex; align-items: center; gap: 10px;
  padding: 4px 10px 4px 4px;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background .12s ease;
}
.hd-profile:hover{ background: var(--surface-3); }
.hd-profile .avatar{
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2BC4B0, #069083);
  color: white;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 600;
}
.hd-profile-name{ font-size: 13px; font-weight: 500; line-height: 1.2; }
.hd-profile-sub{ font-size: 10.5px; color: var(--text-3); }

/* ─── Main + ticker ─── */
.main{
  grid-column: 2;
  padding: 24px 28px 32px;
  min-height: calc(100vh - var(--header-h) - var(--ticker-h));
}
/* View transitions */
.view-anim{ animation: viewIn .28s cubic-bezier(.16,1,.3,1); }
@keyframes viewIn{ from{ opacity: 0; transform: translateY(8px); } to{ opacity: 1; transform: none; } }
.view-anim .card,
.view-anim .kpi,
.view-anim .tbl-wrap,
.view-anim .filterbar,
.view-anim .minimetric,
.view-anim .expcard,
.view-anim .hero-utilidad,
.view-anim .page-head{
  animation: viewItemIn .42s cubic-bezier(.16,1,.3,1) both;
}
.view-anim > * { animation-delay: .02s; }
.view-anim > * + * { animation-delay: .06s; }
.view-anim > * + * + * { animation-delay: .10s; }
.view-anim > * + * + * + * { animation-delay: .14s; }
@keyframes viewItemIn{ from{ opacity: 0; transform: translateY(10px); } to{ opacity: 1; transform: none; } }
.ticker{
  grid-column: 2;
  height: var(--ticker-h);
  background: linear-gradient(90deg, var(--brand-700), var(--brand-500));
  color: #DCFAF5;
  display: flex; align-items: center;
  font-size: 12px;
  overflow: hidden;
  position: sticky; bottom: 0;
}
.ticker-track{
  display: flex; gap: 32px;
  white-space: nowrap;
  animation: tickerScroll 60s linear infinite;
  padding-left: 32px;
}
.ticker-item{ display: inline-flex; align-items: center; gap: 6px; }
.ticker-item b{ color: white; font-weight: 600; }
.ticker-item .mono{ color: white; }
.ticker-dot{ width: 3px; height: 3px; background: rgba(255,255,255,.4); border-radius: 50%; }
@keyframes tickerScroll{
  from{ transform: translateX(0); }
  to{ transform: translateX(-50%); }
}

/* ─── Page header ─── */
.page-head{
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 18px; gap: 16px;
}
.page-title{
  font-size: 22px; font-weight: 600; letter-spacing: -0.02em;
  margin: 0; line-height: 1.2;
}
.page-sub{ font-size: 13px; color: var(--text-3); margin-top: 3px; }
.page-actions{ display: flex; gap: 8px; }

/* ─── Buttons ─── */
.btn{
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 500;
  position: relative;
  isolation: isolate;
  transition: background .14s ease, border-color .14s ease, transform .08s ease, box-shadow .14s ease, color .14s ease;
  outline: 0;
}
.btn:hover{ background: var(--surface-3); border-color: var(--border-strong); }
.btn:active{ transform: translateY(0.5px); }
.btn:focus-visible{ box-shadow: 0 0 0 3px color-mix(in oklch, var(--brand-500) 26%, transparent); border-color: var(--brand-500); }
.btn-primary{
  background: linear-gradient(180deg, var(--brand-500), var(--brand-600));
  color: white;
  border-color: color-mix(in oklch, var(--brand-700) 60%, transparent);
  box-shadow:
    0 1px 1px rgba(15,22,32,.18),
    0 1px 0 rgba(255,255,255,.18) inset,
    0 -1px 0 rgba(0,0,0,.08) inset;
}
.btn-primary:hover{
  background: linear-gradient(180deg, var(--brand-600), var(--brand-700));
  border-color: var(--brand-700);
  transform: translateY(-0.5px);
  box-shadow:
    0 2px 4px rgba(15,22,32,.18),
    0 1px 0 rgba(255,255,255,.18) inset,
    0 -1px 0 rgba(0,0,0,.1) inset;
}
.btn-primary:active{ transform: translateY(0.5px); box-shadow: 0 1px 0 rgba(0,0,0,.08) inset; }
.btn-primary:focus-visible{ box-shadow: 0 0 0 3px color-mix(in oklch, var(--brand-500) 32%, transparent), 0 1px 0 rgba(255,255,255,.18) inset; }
.btn-ghost{ background: transparent; border-color: transparent; box-shadow: none; }
.btn-ghost:hover{ background: var(--surface-3); }
.btn-sm{ padding: 4px 9px; font-size: 12px; }
.btn[disabled], .btn.is-loading{ pointer-events: none; opacity: .8; }
.btn .spinner{
  width: 13px; height: 13px;
  border-radius: 50%;
  border: 1.8px solid currentColor;
  border-right-color: transparent;
  animation: spin .7s linear infinite;
}
.btn.is-success{ background: var(--utilidad); border-color: var(--utilidad); color: white; }
@keyframes spin{ to{ transform: rotate(360deg); } }
.btn .check-burst{ animation: checkPop .35s cubic-bezier(.16,1,.3,1); }
@keyframes checkPop{ 0%{ transform: scale(0); opacity: 0; } 60%{ transform: scale(1.3); opacity: 1; } 100%{ transform: scale(1); } }

/* ─── Filter bar ─── */
.filterbar{
  display: flex; align-items: center; gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 8px;
  margin-bottom: var(--gap-grid);
  box-shadow: var(--shadow-1);
}
.flt-label{ font-size: 11.5px; color: var(--text-3); padding: 0 8px 0 4px; letter-spacing: 0.02em; }
.flt-select{
  position: relative;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 28px 6px 10px;
  background: var(--surface-3);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  min-width: 130px;
  transition: all .12s ease;
}
.flt-select:hover{ background: var(--surface-2); border-color: var(--border); }
.flt-select::after{
  content: ""; position: absolute; right: 10px; top: 50%;
  width: 7px; height: 7px;
  border-right: 1.5px solid var(--text-3);
  border-bottom: 1.5px solid var(--text-3);
  transform: translateY(-70%) rotate(45deg);
}
.flt-divider{ width: 1px; height: 22px; background: var(--border); margin: 0 4px; }
.flt-pills{ display: flex; gap: 4px; padding: 2px; background: var(--surface-3); border-radius: var(--r-md); }
.flt-pill{
  padding: 5px 11px; font-size: 12.5px; font-weight: 500;
  border-radius: 6px; color: var(--text-2); border: 0; background: transparent;
}
.flt-pill.active{ background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }

/* ─── Cards ─── */
.card{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--pad-card);
  box-shadow: var(--shadow-1);
  transition: box-shadow .15s ease, border-color .15s ease, transform .15s ease;
}
.card.hoverable:hover{
  border-color: var(--border-strong);
  box-shadow: var(--shadow-2);
}
.card-head{
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 12px; gap: 8px;
}
.card-title{ font-size: 15px; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
.card-sub  { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* KPI cards */
.kpi-grid{ display: grid; gap: var(--gap-grid); }
.kpi-grid.cols-3{ grid-template-columns: repeat(3, 1fr); }
.kpi-grid.cols-4{ grid-template-columns: repeat(4, 1fr); }
.kpi-grid.cols-6{ grid-template-columns: repeat(6, 1fr); }

.kpi{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--pad-card);
  position: relative;
  overflow: hidden;
  transition: all .15s ease;
  cursor: pointer;
}
.kpi:hover{ border-color: var(--border-strong); box-shadow: var(--shadow-2); transform: translateY(-1px); }
.kpi-top{ display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.kpi-icon{
  width: 26px; height: 26px;
  border-radius: 7px;
  display: grid; place-items: center;
  flex: none;
}
.kpi-icon svg{ width: 14px; height: 14px; }
.kpi-label{
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-2);
}
.kpi-value{
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.025em;
  font-family: var(--font-mono);
  font-feature-settings: "tnum","zero";
  margin-top: 2px;
  line-height: 1.15;
}
.kpi-desc{ font-size: 11.5px; color: var(--text-3); margin-top: 4px; line-height: 1.4; }
.kpi-meta{
  display: flex; align-items: center; gap: 6px;
  margin-top: 10px;
  font-size: 11.5px;
  color: var(--text-3);
}
.kpi-delta{
  display: inline-flex; align-items: center; gap: 3px;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
  font-family: var(--font-mono);
  font-size: 11px;
}
.kpi-delta.up   { background: rgba(16,185,129,.12); color: #047857; }
.kpi-delta.down { background: rgba(239,68,68,.12);  color: #B91C1C; }
.kpi-delta.flat { background: var(--surface-3); color: var(--text-2); }

.kpi-spark{
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 38px;
  pointer-events: none;
  opacity: .9;
}
.kpi.compact{ padding: 14px 16px; }
.kpi.compact .kpi-value{ font-size: 20px; margin-top: 4px; }

/* Hero card (utilidad) */
.hero-utilidad{
  background:
    radial-gradient(120% 100% at 0% 0%, color-mix(in oklch, var(--utilidad) 14%, transparent), transparent 60%),
    var(--surface);
  border: 1px solid color-mix(in oklch, var(--utilidad) 24%, var(--border));
  border-radius: var(--r-lg);
  padding: var(--pad-card);
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 24px;
  align-items: center;
}
.hero-left .kpi-label{ color: color-mix(in oklch, var(--utilidad) 60%, #000); }
.hero-value{
  font-size: 42px; font-weight: 600; letter-spacing: -0.03em;
  font-family: var(--font-mono); font-feature-settings: "tnum","zero";
  color: color-mix(in oklch, var(--utilidad) 50%, #000);
  line-height: 1.05; margin: 6px 0 8px;
}
.hero-formula{
  font-size: 12px; color: var(--text-3);
  margin-top: 8px;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

/* Charts */
.chart-grid{
  display: grid; grid-template-columns: 1.6fr 1fr; gap: var(--gap-grid);
  margin-top: var(--gap-grid);
}
.chart-wrap{ padding: var(--pad-card); }
.chart-legend{ display: flex; gap: 12px; font-size: 12px; color: var(--text-2); flex-wrap: wrap; }
.legend-dot{ width: 8px; height: 8px; border-radius: 2px; display: inline-block; vertical-align: middle; margin-right: 5px; }

/* Bottom small metrics */
.minimetric-row{
  display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap-grid);
  margin-top: var(--gap-grid);
}
.minimetric{
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.minimetric-icon{
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--surface-3); display: grid; place-items: center;
  color: var(--text-2);
}
.minimetric-label{ font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.minimetric-value{ font-size: 17px; font-weight: 600; font-family: var(--font-mono); letter-spacing: -0.01em; }

/* Tables */
.tbl-wrap{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-1);
}
.tbl-toolbar{
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.tbl-toolbar .hd-search{ margin-left: 0; max-width: 280px; }
table.tbl{
  width: 100%; border-collapse: collapse;
}
.tbl th{
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  font-weight: 600;
  padding: 10px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.tbl td{
  padding: var(--pad-row) 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.tbl tbody tr:hover{ background: var(--surface-2); }
.tbl tbody tr:last-child td{ border-bottom: 0; }
.tbl td .mono{ font-size: 12.5px; }

/* Badges */
.badge{
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-2);
  letter-spacing: 0.01em;
}
.badge.green { background: rgba(16,185,129,.12); color: #047857; }
.badge.red   { background: rgba(239,68,68,.12);  color: #B91C1C; }
.badge.amber { background: rgba(245,158,11,.15); color: #92400E; }
.badge.blue  { background: rgba(59,130,246,.12); color: #1E40AF; }
.badge.purple{ background: rgba(139,92,246,.14); color: #5B21B6; }
.badge.teal  { background: var(--brand-100);     color: var(--brand-700); }
.badge.gray  { background: var(--surface-3);     color: var(--text-2); }
.badge .dot{ width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }

/* Avatar in cell */
.av-cell{ display: flex; align-items: center; gap: 10px; }
.av{
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 600; color: white;
  flex: none;
}

/* Empty state */
.empty{
  display: grid; place-items: center;
  padding: 40px 20px;
  color: var(--text-3);
  text-align: center;
}
.empty svg{ opacity: .3; width: 36px; height: 36px; }
.empty-msg{ font-size: 13px; margin-top: 8px; }

/* Donut */
.donut-wrap{ display: flex; align-items: center; gap: 18px; padding: 8px 4px; }
.donut-legend{ flex: 1; display: flex; flex-direction: column; gap: 8px; }
.donut-legend .row{
  display: grid; grid-template-columns: 12px 1fr auto auto; gap: 8px;
  align-items: center; font-size: 12.5px;
}
.donut-legend .dot{ width: 10px; height: 10px; border-radius: 3px; }
.donut-legend .name{ color: var(--text-2); }
.donut-legend .val{ font-family: var(--font-mono); font-size: 12px; color: var(--text); }
.donut-legend .pct{ font-family: var(--font-mono); font-size: 11px; color: var(--text-3); width: 38px; text-align: right; }

/* Tooltip */
.chart-tip{
  position: absolute; pointer-events: none;
  background: #0E1620; color: white;
  font-size: 11.5px;
  padding: 8px 10px;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  transform: translate(-50%, -110%);
  white-space: nowrap;
  z-index: 5;
}
.chart-tip .tip-title{ font-weight: 600; margin-bottom: 4px; opacity: .9; }
.chart-tip .tip-row{ display: flex; align-items: center; gap: 6px; font-family: var(--font-mono); }
.chart-tip .tip-row .dot{ width: 7px; height: 7px; border-radius: 50%; }

/* Page panels generic */
.grid-2{ display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap-grid); }
.grid-3{ display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap-grid); }
.stack{ display: flex; flex-direction: column; gap: var(--gap-grid); }

/* Notif list */
.notif{
  display: flex; gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .12s ease;
}
.notif:hover{ background: var(--surface-2); }
.notif:last-child{ border-bottom: 0; }
.notif.unread{ background: color-mix(in oklch, var(--brand-50) 60%, transparent); }
.notif-icon{
  width: 32px; height: 32px; border-radius: 8px;
  display: grid; place-items: center; flex: none;
}
.notif-title{ font-size: 13.5px; font-weight: 550; margin: 0; }
.notif-body { font-size: 12.5px; color: var(--text-2); margin-top: 2px; line-height: 1.45; }
.notif-time { font-size: 11.5px; color: var(--text-3); margin-top: 4px; }
.notif-cta  { margin-left: auto; }

/* Agenda */
.cal{ background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.cal-hd{ display: grid; grid-template-columns: repeat(7,1fr); background: var(--surface-2); border-bottom: 1px solid var(--border); }
.cal-hd > div{ padding: 9px 12px; font-size: 11px; text-transform: uppercase; color: var(--text-3); font-weight: 600; letter-spacing: 0.06em; }
.cal-body{ display: grid; grid-template-columns: repeat(7,1fr); grid-auto-rows: 110px; }
.cal-cell{ border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 6px 8px; position: relative; display: flex; flex-direction: column; gap: 3px; }
.cal-cell:nth-child(7n){ border-right: 0; }
.cal-cell.muted{ background: var(--surface-2); }
.cal-cell.muted .cal-num{ color: var(--text-4); }
.cal-num{ font-size: 12px; font-weight: 500; color: var(--text-2); }
.cal-num.today{
  background: var(--brand-600); color: white; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center;
}
.cal-evt{
  font-size: 10.5px;
  padding: 3px 6px;
  border-radius: 4px;
  font-weight: 550;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer;
}

/* Forms */
.field-grid{ display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 18px; }
.field{ display: flex; flex-direction: column; gap: 5px; }
.field label{ font-size: 11.5px; font-weight: 600; color: var(--text-2); letter-spacing: 0.01em; }
.field input, .field select, .field textarea{
  padding: 8px 11px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--r-md);
  font: inherit;
  font-size: 13px;
  color: var(--text);
  transition: border .12s ease, box-shadow .12s ease;
}
.field input:focus, .field select:focus, .field textarea:focus{
  outline: 0; border-color: var(--brand-500);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--brand-500) 18%, transparent);
}

/* progress bar */
.pbar{ height: 6px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.pbar > span{ display: block; height: 100%; border-radius: 999px; background: var(--brand-500); }

/* tag chip */
.chip{
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  font-size: 12px; font-weight: 500;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-2);
  transition: background .14s ease, transform .08s ease;
}
.chip-removable:hover{ background: var(--surface-2); }

/* Plan card (suscripciones) */
.plan{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 22px;
  display: flex; flex-direction: column; gap: 12px;
  position: relative;
  transition: all .15s ease;
}
.plan.featured{
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--brand-500) 12%, transparent);
}
.plan-tag{ position: absolute; top: 14px; right: 14px; }
.plan-name{ font-size: 16px; font-weight: 600; }
.plan-price{ font-size: 32px; font-weight: 700; letter-spacing: -0.02em; font-family: var(--font-mono); }
.plan-price span{ font-size: 13px; color: var(--text-3); font-weight: 500; font-family: var(--font-sans); margin-left: 4px; }
.plan ul{ list-style: none; padding: 0; margin: 4px 0; display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--text-2); }
.plan ul li{ display: flex; gap: 8px; align-items: flex-start; }
.plan ul li svg{ color: var(--brand-600); flex: none; margin-top: 2px; }

/* ─── Modal ─── */
.modal-backdrop{
  position: fixed; inset: 0;
  background: rgba(15,22,32,.42);
  z-index: 50;
  display: grid; place-items: center;
  padding: 24px;
  backdrop-filter: blur(2px);
  animation: fadeIn .18s ease;
}
.modal-backdrop.closing{ animation: fadeOut .18s ease forwards; }
@keyframes fadeIn{ from{ opacity: 0; } to{ opacity: 1; } }
@keyframes fadeOut{ from{ opacity: 1; } to{ opacity: 0; } }
.modal{
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: 0 20px 60px rgba(15,22,32,.25), 0 4px 12px rgba(15,22,32,.08);
  width: 100%;
  max-width: 640px;
  max-height: calc(100vh - 48px);
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: modalIn .24s cubic-bezier(.16,1,.3,1);
}
.modal-backdrop.closing .modal{ animation: modalOut .18s ease forwards; }
.modal.lg{ max-width: 820px; }
.modal.xl{ max-width: 980px; }
@keyframes modalIn{ from{ opacity: 0; transform: translateY(12px) scale(.97); } to{ opacity: 1; transform: none; } }
@keyframes modalOut{ from{ opacity: 1; transform: none; } to{ opacity: 0; transform: translateY(6px) scale(.98); } }
.modal-head{
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-title{ font-size: 16px; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
.modal-sub{ font-size: 12px; color: var(--text-3); margin-top: 2px; }
.modal-body{
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}
.modal-foot{
  display: flex; align-items: center; justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}
.modal-foot .left{ margin-right: auto; }

/* Form sections inside modal */
.fs-section-title{
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  margin: 18px 0 10px;
  display: flex; align-items: center; gap: 8px;
}
.fs-section-title::after{ content: ""; flex: 1; height: 1px; background: var(--border); }
.fs-section-title:first-child{ margin-top: 0; }
.fs-subgrid{
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px;
  margin-bottom: 10px;
  animation: subgridIn .22s cubic-bezier(.16,1,.3,1);
}
@keyframes subgridIn{ from{ opacity: 0; transform: translateY(-4px); } to{ opacity: 1; transform: none; } }
.fs-add{
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  background: color-mix(in oklch, var(--utilidad) 14%, transparent);
  color: color-mix(in oklch, var(--utilidad) 50%, #000);
  border: 1px dashed color-mix(in oklch, var(--utilidad) 40%, transparent);
  border-radius: var(--r-md);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background .14s ease, transform .08s ease;
}
.fs-add:hover{ background: color-mix(in oklch, var(--utilidad) 22%, transparent); transform: translateY(-0.5px); }
.fs-add:active{ transform: translateY(0.5px); }

.field.full{ grid-column: 1 / -1; }
.field-check{
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
}
.field-check input{ margin: 0; }
.field-check label{ font-size: 13px; font-weight: 500; cursor: pointer; }
.field-check .help{ font-size: 11.5px; color: var(--text-3); margin-top: 1px; }

/* Radio group rich */
.radio-card{
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all .12s ease;
}
.radio-card:hover{ border-color: var(--border-strong); background: var(--surface); }
.radio-card.checked{
  background: var(--brand-50);
  border-color: var(--brand-500);
  box-shadow: 0 0 0 2px color-mix(in oklch, var(--brand-500) 18%, transparent);
}
.radio-card .dot{
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--border-strong);
  flex: none; margin-top: 1px;
  position: relative;
}
.radio-card.checked .dot{ border-color: var(--brand-500); }
.radio-card.checked .dot::after{
  content: ""; position: absolute; inset: 2px;
  background: var(--brand-500); border-radius: 50%;
}
.radio-card .label{ font-size: 13.5px; font-weight: 500; }
.radio-card .help{ font-size: 11.5px; color: var(--text-3); margin-top: 2px; }

/* File field */
.file-field{
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-md);
  font-size: 12.5px;
  color: var(--text-3);
  cursor: pointer;
}
.file-field:hover{ background: var(--surface); border-color: var(--brand-400); color: var(--brand-700); }
.file-field b{ color: var(--text); font-weight: 550; }

/* ─── Consultas chat split ─── */
.chat-split{
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-1);
  height: calc(100vh - var(--header-h) - var(--ticker-h) - 150px);
  min-height: 540px;
}
.chat-list{
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
}
.chat-list-head{
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 8px;
}
.chat-list-search{
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px;
  background: var(--surface-3);
  border-radius: var(--r-md);
  font-size: 12.5px;
}
.chat-list-search input{ flex: 1; border: 0; outline: 0; background: transparent; font: inherit; }
.chat-list-items{ overflow-y: auto; flex: 1; }
.chat-item{
  display: flex; gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .12s ease;
}
.chat-item:hover{ background: var(--surface-2); }
.chat-item.active{ background: var(--brand-50); }
.chat-item .av{ width: 32px; height: 32px; font-size: 11px; }
.chat-item-body{ flex: 1; min-width: 0; }
.chat-item-top{ display: flex; align-items: center; gap: 6px; }
.chat-item-name{ font-size: 13px; font-weight: 550; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-item-time{ font-size: 10.5px; color: var(--text-3); flex: none; }
.chat-item-preview{
  font-size: 12px;
  color: var(--text-3);
  margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chat-item.unread .chat-item-name{ font-weight: 600; }
.chat-item.unread .chat-item-preview{ color: var(--text-2); }
.chat-item-badge{
  background: var(--brand-500); color: white;
  font-size: 10px; font-weight: 600;
  min-width: 16px; height: 16px;
  border-radius: 8px;
  display: grid; place-items: center;
  padding: 0 5px;
  font-family: var(--font-mono);
}

.chat-panel{ display: flex; flex-direction: column; min-width: 0; }
.chat-panel-head{
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.chat-msgs{
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex; flex-direction: column; gap: 14px;
  background: var(--surface-2);
}
.chat-msg{ display: flex; gap: 10px; max-width: 70%; }
.chat-msg.me{ align-self: flex-end; flex-direction: row-reverse; }
.chat-msg .av{ width: 28px; height: 28px; font-size: 10px; flex: none; }
.chat-msg-body{ display: flex; flex-direction: column; gap: 3px; }
.chat-msg-bubble{
  padding: 9px 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  font-size: 13px; line-height: 1.45;
}
.chat-msg.me .chat-msg-bubble{
  background: var(--brand-600);
  color: white;
  border-color: var(--brand-600);
}
.chat-msg-meta{ font-size: 10.5px; color: var(--text-3); padding: 0 6px; }
.chat-msg.me .chat-msg-meta{ text-align: right; }

.chat-composer{
  display: flex; gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.chat-composer input{
  flex: 1;
  padding: 9px 14px;
  background: var(--surface-3);
  border: 1px solid transparent;
  border-radius: 999px;
  font: inherit;
  font-size: 13px;
  outline: none;
}
.chat-composer input:focus{ background: var(--surface); border-color: var(--brand-400); }

.chat-empty{
  flex: 1;
  display: grid; place-items: center;
  background: var(--surface-2);
  color: var(--text-3);
  text-align: center;
}
.chat-empty-icon{
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--surface);
  display: grid; place-items: center;
  margin: 0 auto 14px;
  color: var(--text-4);
  border: 1px solid var(--border);
}

/* ─── Calendar dot legend ─── */
.cal-legend{
  display: flex; gap: 14px;
  font-size: 12px;
  color: var(--text-2);
  flex-wrap: wrap;
}
.cal-legend .dot{
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block; margin-right: 5px; vertical-align: middle;
}
.cal-cell .evt-dot{
  width: 7px; height: 7px; border-radius: 50%;
  display: inline-block;
  flex: none;
}

/* ─── Expandable data card (Datos tributarios) ─── */
.expcard{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-1);
  margin-bottom: var(--gap-grid);
}
.expcard-head{
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px;
  cursor: pointer;
}
.expcard-head:hover{ background: var(--surface-2); }
.expcard-logo{
  width: 38px; height: 38px;
  border-radius: 9px;
  display: grid; place-items: center;
  color: white; font-weight: 600;
  font-size: 13px;
  flex: none;
}
.expcard-title{ font-weight: 600; font-size: 14px; line-height: 1.2; }
.expcard-sub  { font-size: 12px; color: var(--text-3); margin-top: 1px; font-family: var(--font-mono); }
.expcard-chev{
  margin-left: auto;
  transition: transform .2s ease;
  color: var(--text-3);
}
.expcard.open .expcard-chev{ transform: rotate(180deg); }
.expcard-body{
  padding: 4px 18px 18px;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px 32px;
}
.expcard-row{
  display: grid;
  grid-template-columns: 180px 1fr auto;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px dashed var(--surface-3);
  font-size: 13px;
}
.expcard-row:last-child{ border-bottom: 0; }
.expcard-row .k{ color: var(--text-3); }
.expcard-row .v{ font-family: var(--font-mono); color: var(--text); }
.expcard-row .copy{ visibility: hidden; }
.expcard-row:hover .copy{ visibility: visible; }
.expcard-sub-section{
  grid-column: 1 / -1;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.expcard-sub-title{
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  font-weight: 600;
  margin-bottom: 6px;
}

/* ─── Estado F-29 table ─── */
.f29-table{
  width: 100%;
  border-collapse: collapse;
}
.f29-table th{
  background: var(--surface-3);
  padding: 10px 14px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  color: var(--text-2);
  text-align: center;
}
.f29-table th:first-child{ text-align: left; }
.f29-table td{
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  text-align: center;
  position: relative;
}
.f29-table td:first-child{
  text-align: left;
  font-weight: 500;
  color: var(--text);
}
.f29-table tbody tr:hover td:first-child{ color: var(--brand-700); }
.f29-table tbody tr:hover{ background: color-mix(in oklch, var(--brand-50) 50%, transparent); }
.f29-cell{
  display: inline-grid; place-items: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 11px;
  position: relative;
  transition: transform .12s ease;
}
.f29-cell.d{ background: var(--utilidad); color: white; }
.f29-cell.o{ background: var(--costos);   color: white; }
.f29-cell.nd{ background: transparent; color: var(--costos); font-size: 12px; }
.f29-cell.editable{ cursor: pointer; }
.f29-cell.editable:hover{ transform: scale(1.12); }
.f29-cell.has-note::after{
  content: "";
  position: absolute;
  top: -1px; right: -1px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--ppm);
  border: 1.5px solid var(--surface);
}
.f29-tooltip{
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #0E1620;
  color: white;
  font-size: 11.5px;
  padding: 7px 10px;
  border-radius: 8px;
  white-space: nowrap;
  max-width: 280px;
  white-space: normal;
  width: max-content;
  z-index: 5;
  pointer-events: none;
  animation: tooltipIn .14s ease;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
}
.f29-tooltip::after{
  content: "";
  position: absolute;
  top: 100%; left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #0E1620;
}
@keyframes tooltipIn{ from{ opacity: 0; transform: translate(-50%, 4px); } to{ opacity: 1; transform: translate(-50%, 0); } }

/* F-29 legend */
.f29-legend{
  display: flex; gap: 18px;
  font-size: 12px;
  color: var(--text-2);
  flex-wrap: wrap;
}
.f29-legend .lg{ display: inline-flex; align-items: center; gap: 6px; }

/* Long-press progress ring */
.f29-cell.pressing::before{
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid color-mix(in oklch, var(--brand-500) 50%, transparent);
  border-top-color: var(--brand-500);
  animation: spin 1.4s linear, ringFade 1.4s ease;
}
@keyframes ringFade{ from{ opacity: 0; } to{ opacity: 1; } }

/* Alert / banner cards */
.alert-card{
  display: flex; gap: 12px;
  padding: 14px 16px;
  border-radius: var(--r-md);
  border: 1px solid;
  margin-bottom: var(--gap-grid);
  align-items: flex-start;
}
.alert-card .ic{ flex: none; margin-top: 1px; }
.alert-card-title{ font-size: 13.5px; font-weight: 600; margin: 0 0 2px; line-height: 1.3; }
.alert-card-body { font-size: 12.5px; line-height: 1.5; }
.alert-card.info {
  background: color-mix(in oklch, var(--ventas) 8%, var(--surface));
  border-color: color-mix(in oklch, var(--ventas) 25%, transparent);
  color: color-mix(in oklch, var(--ventas) 40%, #000);
}
.alert-card.info .ic{ color: var(--ventas); }
.alert-card.warn{
  background: color-mix(in oklch, var(--ppm) 10%, var(--surface));
  border-color: color-mix(in oklch, var(--ppm) 28%, transparent);
  color: color-mix(in oklch, var(--ppm) 36%, #000);
}
.alert-card.warn .ic{ color: var(--ppm); }
.alert-card.danger{
  background: color-mix(in oklch, var(--costos) 8%, var(--surface));
  border-color: color-mix(in oklch, var(--costos) 25%, transparent);
  color: color-mix(in oklch, var(--costos) 40%, #000);
}
.alert-card.danger .ic{ color: var(--costos); }

/* IVA projection card */
.iva-card{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px 22px;
  margin-bottom: var(--gap-grid);
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-1);
}
.iva-tag{
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--brand-600);
  margin-bottom: 4px;
}
.iva-sub{ font-size: 13px; color: var(--text-2); margin: 0 0 8px; }
.iva-value{
  font-family: var(--font-mono);
  font-size: 38px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--costos);
  line-height: 1.05;
  display: inline-block;
}
.iva-value.positive{ color: var(--utilidad); }
.iva-remanente{
  font-size: 12.5px;
  color: var(--utilidad);
  font-weight: 500;
  margin-top: 6px;
}
.iva-due{
  font-size: 12.5px;
  color: var(--ppm);
  font-weight: 600;
  text-align: right;
}

/* Highlighted Utilidad KPI card */
.kpi.utilidad-card{
  border-color: color-mix(in oklch, var(--utilidad) 30%, var(--border));
  box-shadow: 0 0 0 2px color-mix(in oklch, var(--utilidad) 12%, transparent), var(--shadow-1);
  background:
    radial-gradient(120% 100% at 100% 0%, color-mix(in oklch, var(--utilidad) 8%, transparent), transparent 60%),
    var(--surface);
}
.kpi.utilidad-card .kpi-value{ color: var(--utilidad); }
.kpi.utilidad-card .kpi-label{ color: color-mix(in oklch, var(--utilidad) 50%, #000); }
.row-actions{ display: inline-flex; gap: 4px; }
.row-actions button{
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  transition: background .14s ease, color .14s ease, border-color .14s ease, transform .08s ease;
}
.row-actions button:hover{ background: var(--surface-3); color: var(--text); }
.row-actions button:active{ transform: scale(0.94); }
.row-actions button.danger:hover{ background: rgba(239,68,68,.1); color: #B91C1C; border-color: rgba(239,68,68,.3); }
.row-actions button.brand:hover{ background: var(--brand-50); color: var(--brand-700); border-color: var(--brand-200); }
