:root {
  --bg: #f1f0ee;
  --surface: #ffffff;
  --surface-sunken: #e7e4e2;
  --ink: #1f1f1f;
  --ink-muted: #6c6c6c;
  --ink-faint: #9a9694;
  --line: #e2e0dd;
  --line-strong: #cfcbc8;
  --accent: #714b67;
  --accent-strong: #5b3b53;
  --accent-soft: #ede1e8;
  --on-accent: #ffffff;
  --margen-color: #c1554a;
  --marker-1: #3f9c8a;
  --marker-2: #c1554a;
  --marker-3: #3f6fa8;
  --marker-4: #7a5ea8;
  --marketing-bg: #f3e6c2;
  --marketing-color: #7a5a06;
  --sugerido-bg: #f5e7b0;
  --sugerido-color: #7a5a06;

  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --font-body: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", "Roboto Mono", Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
}

h1, h2, h3 {
  font-family: var(--font-display);
  margin: 0;
  color: var(--ink);
}

a { color: var(--accent); }
a:hover { color: var(--accent-strong); }

.kicker {
  font-family: var(--font-mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--ink-faint);
}

.shell { max-width: 1280px; margin: 0 auto; padding: 36px 28px 64px; }

/* NavBar */
.navbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; padding: 14px 28px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.navbar-brand { display: flex; align-items: center; gap: 10px; flex: none; }
.navbar-logo { width: 26px; height: 26px; border-radius: 7px; background: var(--accent); }
.navbar-brand .kicker { color: var(--ink); }
.navbar nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pill {
  border-radius: 999px; padding: 7px 15px; font-size: 13px; white-space: nowrap;
  color: var(--ink-muted); font-weight: 500; text-decoration: none;
}
.pill.active { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }
.pill:hover:not(.active) { color: var(--ink); }

/* KPI / stat cards */
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.stat-card {
  border-radius: 10px; padding: 18px 20px; background: var(--surface);
  border: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px;
}
.stat-card .value { font-size: 26px; font-weight: 600; color: var(--ink); }
.stat-card .delta { font-size: 13px; color: var(--ink-muted); }

/* Departamento cards (home) */
.dept-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.dept-card {
  border-radius: 12px; padding: 20px; background: var(--surface); border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 14px; position: relative;
}
.badge {
  border-radius: 999px; padding: 5px 12px; font-size: 12px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px; width: fit-content;
}
.tag-ejemplo, .tag-sugerido {
  position: absolute; top: 16px; right: 16px;
  border-radius: 999px; padding: 4px 10px; font-size: 10px; font-weight: 700; letter-spacing: .04em;
}
.tag-ejemplo { background: var(--surface-sunken); color: var(--ink-muted); }
.tag-sugerido { background: var(--sugerido-bg); color: var(--sugerido-color); }
.tag-ejemplo.inline, .tag-sugerido.inline { position: static; display: inline-flex; margin-bottom: 18px; }

/* Chip "Sugerido" a nivel de campo individual */
.chip-sugerido {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--sugerido-bg); color: var(--sugerido-color);
  border-radius: 999px; padding: 2px 8px; font-size: 10px; font-weight: 700; letter-spacing: .03em;
  margin-left: 6px; vertical-align: middle;
}

.legend-chip {
  border-radius: 999px; padding: 5px 12px; font-size: 12px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px;
}

/* Departamento page */
.seg { display: inline-flex; border-radius: 10px; padding: 4px; gap: 4px; background: var(--surface-sunken); }
.seg-btn {
  border-radius: 7px; padding: 8px 18px; font-size: 14px; font-weight: 600; cursor: pointer;
  background: transparent; color: var(--ink-muted); border: none; font-family: var(--font-body);
}
.seg-btn.active { background: var(--surface); color: var(--accent-strong); }

.bench-card {
  border-radius: 10px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 8px;
}
.bench-row { display: flex; align-items: baseline; gap: 8px; }

.reto-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.reto-card { border-radius: 12px; padding: 20px; background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; }
.reto-card.pendiente { border-style: dashed; }
.reto-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.reto-lista-item { font-size: 12px; color: var(--ink-muted); margin-bottom: 2px; }

.marker-label { font-size: 12px; font-weight: 600; }
.marker-chip {
  border-radius: 999px; padding: 5px 12px; font-size: 12px;
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; background: none; border: none;
  font-family: var(--font-body);
}

.nota-box {
  border: 1px dashed var(--line-strong); border-radius: 12px; padding: 22px; background: var(--surface);
}
.nota-box.tight { padding: 16px 20px; }

/* Bitacora page */
.filtros { display: flex; gap: 8px; flex-wrap: wrap; }
.filtro-pill {
  border-radius: 999px; padding: 7px 16px; font-size: 13px; font-weight: 600; cursor: pointer;
  background: var(--surface-sunken); color: var(--ink-muted); border: none; font-family: var(--font-body);
}
.filtro-pill.active { background: var(--accent-soft); color: var(--accent-strong); }
.entradas-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 6px 24px; }
.entrada { display: flex; align-items: flex-start; gap: 18px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.entrada:last-child { border-bottom: none; }
.entrada .rango { width: 140px; flex: none; font-size: 13px; color: var(--ink-muted); }
.entrada .texto { flex: 1; font-size: 14px; color: var(--ink); }
.badge-scope { border-radius: 999px; padding: 4px 11px; font-size: 11px; font-weight: 700; white-space: nowrap; flex: none; }

/* Correlaciones page */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 22px; margin-bottom: 22px; }

/* Home: histórico — panel con divisor + combinado */
.chart-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px 22px;
  box-shadow: 0 1px 2px rgba(31, 31, 31, 0.04), 0 10px 28px -18px rgba(31, 31, 31, 0.18);
}

.hist-panel {
  display: flex; background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 1px 2px rgba(31, 31, 31, 0.04), 0 10px 28px -18px rgba(31, 31, 31, 0.18);
  overflow: hidden;
}
@media (max-width: 720px) { .hist-panel { flex-direction: column; } }
.hist-panel-col { flex: 1; padding: 20px 24px; display: flex; flex-direction: column; }
.hist-panel-col + .hist-panel-col { border-left: 1px solid var(--line); }
@media (max-width: 720px) { .hist-panel-col + .hist-panel-col { border-left: none; border-top: 1px solid var(--line); } }
.hist-panel-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.hist-panel-head .titulo { font-family: var(--font-display); font-size: 15px; }
.hist-panel-head .unidad { font-size: 11px; color: var(--ink-faint); margin-left: auto; }

.metric-toggle-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.metric-toggle {
  border: 1.5px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 14px 6px 6px;
  font-size: 13px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
  color: var(--ink-muted); font-family: var(--font-body); box-shadow: 0 1px 2px rgba(31, 31, 31, 0.05);
  transition: box-shadow .12s ease;
}
.metric-toggle:hover { border-color: var(--line-strong); }
.metric-toggle .toggle-dot {
  width: 18px; height: 18px; border-radius: 999px; flex: none; display: inline-flex; align-items: center;
  justify-content: center; border: 1.6px solid var(--line-strong); background: transparent;
}
.metric-toggle .toggle-dot svg { display: block; }

/* Carrusel de 2 paneles (histórico/hitos en home, facturación/hitos en departamento) */
.panel-nav { display: flex; align-items: center; gap: 10px; flex: none; }
.panel-nav-btn {
  width: 38px; height: 38px; border-radius: 999px; border: 1.5px solid var(--accent); cursor: pointer;
  background: var(--accent-soft); display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 3px rgba(31, 31, 31, 0.1);
  transition: background .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.panel-nav-btn:hover { background: var(--accent); border-color: var(--accent-strong); box-shadow: 0 3px 8px rgba(113, 75, 103, 0.35); }
.panel-nav-btn:hover svg { stroke: var(--on-accent); }
.panel-nav-btn svg { width: 18px; height: 18px; stroke: var(--accent-strong); stroke-width: 2.6px; transition: stroke .12s ease; }
.panel-dots {
  display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 16px;
  width: fit-content; margin-left: auto; margin-right: auto; padding: 8px 14px; border-radius: 999px;
  background: var(--accent-soft); border: 1px solid var(--accent);
}
.panel-dot {
  width: 9px; height: 9px; border-radius: 999px; border: none; cursor: pointer; padding: 0;
  background: var(--ink-muted); transition: background .12s ease, width .12s ease;
}
.panel-dot:hover { background: var(--accent-strong); }
.panel-dot.active { width: 22px; background: var(--accent); }

/* Hitos: tarjeta apilada fecha + título + detalle + responsable */
.hito-row {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 16px; display: flex; align-items: flex-start; gap: 14px;
}
.hito-fecha {
  flex: none; background: var(--surface-sunken); color: var(--ink-muted); border-radius: 999px;
  padding: 4px 11px; font-size: 11px; font-weight: 700; font-family: var(--font-mono);
  letter-spacing: .02em; white-space: nowrap; margin-top: 1px;
}
.hito-body { flex: 1; min-width: 0; }
.hito-titulo { font-size: 14px; font-weight: 700; color: var(--ink); margin-bottom: 2px; }
.hito-detalle { font-size: 13px; color: var(--ink-muted); line-height: 1.4; }
.hito-pm { font-size: 11px; color: var(--ink-faint); margin-top: 6px; font-weight: 600; }

.go-live-pill {
  background: var(--accent-soft); color: var(--accent-strong); border-radius: 999px;
  padding: 6px 14px; font-size: 13px; font-weight: 600;
}
