/* RUUTS Radar · mismo sistema de diseño que el panel de suscripciones
   Passion One (títulos) + Fustat (texto) · verde lima, tinta, rosado, rojo · bordes 2px con sombra dura */
:root {
  --ink: #152018; --ink-2: #3a463c; --muted: #6e7a6c; --line: #e4e0cf; --bg: #f5f3eb; --card: #fff;
  --lime: #cdee5a; --lime-2: #ecfca1; --deep: #0e6429; --pink: #f9d6dc; --red: #e23744; --red-2: #fadfe0;
  --amber: #e89548; --amber-2: #fbe9d6; --blue: #3b6fd9; --blue-2: #e1eafb; --ok: #2f9e3a; --ok-2: #e4f0de;
  --shadow: 3px 4px 0 0 var(--ink); --radius: 14px;
  --font: "Fustat", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-h: "Passion One", Impact, "Arial Narrow Bold", sans-serif;
  --c1: #0e6429; --c2: #e23744; --c3: #3b6fd9; --c4: #e89548; --c5: #8a5cc7;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 15px/1.5 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--font-h); font-weight: 400; text-transform: uppercase; letter-spacing: .02em; margin: 0; line-height: 1.05; text-wrap: balance; }
h1 { font-size: 34px; } h2 { font-size: 24px; } h3 { font-size: 19px; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--pink); outline-offset: 2px; }
.muted { color: var(--muted); } .small { font-size: 13px; } .right { text-align: right; } .nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.boot { padding: 40px; color: var(--muted); }

.app { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100%; --hdr-h: 64px; }
.app--auth { display: grid; grid-template-columns: minmax(0, 420px); place-content: center; min-height: 100vh; padding: 24px; }
.sidebar { background: #fff; border-right: 1px solid var(--line); padding: 18px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; z-index: 40; }
.brand { font-family: var(--font-h); font-size: 34px; letter-spacing: .04em; color: var(--deep); padding: 4px 10px 14px; text-transform: uppercase; line-height: 1; }
.brand small { display: block; font-family: var(--font); font-size: 11px; letter-spacing: .12em; color: var(--muted); margin-top: 4px; }
.brand-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; }
.nav-group { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: #94a091; padding: 14px 10px 4px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; text-decoration: none; color: var(--ink-2); font-weight: 600; }
.nav a:hover { background: var(--bg); }
.nav a[aria-current="page"] { background: var(--lime-2); color: var(--deep); font-weight: 800; }
.nav .ico { width: 20px; flex: none; }
.nav .count { margin-left: auto; background: var(--red); color: #fff; border-radius: 999px; font-size: 11px; min-width: 20px; height: 20px; display: grid; place-items: center; padding: 0 6px; font-weight: 700; }
.nav-toggle { flex: none; border: 2px solid var(--ink); background: #fff; color: var(--ink); border-radius: 8px; width: 28px; height: 28px; padding: 0; display: grid; place-items: center; cursor: pointer; box-shadow: 2px 2px 0 0 var(--ink); }
.nav-toggle .ico svg { width: 16px; height: 16px; }
.nav-toggle:hover { background: var(--lime-2); }
.nav-x, .nav-scrim { display: none; }
.sidebar .me { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.sidebar .me b { display: block; color: var(--ink); }
.me-link { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.me-link .lbl { line-height: 1.25; min-width: 0; overflow-wrap: anywhere; }
.me .btn-logout { margin-top: 10px; display: flex; justify-content: center; width: 100%; border-radius: 999px; border-width: 1.5px; box-shadow: none; font-weight: 600; }
.me .btn-logout:hover { background: var(--ink); color: #fff; transform: none; }
/* Menú contraído (solo íconos) */
.app.is-collapsed { grid-template-columns: 68px minmax(0, 1fr); }
.is-collapsed .sidebar { padding: 14px 8px; }
.is-collapsed .sidebar .lbl, .is-collapsed .sidebar .nav-group, .is-collapsed .sidebar .brand small { display: none; }
.is-collapsed .brand-row { flex-direction: column; align-items: center; gap: 8px; }
.is-collapsed .brand { display: none; }
.is-collapsed .nav a, .is-collapsed .me-link { justify-content: center; padding: 10px 6px; position: relative; }
.is-collapsed .nav .count { position: absolute; top: 2px; right: 4px; margin: 0; min-width: 16px; height: 16px; font-size: 10px; }
.is-collapsed .me .btn-logout { padding: 8px 0; }
/* Encabezado: buscador y perfil */
.hdr { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px; min-height: var(--hdr-h); padding: 10px 28px; background: #fff; border-bottom: 1px solid var(--line); }
.hdr .hdr-menu, .hdr .hdr-brand { display: none; }
.hdr-search { position: relative; flex: 1 1 auto; max-width: 560px; display: flex; align-items: center; }
.hdr-search > .ico { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); display: grid; color: var(--muted); pointer-events: none; z-index: 1; }
.hdr-search > .ico svg { width: 18px; height: 18px; }
.hdr-search__in { width: 100%; font: 14.5px var(--font); padding: 9px 14px 9px 40px; border: 2px solid var(--line); background: var(--bg); border-radius: 999px; color: var(--ink); }
.hdr-search__in:focus { border-color: var(--ink); background: #fff; outline: none; box-shadow: 0 0 0 3px var(--lime-2); }
.hdr-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.hdr-pop { position: relative; }
.hdr-icon { position: relative; display: grid; place-items: center; width: 42px; height: 42px; padding: 0; border: 2px solid transparent; border-radius: 10px; background: transparent; color: var(--ink); cursor: pointer; }
.hdr-icon:hover, .hdr-icon[aria-expanded="true"] { border-color: var(--ink); background: var(--lime-2); }
.hdr-icon svg { width: 22px; height: 22px; }
.hdr-me { display: flex; align-items: center; gap: 10px; padding: 3px 10px 3px 3px; border: 2px solid transparent; border-radius: 999px; background: transparent; font: inherit; font-weight: 700; color: var(--ink); cursor: pointer; }
.hdr-me:hover, .hdr-me[aria-expanded="true"] { border-color: var(--ink); background: var(--lime-2); }
.hdr-av { flex: none; width: 38px; height: 38px; border-radius: 50%; background: var(--lime); border: 2px solid var(--ink); display: grid; place-items: center; font-weight: 800; font-size: 14px; }
.hdr-me__chev { display: grid; color: var(--muted); transition: transform .12s; } .hdr-me__chev svg { width: 16px; height: 16px; }
.hdr-me[aria-expanded="true"] .hdr-me__chev { transform: rotate(180deg); }
.hdr-drop { position: absolute; right: 0; top: calc(100% + 10px); z-index: 50; width: 300px; max-width: calc(100vw - 24px); background: #fff; border: 2px solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.hdr-drop[hidden] { display: none; }
.hdr-drop__head { display: flex; flex-direction: column; gap: 2px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.hdr-drop__empty { margin: 0; padding: 18px 16px; color: var(--muted); }
.hdr-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 11px 16px; border: 0; background: none; font: inherit; color: var(--ink); text-decoration: none; text-align: left; cursor: pointer; }
.hdr-item:hover, .hdr-item:focus-visible { background: var(--lime-2); outline: none; }
.hdr-item svg { width: 18px; height: 18px; }
.hdr-search__list { left: 0; right: auto; width: 100%; min-width: 320px; max-height: min(70vh, 520px); overflow-y: auto; }
.hdr-group { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: #94a091; padding: 10px 14px 4px; background: var(--bg); }
.hdr-res { display: flex; align-items: center; gap: 12px; padding: 9px 14px; color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line); }
.hdr-res:hover, .hdr-res.is-sel { background: var(--lime-2); }
.hdr-res__page { display: flex; flex-direction: row; align-items: center; gap: 10px; min-width: 0; }
.hdr-res__page > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.hdr-res .ico svg { width: 18px; height: 18px; color: var(--muted); }
.hdr-res b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ico { display: inline-grid; place-items: center; flex: none; }
.ico svg { width: 20px; height: 20px; display: block; }
.btn .ico svg { width: 16px; height: 16px; }
.main { padding: 22px 28px 60px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head p { margin: 4px 0 0; color: var(--muted); max-width: 72ch; }

.card { background: var(--card); border: 2px solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; min-width: 0; }
.card > h3 { margin-bottom: 10px; }
.card .note { color: var(--muted); font-size: 13px; margin: -4px 0 12px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.kpi { background: var(--card); border: 2px solid var(--ink); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); min-width: 0; }
.kpi .l { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.kpi .n { font-family: var(--font-h); font-size: 34px; line-height: 1.05; font-variant-numeric: tabular-nums; margin-top: 2px; }
.kpi .d { font-size: 12.5px; color: var(--muted); }
.kpi .d.good { color: var(--ok); font-weight: 700; } .kpi .d.bad { color: var(--red); font-weight: 700; }
.kpi--alert { background: var(--red-2); }

.btn { font: 700 14px var(--font); padding: 8px 14px; border: 2px solid var(--ink); border-radius: 10px; background: #fff; color: var(--ink); cursor: pointer; box-shadow: 2px 3px 0 0 var(--ink); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { transform: translate(-1px, -1px); box-shadow: 3px 4px 0 0 var(--ink); }
.btn:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 0 var(--ink); }
.btn--primary { background: var(--lime); } .btn--danger { background: var(--red); color: #fff; } .btn--ghost { box-shadow: none; border-color: var(--line); }
.btn--sm { padding: 5px 10px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: default; transform: none; }
.seg { display: inline-flex; border: 2px solid var(--ink); border-radius: 10px; overflow: hidden; background: #fff; }
.seg button { font: 700 13px var(--font); border: 0; background: transparent; padding: 6px 12px; cursor: pointer; color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--lime); color: var(--ink); }
.seg button + button { border-left: 2px solid var(--ink); }

.badge { display: inline-block; font-size: 11.5px; font-weight: 800; padding: 2px 8px; border-radius: 999px; border: 1.5px solid var(--ink); background: #fff; white-space: nowrap; text-transform: uppercase; letter-spacing: .04em; }
.badge--error { background: var(--red-2); } .badge--ux { background: var(--pink); } .badge--contenido { background: var(--amber-2); }
.badge--trafico { background: var(--blue-2); } .badge--conversion { background: var(--lime-2); }
.badge--nueva { background: #fff; } .badge--en_curso { background: var(--amber-2); } .badge--hecha { background: var(--ok-2); } .badge--descartada { background: var(--line); }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: 6px 8px; border-bottom: 2px solid var(--ink); white-space: nowrap; }
.table th button { all: unset; cursor: pointer; } .table th button:focus-visible { outline: 3px solid var(--pink); }
.table td { padding: 7px 8px; border-bottom: 1px solid var(--line); }
.table td.n, .table th.n { text-align: right; white-space: nowrap; }
.table tr.click { cursor: pointer; } .table tr.click:hover td { background: var(--bg); }
.table td.hot { color: var(--red); font-weight: 800; } .table td.cool { color: var(--ok); font-weight: 700; }
.path { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; max-width: 36ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.search { font: 14px var(--font); padding: 7px 10px; border: 2px solid var(--ink); border-radius: 10px; min-width: 220px; }

.action { border: 2px solid var(--ink); border-radius: var(--radius); background: #fff; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow); }
.action h3 { font-size: 20px; }
.action .meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 13px; color: var(--muted); }
.action p { margin: 0; max-width: 80ch; }
.action .ev { font-size: 12.5px; color: var(--muted); }
.action textarea { font: 14px var(--font); width: 100%; min-height: 60px; border: 2px solid var(--line); border-radius: 10px; padding: 8px; }
.ba { display: flex; gap: 16px; align-items: baseline; flex-wrap: wrap; background: var(--bg); border-radius: 10px; padding: 8px 12px; font-size: 13.5px; }
.ba b { font-family: var(--font-h); font-size: 22px; font-weight: 400; }

.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-weight: 700; font-size: 13.5px; }
.field input, .field select, .field textarea { font: 14px var(--font); padding: 8px 10px; border: 2px solid var(--ink); border-radius: 10px; background: #fff; }
.field .help { font-size: 12.5px; color: var(--muted); }
.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

.empty { padding: 24px; text-align: center; color: var(--muted); border: 2px dashed var(--line); border-radius: var(--radius); }
.alert { border: 2px solid var(--ink); border-radius: var(--radius); padding: 10px 14px; background: var(--amber-2); }
.alert--bad { background: var(--red-2); }
.toast { position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: 16px; background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 10px; z-index: 50; }

.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis text { font-size: 11px; fill: var(--muted); }
.chart .grid line { stroke: var(--line); }
.chart .tip { position: absolute; pointer-events: none; background: #fff; border: 2px solid var(--ink); border-radius: 8px; padding: 6px 8px; font-size: 12px; white-space: nowrap; box-shadow: 2px 3px 0 0 var(--ink); z-index: 2; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--ink-2); margin-bottom: 6px; }
.legend i { display: inline-block; width: 12px; height: 4px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.cohort td.c { text-align: center; font-weight: 700; }

.login { max-width: 420px; width: 100%; }
.login .brand { padding: 0 0 10px; }

@media (max-width: 860px) {
  .app, .app.is-collapsed { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 280px; transform: translateX(-102%); transition: transform .2s; padding: 14px; }
  .sidebar.open { transform: none; }
  .nav-toggle { display: none; }
  .nav-toggle.nav-x { display: grid; width: 34px; height: 34px; }
  body.nav-open { overflow: hidden; }
  body.nav-open .nav-scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(21, 32, 24, .4); }
  .is-collapsed .sidebar .lbl, .is-collapsed .sidebar .nav-group, .is-collapsed .sidebar .brand small { display: revert; }
  .is-collapsed .brand { display: block; } .is-collapsed .brand-row { flex-direction: row; }
  .is-collapsed .nav a, .is-collapsed .me-link { justify-content: flex-start; padding: 9px 10px; }
  .hdr { flex-wrap: wrap; gap: 8px 10px; padding: 8px max(14px, env(safe-area-inset-left)); }
  .hdr .hdr-menu { display: grid; } .hdr .hdr-brand { display: block; } .hdr-brand .brand { padding: 0; font-size: 26px; }
  .hdr-me__name, .hdr-me__chev { display: none; } .hdr-me { padding: 2px; }
  .hdr-search { order: 10; flex-basis: 100%; max-width: none; }
  .hdr-drop { position: fixed; left: 12px; right: 12px; top: 64px; width: auto; max-width: none; }
  .hdr-search__list { top: 116px; min-width: 0; }
  .main { padding: 16px max(16px, env(safe-area-inset-right)) 40px max(16px, env(safe-area-inset-left)); }
  h1 { font-size: 28px; }
}
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }
@media (prefers-reduced-motion: reduce) { .btn:hover, .btn:active { transform: none; } }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.checklist li { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px; align-items: start; }
.checklist .badge { justify-self: start; }
.cmd { display: block; margin-top: 6px; padding: 8px 10px; background: var(--ink); color: #fff; border-radius: 8px; font-size: 12.5px; overflow-wrap: anywhere; user-select: all; }
/* Interpretación: lectura del periodo, qué hacer esta semana y acciones (por qué / qué hacer / cómo medir) */
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); align-items: start; }
.findings { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.findings li { display: grid; grid-template-columns: 82px minmax(0, 1fr); gap: 10px; align-items: start; padding-top: 12px; border-top: 1px solid var(--line); }
.findings li:first-child { border-top: 0; padding-top: 0; }
.findings p { margin: 2px 0 0; }
.findings .badge { justify-self: start; }
.badge--tono-alerta { background: var(--red-2); } .badge--tono-bien { background: var(--ok-2); } .badge--tono-falta { background: var(--amber-2); } .badge--tono-info { background: var(--bg); }
.todo { display: grid; gap: 4px; padding: 10px 0; border-top: 1px solid var(--line); color: inherit; text-decoration: none; }
.todo:hover b { text-decoration: underline; }
.badge--effort1 { background: var(--lime); } .badge--effort2 { background: var(--lime-2); } .badge--effort3 { background: #fff; }
.sec-lbl { font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 4px; }
.why { background: var(--bg); border-radius: 10px; padding: 10px 12px; }
.tiles { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); margin-bottom: 6px; }
.tile b { display: block; font-family: var(--font-h); font-size: 28px; font-weight: 400; line-height: 1.05; font-variant-numeric: tabular-nums; }
.tile span { font-size: 13px; color: var(--ink-2); }
.note-box { background: var(--card); border: 2px dashed var(--line); border-radius: var(--radius); padding: 10px 14px; margin: 0 0 14px; font-size: 14px; color: var(--ink-2); }
h2.group { font-size: 22px; margin: 10px 0 0; }
/* Ajustes */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip { font-size: 13px; font-weight: 700; text-decoration: none; padding: 5px 12px; border: 1.5px solid var(--ink); border-radius: 999px; background: #fff; }
.chip:hover { background: var(--lime-2); }
.card.setting { margin-bottom: 16px; scroll-margin-top: calc(var(--hdr-h) + 12px); }
.setting__row { font: 800 13px var(--font); text-transform: none; letter-spacing: 0; margin: 14px 0 8px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--ink-2); }
.setting__row:first-of-type { border-top: 0; padding-top: 0; }
.cuts { display: grid; gap: 8px; margin: 6px 0 10px; }
.cut { display: grid; grid-template-columns: minmax(150px, 220px) minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 10px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--bg); }
.cut__id { display: flex; flex-direction: column; min-width: 0; }
.cut__dims { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.cut select { font: 13.5px var(--font); padding: 6px 8px; border: 2px solid var(--ink); border-radius: 8px; background: #fff; min-width: 0; }
.cut select:disabled { border-color: var(--line); color: var(--ink-2); }
.savebar { position: sticky; bottom: 0; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 0; background: linear-gradient(to top, var(--bg) 70%, transparent); }
[id^="sec-"] { scroll-margin-top: calc(var(--hdr-h) + 12px); }
.is-target { box-shadow: 0 0 0 4px var(--lime), var(--shadow) !important; transition: box-shadow .3s; }
@media (max-width: 860px) { .cut { grid-template-columns: 1fr; } .cut__dims { grid-template-columns: 1fr; } }
