/* =============================================================
   vidrio-ui · v1.0.0
   Sistema de diseño de Vidrio Fruits para todas las apps.
   Estética editorial: crema/tinta/dorado, serif de titulares
   (Cormorant Garamond) + sans de interfaz (Inter). Móvil primero.

   Origen visual: dashboards.vidriofruits.com y campo-vidriofruits.
   Fuente de verdad: repo vidrio-ui. Las apps VENDORIZAN este
   fichero (copia literal); no se edita dentro de la app.

   Fuentes AUTO-ALOJADAS (licencia OFL): copiar la carpeta fonts/
   junto a este fichero. Nada de Google Fonts: funciona offline y
   sin dependencias externas (patrón PWA de la casa).
   ============================================================= */

/* ---------------------------------------------- 0 · fuentes -- */
@font-face {
  font-family: 'Cormorant Garamond';
  font-style: italic; font-weight: 600; font-display: swap;
  src: url('fonts/cormorant-italic-600-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Cormorant Garamond';
  font-style: italic; font-weight: 600; font-display: swap;
  src: url('fonts/cormorant-italic-600-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Cormorant Garamond';
  font-style: italic; font-weight: 700; font-display: swap;
  src: url('fonts/cormorant-italic-700-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Cormorant Garamond';
  font-style: italic; font-weight: 700; font-display: swap;
  src: url('fonts/cormorant-italic-700-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Cormorant Garamond';
  font-style: normal; font-weight: 600; font-display: swap;
  src: url('fonts/cormorant-normal-600-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Cormorant Garamond';
  font-style: normal; font-weight: 600; font-display: swap;
  src: url('fonts/cormorant-normal-600-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Inter';
  font-style: normal; font-weight: 400; font-display: swap;
  src: url('fonts/inter-normal-400-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal; font-weight: 400; font-display: swap;
  src: url('fonts/inter-normal-400-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Inter';
  font-style: normal; font-weight: 500; font-display: swap;
  src: url('fonts/inter-normal-500-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal; font-weight: 500; font-display: swap;
  src: url('fonts/inter-normal-500-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Inter';
  font-style: normal; font-weight: 600; font-display: swap;
  src: url('fonts/inter-normal-600-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal; font-weight: 600; font-display: swap;
  src: url('fonts/inter-normal-600-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Inter';
  font-style: normal; font-weight: 700; font-display: swap;
  src: url('fonts/inter-normal-700-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal; font-weight: 700; font-display: swap;
  src: url('fonts/inter-normal-700-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ----------------------------------------------- 1 · tokens -- */
:root {
  /* Paleta de marca */
  --cream: #f5f1ea;        /* fondo general */
  --paper: #fbf8f3;        /* superficie de tarjetas */
  --paper-2: #f0ebe1;      /* superficie hundida / hover */
  --ink: #1a1614;          /* texto y superficies oscuras */
  --ink-soft: #2c2622;
  --gold: #c89535;         /* acento principal */
  --gold-d: #8a6418;       /* dorado oscuro: texto acento sobre claro */
  --gold-soft: #e3c587;    /* dorado suave: texto acento sobre oscuro */
  --wine: #7a1e2b;         /* peligro / error */
  --olive: #5a6b3f;        /* positivo */
  --muted: #807468;        /* texto secundario */
  --rule: #e3ddd1;         /* hairline */
  --rule-strong: #c8bfae;  /* borde de inputs */

  /* Estados semánticos */
  --ok: var(--olive);      --ok-bg: #dde4cd;
  --warn: #b87514;         --warn-bg: #f6e6c8;
  --bad: #9c2a13;          --bad-bg: #f3ddd6;
  --info: #2a5b8a;         --info-bg: #d8e6f3;

  /* Tipografía */
  --serif: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Geometría */
  --radius: 4px;           /* editorial: esquinas casi rectas */
  --radius-pill: 999px;
  --app-max: 560px;        /* ancho de columna; las apps lo pueden subir */
  --sombra: 0 4px 16px rgba(26, 22, 20, 0.14);

  /* Capas */
  --z-topbar: 20;
  --z-nav: 30;
  --z-toast: 100;
}

/* Tema oscuro opcional (experimental): <html data-theme="dark"> */
[data-theme="dark"] {
  --cream: #16120f;
  --paper: #201b17;
  --paper-2: #2a241f;
  --ink: #f5f1ea;
  --ink-soft: #e6dfd4;
  --muted: #a2968a;
  --rule: #352e28;
  --rule-strong: #4a4139;
  --sombra: 0 4px 16px rgba(0, 0, 0, 0.5);
}

/* ------------------------------------------------- 2 · base -- */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; }
body {
  font-family: var(--sans);
  background: var(--cream);
  color: var(--ink);
  line-height: 1.5;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ----------------------------------------------- 3 · layout -- */
.wrap { max-width: var(--app-max); margin: 0 auto; padding: 0 16px; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.row + .row { margin-top: 6px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.oculto { display: none !important; }

/* ------------------------------------------------ 4 · marca -- */
/* Wordmark: SVG inline (ver assets/vidrio-wordmark.svg y demo). */
.brand-mark { display: inline-block; vertical-align: middle; line-height: 0; }
.brand-mark svg { display: block; }

/* ----------------------------------------------- 5 · topbar -- */
/* Cabecera de la casa: tinta, filo dorado, wordmark + sección. */
.topbar {
  position: sticky; top: 0; z-index: var(--z-topbar);
  background: var(--ink);
  color: var(--cream);
  border-bottom: 2px solid var(--gold);
  padding-top: env(safe-area-inset-top);
}
.topbar .topbar-inner {
  max-width: var(--app-max); margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
}
.topbar .brand-row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar .brand-row .sep { width: 1px; height: 20px; background: var(--gold); opacity: 0.6; flex: none; }
.topbar .section-tag {
  font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--gold-soft); font-weight: 500;
  border-top: none; padding-top: 0; margin: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar .who-chip {
  display: inline-flex; align-items: center; gap: 8px; flex: none;
  background: rgba(245, 241, 234, 0.08);
  border: 1px solid rgba(200, 149, 53, 0.35);
  padding: 5px 11px; border-radius: var(--radius-pill);
  font-size: 12px;
}
.topbar .who-chip .name { color: var(--cream); font-weight: 500; }
.topbar .who-chip .rol { color: var(--gold-soft); text-transform: uppercase; letter-spacing: 0.08em; font-size: 10px; }
.topbar .who-chip a { color: var(--gold-soft); text-decoration: none; }
.topbar .who-chip a:hover { color: var(--cream); }

/* Sello de fuente de datos (DEMO / REAL) — va dentro del topbar */
.sello {
  flex: none;
  font-size: 9px; letter-spacing: 0.18em; text-transform: uppercase;
  padding: 4px 9px; border-radius: 2px; font-weight: 700;
}
.sello--demo { background: var(--warn); color: #fff; }
.sello--real { background: var(--olive); color: #fff; }

/* ------------------------------------ 6 · navegación inferior -- */
.nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: var(--z-nav);
  background: var(--paper);
  border-top: 1px solid var(--rule-strong);
  display: flex; justify-content: space-around;
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
}
.nav a {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  min-width: 64px; padding: 6px 8px 4px;
  text-decoration: none; color: var(--muted);
  font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 600;
}
.nav a .ico { display: block; width: 22px; height: 22px; }
.nav a .ico svg { width: 100%; height: 100%; stroke: currentColor; fill: none; stroke-width: 1.6; }
.nav a.on { color: var(--gold-d); }
.nav a.on::before {
  content: ''; position: absolute; top: -7px; left: 50%; transform: translateX(-50%);
  width: 26px; height: 2px; background: var(--gold);
}

/* ------------------------------------------ 7 · tipografía -- */
.eyebrow {
  font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--muted); margin: 22px 0 4px; font-weight: 500;
}
.page-title, h2.page-title {
  font-family: var(--serif);
  font-size: clamp(30px, 8vw, 38px);
  font-weight: 600; line-height: 1.08; letter-spacing: -0.01em;
  margin: 0 0 12px; color: var(--ink);
}
.page-title em { font-style: italic; color: var(--gold-d); }
.page-sub { font-size: 13px; color: var(--muted); margin: -6px 0 16px; }

/* Ordinal de sección editorial: «§01 · Antes de llamar» */
.ord, .section-tag {
  display: inline-block;
  font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--gold-d); font-weight: 600;
  border-top: 2px solid var(--gold);
  padding-top: 5px; margin: 20px 0 8px;
}
.ord .num { color: var(--gold); margin-right: 4px; }

/* ---------------------------------------------- 8 · tarjetas -- */
.card {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 14px 15px;
  margin-bottom: 10px;
}
.card h3, .card .card-title {
  font-family: var(--serif); font-size: 20px; font-weight: 600;
  line-height: 1.15; letter-spacing: -0.005em; margin: 0 0 6px;
}
.card h3 em, .card .card-title em { font-style: italic; color: var(--gold-d); }
.card--tocable { cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.card--tocable:hover { border-color: var(--gold); background: var(--paper); }
.card--tocable:active { background: var(--paper-2); }

/* Tarjeta oscura destacada (lo importante del día) */
.card-dark {
  background: var(--ink); color: var(--cream);
  border: none; border-radius: var(--radius);
  padding: 20px 18px 18px; margin-bottom: 10px;
  position: relative;
}
.card-dark::before {
  content: ''; position: absolute; left: 18px; right: 18px; top: 0;
  height: 2px; background: var(--gold);
}
.card-dark .tag {
  font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--gold); font-weight: 600; margin-bottom: 4px;
}
.card-dark .head-title {
  font-family: var(--serif); font-size: 26px; font-weight: 600;
  letter-spacing: -0.01em; line-height: 1.1; margin: 0;
}
.card-dark .head-title em { font-style: italic; color: var(--gold-soft); }
.card-dark .sub, .card-dark .mini { color: var(--gold-soft); }

/* ------------------------------------------------- 9 · texto -- */
.dato { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.sub { color: var(--muted); font-size: 13px; }
.mini { font-size: 11px; color: var(--muted); }
.null { color: var(--muted); font-style: italic; font-weight: 400; } /* null ≠ 0 */
.desv--pos { color: var(--ok); font-weight: 600; }
.desv--neg { color: var(--bad); font-weight: 600; }
a.tel { color: var(--gold-d); text-decoration: none; font-weight: 600; }
.hl { background: linear-gradient(transparent 55%, #ffe55b 55%); padding: 0 4px; font-weight: 700; color: #1a1614; }
hr.regla, .divider { border: none; border-top: 1px solid var(--rule); margin: 14px 0; }
.gold-rule { height: 2px; background: var(--gold); width: 36px; border: none; margin: 0 0 14px; }

/* ------------------------------------------------ 10 · kpis -- */
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.kpi {
  background: var(--paper);
  border: 1px solid var(--rule); border-top: 2px solid var(--gold);
  border-radius: var(--radius);
  padding: 12px 13px 10px;
}
.kpi .valor {
  font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em; line-height: 1.2;
}
.kpi .etiqueta {
  font-size: 9.5px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--muted); font-weight: 600; margin-top: 2px;
}

/* ---------------------------------------- 11 · barras de mix -- */
.bar { display: flex; align-items: center; gap: 8px; margin: 5px 0; font-size: 13px; }
.bar .nombre { width: 92px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar .pista { flex: 1; height: 8px; background: var(--paper-2); border-radius: 2px; overflow: hidden; }
.bar .relleno { height: 100%; background: var(--gold); border-radius: 0 2px 2px 0; }
.bar .cifra { min-width: 64px; text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-soft); }

/* ------------------------------- 11b · avatares de cliente -- */
/* Logo local si existe; si el <img> falla se elimina y aflora el
   monograma serif (iniciales). */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; flex: none;
  background: #fff; border: 1px solid var(--rule); border-radius: var(--radius);
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.avatar .mono {
  font-family: var(--serif); font-size: 19px; font-weight: 600;
  color: var(--gold-d); letter-spacing: 0.02em;
}
.avatar img ~ .mono { display: none; }
.avatar--lg { width: 68px; height: 68px; }
.avatar--lg .mono { font-size: 30px; }
[data-theme="dark"] .avatar { background: var(--paper-2); }

/* --------------------------------- 11c · gráficas de la casa -- */
/* SVG inline generado por la app; estos estilos dan la piel. La serie
   actual va en dorado con etiquetas visibles; la campaña anterior es
   referencia en gris DISCONTINUO (de-énfasis + doble codificación). */
.grafica { position: relative; margin: 6px 0 2px; }
.grafica svg { display: block; width: 100%; height: auto; }
.grafica .grid { stroke: var(--rule); stroke-width: 1; }
.grafica .eje { fill: var(--muted); font-family: var(--sans); font-size: 10px; }
.grafica .etiq { fill: var(--ink); font-family: var(--sans); font-size: 11px; font-weight: 600; }
.grafica .serie { fill: none; stroke: var(--gold); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.grafica .serie--ant { stroke: var(--muted); stroke-dasharray: 5 4; }
.grafica .area { fill: var(--gold); opacity: 0.1; stroke: none; }
.grafica .punto { fill: var(--gold); stroke: var(--paper); stroke-width: 2; }
.grafica .col { fill: var(--gold); }
.grafica .hit { fill: transparent; }
.leyenda { display: flex; gap: 16px; justify-content: flex-end; font-size: 11px; color: var(--muted); margin: 2px 0 4px; }
.leyenda .clave { display: inline-flex; align-items: center; gap: 6px; }
.leyenda .linea { width: 18px; border-top: 2px solid var(--gold); }
.leyenda .linea--ant { border-top-style: dashed; border-top-color: var(--muted); }
.tooltip-graf {
  position: absolute; pointer-events: none; z-index: 5;
  background: var(--ink); color: var(--cream);
  font-size: 11.5px; line-height: 1.5; padding: 7px 10px; border-radius: 3px;
  border-left: 3px solid var(--gold);
  box-shadow: var(--sombra); white-space: nowrap;
  transform: translate(-50%, -100%);
  opacity: 0; transition: opacity 0.12s;
}
.tooltip-graf.visible { opacity: 1; }
.tooltip-graf .t-ant { color: var(--gold-soft); }

/* ------------------------------------------------ 12 · tabla -- */
.tabla { width: 100%; border-collapse: collapse; font-size: 13px; }
.tabla th {
  text-align: left; font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); font-weight: 600; padding: 8px 10px;
  border-bottom: 2px solid var(--gold);
}
.tabla td { padding: 9px 10px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.tabla td.num, .tabla th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tabla tr:last-child td { border-bottom: none; }
/* Envoltorio: si la tabla no cabe, scroll horizontal dentro de la tarjeta */
.tabla-scroll { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }

/* ----------------------------------------- 13 · formularios -- */
label {
  display: block;
  font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
  margin: 14px 0 5px;
}
label.plain { text-transform: none; letter-spacing: 0; font-size: 14px; font-weight: 400; color: var(--ink); }
input, textarea, select {
  width: 100%;
  font-family: var(--sans); font-size: 16px; /* 16px evita el zoom de iOS */
  padding: 12px 13px;
  border: 1px solid var(--rule-strong); border-radius: 3px;
  background: var(--paper); color: var(--ink);
  transition: border-color 0.15s, background 0.15s;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--gold);
  background: #fff;
}
[data-theme="dark"] input:focus, [data-theme="dark"] textarea:focus, [data-theme="dark"] select:focus { background: var(--paper-2); }
textarea { min-height: 84px; resize: vertical; }
select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238a6418' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center;
  padding-right: 36px;
}
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--gold-d); }

/* Chips de selección rápida */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.chip {
  padding: 9px 15px;
  border: 1px solid var(--rule-strong); border-radius: var(--radius-pill);
  background: var(--paper); color: var(--ink-soft);
  font-size: 13.5px; font-weight: 500;
  cursor: pointer; user-select: none;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.chip:hover { border-color: var(--gold); }
.chip--on { background: var(--ink); color: var(--cream); border-color: var(--ink); font-weight: 600; }

/* Buscador pegajoso (el top asume el topbar de la casa, ~53px) */
.buscador { position: sticky; top: 52px; z-index: 10; background: var(--cream); padding: 8px 0; }
.buscador input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Ccircle cx='7' cy='7' r='4.6' stroke='%23807468' stroke-width='1.4' fill='none'/%3E%3Cpath d='M10.5 10.5L14 14' stroke='%23807468' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: left 13px center;
  padding-left: 38px;
}

/* ---------------------------------------------- 14 · botones -- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%;
  padding: 14px 20px;
  font-family: var(--sans); font-size: 13px; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase;
  border: 1px solid transparent; border-radius: 3px;
  background: var(--ink); color: var(--cream);
  cursor: pointer; text-decoration: none; text-align: center;
  margin-top: 12px;
  transition: background 0.15s, color 0.15s, border-color 0.15s, opacity 0.15s;
}
.btn:hover { background: var(--gold-d); color: #fff; }
.btn:active { opacity: 0.85; }
.btn--ink { background: var(--ink); color: var(--cream); }
.btn--gold { background: var(--gold); color: #1a1614; }
.btn--gold:hover { background: var(--gold-d); color: #fff; }
.btn--linea { background: transparent; color: var(--ink-soft); border-color: var(--rule-strong); }
.btn--linea:hover { background: var(--ink); color: var(--cream); border-color: var(--ink); }
.btn--peligro { background: var(--wine); color: #fff; }
.btn--peligro:hover { background: #5a141f; }
.btn--ghost { background: transparent; color: var(--ink-soft); width: auto; padding: 8px 10px; letter-spacing: 0.08em; }
.btn--ghost:hover { background: var(--paper-2); color: var(--ink); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-fila { display: flex; gap: 8px; }
.btn-fila .btn { margin-top: 10px; }

/* CTA grande (acción principal de la pantalla) */
.cta-big { padding: 18px 24px; font-size: 14px; letter-spacing: 0.18em; background: var(--gold); color: #1a1614; font-weight: 700; }
.cta-big:hover { background: var(--gold-d); color: #fff; }

/* ----------------------------------------------- 15 · badges -- */
.badge {
  display: inline-block;
  padding: 3px 9px; border-radius: 2px;
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.14em;
  white-space: nowrap;
}
/* Semánticos (preferir en apps nuevas) */
.badge--ok      { background: var(--ok-bg);   color: var(--ok); }
.badge--warn    { background: var(--warn-bg); color: var(--warn); }
.badge--bad     { background: var(--bad-bg);  color: var(--bad); }
.badge--info    { background: var(--info-bg); color: var(--info); }
.badge--neutro  { background: var(--paper-2); color: var(--muted); }
.badge--dorado  { background: var(--gold); color: #1a1614; }
.badge--suave   { background: var(--gold-soft); color: #6d4e12; }
/* Alias de dominio ya en uso */
.badge--vencida   { background: var(--bad); color: #fff; }
.badge--hoy       { background: var(--warn); color: #fff; }
.badge--futuro    { background: var(--paper-2); color: var(--muted); }
.badge--abierto   { background: var(--wine); color: #fff; }
.badge--prospecto { background: var(--gold-soft); color: #6d4e12; }

/* ------------------------------------------------ 16 · login -- */
/* Editorial: héroe de tinta con wordmark grande + tarjeta de acceso. */
.login-wrap { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr; background: var(--cream); }
.login-hero {
  background: var(--ink);
  color: var(--cream);
  border-bottom: 2px solid var(--gold);
  padding: calc(34px + env(safe-area-inset-top)) 26px 30px;
  text-align: center;
}
.login-hero .hero-eyebrow {
  font-size: 10px; letter-spacing: 0.24em; text-transform: uppercase;
  color: var(--gold-soft); font-weight: 500;
}
.login-hero .hero-title {
  font-family: var(--serif); font-size: clamp(36px, 10vw, 48px);
  font-weight: 600; line-height: 1.05; letter-spacing: -0.01em;
  margin: 8px 0 0;
}
.login-hero .hero-title em { font-style: italic; color: var(--gold); }
.login-hero .hero-sub { font-size: 13px; color: var(--gold-soft); margin-top: 8px; }
.login-form-wrap { display: flex; align-items: flex-start; justify-content: center; padding: 30px 20px 40px; }
.login-card {
  width: 100%; max-width: 380px;
  background: var(--paper);
  border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 26px 24px 24px;
}
.login-card .login-eyebrow {
  display: block; text-align: center;
  font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 14px;
}
@media (min-width: 820px) {
  .login-wrap { grid-template-rows: none; grid-template-columns: 1.1fr 1fr; }
  .login-hero { display: flex; flex-direction: column; justify-content: center;
    border-bottom: none; border-right: 2px solid var(--gold); }
  .login-form-wrap { align-items: center; }
}

/* -------------------------------------- 17 · estados vacíos -- */
.vacio, .empty { text-align: center; color: var(--muted); padding: 36px 20px 28px; }
.vacio .serif, .empty h3 {
  font-family: var(--serif); font-size: 24px; font-weight: 600;
  color: var(--ink-soft); margin: 0 0 6px;
}
.vacio .serif em, .empty h3 em { font-style: italic; color: var(--gold-d); }
.vacio p, .empty p { margin: 0; font-size: 13.5px; }

/* --------------------------------------- 18 · detalle y kv -- */
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 7px 14px; font-size: 14px; margin: 0; }
.kv dt { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; padding-top: 2px; }
.kv dd { margin: 0; color: var(--ink); }
.card-dark .kv dt { color: var(--gold-soft); }
.card-dark .kv dd { color: var(--cream); }

.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--gold-d); text-decoration: none; font-weight: 600;
  margin: 14px 0 4px;
}
.back-link:hover { color: var(--ink); }

/* --------------------------------- 19 · toast, offline, skel -- */
.toast {
  position: fixed; bottom: calc(84px + env(safe-area-inset-bottom));
  left: 50%; transform: translateX(-50%);
  z-index: var(--z-toast);
  background: var(--ink); color: var(--cream);
  padding: 12px 18px; border-radius: 3px;
  font-size: 14px; max-width: 90%;
  border-left: 3px solid var(--gold);
  box-shadow: var(--sombra);
  opacity: 0; pointer-events: none; transition: opacity 0.25s;
}
.toast.visible { opacity: 1; pointer-events: auto; }
.toast--error, .toast.error { border-left-color: var(--wine); }

.offline {
  background: var(--wine); color: #fff; text-align: center;
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  padding: 6px 10px;
}

@keyframes vui-shimmer { 0% { background-position: -200px 0; } 100% { background-position: 200px 0; } }
.skel {
  border-radius: 3px; min-height: 14px;
  background: linear-gradient(90deg, var(--paper-2) 25%, var(--paper) 50%, var(--paper-2) 75%);
  background-size: 400px 100%;
  animation: vui-shimmer 1.2s infinite linear;
  color: transparent !important;
}

/* -------------------------------------------- 20 · escritorio -- */
/* En pantalla grande: columna más ancha, la nav inferior se dockea
   bajo el topbar como menú horizontal y los KPIs van en fila. */
@media (min-width: 900px) {
  :root { --app-max: 1180px; }
  .wrap { padding-top: 76px; }
  /* La navegación se dockea bajo la cabecera como una barra de verdad:
     objetivos grandes (el comercial usa ratón, pero también portátil táctil)
     y alineada a la izquierda con el contenido, no flotando en el centro. */
  .nav {
    position: fixed; top: 54px; bottom: auto; left: 0; right: 0;
    justify-content: flex-start; gap: 4px;
    background: var(--cream);
    border-top: none; border-bottom: 1px solid var(--rule-strong);
    padding: 0;
  }
  .nav::before {
    /* Empuja la barra hasta alinearla con la columna de contenido */
    content: ''; flex: none;
    width: max(16px, calc((100vw - var(--app-max)) / 2));
  }
  .nav a {
    flex-direction: row; gap: 10px;
    font-size: 12px; letter-spacing: 0.16em;
    padding: 15px 20px; min-width: 0;
    border-bottom: 2px solid transparent;
  }
  .nav a:hover { color: var(--ink); background: var(--paper); }
  .nav a .ico { width: 20px; height: 20px; }
  .nav a.on { border-bottom-color: var(--gold); background: var(--paper); }
  .nav a.on::before { display: none; }
  .kpis { grid-template-columns: repeat(4, 1fr); gap: 12px; }
  .buscador { top: 118px; }
  .toast { bottom: 32px; }
  .card { padding: 16px 18px; }
  .page-title { font-size: 34px; }
}

@media (min-width: 1500px) {
  :root { --app-max: 1400px; }
}
