:root {
  --amarillo: #F1BE49;
  --amarillo-hondo: #E3A92A;
  --verde: #317039;
  --tinta: #1E272E;
  --rojo: #B2412A;

  --bg: #F6F5F1;
  --card: #FFFFFF;
  --text: #1E272E;
  --text-2: #4E5961;
  --muted: #7C868D;
  --line: #E4E2DB;
  --grid: #EEECE6;
  --ghost: #CFCCC3;
  --mark: #1E272E;
  --up: #317039;
  --down: #B2412A;

  --nav-on-bg: #1E272E;
  --nav-on-fg: #FFFFFF;
  --display: "Fraunces", Georgia, serif;
  --ui: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --r-l: 28px;
  --r-m: 18px;
  --r-s: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12171B;
    --card: #1B2328;
    --text: #F1EFE9;
    --text-2: #BCC3C8;
    --muted: #8A949A;
    --line: #2B353C;
    --grid: #252E34;
    --ghost: #4A555C;
    --mark: #EDEBE4;
    --up: #6DBE78;
    --down: #F08A6E;
    color-scheme: dark;
    --nav-on-bg: #F1BE49;
    --nav-on-fg: #1E272E;
  }
}
:root[data-theme="dark"] {
    --bg: #12171B;
    --card: #1B2328;
    --text: #F1EFE9;
    --text-2: #BCC3C8;
    --muted: #8A949A;
    --line: #2B353C;
    --grid: #252E34;
    --ghost: #4A555C;
    --mark: #EDEBE4;
    --up: #6DBE78;
    --down: #F08A6E;
    color-scheme: dark;
    --nav-on-bg: #F1BE49;
    --nav-on-fg: #1E272E;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--ui); font-size: 15px; line-height: 1.45;
  font-feature-settings: "tnum" 1, "lnum" 1;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--amarillo-hondo); outline-offset: 2px; border-radius: 6px; }

.wrap { max-width: 1240px; margin: 0 auto; padding: 0 20px 64px; }

/* ---------- barra superior ---------- */
.top { display: flex; align-items: center; gap: 24px; padding: 18px 0 18px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); flex-shrink: 0; }
.brand img { width: 38px; height: 38px; display: block; border-radius: 10px; }
.brand b { font-weight: 800; font-size: 17px; letter-spacing: -0.01em; }
.brand span { color: var(--muted); font-weight: 500; font-size: 17px; }
.nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; flex: 1; }
.nav::-webkit-scrollbar { display: none; }
.nav button {
  border: 0; background: none; padding: 8px 14px; border-radius: 999px; cursor: pointer;
  font-weight: 600; font-size: 14px; color: var(--muted); white-space: nowrap;
}
.nav button[aria-current="page"] { background: var(--nav-on-bg); color: var(--nav-on-fg); }
.nav button:disabled { cursor: default; opacity: .55; }
.nav button small { font-weight: 500; font-size: 11px; margin-left: 4px; }
.menu { display: flex; align-items: center; gap: 24px; flex: 1; min-width: 0; }
.burger { display: none; margin-left: auto; width: 42px; height: 42px; border: 1px solid var(--line); background: var(--card); border-radius: 12px; cursor: pointer; flex-direction: column; justify-content: center; align-items: center; gap: 4px; }
.burger span { display: block; width: 18px; height: 2px; border-radius: 2px; background: var(--text); transition: transform .2s, opacity .2s; }
.burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
@media (prefers-reduced-motion: reduce) { .burger span { transition: none; } }
.user { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); flex-shrink: 0; }
.user button { border: 1px solid var(--line); background: var(--card); padding: 6px 12px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 13px; }

/* ---------- héroe: el día de hoy ---------- */
.hero {
  background: var(--amarillo); color: var(--tinta); border-radius: var(--r-l);
  padding: 30px 34px 26px; display: grid; grid-template-columns: minmax(280px, 0.9fr) 1.4fr; gap: 28px;
  position: relative; overflow: hidden;
}
.hero-r { position: absolute; right: -10px; bottom: -150px; font-family: var(--display); font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 144; font-weight: 900; font-size: 420px; line-height: 1; color: var(--tinta); opacity: .06; pointer-events: none; user-select: none; }
.hero h1 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -0.005em; }
.live { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; margin-top: 6px; color: rgba(30,39,46,.75); }
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--verde); box-shadow: 0 0 0 0 rgba(49,112,57,.5); animation: pulse 2.4s ease-out infinite; }
.live.stale i { background: var(--rojo); animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(49,112,57,.45); } 80%, 100% { box-shadow: 0 0 0 9px rgba(49,112,57,0); } }
@media (prefers-reduced-motion: reduce) { .live i { animation: none; } }
.big {
  font-family: var(--display); font-variation-settings: "SOFT" 100, "opsz" 144; font-weight: 800;
  font-size: clamp(72px, 10vw, 128px); line-height: .92; letter-spacing: -0.035em; margin: 22px 0 14px;
}
.big small { font-size: .42em; letter-spacing: -0.01em; margin-left: 6px; font-weight: 700; }
.delta-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  background: var(--tinta); color: #fff; font-weight: 700; font-size: 14px;
}
.delta-pill.up b { color: #9FE0A7; } .delta-pill.down b { color: #FFB49E; }
.delta-pill span { font-weight: 500; opacity: .85; }
.hero-stats { display: flex; gap: 26px; margin-top: 22px; flex-wrap: wrap; }
.hero-stats div { display: flex; flex-direction: column; }
.hero-stats b { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.hero-stats span { font-size: 13px; font-weight: 500; color: rgba(30,39,46,.72); }
.hero-chart { min-height: 270px; display: flex; flex-direction: column; }
.hero-chart .legend { display: flex; gap: 16px; font-size: 13px; font-weight: 600; flex-wrap: wrap; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; font-weight: 600; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 18px; height: 0; border-top: 3px solid currentColor; display: inline-block; }
.legend i.dash { border-top-style: dashed; }
.legend i.soft { opacity: .4; }
.legend i.box { width: 10px; height: 10px; border: 0; border-radius: 3px; background: currentColor; }

/* ---------- rejilla de tarjetas ---------- */
.grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; margin-top: 16px; }
.card { background: var(--card); border-radius: var(--r-m); padding: 22px 24px; border: 1px solid var(--line); min-width: 0; }
.c5 { grid-column: span 5; } .c7 { grid-column: span 7; } .c6 { grid-column: span 6; } .c12 { grid-column: span 12; }
.card h2 { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: -0.005em; }
.card .sub { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.num {
  font-family: var(--display); font-variation-settings: "SOFT" 100, "opsz" 72; font-weight: 800;
  font-size: 44px; letter-spacing: -0.03em; line-height: 1; margin: 16px 0 6px;
}
.delta { font-weight: 700; font-size: 14px; display: inline-flex; gap: 4px; align-items: baseline; }
.delta.up { color: var(--up); } .delta.down { color: var(--down); } .delta.flat { color: var(--muted); }
.delta span { color: var(--muted); font-weight: 500; }

/* mes */
.month-bar { position: relative; height: 14px; border-radius: 999px; background: var(--grid); margin: 18px 0 8px; }
.month-bar .done { position: absolute; inset: 0 auto 0 0; background: var(--mark); border-radius: 999px; }
.month-bar .proj { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: repeating-linear-gradient(135deg, var(--amarillo) 0 6px, var(--amarillo-hondo) 6px 8px); }
.month-bar .ref { position: absolute; top: -6px; bottom: -6px; width: 2px; background: var(--text); }
.month-scale { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.kv { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 10px 16px; margin: 18px 0 0; padding-top: 16px; border-top: 1px solid var(--line); font-size: 14px; }
.kv dt { color: var(--text-2); } .kv dd { margin: 0; font-weight: 700; text-align: right; }
.kv dd em { font-style: normal; font-weight: 500; color: var(--muted); margin-left: 6px; }

/* familias */
.fam { list-style: none; margin: 16px 0 0; padding: 0; }
.fam li { display: grid; grid-template-columns: 162px 1fr 80px 58px 44px; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--grid); font-size: 14px; }
.fam li:last-child { border-bottom: 0; }
.fam .hdr { font-size: 12px; color: var(--muted); padding-top: 0; }
.fam .n { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fam .bar { height: 10px; border-radius: 0 4px 4px 0; background: var(--mark); }
.fam .v, .fam .m, .fam .d { text-align: right; }
.fam .v { font-weight: 700; } .fam .m { color: var(--text-2); }

/* productos */
.prods { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin-top: 14px; }
.prods h3 { margin: 0 0 6px; font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.prods h3 .dot { width: 10px; height: 10px; border-radius: 50%; }
.prods ul { list-style: none; margin: 0; padding: 0; }
.prods li { display: grid; grid-template-columns: minmax(0,1fr) 240px; gap: 2px 12px; padding: 10px 0; border-bottom: 1px solid var(--grid); }
.prods li:last-child { border-bottom: 0; }
.prods .pn { font-weight: 600; font-size: 14px; text-transform: none; }
.prods .pf { font-size: 12px; color: var(--muted); }
.prods .pv { text-align: right; font-weight: 700; font-size: 14px; }
.prods .pc { text-align: right; font-size: 12px; color: var(--muted); }
.empty { color: var(--muted); font-size: 14px; padding: 10px 0; }

/* gráficos */
svg.chart { display: block; width: 100%; height: auto; overflow: visible; }
svg text { font-family: var(--ui); }
.axis { fill: var(--muted); font-size: 12px; }
.tip {
  position: fixed; pointer-events: none; z-index: 20; background: var(--tinta); color: #fff;
  padding: 9px 12px; border-radius: 10px; font-size: 13px; line-height: 1.4; box-shadow: 0 8px 24px rgba(0,0,0,.18);
  opacity: 0; transform: translateY(4px); transition: opacity .12s, transform .12s; max-width: 240px;
}
.tip.on { opacity: 1; transform: none; }
.tip b { font-weight: 700; } .tip .t { color: rgba(255,255,255,.7); font-size: 12px; }

.foot { margin-top: 26px; color: var(--muted); font-size: 12.5px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--amarillo); }
.login form { background: var(--card); color: var(--text); border-radius: var(--r-l); padding: 36px 32px; width: min(380px, 100%); display: grid; gap: 14px; }
.login img { width: 56px; display: block; border-radius: 14px; }
.login h1 { margin: 6px 0 4px; font-family: var(--display); font-variation-settings: "SOFT" 100; font-weight: 800; font-size: 32px; letter-spacing: -0.02em; }
.login p { margin: 0 0 6px; color: var(--muted); font-size: 14px; }
.login label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; }
.login input { border: 1px solid var(--line); background: var(--bg); border-radius: 12px; padding: 12px 14px; font-size: 15px; }
.login button { margin-top: 6px; border: 0; background: var(--tinta); color: #fff; border-radius: 12px; padding: 13px; font-weight: 700; cursor: pointer; }
.login .err { color: var(--down); font-size: 13px; min-height: 18px; }
.state { min-height: 60vh; display: grid; place-items: center; color: var(--muted); text-align: center; }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; padding: 26px 22px 22px; }
  .c5, .c7, .c6 { grid-column: span 12; }
}
@media (max-width: 640px) {
  .wrap { padding: 0 14px 48px; }
  .top { gap: 10px; padding: 14px 0; position: relative; }
  .burger { display: flex; }
  .menu { display: none; position: absolute; top: 100%; left: 0; right: 0; z-index: 30; flex-direction: column; align-items: stretch; gap: 6px;
    background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 10px; box-shadow: 0 14px 34px rgba(0,0,0,.14); }
  .menu.open { display: flex; }
  .nav { flex-direction: column; gap: 2px; overflow: visible; }
  .nav button { text-align: left; padding: 12px 14px; border-radius: 12px; font-size: 15px; }
  .user { margin: 4px 0 0; padding: 10px 6px 2px 14px; border-top: 1px solid var(--line); justify-content: space-between; }
  .brand span { display: none; }
  .hero { border-radius: 22px; }
  .hero-chart { min-height: 220px; }
  .hero-stats { gap: 18px; }
  .card { padding: 18px; }
  .num { font-size: 38px; }
  .prods { grid-template-columns: 1fr; gap: 18px; }
  .fam li { grid-template-columns: 1fr 76px 52px; }
  .prods li { grid-template-columns: minmax(0,1fr) auto; }
  .prods .pc { grid-column: 1 / -1; text-align: left; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dt { margin-top: 10px; } .kv dd { text-align: left; }
  .delta-pill { flex-wrap: wrap; border-radius: 14px; }
  .fam .bar-cell, .fam .m { display: none; }
}

.xh.hl { stroke-opacity: .45; }
.prods .pv { justify-content: flex-end; }

.demo-note { margin: 0 0 12px; font-size: 13px; color: var(--text-2); }
.user:empty { display: none; }
