@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 100 700;
  font-display: swap;
  src: url('fonts/ibm-plex-sans-latin-wght-normal.woff2') format('woff2-variations'),
       url('fonts/ibm-plex-sans-latin-ext-wght-normal.woff2') format('woff2-variations');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/ibm-plex-mono-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/ibm-plex-mono-latin-600-normal.woff2') format('woff2');
}

:root {
  --primary: #f07b3f;
  --primary-dark: #cf7700;
  --primary-soft: #fff4ee;
  --brand-strong: #a8461a;
  --bg: #fbfeff;
  --card: #fbfeff;
  --text: #08181d;
  --muted: #5c7077;
  --line: #e1eaed;
  --field: #eef3f5;
  --field-border: #cdd8dc;
  --green: #02713a;
  --green-bg: #e3f9ed;
  --red: #c4243a;
  --red-bg: #fff1f2;
  --amber: #7a5602;
  --amber-bg: #fff6dd;
  --shadow: 0 1px 2px -1px rgba(8, 24, 29, 0.07), 0 4px 12px -6px rgba(8, 24, 29, 0.1);
  --round: 14px;
  --sidebar: 250px;
  --serie-1: #f07b3f;
  --serie-1-suave: #f7c295;
  --serie-2: #2a78d6;
  --serie-3: #1baf7a;
  --serie-4: #4a3aa7;
  --serie-5: #e87ba4;
  --foreground: var(--text);
  --muted-foreground: var(--muted);
  --ring: var(--primary);
  --sombra-tarjeta: 0 1px 2px -1px rgba(8, 24, 29, 0.07), 0 4px 12px -6px rgba(8, 24, 29, 0.1);
  --sombra-elevada: 0 2px 4px -2px rgba(8, 24, 29, 0.08), 0 12px 24px -12px rgba(8, 24, 29, 0.14), 0 32px 64px -32px rgba(8, 24, 29, 0.18);
  --radio: 0.7rem;
  --radio-md: calc(var(--radio) - 2px);
  --radio-sm: calc(var(--radio) - 4px);
  --radio-xl: calc(var(--radio) + 4px);
  --campo: var(--field);
  --campo-hover: #e4ecef;
  --success: #02713a;
  --success-strong: #02713a;
  --destructive: #c4243a;
  --destructive-strong: #c4243a;
  font-family: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  color-scheme: light;
}

:root.dark {
  --primary: #f07b3f;
  --primary-dark: #cf7700;
  --primary-soft: #36190a;
  --brand-strong: #f5b48f;
  --bg: #060b11;
  --card: #0c1219;
  --text: #f1f5fa;
  --muted: #98a4b1;
  --line: #181f26;
  --field: #161e26;
  --field-border: #2c3640;
  --green: #01e97e;
  --green-bg: #00220d;
  --red: #ff8b99;
  --red-bg: #361017;
  --amber: #fdb502;
  --amber-bg: #33250b;
  --shadow: none;
  --serie-1: #d77700;
  --serie-1-suave: #643d18;
  --serie-2: #3987e5;
  --serie-3: #199e70;
  --serie-4: #9085e9;
  --serie-5: #d55181;
  --campo-hover: #1d2731;
  --success: #01e97e;
  --success-strong: #01e97e;
  --destructive: #ff8b99;
  --destructive-strong: #ff8b99;
  --sombra-tarjeta: none;
  --sombra-elevada: 0 2px 4px -2px rgba(0, 0, 0, 0.4), 0 16px 32px -16px rgba(0, 0, 0, 0.55), 0 40px 80px -40px rgba(0, 0, 0, 0.65);
  color-scheme: dark;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .5; cursor: not-allowed; }
a { color: inherit; text-decoration: none; }
*:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 24px; letter-spacing: -.6px; line-height: 1.3; }
h2 { font-size: 17px; letter-spacing: -.3px; }
h3 { font-size: 14px; font-weight: 700; }
small, .muted { color: var(--muted); }
strong { font-weight: 700; }
.mono { font-family: 'IBM Plex Mono', monospace; }
.num { font-variant-numeric: tabular-nums; }
.loader { min-height: 100vh; display: grid; place-items: center; color: var(--muted); font-weight: 600; }

/* ---------- Estructura ---------- */
.app-layout { display: grid; grid-template-columns: var(--sidebar) minmax(0,1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; overscroll-behavior: contain; background: var(--card); display: flex; flex-direction: column; padding: 18px 12px; border-right: 1px solid rgba(10,40,50,.04); z-index: 30; }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 5px 25px; }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; background: var(--primary); color: #fff; border-radius: 11px; flex-shrink: 0; }
.brand strong { font-size: 18px; line-height: 1.2; display: block; letter-spacing: -.5px; }
.brand small { font-size: 12px; font-weight: 600; }
.group-label { color: var(--muted); font-size: 12px; font-weight: 700; margin: 17px 8px 9px; text-transform: uppercase; letter-spacing: .5px; }
.nav-link { width: 100%; border: 0; background: transparent; display: flex; align-items: center; gap: 12px; text-align: left; color: #2a4048; border-radius: 10px; padding: 10px 11px; margin: 2px 0; font-size: 14px; font-weight: 600; min-height: 42px; }
.nav-link:hover { background: var(--field); }
.nav-link.active { color: var(--brand-strong); background: var(--primary-soft); }
.nav-badge { margin-left: auto; background: var(--red-bg); color: var(--red); border-radius: 99px; font-size: 11px; font-weight: 700; padding: 1px 7px; }
.ic { display: inline-flex; align-items: center; justify-content: center; width: 19px; height: 19px; flex: 0 0 19px; }
.ic svg { width: 19px; height: 19px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sidebar-bottom { margin-top: auto; padding-top: 15px; border-top: 1px solid var(--line); }
.user-mini { display: flex; gap: 9px; align-items: center; margin: 8px 4px 12px; }
.avatar { width: 36px; height: 36px; border-radius: 10px; background: var(--field); display: grid; place-items: center; color: var(--brand-strong); font-weight: 700; }
.user-mini strong, .user-mini small { display: block; line-height: 1.3; }

.main-area { min-width: 0; }
.topbar { height: 69px; display: flex; align-items: center; justify-content: space-between; padding: 0 30px; gap: 15px; border-bottom: 1px solid var(--line); }
.top-left, .top-right { display: flex; align-items: center; gap: 15px; }
.top-left strong { font-size: 14px; }
.topbar .breadcrumb-muted { color: var(--muted); font-weight: 600; }
.btn-icon { border: 0; background: transparent; display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; color: var(--text); }
.btn-icon:hover { background: var(--field); }
.status-pill { border-radius: 99px; background: var(--green-bg); color: var(--green); padding: 6px 12px; font-size: 12px; font-weight: 700; display: flex; align-items: center; gap: 7px; }
.status-pill.closed { background: var(--amber-bg); color: var(--amber); }
.status-pill.alert { background: var(--red-bg); color: var(--red); }
.status-pill .dot { background: #0b9458; }
.status-pill.closed .dot { background: #b0720a; }
.status-pill.alert .dot { background: currentColor; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; background: currentColor; }

.content { padding: 27px 34px 60px; max-width: 1640px; margin: 0 auto; }
.page-heading { display: flex; align-items: start; justify-content: space-between; gap: 18px; margin-bottom: 25px; }
.page-heading p { color: var(--muted); margin-top: 5px; }
.actions, .inline-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }

/* ---------- Botones ---------- */
.btn { background: var(--field); color: var(--text); border: 1px solid transparent; min-height: 39px; padding: 9px 15px; border-radius: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; transition: filter .15s, background .15s; }
.btn:hover { filter: brightness(.97); }
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.secondary { background: var(--card); border-color: var(--line); }
.btn.danger { background: var(--red-bg); color: var(--red); }
.btn.green { background: #076646; color: #fff; }
.btn.small { font-size: 12px; padding: 6px 10px; min-height: 32px; border-radius: 9px; }
.btn.ghost { border: 0; background: transparent; }
.btn.block { width: 100%; }

/* ---------- Tarjetas e indicadores ---------- */
.panel { background: var(--card); border-radius: var(--round); box-shadow: var(--shadow); padding: 20px; border: 1px solid rgba(25,55,65,.03); min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.panel-head .subtle { color: var(--muted); font-weight: 600; font-size: 12px; }
.cols2 { display: grid; grid-template-columns: minmax(0,1.6fr) minmax(280px,1fr); gap: 18px; }
.cols-balanced { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.tarjeta { background: var(--card); color: var(--foreground); border-radius: var(--radio-xl); box-shadow: var(--sombra-tarjeta); padding: 1rem 1.25rem; min-width: 0; border: 1px solid var(--line); }
.tarjeta h2 { font-size: 0.9375rem; margin-bottom: 0.25rem; font-weight: 700; }

.resumen-caja { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.indicador {
  position: relative; overflow: hidden; justify-content: flex-start; gap: 0.5rem; isolation: isolate;
  padding: 0.875rem 1rem; background: var(--card); border-radius: var(--radio-xl); box-shadow: var(--sombra-tarjeta);
  border: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0;
}
.indicador > :not(.indicador-fondo) { position: relative; z-index: 1; }
.indicador-fondo { position: absolute; right: -0.75rem; bottom: -1rem; z-index: 0; color: var(--primary); opacity: 0.08; pointer-events: none; }
.indicador-fondo svg { width: 5.5rem; height: 5.5rem; stroke: currentColor; fill: none; stroke-width: 1.6; }
.indicador.destacado { background: var(--primary); color: #fff; border-color: var(--primary); }
.indicador.destacado .indicador-fondo { color: #fff; opacity: 0.16; }
.indicador.destacado .dato-nombre, .indicador.destacado .indicador-nota, .indicador.destacado .indicador-cambio { color: rgba(255, 255, 255, 0.92); }
.indicador.destacado .dato-valor { color: #fff; }
.indicador.destacado .indicador-icono { background: rgba(255, 255, 255, 0.22); color: #fff; }
.indicador.destacado .indicador-cambio strong, .indicador.destacado .indicador-cambio svg { color: #fff; }
.indicador.destacado .tendencia { --serie: #fff !important; }
.indicador.destacado .tendencia-area { opacity: 0.22; }
.indicador-cabeza { display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.indicador-cabeza .dato-nombre { font-size: 0.8125rem; font-weight: 600; color: var(--muted-foreground); }
.indicador-icono { flex: none; width: 1.875rem; height: 1.875rem; border-radius: var(--radio-md); display: grid; place-items: center; background: var(--serie, var(--primary)); color: #fff; }
.indicador-icono svg, .indicador-icono .ic svg { width: 1rem; height: 1rem; stroke: currentColor; fill: none; stroke-width: 2; }
.indicador-cuerpo { display: grid; gap: 0.4rem; min-width: 0; }
.indicador-cifras { display: grid; gap: 0.15rem; min-width: 0; }
.indicador .dato-valor { font-size: 1.5rem; font-weight: 700; line-height: 1.1; letter-spacing: -0.01em; color: var(--foreground); font-variant-numeric: tabular-nums; }
.indicador-cambio { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.75rem; color: var(--muted-foreground); white-space: nowrap; }
.indicador-cambio svg { width: 0.95rem; height: 0.95rem; min-width: 0.95rem; min-height: 0.95rem; stroke: currentColor; fill: none; stroke-width: 2; }
.indicador-cambio.sube strong, .indicador-cambio.sube svg { color: var(--success-strong); }
.indicador-cambio.baja strong, .indicador-cambio.baja svg { color: var(--destructive-strong); }
.indicador-nota { font-size: 0.75rem; color: var(--muted-foreground); }
.indicador-medidor { height: 0.5rem; margin: 0.5rem 0; border-radius: 999px; background: var(--campo); overflow: hidden; }
.indicador-medidor span { display: block; height: 100%; min-width: 0.5rem; border-radius: 999px; background: var(--serie, var(--primary)); }

.tendencia { display: block; width: 100%; height: 1.5rem; overflow: visible; }
.tendencia-linea { fill: none; stroke: var(--serie); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.tendencia-area { fill: var(--serie); opacity: 0.12; }
.tendencia-punto { fill: none; stroke: var(--serie); stroke-width: 7; stroke-linecap: round; vector-effect: non-scaling-stroke; }

/* ---------- Saludo del Dashboard ---------- */
.pagina.inicio { display: flex; flex-direction: column; gap: 1.25rem; }
.saludo { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.25rem; }
.saludo-titulo { font-size: 1.45rem; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
.saludo-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.75rem; margin: 0.25rem 0 0; font-size: 0.8125rem; color: var(--muted-foreground); }
.saludo-fecha::first-letter { text-transform: uppercase; }
.saludo-estado { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 600; }
.saludo-estado::before { content: ""; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--muted-foreground); }
.saludo-estado.abierta { color: var(--success-strong); }
.saludo-estado.abierta::before { background: var(--success); box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 60%, transparent); animation: latido 2s infinite; }
.saludo-estado.cerrada { color: var(--amber); }
.saludo-estado.cerrada::before { background: var(--amber); }
@keyframes latido {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 55%, transparent); }
  70% { box-shadow: 0 0 0 0.45rem transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.saludo-accesos { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.saludo-accesos .btn { border-radius: 999px; font-size: 0.8125rem; padding: 6px 14px; min-height: 34px; background: var(--field); border: 1px solid var(--line); }
.saludo-accesos .btn:hover { background: var(--field-border); }
.saludo-accesos .btn .ic { color: var(--primary); }

/* ---------- Gráficos ---------- */
.inicio-graficos { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 1rem; align-items: stretch; }
.grafico { display: flex; flex-direction: column; gap: 0.75rem; }
.grafico-cabeza { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; }
.grafico-cabeza h2 { margin: 0; }
.grafico-ayuda { margin: 0.2rem 0 0; font-size: 0.8125rem; color: var(--muted-foreground); }
.grafico-alternar { flex: none; color: var(--muted-foreground); cursor: pointer; border: 0; background: transparent; font-size: 0.8125rem; padding: 4px 8px; border-radius: 6px; }
.grafico-alternar:hover { background: var(--field); color: var(--text); }
.grafico-cifra { margin: 0; font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.grafico-vacio { margin: auto 0; padding: 2rem 0.5rem; text-align: center; color: var(--muted-foreground); font-size: 0.8125rem; }
.grafico-cuerpo { min-width: 0; margin-top: auto; }
.grafico-lienzo { width: 100%; min-width: 0; }
.grafico-svg { display: block; overflow: visible; font-family: inherit; }
.grafico-svg text { font-size: 11px; font-weight: 600; }
.grafico-eje { fill: var(--muted-foreground); }
.grafico-eje.fuerte { fill: var(--foreground); font-weight: 700; }
.grafico-valor { fill: var(--foreground); font-weight: 700; font-variant-numeric: tabular-nums; }
.grafico-zona { cursor: pointer; outline: none; }
.grafico-zona:focus-visible { outline: none; }
.grafico-marca { fill: var(--serie-1); transition: opacity 0.15s; pointer-events: none; }
.grafico-marca.suave { fill: var(--serie-1-suave); }
.grafico-linea { fill: none; stroke: var(--serie-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.grafico-area { fill: var(--serie-1); opacity: 0.12; }
.grafico-punto { fill: var(--serie-1); stroke: var(--card); stroke-width: 2; pointer-events: none; }
.grafico-punto.activo { fill: var(--serie-1); stroke: var(--card); stroke-width: 3; pointer-events: none; }
.grafico-dona { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 1.25rem; padding: 0.5rem 0; }
.grafico-dona-figura { flex: none; }
.grafico-sector { cursor: pointer; outline: none; transition: opacity 0.15s; }
.grafico-sector.apagado { opacity: 0.25; }
.grafico-dona-total { fill: var(--foreground); font-size: 18px !important; font-weight: 700 !important; }
.grafico-leyenda { display: grid; gap: 0.5rem; min-width: 11rem; flex: 1 1 11rem; list-style: none; padding: 0; margin: 0; }
.grafico-leyenda li { display: grid; grid-template-columns: auto 1fr auto 2.5rem; align-items: center; gap: 0.5rem; font-size: 0.8125rem; }
.grafico-leyenda li.sin-valor { color: var(--muted-foreground); }
.grafico-leyenda strong { font-variant-numeric: tabular-nums; }
.grafico-leyenda-nombre { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grafico-leyenda-pct { text-align: right; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.grafico-muestra { width: 0.625rem; height: 0.625rem; border-radius: 3px; display: inline-block; }
.radial-svg { display: block; overflow: visible; }
.radial-pista { fill: none; stroke: var(--campo); stroke-linecap: round; }
.radial-arco { fill: none; stroke-linecap: round; cursor: pointer; outline: none; transition: opacity 0.15s; }
.radial-arco.apagado { opacity: 0.25; }
.radial-leyenda li { grid-template-columns: auto 1fr auto auto; }
.radial-leyenda .grafico-leyenda-pct { min-width: 4.5rem; }
.grafico-tabla { width: 100%; border-collapse: collapse; font-size: 0.8125rem; margin-top: 0.5rem; }
.grafico-tabla th, .grafico-tabla td { padding: 0.45rem 0.6rem; border-bottom: 1px solid var(--line); text-align: left; }
.grafico-tabla th.num, .grafico-tabla td.num { text-align: right; }
.grafico-tip {
  position: fixed; z-index: 300; pointer-events: none; display: grid; gap: 0.1rem;
  padding: 0.5rem 0.65rem; border-radius: var(--radio-md); max-width: 16rem;
  background: var(--card); color: var(--foreground); box-shadow: var(--sombra-elevada); font-size: 0.75rem;
  border: 1px solid var(--line);
}
.grafico-tip[hidden] { display: none; }
.grafico-tip strong { font-size: 0.875rem; font-variant-numeric: tabular-nums; }
.grafico-tip span { color: var(--muted-foreground); }

/* ---------- Listas de estado ---------- */
.ahora { display: grid; gap: 0.35rem; list-style: none; padding: 0; margin: 0; }
.ahora-enlace { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem 0.4rem; color: var(--foreground); text-decoration: none; border-radius: 8px; transition: background .15s; width: 100%; border: 0; background: transparent; text-align: left; }
.ahora-enlace:hover { background: var(--field); }
.ahora-texto { display: grid; min-width: 0; line-height: 1.3; }
.ahora-texto strong { font-weight: 700; font-size: 0.875rem; }
.ahora-texto span { font-size: 0.75rem; color: var(--muted-foreground); }
.ahora-enlace .indicador-icono { width: 2rem; height: 2rem; border-radius: 8px; }
.lista-estado { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.25rem; }
.lista-estado li { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.45rem 0; border-bottom: 1px solid var(--line); font-size: 0.8125rem; }
.lista-estado li:last-child { border-bottom: 0; }
.lista-estado strong { color: var(--foreground); }
.chip {
  display: inline-flex; align-items: center; gap: 0.375rem; height: 1.35rem; padding: 0 0.55rem;
  border-radius: 999px; white-space: nowrap; font-size: 0.75rem; font-weight: 600; line-height: 1;
  background: var(--campo); color: var(--muted-foreground);
}
.chip::before { content: ""; width: 0.375rem; height: 0.375rem; border-radius: 50%; background: currentColor; flex: none; }
.chip-alerta { background: var(--red-bg); color: var(--red); }
.chip-aviso { background: var(--amber-bg); color: var(--amber); }
.chip-ok { background: var(--green-bg); color: var(--green); }
.chip-info { background: var(--primary-soft); color: var(--brand-strong); }
.campo-ayuda { font-size: 0.8125rem; color: var(--muted-foreground); margin: 0.35rem 0 0; }

/* ---------- Avisos ---------- */
.notice { display: flex; gap: 12px; align-items: flex-start; background: var(--field); border-radius: 12px; padding: 13px 16px; margin: 10px 0; font-size: 13px; }
.notice .ic { flex: 0 0 19px; margin-top: 1px; }
.notice.warning { background: var(--amber-bg); color: var(--amber); }
.notice.info { background: #eef7ff; color: #24628a; }
.notice.success { background: var(--green-bg); color: var(--green); }
.notice.error { background: var(--red-bg); color: var(--red); }
.notice-cta { margin-left: auto; }

/* ---------- Tablas ---------- */
.table-wrap { overflow: auto; max-width: 100%; }
table { width: 100%; border-collapse: collapse; text-align: left; min-width: 610px; font-size: 13px; }
th { background: var(--field); color: var(--muted); font-weight: 700; padding: 11px 13px; white-space: nowrap; }
th.r, td.r { text-align: right; }
td { padding: 12px 13px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td strong { font-weight: 700; }
td small { display: block; margin-top: 2px; }
tfoot td { background: var(--field); font-weight: 700; border-bottom: 0; color: var(--text); }
tr.inactiva td { opacity: .55; }
tr.anulada td strong:first-child { text-decoration: line-through; }

.pill { font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; background: var(--field); color: var(--muted); white-space: nowrap; }
.pill.good { color: var(--green); background: var(--green-bg); }
.pill.bad { color: var(--red); background: var(--red-bg); }
.pill.pending { color: var(--amber); background: var(--amber-bg); }
.pill.info { color: #24628a; background: #eef7ff; }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .ic { width: 42px; height: 42px; color: #90a1a7; margin-bottom: 8px; }
.empty .ic svg { width: 32px; height: 32px; }

/* ---------- Formularios ---------- */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row.three { grid-template-columns: repeat(3, 1fr); }
.form-row.four { grid-template-columns: repeat(4, 1fr); }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; min-width: 0; }
.field label { font-size: 12px; font-weight: 700; color: var(--text); }
.field .campo-ayuda { margin: 0; }
.input, .select, textarea { background: var(--field); color: var(--text); border: 1px solid var(--field-border); outline: none; border-radius: 10px; min-height: 42px; width: 100%; padding: 10px 12px; box-shadow: none; transition: border-color .15s; }
.input:focus, .select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(244,140,6,.12); }
.input.num { font-variant-numeric: tabular-nums; }
textarea { min-height: 85px; resize: vertical; }
.check { display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 600; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }

.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.search { position: relative; flex: 1; min-width: 220px; }
.search .ic { position: absolute; top: 12px; left: 12px; color: var(--muted); }
.search input { padding-left: 40px; }
.tab-row { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 18px; }
.tab { padding: 9px 15px; border: 0; border-radius: 99px; background: var(--field); color: var(--text); font-weight: 700; font-size: 12px; }
.tab.active { background: var(--primary); color: white; }
.subtabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 22px; padding-bottom: 2px; overflow-x: auto; }
.subtab { padding: 10px 18px; border: 0; background: transparent; color: var(--muted); font-weight: 700; font-size: 13px; border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; transition: color .15s, border-color .15s; }
.subtab:hover { color: var(--text); }
.subtab.active { color: var(--brand-strong); border-bottom-color: var(--primary); }

/* ---------- Modales ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(18, 32, 39, 0.65); display: flex; align-items: center;
  justify-content: center; z-index: 1000; padding: 20px; backdrop-filter: blur(5px); overflow-y: auto;
}
.modal { background: var(--card); width: min(100%, 600px); max-height: min(92vh, 940px); overflow-y: auto; border-radius: 17px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35); margin: auto; display: flex; flex-direction: column; }
.modal.wide { width: min(100%, 980px); }
.modal.medium { width: min(100%, 740px); }
.modal.narrow { width: min(100%, 460px); }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 20px 22px; border-bottom: 1px solid var(--line); flex-shrink: 0; gap: 12px; }
.modal-header small { display: block; color: var(--muted); font-weight: 600; }
.modal-body { padding: 21px 22px; flex: 1 1 auto; overflow-y: auto; }
.modal-footer { padding: 15px 22px; background: var(--field); display: flex; justify-content: flex-end; gap: 8px; border-radius: 0 0 17px 17px; flex-shrink: 0; flex-wrap: wrap; align-items: center; }
.modal-footer .izq { margin-right: auto; color: var(--muted); font-size: 13px; }
.modal .divider { height: 1px; background: var(--line); margin: 14px 0; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.large-number { font-size: 23px; font-weight: 700; }

/* ---------- Venta: carrito y líneas ---------- */
.selling { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 20px; align-items: start; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.product-card { border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 12px; min-width: 0; display: flex; flex-direction: column; gap: 6px; box-shadow: var(--shadow); text-align: left; transition: transform .15s ease, border-color .15s ease; }
.product-card:hover:not(:disabled) { transform: translateY(-2px); border-color: color-mix(in srgb, var(--primary) 40%, var(--line)); }
.product-card:disabled { opacity: .55; }
.product-card .name { font-size: 14.5px; font-weight: 700; color: var(--text); line-height: 1.25; }
.product-card .price { font-size: 17px; font-weight: 700; color: var(--primary); font-variant-numeric: tabular-nums; }
.stock { color: var(--green); font-size: 11.5px; font-weight: 700; }
.stock.low { color: var(--amber); }
.stock.out { color: var(--red); }
.cart { position: sticky; top: 20px; align-self: start; max-height: calc(100vh - 40px); overflow: auto; }
.cart-line { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cart-line .cart-text { min-width: 0; flex: 1; }
.cart-line .cart-text strong { display: block; font-size: 13.5px; }
.qty-control { display: flex; align-items: center; gap: 8px; }
.qty-control button { width: 27px; height: 27px; border: 0; background: var(--field); border-radius: 8px; font-weight: 700; color: var(--text); flex: none; }
.qty-control .q { min-width: 24px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.cart-total { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); padding: 16px 0 12px; font-size: 16px; }
.cart-total strong { font-size: 26px; font-variant-numeric: tabular-nums; }

/* Resumen diario */
.resumen-tabla td { padding: 9px 13px; }
.resumen-tabla .input { min-height: 36px; max-width: 110px; }
.resumen-dia { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.resumen-dia .field { margin-bottom: 0; }

/* Detalle FIFO */
.fifo-detalle { background: var(--field); border-radius: 12px; padding: 12px 14px; font-size: 12.5px; display: grid; gap: 6px; }
.fifo-fila { display: flex; justify-content: space-between; gap: 10px; font-variant-numeric: tabular-nums; }
.fifo-fila.total { border-top: 1px dashed var(--field-border); padding-top: 6px; margin-top: 2px; font-weight: 700; }
.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.summary-tile { padding: 18px; border-radius: 13px; background: var(--field); }
.summary-tile strong { display: block; font-size: 22px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.summary-tile.ok strong { color: var(--green); }
.summary-tile.mal strong { color: var(--red); }

/* Reportes */
.report-filters { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.report-filters label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; font-weight: 700; }
.report-filters .input, .report-filters .select { width: auto; min-height: 38px; }
.report-presets { display: flex; gap: 8px; flex-wrap: wrap; }
.report-note { color: var(--muted); font-size: 12px; margin-top: 16px; }
.report-bars { display: grid; gap: 13px; }
.report-row { display: grid; grid-template-columns: 180px minmax(0,1fr) 95px; gap: 10px; align-items: center; }
.bar-track { height: 11px; background: var(--field); border-radius: 12px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--primary); border-radius: 12px; }

/* Respaldos */
.backup-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 18px; }
.backup-card { border: 1px solid var(--line); border-radius: var(--radio-xl); padding: 20px; background: var(--card); display: flex; flex-direction: column; gap: 10px; }
.backup-card > .ic { width: 42px; height: 42px; border-radius: 12px; background: var(--primary-soft); color: var(--brand-strong); display: grid; place-items: center; }
.backup-card > .ic svg { width: 22px; height: 22px; }
.backup-card h3 { font-size: 15px; }
.backup-card p { color: var(--muted); font-size: 13px; flex: 1; }
.file-drop { border: 1.5px dashed var(--field-border); border-radius: 12px; padding: 18px; text-align: center; color: var(--muted); font-size: 13px; cursor: pointer; display: block; }
.file-drop:hover { border-color: var(--primary); color: var(--text); }
.file-drop input { display: none; }

/* ---------- Toast ---------- */
#toast { position: fixed; bottom: 20px; right: 20px; z-index: 1300; display: grid; gap: 8px; max-width: min(420px, calc(100vw - 30px)); }
.toast-item { background: #10252c; color: white; border-radius: 12px; padding: 13px 18px; box-shadow: 0 12px 30px #0003; font-size: 13px; font-weight: 600; animation: aparecerSubir .25s ease-out both; }
.toast-item.error { background: #9a2435; }
.toast-item.success { background: #086542; }
.toast-item.warning { background: #7a5602; }

/* ---------- Modo oscuro: retoques ---------- */
.mobile-cover { display: none; }
.sidebar.collapsed { width: 66px; padding-left: 8px; padding-right: 8px; }
.app-layout:has(.sidebar.collapsed) { grid-template-columns: 66px minmax(0,1fr); }
.sidebar.collapsed .brand-copy, .sidebar.collapsed .nav-text, .sidebar.collapsed .group-label, .sidebar.collapsed .user-mini > div:not(.avatar), .sidebar.collapsed .nav-badge { display: none; }
.sidebar.collapsed .brand { padding-left: 3px; }
.sidebar.collapsed .nav-link { justify-content: center; padding: 10px; }
.sidebar.collapsed .user-mini { justify-content: center; }
.dark .sidebar { border-color: var(--line); }
.dark .summary-tile, .dark .fifo-detalle { background: var(--field); }
.dark .notice.info { background: #102c43; color: #a8cef0; }
.dark .pill.info { background: #102c43; color: #a8cef0; }
.dark .nav-link { color: var(--text); }
.dark .nav-link.active { color: #ffc68b; }

/* ---------- Responsive ---------- */
@media (max-width: 1300px) {
  .content { padding: 24px; }
  .topbar { padding: 0 23px; }
}
@media (max-width: 1050px) {
  .resumen-caja { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .selling { grid-template-columns: minmax(0,1fr) 310px; }
  .cols2, .inicio-graficos { grid-template-columns: 1fr; }
  .sidebar { width: 66px; padding-left: 8px; padding-right: 8px; }
  .app-layout { grid-template-columns: 66px minmax(0,1fr); }
  .sidebar .brand-copy, .sidebar .nav-text, .sidebar .group-label, .sidebar .user-mini > div:not(.avatar), .sidebar .nav-badge { display: none; }
  .sidebar .nav-link { justify-content: center; }
  .sidebar .brand { padding-left: 3px; }
  .sidebar .user-mini { justify-content: center; }
  .sidebar.mobile-expanded { position: fixed; width: 270px; box-shadow: 0 0 30px #0003; z-index: 55; padding: 18px 12px; }
  .sidebar.mobile-expanded .brand-copy, .sidebar.mobile-expanded .nav-text, .sidebar.mobile-expanded .group-label, .sidebar.mobile-expanded .user-mini > div:not(.avatar), .sidebar.mobile-expanded .nav-badge { display: block; }
  .sidebar.mobile-expanded .nav-link { justify-content: flex-start; }
  .mobile-cover.active { display: block; position: fixed; inset: 0; background: #0005; z-index: 50; }
}
@media (max-width: 900px) {
  .inicio-graficos { grid-template-columns: 1fr; }
  .resumen-caja { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .content { padding: 16px 14px 45px; }
  .topbar { height: 61px; padding: 0 12px; }
  .topbar .breadcrumb-muted { display: none; }
  .top-right .status-pill { display: none; }
  .page-heading { align-items: flex-start; flex-direction: column; margin-bottom: 18px; }
  .page-heading h1 { font-size: 23px; }
  .cols-balanced, .selling, .summary-grid { grid-template-columns: 1fr; }
  .form-row, .form-row.three, .form-row.four { grid-template-columns: 1fr; }
  .cart { position: static; max-height: none; }
  .product-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
  .modal-body, .modal-header { padding: 16px; }
  .modal-footer { padding: 12px 16px; }
  .report-row { grid-template-columns: 110px 1fr 75px; }
  .btn { white-space: normal; }
  .toolbar .search { width: 100%; }
  .report-filters label { flex: 1 1 200px; }
  .report-filters .input, .report-filters .select { flex: 1; min-width: 0; }
}
@media (max-width: 480px) {
  .saludo-accesos { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .resumen-caja { grid-template-columns: 1fr; }
  .content { padding-left: 10px; padding-right: 10px; }
  .panel, .tarjeta { padding: 15px; }
  .indicador .dato-valor { font-size: 1.35rem; }
}

/* ---------- Animaciones de entrada ---------- */
.animar .resumen-caja > *, .animar .inicio-graficos > *, .animar .saludo { animation: aparecerSubir 0.5s ease-out both; }
.animar .resumen-caja > :nth-child(2) { animation-delay: 0.06s; }
.animar .resumen-caja > :nth-child(3) { animation-delay: 0.12s; }
.animar .resumen-caja > :nth-child(4) { animation-delay: 0.18s; }
.animar .inicio-graficos > :nth-child(1) { animation-delay: 0.2s; }
.animar .inicio-graficos > :nth-child(2) { animation-delay: 0.25s; }
@keyframes aparecerSubir { from { opacity: 0; transform: translateY(10px); } }
.animar .grafico-marca { transform-box: fill-box; transform-origin: bottom; animation: crecer 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
@keyframes crecer { from { transform: scaleY(0); } }
.animar .grafico-linea, .animar .tendencia-linea { stroke-dasharray: 1; animation: trazar 1s ease-out both 0.25s; }
@keyframes trazar { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
.animar .grafico-area, .animar .tendencia-area { animation: aparecerArea 0.8s ease-out both 0.5s; }
@keyframes aparecerArea { from { opacity: 0; } }
.animar .grafico-sector { transform-box: view-box; transform-origin: center; animation: girarEntrar 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
@keyframes girarEntrar { from { opacity: 0; transform: rotate(-25deg) scale(0.92); } }
.animar .radial-arco { animation: trazarRadial 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
@keyframes trazarRadial { from { stroke-dasharray: 0 1; } to { stroke-dasharray: var(--parte) 1; } }
.animar .indicador-medidor span { transform-origin: left; animation: crecerAncho 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) both 0.3s; }
@keyframes crecerAncho { from { transform: scaleX(0); } }

@media (prefers-reduced-motion: reduce) {
  .animar *, .toast-item { animation: none !important; }
}

/* ---------- Impresión ---------- */
@media print {
  .sidebar, .topbar, .page-heading, .modal-footer, .btn, #toast, .modal-header, .tab-row, .subtabs, .toolbar, .no-print { display: none !important; }
  .modal-overlay { position: static; background: white; padding: 0; display: block; backdrop-filter: none; }
  .modal { box-shadow: none; max-height: unset; overflow: visible; width: 100%; border: 0; }
  .modal-body { padding: 0; }
  .app-layout { display: block; }
}

/* ---------- Inicio de sesión (modo servidor) ---------- */
.login-screen { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login-left { background: linear-gradient(155deg, #e68000, #f79e21); color: #fff; padding: clamp(32px, 5vw, 90px); display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-left .brand strong, .login-left .brand small { color: #fff; }
.login-left h1 { font-size: clamp(32px, 4vw, 58px); line-height: 1.12; letter-spacing: -1.5px; margin: 20px 0; position: relative; }
.login-left p { font-size: 17px; max-width: 410px; opacity: .92; }
.login-right { display: grid; place-items: center; padding: 25px; }
.login-card { width: min(100%, 390px); }
.login-card h2 { font-size: 26px; margin: 12px 0 6px; }
.login-card > p { margin-bottom: 24px; color: var(--muted); }
@media (max-width: 760px) {
  .login-screen { grid-template-columns: 1fr; }
  .login-left { min-height: 200px; padding: 24px 28px; }
  .login-left h1 { font-size: 28px; margin: 6px 0; }
  .login-left p { font-size: 14px; }
  .login-right { padding: 28px; }
}
