/* Guardián backend: one small stylesheet for every page. No inline styles anywhere (strict CSP on the panels). */
:root {
  color-scheme: light dark;
  --bg: #f7f6f3; --surface: #ffffff; --text: #1c1b19; --muted: #5d5b55; --line: #dedbd3; --grid: #e8e6e0;
  --accent: #1f5fbf; --accent-text: #ffffff; --accent-soft: #e6eefb;
  --danger: #b3261e; --danger-soft: #fbe9e7; --ok: #1a7f37; --ok-soft: #e4f4e8; --warn: #8a5a00; --warn-soft: #fff3d6;
  --s1: #2a78d6; --s2: #eb6834;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141413; --surface: #1d1d1b; --text: #f2f1ec; --muted: #b4b2a8; --line: #36352f; --grid: #2e2d2a;
    --accent: #7db0ff; --accent-text: #0b0b0b; --accent-soft: #1b2a44;
    --danger: #ff9b92; --danger-soft: #3a1f1c; --ok: #78d893; --ok-soft: #17301f; --warn: #f0b955; --warn-soft: #3a2d10;
    --s1: #3987e5; --s2: #d95926;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
main, .top-in { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
main { padding-bottom: 48px; }
h1 { font-size: 1.7rem; line-height: 1.2; margin: 24px 0 8px; }
h2 { font-size: 1.25rem; margin: 32px 0 8px; }
h3 { font-size: 1.05rem; margin: 0 0 4px; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; }
.top { background: var(--surface); border-bottom: 1px solid var(--line); }
.top-in { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 20px; min-height: 52px; }
.brand { font-weight: 700; color: var(--text); text-decoration: none; margin-right: 8px; }
.top nav { display: flex; flex-wrap: wrap; gap: 0 20px; order: 3; flex-basis: 100%; }
.top form { order: 2; margin-left: auto; }
@media (min-width: 720px) { .top nav { order: 2; flex: 1 1 auto; } .top form { order: 3; margin-left: 0; } }
.top nav a { color: var(--text); text-decoration: none; padding: 12px 0; border-bottom: 3px solid transparent; }
.top nav a[aria-current="page"] { border-bottom-color: var(--accent); font-weight: 600; }
.top form { margin: 0; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin: 12px 0; }
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; }
.tile .n { font-size: 2rem; font-weight: 700; line-height: 1.1; }
.tile .l { color: var(--muted); font-size: .9rem; }
.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .93rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .85rem; white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.blocked td { background: var(--danger-soft); }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--accent-soft); color: var(--accent); }
.badge.bad { background: var(--danger-soft); color: var(--danger); }
.badge.good { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.bad { color: var(--danger); }
.good { color: var(--ok); }

label { display: block; font-weight: 600; margin: 12px 0 4px; }
input[type=text], input[type=password], input[type=email], input[type=number], textarea, select {
  width: 100%; max-width: 520px; padding: 10px 12px; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--muted); border-radius: 8px;
}
textarea { max-width: 100%; min-height: 160px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9rem; }
input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 2px;
}
button, .button {
  display: inline-block; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; text-align: center;
  padding: 10px 18px; border-radius: 10px; border: 2px solid var(--accent); background: var(--accent); color: var(--accent-text);
}
button.secondary, .button.secondary { background: transparent; color: var(--accent); }
button.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
button.link { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; font-weight: 400; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.hint { color: var(--muted); font-size: .9rem; margin: 4px 0; }
.alert { padding: 12px 16px; border-radius: 10px; margin: 12px 0; border: 1px solid var(--line); }
.alert.error { background: var(--danger-soft); border-color: var(--danger); }
.alert.ok { background: var(--ok-soft); border-color: var(--ok); }
.alert.warn { background: var(--warn-soft); border-color: var(--warn); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---- charts (inline SVG; see charts.py) ---- */
figure.chart { margin: 16px 0; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
figure.chart figcaption p { margin: 0; font-size: .9rem; }
.chart-svg { width: 100%; height: auto; display: block; margin-top: 8px; }
.chart-svg .grid { stroke: var(--grid); stroke-width: 1; }
.chart-svg .tick { fill: var(--muted); font-size: 11px; }
.chart-svg .label { fill: var(--text); font-size: 12px; }
.chart-svg .value { fill: var(--text); font-size: 12px; font-variant-numeric: tabular-nums; }
.chart-svg .hit { fill: transparent; }
.chart-svg .hit:hover { fill: var(--text); fill-opacity: .07; }
.mark.s1 { fill: var(--s1); } .mark.s2 { fill: var(--s2); }
.line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.line.s1 { stroke: var(--s1); } .line.s2 { stroke: var(--s2); }
.dot { stroke: var(--surface); stroke-width: 2; }
.dot.s1 { fill: var(--s1); } .dot.s2 { fill: var(--s2); }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 0; margin: 8px 0 0; font-size: .9rem; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.swatch.s1 { background: var(--s1); } .swatch.s2 { background: var(--s2); }
details.tableview { margin-top: 8px; font-size: .9rem; }
details.tableview summary { cursor: pointer; color: var(--accent); }

/* ---- family panel: bigger and calmer ---- */
body.familia { font-size: 20px; }
body.familia h1 { font-size: 2rem; }
body.familia .top-in { min-height: 64px; }
body.familia button, body.familia .button { font-size: 1.05rem; padding: 14px 22px; min-height: 52px; }
body.familia input[type=text], body.familia input[type=password], body.familia select { font-size: 1.2rem; padding: 14px; }
body.familia .status { display: flex; gap: 14px; align-items: flex-start; }
body.familia .status .icon { font-size: 2rem; line-height: 1; }
.levels { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.level { border: 2px solid var(--line); border-radius: 12px; padding: 14px; background: var(--surface); }
.level.current { border-color: var(--accent); background: var(--accent-soft); }
.level p { margin: 6px 0 12px; font-size: .9em; }
.alerts { list-style: none; padding: 0; margin: 0; }
.alerts li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.alerts li:last-child { border-bottom: 0; }
.det { padding: 12px 0; border-bottom: 1px solid var(--line); }
.det:last-of-type { border-bottom: 0; }
.det .t { font-weight: 600; }
.det .m { font-size: .85em; color: var(--muted); margin: 2px 0 8px; }
details.cat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 0 16px; margin: 10px 0; }
details.cat > summary { cursor: pointer; padding: 14px 0; font-weight: 700; }
details.cat form { padding-bottom: 14px; }

/* ---- public landing placeholder ---- */
body.public main { max-width: 760px; }
.hero { padding: 40px 0 8px; }
.hero h1 { font-size: 2.3rem; }
.hero p { font-size: 1.2rem; }
footer.foot { max-width: 1100px; margin: 0 auto; padding: 24px 16px 40px; color: var(--muted); font-size: .9rem; }
.policy h2 { margin-top: 28px; }
.policy li { margin: 4px 0; }

/* ---- beta overview ---- */
.tile.attn { border-color: var(--danger); background: var(--danger-soft); }
.tile.attn .n { color: var(--danger); }
tr.attn td { background: var(--danger-soft); }
tr.attn td:first-child { box-shadow: inset 4px 0 0 var(--danger); }
tr.warn td:first-child { box-shadow: inset 4px 0 0 var(--warn); }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.pills a { padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; color: var(--text); }
.pills a[aria-current="true"] { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
ul.flags { margin: 0; padding-left: 18px; }

/* v1.10: the alert story under an alert in the admin timelines */
ol.story { margin: .3em 0 0; padding-left: 1.4em; font-size: .85em; color: var(--muted); }
ol.story li { margin: 0; }

/* ---- tablero (/admin/tablero): categorical slots 3-5 + a neutral, panels in a grid (one column on a phone) ---- */
:root { --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s0: #b9b6ad; --track: #efede8; }
@media (prefers-color-scheme: dark) { :root { --s3: #199e70; --s4: #c98500; --s5: #d55181; --s0: #5c5a53; --track: #262624; } }
.mark.s3 { fill: var(--s3); } .mark.s4 { fill: var(--s4); } .mark.s5 { fill: var(--s5); } .mark.s0 { fill: var(--s0); }
.line.s3 { stroke: var(--s3); } .dot.s3 { fill: var(--s3); }
.swatch.s3 { background: var(--s3); } .swatch.s4 { background: var(--s4); } .swatch.s5 { background: var(--s5); } .swatch.s0 { background: var(--s0); }
body.tb main { max-width: 1280px; }
.tb-h { margin-top: 28px; }
.tb-filters .tb-fields { display: grid; gap: 0 12px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.tb-filters label { margin-top: 8px; font-size: .9rem; }
.tb-filters select { max-width: 100%; }
.tb-filters label.check { font-weight: 400; display: flex; gap: 8px; align-items: center; }
.tb-filters label.check input { width: 20px; height: 20px; }
ul.chips { list-style: none; padding: 0; margin: 8px 0; display: flex; flex-wrap: wrap; gap: 6px; }
ul.chips li { background: var(--accent-soft); border-radius: 999px; padding: 2px 4px 2px 12px; font-size: .9rem; }
ul.chips a { display: inline-block; min-width: 28px; text-align: center; text-decoration: none; font-weight: 700; }
.tb-kpis { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.tb-kpis .tile .n { font-size: 2.4rem; font-variant-numeric: tabular-nums; }
.tb-grid { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .tb-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .tb-grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; min-width: 0; }
.panel > h3 { margin: 0; }
.panel > .sub { color: var(--muted); font-size: .88rem; margin: 2px 0 10px; }
.panel figure.chart { margin: 0; padding: 0; border: 0; background: none; }
.tb-big { font-size: 1.1rem; margin: 0 0 8px; }
.tb td.mono { white-space: nowrap; }
.tb-grid.tb-wide { grid-template-columns: minmax(0, 1fr); margin-bottom: 12px; }
.badge.neutral { background: var(--track); color: var(--muted); }
ol.bars { list-style: none; padding: 0; margin: 8px 0 0; }
ol.bars li { margin: 0 0 10px; }
.bar-l { display: flex; justify-content: space-between; gap: 12px; font-size: .92rem; line-height: 1.3; }
.bar-name { min-width: 0; overflow-wrap: anywhere; }
.bar-note { display: block; color: var(--muted); font-size: .8rem; }
.bar-v { white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 600; }
.bar-t { display: block; width: 100%; height: 10px; margin-top: 3px; }
.bar-t .track { fill: var(--track); }
.bar-t .mark { stroke: var(--surface); stroke-width: 2px; vector-effect: non-scaling-stroke; }
@media (max-width: 600px) {
  .tb .chart-svg .tick { font-size: 17px; }
  .tb .chart-svg { overflow: visible; }
  .tb h1 { font-size: 1.45rem; }
}
/* ---- /baja and /arrepentimiento (Disp. 954/2025): big, obvious buttons ---- */
input[type=date] { width: 100%; max-width: 520px; padding: 10px 12px; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--muted); border-radius: 8px; }
button.big, .button.big { font-size: 1.1rem; padding: 14px 24px; min-height: 52px; }
.code-big { font-size: 1.4rem; letter-spacing: .05em; }
footer.foot nav.legal a { white-space: nowrap; }
.top-legal { font-size: .9rem; margin-left: auto; }
.top-legal a { white-space: nowrap; }
footer.foot .support { margin: 8px 0 0; }
