/* Meet Music Admin - Sistema de Diseño y Estilos Modulares */
:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface2: #f1f5f9;
  --surface3: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  
  --accent: #f0641e;
  --accent-hover: #d95314;
  --accent-soft: #ffedd5;
  --accent-glow: rgba(240, 100, 30, 0.15);

  --ok: #10b981;
  --ok-soft: #d1fae5;
  --warn: #f59e0b;
  --warn-soft: #fef3c7;
  --bad: #ef4444;
  --bad-soft: #fee2e2;
  --info: #3b82f6;
  --info-soft: #dbeafe;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0f19;
    --surface: #111827;
    --surface2: #1f2937;
    --surface3: #374151;
    --text: #f9fafb;
    --muted: #9ca3af;
    --line: #1f2937;

    --accent: #f97316;
    --accent-hover: #ea580c;
    --accent-soft: rgba(249, 115, 22, 0.15);
    --accent-glow: rgba(249, 115, 22, 0.25);

    --ok: #34d399;
    --ok-soft: rgba(52, 211, 153, 0.15);
    --warn: #fbbf24;
    --warn-soft: rgba(251, 191, 36, 0.15);
    --bad: #f87171;
    --bad-soft: rgba(248, 113, 113, 0.15);
    --info: #60a5fa;
    --info-soft: rgba(96, 165, 250, 0.15);
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  }
}

:root[data-theme="dark"] {
  --bg: #0b0f19;
  --surface: #111827;
  --surface2: #1f2937;
  --surface3: #374151;
  --text: #f9fafb;
  --muted: #9ca3af;
  --line: #1f2937;

  --accent: #f97316;
  --accent-hover: #ea580c;
  --accent-soft: rgba(249, 115, 22, 0.15);
  --accent-glow: rgba(249, 115, 22, 0.25);

  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, 0.15);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.15);
  --bad: #f87171;
  --bad-soft: rgba(248, 113, 113, 0.15);
  --info: #60a5fa;
  --info-soft: rgba(96, 165, 250, 0.15);
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-padding-top: 80px; scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14.5px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--accent); text-decoration: none; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
[hidden] { display: none !important; }

/* Tipografía */
h1 { font-size: clamp(26px, 3.5vw, 36px); font-weight: 800; letter-spacing: -0.03em; line-height: 1.15; color: var(--text); }
h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
h3 { font-size: 16px; font-weight: 700; }
.lead { color: var(--muted); font-size: 15.5px; max-width: 750px; line-height: 1.6; margin-top: 8px; }
.sub { color: var(--muted); font-size: 14px; margin: 4px 0 16px; }

/* Cabecera Sticky */
header.top {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  transition: border-color .2s;
}
.top-in {
  max-width: 1280px; margin: 0 auto;
  padding: 10px 20px;
  display: flex; gap: 14px; align-items: center;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 18px; letter-spacing: -0.02em;
}
/* El icono de Meet Music (img/logo.png), que ya trae sus esquinas. */
.brand .c {
  width: 32px; height: 32px; display: block; flex-shrink: 0;
  border-radius: 22%; box-shadow: 0 2px 8px var(--accent-glow);
}
nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; flex: 1; padding: 2px 0; }
nav a {
  padding: 7px 12px; border-radius: var(--radius-sm);
  color: var(--muted); font-size: 13.5px; font-weight: 500;
  white-space: nowrap; transition: all .15s ease;
}
nav a:hover { background: var(--surface2); color: var(--text); }
nav a.active { background: var(--surface2); color: var(--accent); font-weight: 600; }

.user-pill {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 12px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-full);
  font-size: 13px; font-weight: 600;
}
.user-avatar {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-size: 11px;
}

.icon-btn {
  width: 38px; height: 38px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface);
  color: var(--text); display: grid; place-items: center;
  font-size: 15px; transition: all .15s; flex: none;
}
.icon-btn:hover { background: var(--surface2); border-color: var(--accent); }

.burger { display: none; margin-left: auto; }
.burger span, .burger span::before, .burger span::after {
  display: block; width: 18px; height: 2px; border-radius: 2px;
  background: var(--text); position: relative; transition: .2s;
}
.burger span::before, .burger span::after { content: ""; position: absolute; left: 0; }
.burger span::before { top: -6px; } .burger span::after { top: 6px; }
.burger[aria-expanded="true"] span { background: transparent; }
.burger[aria-expanded="true"] span::before { transform: translateY(6px) rotate(45deg); }
.burger[aria-expanded="true"] span::after { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 1040px) {
  .burger { display: grid; }
  nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; gap: 4px; padding: 12px 20px;
    background: var(--surface); border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-lg);
  }
  nav.open { display: flex; }
}

/* Layout Principal */
main { max-width: 1280px; width: 100%; margin: 0 auto; padding: 24px 20px 80px; flex: 1; }
section { margin-bottom: 56px; }
.sec-h {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; flex-wrap: wrap; margin-bottom: 6px;
}

/* Componentes Base */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 600;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--text); transition: all .15s ease; white-space: nowrap;
}
.btn:hover { background: var(--surface2); border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 2px 8px var(--accent-glow); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.small { padding: 5px 11px; font-size: 12.5px; }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); border-color: var(--bad); }
.btn.danger.sure { background: var(--bad); color: #fff; border-color: var(--bad); }

.banner {
  padding: 12px 18px; border-radius: var(--radius);
  background: var(--warn-soft); color: var(--warn);
  font-size: 14px; font-weight: 500; margin-bottom: 24px;
  border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent);
}

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600; padding: 3px 9px;
  border-radius: var(--radius-full); background: var(--surface2); color: var(--muted);
}
.pill.l { color: #fff; background: var(--lc); }
.st-pendiente { background: var(--info-soft); color: var(--info); }
.st-en_curso { background: var(--warn-soft); color: var(--warn); }
.st-hecho { background: var(--ok-soft); color: var(--ok); }
.st-idea { background: var(--surface2); color: var(--muted); }
.st-propuestas { background: var(--accent-soft); color: var(--accent); }

/* Dashboard / KPIs */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin: 20px 0; }
.kpi { padding: 16px 20px; }
.kpi b { display: block; font-size: 32px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
.kpi span { color: var(--muted); font-size: 13px; font-weight: 500; margin-top: 4px; display: block; }

.bar { height: 10px; border-radius: var(--radius-full); background: var(--surface2); overflow: hidden; display: flex; }
.bar i { display: block; height: 100%; transition: width .3s ease; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--muted); margin-top: 10px; }
.legend span::before {
  content: ""; display: inline-block; width: 10px; height: 10px;
  border-radius: 3px; margin-right: 6px; background: var(--c); vertical-align: -1px;
}

/* Tablero Drag & Drop */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0 0 18px; }
.toolbar input[type=search] {
  flex: 1; min-width: 220px; padding: 8px 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font: inherit;
}
.toolbar input[type=search]:focus { outline: 2px solid var(--accent); }
.chip {
  border: 1px solid var(--line); background: var(--surface);
  padding: 6px 14px; border-radius: var(--radius-full);
  cursor: pointer; font-size: 13px; font-weight: 500; transition: all .15s;
}
.chip:hover { border-color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); font-weight: 600; }

.board { display: grid; grid-template-columns: repeat(5, minmax(260px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 12px; }
.col { background: var(--surface2); border-radius: var(--radius); padding: 12px; min-width: 260px; display: flex; flex-direction: column; }
.col.over { outline: 2px dashed var(--accent); outline-offset: -2px; }
.col-h { display: flex; justify-content: space-between; align-items: center; padding: 2px 4px 10px; font-weight: 700; font-size: 14px; }
.col-h span { color: var(--muted); font-weight: 500; margin-left: 6px; font-size: 12.5px; }
.col-list { min-height: 50px; flex: 1; }
.tc {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 8px;
  cursor: grab; display: block; width: 100%; text-align: left;
  box-shadow: var(--shadow-sm); transition: transform .1s, border-color .15s;
}
.tc:hover { border-color: var(--accent); }
.tc.dragging { opacity: .3; cursor: grabbing; }
.tc .tt { font-size: 14px; font-weight: 600; line-height: 1.35; }
.tc .meta { display: flex; gap: 6px; margin-top: 8px; align-items: center; flex-wrap: wrap; }
.add-card {
  border: 1px dashed var(--line); background: none; border-radius: var(--radius-sm);
  padding: 9px; color: var(--muted); cursor: pointer; width: 100%; font-size: 13px; font-weight: 600;
  transition: all .15s;
}
.add-card:hover { color: var(--text); border-color: var(--accent); background: var(--surface); }

/* Pantallas y Capturas */
.shots-group { margin: 28px 0 10px; font-size: 12.5px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: var(--muted); }
.screen { padding: 20px; margin-bottom: 16px; }
.screen-h { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; }
.refs { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.screen > p { margin: 8px 0 16px; color: var(--muted); font-size: 14px; max-width: 900px; white-space: pre-line; }
.trio { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 2fr); gap: 16px; align-items: end; }
.shot { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 0; width: 100%; }
.shot figcaption { font-size: 13px; font-weight: 600; display: flex; gap: 8px; align-items: center; }
.frame { position: relative; width: 100%; overflow: hidden; background: var(--surface2); border: 1px solid var(--line); cursor: pointer; transition: outline .15s; }
.frame.ios { max-width: 180px; aspect-ratio: 9/19.5; border-radius: 28px; border: 5px solid #1c1917; }
.frame.android { max-width: 180px; aspect-ratio: 9/20; border-radius: 18px; border: 5px solid #292524; }
.frame.web { aspect-ratio: 16/10; border-radius: 10px; padding-top: 24px; }
.frame.web::before {
  content: "● ● ●"; position: absolute; top: 0; left: 0; right: 0; height: 24px;
  font-size: 9px; letter-spacing: 2px; color: #a8a29e; padding: 5px 12px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.frame img { display: block; width: 100%; height: 100%; object-fit: cover; }
.frame.drop { outline: 3px dashed var(--accent); outline-offset: -3px; }
.ph {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center;
  gap: 6px; padding: 14px; text-align: center;
  background: repeating-linear-gradient(135deg, transparent 0 10px, color-mix(in srgb, var(--line) 50%, transparent) 10px 11px);
}
.frame.web .ph { top: 24px; }
.ph b { font-size: 12px; color: var(--accent); text-transform: uppercase; letter-spacing: .06em; }
.ph span { font-size: 11.5px; color: var(--muted); line-height: 1.4; }
.linkish { border: 0; background: none; color: var(--muted); font-size: 12px; cursor: pointer; text-decoration: underline; padding: 0; }
.linkish:hover { color: var(--accent); }

/* Listas Limpias */
ul.clean { margin: 0; padding: 0; list-style: none; }
ul.clean li { padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 14.5px; display: flex; gap: 12px; align-items: flex-start; }
ul.clean li:last-child { border: 0; }
ul.clean li .tx { flex: 1; cursor: pointer; }
ul.clean li.done .tx { color: var(--muted); text-decoration: line-through; }
ul.clean input[type=checkbox] { margin-top: 4px; accent-color: var(--accent); width: 17px; height: 17px; cursor: pointer; }

.grid2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.parts { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.part { padding: 14px 16px; display: flex; gap: 12px; align-items: flex-start; cursor: pointer; text-align: left; width: 100%; }
.part:hover, .clickable:hover { border-color: var(--accent); }
.dot { flex: none; width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; }
.dot.ok { background: var(--ok); } .dot.parcial { background: var(--warn); } .dot.no { background: var(--muted); }
.func-h { display: flex; align-items: center; gap: 8px; margin: 18px 0 10px; font-size: 15px; }
.func-h::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.func-h span { color: var(--muted); font-weight: 500; }

.phase { padding: 18px 20px; margin-bottom: 14px; }
.phase-h { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.phase-h p { margin: 0; color: var(--muted); font-size: 14px; }
.phase .bar { margin: 12px 0 14px; }
.items { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 6px; }
.item { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: var(--radius-sm); font-size: 14px; cursor: pointer; border: 0; background: none; text-align: left; width: 100%; }
.item:hover { background: var(--surface2); }
.n { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; min-width: 34px; font-weight: 600; }
.item .t { flex: 1; min-width: 0; }

/* Formularios dinámicos y métricas */
.forms-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.form-card { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.form-card-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.form-card-h h3 { font-size: 17px; margin: 0; line-height: 1.3; }
.form-card p { margin: 0; color: var(--muted); font-size: 14px; }
.form-card .stats-badge {
  display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted);
  background: var(--surface2); padding: 5px 12px; border-radius: var(--radius-full); width: fit-content;
}
.form-card .stats-badge b { color: var(--text); font-size: 14px; font-weight: 700; }
.form-actions {
  display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 14px;
  border-top: 1px solid var(--line); flex-wrap: wrap;
}
.toggle-btn {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  background: none; border: 1px solid var(--line); border-radius: var(--radius-full);
  padding: 4px 12px; font-size: 12.5px; font-weight: 600; transition: all .15s;
}
.toggle-btn.active { background: var(--ok-soft); color: var(--ok); border-color: var(--ok); }
.toggle-btn.inactive { background: var(--bad-soft); color: var(--bad); border-color: var(--bad); }

.q-box { background: var(--surface2); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.q-box-h { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin-bottom: 12px; }
.q-box-opts { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.q-opt-row { display: flex; gap: 10px; align-items: center; }
.q-opt-input {
  flex: 1;
  font: inherit;
  font-size: 14.5px !important;
  font-weight: 500;
  padding: 10px 14px !important;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface) !important;
  color: var(--text) !important;
  transition: all .15s ease;
}
.q-opt-input:focus {
  outline: none;
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px var(--accent-glow) !important;
}
.q-opt-input::placeholder {
  color: var(--muted);
  opacity: 0.75;
}
.stat-bar-group { margin: 10px 0 14px; }
.stat-bar-header { display: flex; justify-content: space-between; font-size: 13.5px; margin-bottom: 5px; }
.stat-bar-bg { height: 9px; background: var(--surface2); border-radius: var(--radius-full); overflow: hidden; }
.stat-bar-fill { height: 100%; background: var(--accent); border-radius: var(--radius-full); transition: width .3s ease; }

/* Diálogo Modal */
dialog {
  border: 0; border-radius: var(--radius-lg); padding: 0;
  max-width: 680px; width: calc(100% - 32px);
  background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-lg); max-height: calc(100dvh - 40px);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(4px); }
dialog form { padding: 24px; display: flex; flex-direction: column; gap: 14px; }
dialog h3 { font-size: 20px; font-weight: 800; margin: 0; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 13px; color: var(--muted); font-weight: 600; }
.field input, .field select, .field textarea {
  font: inherit; padding: 10px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface) !important; color: var(--text) !important;
  transition: border-color .15s;
}
.field select option {
  background: var(--surface) !important;
  color: var(--text) !important;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow);
}
.field textarea { min-height: 180px; resize: vertical; line-height: 1.5; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.actions .grow { flex: 1; }
.meta-line { font-size: 12.5px; color: var(--muted); }

/* Pantalla Login Moderna (Gate) */
.gate {
  min-height: 100vh; display: grid; place-items: center; padding: 32px 16px;
  background: radial-gradient(circle at 50% 20%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 70%);
}
.gate .card {
  max-width: 440px; width: 100%; padding: 36px 32px;
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  border: 1px solid var(--line);
}
.gate-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; }
.gate-brand .c {
  width: 38px; height: 38px; display: block; flex-shrink: 0;
  border-radius: 22%; box-shadow: 0 4px 12px var(--accent-glow);
}
.gate-brand span { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.gate h1 { font-size: 24px; font-weight: 800; margin-bottom: 6px; }
.gate p { color: var(--muted); font-size: 14px; margin-bottom: 24px; line-height: 1.5; }


.input-group { position: relative; display: flex; align-items: center; margin-bottom: 14px; }
.input-group input { width: 100%; padding-right: 42px; }
.toggle-eye {
  position: absolute; right: 12px; background: none; border: 0;
  cursor: pointer; color: var(--muted); font-size: 16px; padding: 4px;
}
.toggle-eye:hover { color: var(--text); }

.gate .btn.primary { width: 100%; padding: 12px; font-size: 15px; margin-top: 4px; }
.gate .demo-btn {
  width: 100%; padding: 10px; margin-top: 10px;
  display: block; text-align: center; font-size: 13.5px;
}
.gate .msg { font-size: 13.5px; margin-top: 14px; text-align: center; }
.gate .msg.error { color: var(--bad); }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg);
  padding: 11px 20px; border-radius: var(--radius-full);
  font-size: 14px; font-weight: 600; z-index: 100;
  box-shadow: var(--shadow-lg); max-width: calc(100% - 32px);
  animation: toastIn .2s ease-out;
}
@keyframes toastIn { from { transform: translate(-50%, 12px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

footer { color: var(--muted); font-size: 13px; text-align: center; padding: 24px; border-top: 1px solid var(--line); }

@media (max-width: 760px) {
  .trio { grid-template-columns: 1fr 1fr; }
  .shot.web { grid-column: 1 / -1; }
  .board { grid-template-columns: repeat(5, 84vw); }
}

@media (max-width: 600px) {
  .form-editor-page main { padding: 18px 12px 56px; }
  .form-editor-page #root > .sec-h { align-items: stretch; }
  .form-editor-page #root > .sec-h > div:last-child { width: 100%; }
  .form-editor-page #root > .sec-h > div:last-child .btn { flex: 1; }
  .form-editor-page #root > .card { padding: 18px !important; }
  .q-box { padding: 14px !important; }
  .q-box-h { align-items: flex-start; }
  .q-box-h > div:last-child { flex-wrap: wrap; justify-content: flex-end; }
  .q-question-layout { grid-template-columns: minmax(0, 1fr) !important; }
  .q-range-config { grid-template-columns: minmax(0, 1fr) !important; }
  .q-opt-row { gap: 6px; }
  .q-opt-row input[type="text"] { min-width: 0; width: 100%; }
  .q-box-opts > div:first-child { align-items: flex-start !important; }
  .form-editor-page #root > div:last-child { align-items: stretch !important; }
  .form-editor-page #root > div:last-child > div { flex-wrap: wrap; }
  .form-editor-page #root > div:last-child .btn { flex: 1; }
}


/* ── Responder formulario (panel y página pública) ───────────────── */
.q-card { padding: 24px; margin-bottom: 20px; transition: border-color .2s, box-shadow .2s; }
.q-card.q-error { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.q-card-h { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.q-card h3 { margin: 4px 0 0; font-size: 16.5px; line-height: 1.35; }
.q-ayuda { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.pill.soft { background: var(--surface2); }
.pill.req { background: var(--bad-soft); color: var(--bad); font-weight: 700; }
.q-opts { display: grid; gap: 10px; margin-top: 14px; }
.q-field { margin-top: 14px; }
.q-field input, .q-field select, .q-field textarea {
  width: 100%; box-sizing: border-box; padding: 12px 14px; font: inherit; font-size: 14.5px;
  border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); color: var(--text);
}
.q-field textarea { line-height: 1.5; resize: vertical; }
.q-field input:focus, .q-field select:focus, .q-field textarea:focus, .q-otro-text:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow);
}
.q-opt-label {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; cursor: pointer;
  background: var(--surface2); border: 1px solid var(--line); border-radius: var(--radius-sm); transition: all .15s;
}
.q-opt-label:hover { border-color: var(--accent); }
.q-opt-label:has(input:checked), .q-scale-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.q-opt-label:has(input:disabled) { opacity: .5; cursor: not-allowed; }
.q-opt-label > input[type="radio"], .q-opt-label > input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); cursor: inherit; flex: none; }
.q-opt-label span { font-size: 14.5px; font-weight: 500; color: var(--text); }
.q-opt-label .nowrap { white-space: nowrap; }
.q-otro-text {
  flex: 1; min-width: 0; padding: 8px 12px; font: inherit; font-size: 13.5px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
}
.q-regla { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.q-regla b { color: var(--accent); }
.q-escala-et { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.q-escala { display: flex; gap: 10px; flex-wrap: wrap; }
.q-scale-opt {
  position: relative; flex: 1; min-width: 54px; text-align: center; padding: 16px 8px; cursor: pointer;
  background: var(--surface2); border: 1px solid var(--line); border-radius: var(--radius-sm); transition: all .15s;
}
.q-scale-opt:hover { border-color: var(--accent); }
.q-scale-opt input { position: absolute; opacity: 0; pointer-events: none; }
.q-scale-opt b { font-size: 20px; color: var(--text); }
.q-range-field { padding: 8px 2px; }
.q-range-field input[type="range"] { width: 100%; accent-color: var(--accent); cursor: pointer; }
.q-range-values { display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.q-range-values output { color: var(--accent); font-size: 18px; font-weight: 800; }
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

@media (max-width: 600px) {
  .q-matriz-wrap { overflow: visible !important; }
  .q-matriz-table { display: block; width: 100% !important; min-width: 0 !important; }
  .q-matriz-table thead { display: none; }
  .q-matriz-table tbody { display: block; width: 100%; }
  .q-matriz-row { display: flex; flex-wrap: wrap; width: 100%; padding: 10px 0; }
  .q-matriz-row th { display: block; flex: 0 0 100%; box-sizing: border-box; padding: 4px 8px 10px !important; }
  .q-matriz-row td { display: flex; flex: 0 0 16.666%; align-items: center; justify-content: center; min-width: 0; padding: 6px 2px !important; }
  .q-matriz-row td::before { content: attr(data-nivel); font-weight: 700; color: var(--muted); margin-right: 5px; }
  .q-matriz-row td label { display: inline-grid; place-items: center; min-width: 30px; min-height: 30px; }
}

/* ── Preguntas plegables en resultados ───────────────────────────── */
details.q-det { padding: 0; margin-bottom: 14px; overflow: hidden; }
details.q-det > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px; padding: 16px 20px;
}
details.q-det > summary::-webkit-details-marker { display: none; }
details.q-det > summary:hover { background: var(--surface2); }
details.q-det .q-chev { flex: none; transition: transform .2s; color: var(--muted); font-size: 12px; }
details.q-det[open] .q-chev { transform: rotate(90deg); }
details.q-det .q-sum { flex: 1; min-width: 0; }
details.q-det .q-sum h3 { margin: 0; font-size: 15.5px; line-height: 1.35; }
details.q-det .q-sum small { display: block; margin-top: 3px; color: var(--muted); font-size: 12.5px; }
details.q-det .q-det-body { padding: 4px 20px 20px; border-top: 1px solid var(--line); }

/* Subpáginas: cada entrada del menú enseña solo lo suyo. */
.pagina[hidden] { display: none; }
.portal-link { margin: 0 0 12px; display: flex; justify-content: flex-end; }
