/* SENTRA frontend — design system from the claude.ai/design mockups.
   Light console: #EDF2F8 canvas, white 240px sidebar, 64px header.
   Role accents: SUPER_ADMIN purple (#7C5CFC), ORG_ADMIN/SUPERVISOR cyan (#12A0DD).
   Semantic colors are sacred: green=ok/validada, amber=warn/observada, red=danger. */
:root {
  --ink: #16273d;
  --ink-soft: #5c7188;
  --ink-faint: #93a3b8;
  --canvas: #edf2f8;
  --surface: #ffffff;
  --line: #dce5f0;
  --line-soft: #ebf0f7;
  --line-strong: #cbd8e8;
  --thead: #f3f7fc;
  --input-bg: #f3f7fc;

  --accent: #12a0dd;        /* cyan (org/supervisor) */
  --accent-ink: #0a5e86;
  --accent-deep: #0a76a6;
  --accent-soft: #e7f4fb;
  --accent-border: #bfe4f6;

  --purple: #7c5cfc;        /* platform console */
  --purple-ink: #5b32c9;
  --purple-deep: #6d3ee8;
  --purple-soft: #f0ecfe;
  --purple-border: #e0d6fc;

  --ok: #16a34a; --ok-bright: #22c55e; --ok-soft: #ecfdf3; --ok-border: #c6f0d3; --ok-ink: #15803d;
  --warn: #d97706; --warn-ink: #b54708; --warn-soft: #fffbeb; --warn-border: #fde0a8; --warn-soft2: #fff6e6;
  --danger: #b42318; --danger-soft: #fef2f2; --danger-soft2: #feecec; --danger-border: #f7c9c9;

  /* vote strength (sacred) */
  --v-hard: #22c55e; --v-soft: #84cc16; --v-float: #f59e0b; --v-diff: #f97316; --v-imp: #ef4444; --v-none: #64748b;

  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --shadow: 0 1px 2px rgba(20,40,70,.04), 0 6px 16px rgba(20,40,70,.05);
  --shadow-pop: -12px 0 40px rgba(20,40,70,.12);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--canvas); color: var(--ink); font-family: var(--font); font-size: 14px; }
.tnum { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum' 1; }
a { color: var(--accent-deep); text-decoration: none; }
a:hover { color: var(--accent); }
input:focus, button:focus-visible, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
[data-role="SUPER_ADMIN"] input:focus, [data-role="SUPER_ADMIN"] button:focus-visible { outline-color: var(--purple); }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 6px; border: 3px solid transparent; background-clip: padding-box; }

.hidden { display: none !important; }

/* ===================== LOGIN ===================== */
.login-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow); padding: 28px; }
.brandline { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.brandmark { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; color: #fff;
  font-weight: 800; font-size: 17px; background: linear-gradient(135deg, #0a76a6, #12a0dd); }
.brandname { font-size: 17px; font-weight: 700; line-height: 1.15; }
.brandtag { font-size: 11px; color: var(--ink-soft); }

/* ===================== SHELL ===================== */
.shell { display: flex; height: 100dvh; overflow: hidden; }
.sidebar { width: 240px; flex: none; background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; }
.sb-logo { height: 64px; flex: none; display: flex; align-items: center; padding: 0 20px; gap: 10px;
  border-bottom: 1px solid var(--line-soft); }
.sb-scope { padding: 12px 16px 6px; font-size: 10px; letter-spacing: .1em; color: var(--ink-faint);
  font-weight: 700; text-transform: uppercase; }
.sb-scope .chip { display: inline-flex; align-items: center; gap: 6px; color: var(--purple-deep);
  background: var(--purple-soft); border: 1px solid var(--purple-border); border-radius: 20px; padding: 4px 10px; }
.sb-nav { flex: 1; padding: 6px 10px 10px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.sb-item { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left; border: none;
  cursor: pointer; font-family: inherit; font-size: 13px; font-weight: 500; padding: 9px 11px 9px 13px;
  border-radius: 6px; background: none; color: var(--ink-soft); }
.sb-item .ic { width: 18px; text-align: center; font-size: 14px; opacity: .9; }
.sb-item .lbl { flex: 1; }
.sb-item .bdg { background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; min-width: 17px;
  height: 17px; border-radius: 9px; display: flex; align-items: center; justify-content: center; padding: 0 5px; }
.sb-item.on { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600;
  box-shadow: inset 3px 0 0 var(--accent); }
[data-role="SUPER_ADMIN"] .sb-item.on { background: var(--purple-soft); color: var(--purple-ink);
  box-shadow: inset 3px 0 0 var(--purple); }
.sb-user { padding: 12px 16px; border-top: 1px solid var(--line-soft); display: flex; align-items: center; gap: 11px; }
.avatar { width: 34px; height: 34px; flex: none; border-radius: 50%; background: var(--accent-soft);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; color: var(--accent-deep); }
[data-role="SUPER_ADMIN"] .avatar { background: var(--purple-soft); color: var(--purple-deep); }
.sb-user .who { line-height: 1.3; min-width: 0; flex: 1; }
.sb-user .who b { font-size: 13px; font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user .who span { font-size: 11px; color: var(--ink-soft); }
.sb-user .out { border: none; background: none; color: var(--ink-faint); cursor: pointer; font-size: 15px; padding: 4px; }
.sb-user .out:hover { color: var(--danger); }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.head { height: 64px; flex: none; border-bottom: 1px solid var(--line); display: flex; align-items: center;
  justify-content: space-between; padding: 0 26px; background: var(--surface); gap: 14px; }
.head h1 { font-size: 17px; font-weight: 700; margin: 0; }
.head .sub { font-size: 12px; color: var(--ink-faint); margin-top: 1px; }
.head-right { display: flex; align-items: center; gap: 12px; }
.live-dot { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-soft);
  padding: 7px 12px; border: 1px solid var(--line); border-radius: 6px; }
.live-dot i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok-bright); }

.content { flex: 1; overflow-y: auto; padding: 24px 28px 40px; min-height: 0; }
.content--flush { padding: 0; overflow: hidden; display: flex; }

/* ===================== COMPONENTS ===================== */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.card-p { padding: 16px 18px; }
.card-title { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft);
  font-weight: 700; margin: 0 0 12px; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow);
  padding: 18px 18px 16px; border-left: 3px solid var(--kpi, var(--accent)); }
.kpi .l { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft); font-weight: 600; }
.kpi .v { font-size: 32px; font-weight: 700; margin: 10px 0 4px; line-height: 1; }
.kpi .d { font-size: 12px; color: var(--ink-faint); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: none; cursor: pointer;
  font-family: inherit; font-weight: 700; font-size: 13px; border-radius: 6px; height: 38px; padding: 0 16px; }
.btn-acc { background: var(--accent); color: #fff; }
.btn-purple { background: var(--purple); color: #fff; }
.btn-line { background: var(--surface); border: 1px solid var(--line); color: var(--ink-soft); font-weight: 600; }
.btn-line:hover { color: var(--accent-ink); border-color: var(--accent); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-ok { background: var(--ok-soft); border: 1px solid var(--ok-border); color: var(--ok-ink); }
.btn-warn { background: var(--warn-soft); border: 1px solid var(--warn-border); color: var(--warn-ink); }
.btn-dng { background: var(--danger-soft); border: 1px solid var(--danger-border); color: var(--danger); }
kbd { font-family: inherit; font-size: 11px; font-weight: 700; background: var(--ink); color: #fff;
  border-radius: 5px; padding: 2px 7px; line-height: 1; }

table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl thead tr { background: var(--thead); }
.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--ink-soft); font-weight: 600; padding: 12px 14px; }
.tbl td { padding: 13px 14px; border-top: 1px solid var(--line-soft); }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600;
  padding: 3px 10px; border-radius: 20px; border: 1px solid transparent; }
.badge--ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 9%, white); }
.badge--warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 9%, white); }
.badge--dng { color: var(--danger); background: var(--danger-soft2); }
.badge--mute { color: var(--ink-soft); background: var(--thead); }
.badge--purple { color: var(--purple-deep); background: var(--purple-soft); border-color: var(--purple-border); }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--ink-soft); font-weight: 600; margin-bottom: 7px; }
.field input, .field select, .field textarea { width: 100%; height: 40px; background: var(--input-bg);
  border: 1px solid var(--line); border-radius: 4px; color: var(--ink); padding: 0 12px; font-size: 14px; font-family: inherit; }
.field textarea { height: auto; min-height: 80px; padding: 10px 12px; resize: vertical; }
.fhint { font-size: 11px; color: var(--ink-faint); margin-top: 6px; }
.ferr { font-size: 12px; color: var(--danger); background: var(--danger-soft); border-radius: 6px;
  padding: 9px 11px; margin-top: 10px; white-space: pre-line; }
.fok { font-size: 12px; color: var(--ok-ink); background: var(--ok-soft); border-radius: 6px; padding: 9px 11px; margin-top: 10px; }

/* slide-over (SuperAdmin wizard etc.) */
.overlay { position: fixed; inset: 0; background: rgba(22,39,61,.28); backdrop-filter: blur(2px); z-index: 40; }
.slideover { position: fixed; top: 0; right: 0; bottom: 0; width: 480px; max-width: 94vw; background: var(--surface);
  border-left: 1px solid var(--line); z-index: 50; display: flex; flex-direction: column; box-shadow: var(--shadow-pop); }
.so-head { padding: 22px 26px 16px; border-bottom: 1px solid var(--line-soft); }
.so-body { flex: 1; overflow-y: auto; padding: 24px 26px; }
.so-foot { border-top: 1px solid var(--line-soft); padding: 16px 26px; display: flex; align-items: center;
  justify-content: space-between; background: #f8fafd; }

/* toast */
.toast { position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%); background: var(--ink); color: #fff;
  border-radius: 10px; padding: 12px 18px; font-size: 13px; font-weight: 600; z-index: 90; opacity: 0;
  pointer-events: none; transition: opacity .25s; box-shadow: 0 8px 30px rgba(20,40,70,.3); }
.toast.on { opacity: 1; }

/* supervisor queue split */
.split { flex: 1; display: flex; min-height: 0; width: 100%; }
.q-list { width: 360px; flex: none; background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0; }
.q-list-head { padding: 12px 16px; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center;
  justify-content: space-between; font-size: 12px; font-weight: 700; }
.q-scroll { flex: 1; overflow-y: auto; }
.q-row { padding: 13px 16px; border-bottom: 1px solid var(--thead); cursor: pointer;
  border-left: 3px solid transparent; background: var(--surface); }
.q-row.on { border-left-color: var(--accent); background: #f0f9fe; }
.q-risk { font-size: 20px; font-weight: 700; line-height: 1; }
.q-tag { font-size: 10.5px; font-weight: 700; border-radius: 5px; padding: 2px 7px; border: 1px solid; }
.q-detail { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.q-detail-scroll { flex: 1; overflow-y: auto; padding: 20px 24px 12px; }
.q-actions { flex: none; border-top: 1px solid var(--line); background: var(--surface); padding: 14px 24px; }
.meta-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.meta-grid .k { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-faint); font-weight: 600; }
.meta-grid .w { font-size: 12.5px; font-weight: 600; margin-top: 3px; }

/* charts */

/* map pages */
.map-full { flex: 1; position: relative; min-height: 0; }
.map-full .mapbox { position: absolute; inset: 0; }
.map-side { position: absolute; top: 16px; right: 16px; width: 290px; z-index: 5; }

/* team cards */
.team-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.stat3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.stat3 .s { background: #f7fafd; border: 1px solid var(--line-soft); border-radius: 6px; padding: 9px 10px; }
.stat3 .s b { font-size: 18px; font-weight: 700; display: block; }
.stat3 .s span { font-size: 10px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .03em; }

/* horizontal bar rows (custom-question analytics, distributions) */
.hbars { display: flex; flex-direction: column; gap: 9px; }
.hbar { display: grid; grid-template-columns: 130px 1fr 78px; align-items: center; gap: 10px; font-size: 12.5px; }
.hbar .lb { color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar .track { height: 12px; border-radius: 6px; background: var(--thead); overflow: hidden; }
.hbar .fill { height: 100%; border-radius: 6px; background: var(--accent); min-width: 3px; transition: width .35s ease; }
.hbar .val { text-align: right; color: var(--ink); font-weight: 700; }
.hbar .val .mut { color: var(--ink-faint); font-weight: 500; margin-left: 4px; }
/* Primera fila de la cola residual (otros / blanco-nulo / no sabe): separada del
   bloque de candidatos para que no se lea como el furgón de cola de la carrera. */
.hbar--tail { margin-top: 7px; padding-top: 11px; border-top: 1px dashed var(--line); }

/* spinner (every loading view) */
.spin-wrap { display: grid; place-items: center; padding: 54px 20px; }
.spinner { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--line-strong); border-top-color: var(--accent); animation: spin .7s linear infinite; }
.spin-wrap .lbl { margin-top: 12px; font-size: 12.5px; color: var(--ink-faint); }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--thead) 25%, var(--line-soft) 37%, var(--thead) 63%); background-size: 400% 100%; animation: sk 1.3s ease infinite; border-radius: 8px; }
@keyframes sk { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* map overlays: legend + basemap controls */
.map-legend { position: absolute; top: 14px; left: 14px; z-index: 6; background: rgba(255,255,255,.94); backdrop-filter: blur(4px); border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; box-shadow: var(--shadow); max-width: 210px; }
.map-legend h4 { margin: 0 0 8px; font-size: 10px; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-soft); font-weight: 700; }
.map-legend .lg-row { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--ink); padding: 2px 0; }
.map-legend .sw { width: 13px; height: 13px; border-radius: 4px; flex: none; }
.map-legend .lg-sub { margin-top: 9px; padding-top: 8px; border-top: 1px solid var(--line-soft); }
/* Filas de la leyenda que además filtran. Se pulsan, así que tienen que
   parecer pulsables sin dejar de leerse como una leyenda. */
.map-legend .lg-btn { width: 100%; border: 0; background: none; font: inherit; font-size: 11.5px;
  color: var(--ink); cursor: pointer; text-align: left; border-radius: 6px; padding: 3px 4px; margin-left: -4px; }
.map-legend .lg-btn:hover { background: var(--thead); }
.map-legend .lg-all { width: 100%; margin-top: 7px; border: 1px solid var(--line); background: none;
  font: inherit; font-size: 11px; font-weight: 700; color: var(--ink-soft); cursor: pointer;
  border-radius: 6px; padding: 5px 8px; }
.map-legend .lg-all:hover { border-color: var(--accent); color: var(--accent-ink); }
.map-ctrl { position: absolute; bottom: 14px; left: 14px; z-index: 6; display: flex; gap: 6px; background: rgba(255,255,255,.94); backdrop-filter: blur(4px); border: 1px solid var(--line); border-radius: 10px; padding: 5px; box-shadow: var(--shadow); }
.map-ctrl button { border: 0; background: none; font: inherit; font-size: 11.5px; font-weight: 600; color: var(--ink-soft); padding: 6px 10px; border-radius: 7px; cursor: pointer; }
.map-ctrl button.on { background: var(--accent); color: #fff; }
.map-ctrl .sep { width: 1px; background: var(--line); margin: 4px 2px; }

/* question / answer reading blocks (supervisor) */
.qa-list { display: flex; flex-direction: column; }
.qa-item { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.qa-item .q { color: var(--ink-soft); }
.qa-item .a { font-weight: 700; text-align: right; }

/* ---- campo de contraseña con ojo (mostrar / ocultar) ---- */
.pwd-wrap { position: relative; display: block; }
.pwd-wrap > input { width: 100%; padding-right: 42px; }
.pwd-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; display: grid; place-items: center; border: 0; background: none; color: var(--ink-faint); cursor: pointer; border-radius: 7px; padding: 0; }
.pwd-eye:hover { color: var(--accent-deep); background: var(--accent-soft); }
.pwd-eye svg { width: 18px; height: 18px; }

/* ---- constructor de encuestas (estilo Google Forms) ---- */
.qb-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.qb-add { height: 34px; padding: 0 13px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft); border-radius: 9px; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; transition: border-color .15s, color .15s, background .15s; }
.qb-add:hover { border-color: var(--accent); color: var(--accent-deep); background: var(--accent-soft); }

.qcard { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px 14px; margin-bottom: 14px; box-shadow: 0 1px 2px rgba(15,32,54,.04); transition: border-color .15s, box-shadow .15s; }
.qcard:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
/* Franja de color a la izquierda: marca la tarjeta activa, como en Forms. */
.qcard::before { content: ''; position: absolute; left: 0; top: 14px; bottom: 14px; width: 4px; border-radius: 0 4px 4px 0; background: transparent; transition: background .15s; }
.qcard:focus-within::before { background: var(--accent); }
.qcard .qc-grip { text-align: center; color: var(--line-strong); font-size: 12px; letter-spacing: 2px; line-height: 1; margin-bottom: 8px; cursor: grab; user-select: none; }
.qcard .qc-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.qcard .qc-n { font-size: 11px; font-weight: 800; color: var(--ink-faint); }
.qcard .qc-type { font-size: 11px; font-weight: 700; color: var(--accent-deep); background: var(--accent-soft); border-radius: 20px; padding: 3px 9px; }
.qcard .qc-acts { margin-left: auto; display: flex; gap: 2px; }
.qcard .qc-acts button { width: 30px; height: 30px; display: grid; place-items: center; border: 0; background: none; color: var(--ink-faint); border-radius: 7px; cursor: pointer; font-size: 14px; padding: 0; }
.qcard .qc-acts button:hover { background: var(--thead); color: var(--ink); }
.qcard .qc-acts button:disabled { opacity: .3; cursor: default; }
/* Enunciado y descripción: subrayado sobrio, sin caja, como Google Forms. */
.qcard .qc-label { width: 100%; border: 0; border-bottom: 1px solid var(--line); background: transparent; font: inherit; font-size: 15px; font-weight: 600; color: var(--ink); padding: 7px 2px; outline: none; }
.qcard .qc-label:focus { border-bottom: 2px solid var(--accent); padding-bottom: 6px; }
.qcard .qc-desc { width: 100%; border: 0; border-bottom: 1px solid transparent; background: transparent; font: inherit; font-size: 12.5px; color: var(--ink-soft); padding: 5px 2px; outline: none; margin-top: 2px; }
.qcard .qc-desc:focus { border-bottom-color: var(--line); }
.qcard .qc-desc::placeholder { font-style: italic; }

.qopt { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.qopt .glyph { width: 16px; height: 16px; flex: none; border: 2px solid var(--line-strong); background: transparent; }
.qopt .glyph.radio { border-radius: 50%; }
.qopt .glyph.check { border-radius: 4px; }
.qopt input.opt { flex: 1; border: 0; border-bottom: 1px solid transparent; background: transparent; font: inherit; font-size: 13.5px; color: var(--ink); padding: 5px 2px; outline: none; }
.qopt input.opt:focus { border-bottom-color: var(--accent); }
.qopt .rm { width: 28px; height: 28px; border: 0; background: none; color: var(--ink-faint); cursor: pointer; border-radius: 6px; font-size: 15px; padding: 0; }
.qopt .rm:hover { background: var(--danger-soft); color: var(--danger); }
.qopt .rm:disabled { opacity: .25; cursor: default; }
.qadd-opt { border: 0; background: none; color: var(--accent-deep); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; padding: 7px 2px; }
.qadd-opt:hover { text-decoration: underline; }

.qcard .qc-foot { display: flex; align-items: center; gap: 14px; margin-top: 12px; padding-top: 11px; border-top: 1px solid var(--line-soft); }
.qcard .qc-req { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-soft); cursor: pointer; margin-left: auto; }
.qb-empty { border: 2px dashed var(--line); border-radius: 12px; padding: 30px 20px; text-align: center; color: var(--ink-faint); font-size: 13px; }

/* ===================== RESPONSIVE =====================
   El panel se diseñó para un monitor ancho y ahí se quedó: una sola parada en
   1100px que arreglaba cuatro cosas. En un portátil de 13" o media pantalla, las
   rejillas de columnas fijas —KPIs a cuatro, tarjetas del centro de mando a
   tres— empujaban el contenido fuera de la tarjeta.

   La regla de aquí en adelante: las rejillas de tarjetas se declaran con
   `auto-fit`/`minmax` para que decidan solas cuántas columnas caben, y estos
   cortes se reservan para lo que no puede resolverse solo (el ancho de la barra
   lateral, el panel flotante del mapa, las tablas). */

/* Contenido + panel lateral: el patrón de media docena de pantallas (equipo,
   partidos, encuesta, asignaciones, reportes). Vivía como estilo EN LÍNEA, y un
   estilo en línea gana a cualquier media query — por eso estas pantallas seguían
   con dos columnas fijas por estrecha que fuera la ventana. */
.side-grid { display: grid; grid-template-columns: 1fr 320px; gap: 16px; align-items: start; }
.side-grid--sm { grid-template-columns: 1fr 300px; }
.side-grid--three { grid-template-columns: 280px 1fr 300px; }

@media (max-width: 1250px) {
  /* El constructor de encuestas es lista | editor | vista previa. Al no caber
     las tres, la vista previa pasa a ocupar el ancho completo debajo en vez de
     apretujarse en la columna de la lista, que es donde caería sola. */
  .side-grid--three { grid-template-columns: 280px 1fr; }
  .side-grid--three > :nth-child(3) { grid-column: 1 / -1; }
}
@media (max-width: 980px) {
  .side-grid, .side-grid--sm, .side-grid--three { grid-template-columns: 1fr; }
}

@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .team-grid { grid-template-columns: 1fr; }
  .sidebar { width: 200px; }
  .hbar { grid-template-columns: 100px 1fr 64px; }
  .meta-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 820px) {
  /* La barra lateral pasa a ser una tira de iconos: el contenido necesita el
     ancho más que las etiquetas del menú, que ya llevan icono. */
  .sidebar { width: 58px; }
  .sidebar .lbl, .sidebar .sb-sec, .sidebar .sb-scope, .sidebar .who { display: none; }
  .sb-item { justify-content: center; padding-left: 0; padding-right: 0; gap: 0; }
  .sb-logo { padding: 0 12px; justify-content: center; }
  .sb-user { padding: 12px 10px; justify-content: center; }

  .head { height: auto; min-height: 58px; padding: 10px 16px; flex-wrap: wrap; }
  .head h1 { font-size: 15px; }
  .content { padding: 16px 14px 32px; }

  .kpis { grid-template-columns: 1fr; gap: 12px; }
  .kpi .v { font-size: 26px; }
  .meta-grid { grid-template-columns: 1fr 1fr; }
  .stat3 { grid-template-columns: 1fr; }

  /* La etiqueta ya no compite con la barra: se apila encima, a lo ancho. */
  .hbar { grid-template-columns: 1fr auto; grid-template-areas: "lb val" "track track"; gap: 4px 10px; }
  .hbar .lb { grid-area: lb; white-space: normal; }
  .hbar .val { grid-area: val; }
  .hbar .track { grid-area: track; }

  /* El panel del mapa dejaba de caber flotando sobre un mapa estrecho. */
  .map-side { position: static; width: auto; margin: 12px; }
  .map-full { display: flex; flex-direction: column; }
  .map-full .mapbox { position: relative; inset: auto; height: 60vh; flex: none; }

  /* Lista + detalle (cola de revisión) no caben lado a lado. */
  .split { flex-direction: column; overflow-y: auto; }

  /* Una tabla no se puede encoger sin volverse ilegible. Se desplaza DENTRO de
     su tarjeta en vez de estirar la página entera, que es lo que descuadraba
     todo lo demás. */
  table.tbl { display: block; overflow-x: auto; white-space: nowrap; }
}
