/* Panel = lista de fichas + editor con etiqueta QR. Vista QR = bloques independientes por parámetro. */
/* Colores corporativos: negro + naranja. Cambia --accent por el naranja exacto de la marca si lo tienes. */
:root {
  --brand: #111111; --brand-ink: #ffffff; --brand-muted: #b9b2ab;
  --bg: #f1efed; --surface: #fdfcfb; --surface-2: #f6f4f2; --ink: #141210; --muted: #625b55; --line: #dcd7d2;
  --accent: #f26b1d; --accent-text: #b4490b; --accent-soft: #fde6d6; --accent-ink: #111111;
  --ok: #2b7a4b; --ok-soft: #dcefe3; --warn: #806300; --warn-soft: #f5edc6; --bad: #b03a2e; --bad-soft: #f6dfdc;
  --shadow: 0 1px 2px rgba(20,16,12,.06), 0 4px 14px rgba(20,16,12,.07);
  --f-display: "IBM Plex Sans Condensed", "Arial Narrow", "Roboto Condensed", sans-serif;
  --f-body: "IBM Plex Sans", "Segoe UI", Roboto, system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --brand: #000000; --brand-ink: #ffffff; --brand-muted: #a39b94;
    --bg: #0e0d0c; --surface: #181614; --surface-2: #1f1c1a; --ink: #f1ede9; --muted: #a39b94; --line: #332e2a;
    --accent: #ff7a2e; --accent-text: #ff8f4d; --accent-soft: #3a2010; --accent-ink: #111111;
    --ok: #62c08c; --ok-soft: #173426; --warn: #e3c04d; --warn-soft: #332b0e; --bad: #ef7d70; --bad-soft: #3d1f1b;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 18px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 15px; line-height: 1.5; }
img { max-width: 100%; }
[hidden] { display: none !important; }
#app { max-width: 1240px; margin: 0 auto; padding: 20px 16px 48px; }
h1, h2, h3 { font-family: var(--f-display); text-wrap: balance; margin: 0; }
.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.eyebrow { font-family: var(--f-display); font-weight: 600; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
a { color: var(--accent-text); }

.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); padding: 8px 14px; border-radius: 6px; cursor: pointer; font-weight: 500; font-size: 14px; white-space: nowrap; text-decoration: none; color: var(--ink); }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.06); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.danger { color: var(--bad); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--accent-text); padding-inline: 6px; }
.btn.small { padding: 5px 10px; font-size: 13px; }

.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.accent { background: var(--accent-soft); color: var(--accent-text); }

/* panel */
.topbar { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; padding: 18px 20px; background: var(--brand); color: var(--brand-ink); border-radius: 8px; border-bottom: 4px solid var(--accent); margin-bottom: 20px; }
.topbar .eyebrow { color: var(--accent); }
.topbar .btn:not(.primary) { background: transparent; color: var(--brand-ink); border-color: #4a4440; }
.topbar .btn:not(.primary):hover { border-color: var(--accent); }
.topbar h1 { font-size: 30px; font-weight: 700; line-height: 1.1; }
.topbar p { margin: 4px 0 0; color: var(--brand-muted); max-width: 60ch; }
.topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.banner { padding: 10px 14px; border-radius: 6px; background: var(--warn-soft); color: var(--warn); margin-bottom: 16px; font-size: 14px; }
.layout { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 880px) { .layout { grid-template-columns: minmax(0, 1fr); } }
.list-col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.list { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; text-align: left; padding: 12px 14px; border: 0; border-bottom: 1px solid var(--line); background: transparent; cursor: pointer; }
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--surface-2); }
.row[aria-current="true"] { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.row .ot { font-family: var(--f-mono); font-size: 12.5px; color: var(--accent-text); font-weight: 500; }
.row .eq { grid-column: 1 / -1; font-weight: 600; overflow-wrap: anywhere; }
.row .sn { grid-column: 1 / -1; font-size: 13px; color: var(--muted); font-family: var(--f-mono); }
.empty { padding: 22px 16px; color: var(--muted); font-size: 14px; text-align: center; }

.editor-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 20px; align-items: start; min-width: 0; }
@media (max-width: 1100px) { .editor-wrap { grid-template-columns: minmax(0, 1fr); } }
.editor { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
.editor-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.editor-head h2 { font-size: 20px; }
.editor-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.confirm { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13px; color: var(--bad); }
.sec { padding: 16px 18px 18px; border-bottom: 1px solid var(--line); display: grid; gap: 12px; }
.sec:last-child { border-bottom: 0; }
.sec, .sec > *, .editor-wrap > * { min-width: 0; }
.tag-col { background: var(--bg); z-index: 1; }
.sec-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sec-title h3 { font-size: 16px; font-weight: 600; }
.internal { font-size: 11.5px; font-weight: 600; color: var(--warn); background: var(--warn-soft); padding: 2px 8px; border-radius: 4px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field label { font-size: 12.5px; font-weight: 500; color: var(--muted); }
input[type="text"], input[type="url"], input[type="date"], input[type="search"], input[type="password"], select, textarea {
  width: 100%; min-width: 0; background: var(--surface-2); border: 1px solid var(--line); border-radius: 5px; padding: 7px 9px; font-size: 14px;
}
textarea { resize: vertical; min-height: 64px; }
textarea.tall { min-height: 140px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.ot-input { font-family: var(--f-mono); font-weight: 500; }
.hint { font-size: 12.5px; color: var(--muted); margin: 0; }
.hint.warn { color: var(--warn); }

.ctrl-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; }
.ctrl-table { width: 100%; border-collapse: collapse; min-width: 720px; font-size: 13.5px; }
.ctrl-table th { text-align: left; font-weight: 500; font-size: 12px; color: var(--muted); padding: 7px 8px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.ctrl-table td { padding: 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.ctrl-table tr:last-child td { border-bottom: 0; }
.ctrl-table input, .ctrl-table select { padding: 5px 7px; font-size: 13px; }
.ctrl-empty { padding: 14px; color: var(--muted); font-size: 13.5px; }

.tag-col { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 12px; }
@media (max-width: 1100px) { .tag-col { position: static; } }
.tag-img { display: block; width: 100%; max-width: 300px; border-radius: 10px; box-shadow: var(--shadow); border: 1px solid #d9d9d9; background: #fff; }
.tag-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.link-box { font-family: var(--f-mono); font-size: 11.5px; word-break: break-all; background: var(--surface-2); border: 1px solid var(--line); border-radius: 5px; padding: 6px 8px; }

.placeholder { background: var(--surface); border: 1px dashed var(--line); border-radius: 8px; padding: 40px 24px; text-align: center; color: var(--muted); }
.placeholder h2 { color: var(--ink); font-size: 20px; margin-bottom: 6px; }

.login { max-width: 380px; margin: 10vh auto 0; background: var(--surface); border: 1px solid var(--line); border-top: 6px solid var(--accent); border-radius: 10px; padding: 24px; display: grid; gap: 14px; box-shadow: var(--shadow); }
.login .eyebrow { color: var(--accent-text); }
.login h1 { font-size: 26px; }
.error { color: var(--bad); font-size: 13.5px; margin: 0; }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 9px 16px; border-radius: 6px; font-size: 14px; box-shadow: var(--shadow); z-index: 30; max-width: calc(100% - 32px); }
.busy { position: fixed; top: 0; left: 0; right: 0; height: 3px; background: var(--accent); z-index: 40; animation: busy 1.1s ease-in-out infinite; transform-origin: left; }
@keyframes busy { 0% { transform: scaleX(0); } 60% { transform: scaleX(.8); } 100% { transform: scaleX(1); opacity: 0; } }

/* fotos */
.foto-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.foto { margin: 0; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; display: flex; flex-direction: column; min-width: 0; }
.foto-img { display: block; padding: 0; border: 0; background: var(--line); cursor: zoom-in; aspect-ratio: 4 / 3; width: 100%; max-width: 100%; }
.foto-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.codigo-box { display: grid; gap: 6px; padding: 12px; border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 6px; background: var(--surface); }
.codigo { font-size: 26px; letter-spacing: .18em; }
.acceso { margin-top: 16px; background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--accent); border-radius: 8px; padding: 18px; display: grid; gap: 10px; }
.acceso h2 { font-size: 18px; }
.acceso-fila { display: flex; flex-wrap: wrap; gap: 8px; }
.acceso-fila input { flex: 1 1 160px; max-width: 240px; font-family: var(--f-mono); font-size: 20px; letter-spacing: .15em; padding: 10px 12px; }
.foto-sin { display: grid; place-items: center; width: 100%; height: 100%; color: var(--muted); font-size: 13px; }
.lightbox .cargando { opacity: .75; }
.foto figcaption { display: flex; gap: 4px; align-items: center; padding: 6px; font-size: 13px; min-width: 0; }
.foto figcaption > span { overflow-wrap: anywhere; color: var(--muted); padding: 0 2px; }
.foto figcaption input { padding: 4px 6px; font-size: 12.5px; }
.foto-del { display: flex; gap: 4px; }
.foto-loading { align-items: center; justify-content: center; min-height: 120px; color: var(--muted); font-size: 13px; border-style: dashed; }
.lightbox { position: fixed; inset: 0; z-index: 20; background: rgba(8,12,16,.9); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 16px; cursor: zoom-out; }
.lightbox figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; max-width: 100%; }
.lightbox img { max-width: 100%; max-height: 80vh; object-fit: contain; border-radius: 4px; }
.lightbox figcaption { color: #e8ecef; font-size: 14px; text-align: center; }

/* vista QR */
.scan { max-width: 680px; margin: 0 auto; }
.scan-head { padding: 18px 20px; background: var(--brand); color: var(--brand-ink); border-radius: 8px; border-bottom: 4px solid var(--accent); display: grid; gap: 6px; }
.scan-head .eyebrow { color: var(--accent); }
.scan-head .scan-meta { color: var(--brand-muted); }
.scan-head .scan-meta b { color: var(--brand-ink); }
.scan-head h1 { font-size: 30px; line-height: 1.1; font-weight: 700; overflow-wrap: anywhere; }
.scan-meta { color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 14px; }
.scan-meta b { font-weight: 500; }
.blocks { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-top: 16px; }
.block { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; display: grid; gap: 10px; align-content: start; min-width: 0; }
.block.full { grid-column: 1 / -1; }
.block h2 { font-size: 13px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.block h2::before { content: ""; width: 4px; height: 14px; border-radius: 2px; background: var(--accent); }
.block-body { display: grid; gap: 10px; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 16px; margin: 0; font-size: 14.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; white-space: pre-line; }
.survey { border-top: 4px solid var(--accent); }
.survey .block-body { gap: 18px; }
.survey-intro { margin: 0; max-width: 70ch; }
.req { color: var(--accent-text); font-weight: 700; }
.q { border: 0; margin: 0; padding: 0; display: grid; gap: 8px; min-width: 0; }
.q legend { padding: 0; margin-bottom: 8px; font-weight: 600; line-height: 1.4; }
.q.missing legend { color: var(--bad); }
.q.missing .scale-opt span, .q.missing .opt, .q.missing textarea { border-color: var(--bad); }
.scale { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; max-width: 420px; }
.scale-opt { position: relative; cursor: pointer; }
.scale-opt input, .opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.scale-opt span { display: grid; place-items: center; height: 44px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); font-family: var(--f-mono); font-weight: 500; font-size: 16px; }
.scale-opt:hover span { border-color: var(--accent); }
.scale-opt input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.scale-opt input:focus-visible + span, .opt input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.scale-ends { display: flex; justify-content: space-between; max-width: 420px; font-size: 12.5px; color: var(--muted); }
.opts { display: grid; gap: 6px; max-width: 420px; }
.opt { position: relative; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); cursor: pointer; }
.opt span::before { content: ""; display: inline-block; width: 14px; height: 14px; margin-right: 10px; vertical-align: -2px; border-radius: 50%; border: 2px solid var(--muted); box-sizing: border-box; }
.opt:hover { border-color: var(--accent); }
.opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.opt input:checked + span::before { border: 4px solid var(--accent); }
.thanks { padding: 14px 16px; border-radius: 6px; background: var(--accent-soft); }
.thanks p { margin: 4px 0 0; }
.desc { display: grid; gap: 4px; padding: 10px 12px; background: var(--surface-2); border-radius: 6px; }
.desc-label { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.desc p { margin: 0; white-space: pre-line; overflow-wrap: anywhere; max-width: 75ch; }
.pending { color: var(--muted); font-style: italic; font-size: 14px; margin: 0; }
.ctrl-card { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 11px 13px; display: grid; gap: 4px; }
.ctrl-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.ctrl-type { font-family: var(--f-display); font-weight: 600; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--accent-text); }
.ctrl-desc { font-weight: 500; overflow-wrap: anywhere; }
.ctrl-sub { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 2px 12px; }
.report-link { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); color: var(--ink); text-decoration: none; max-width: 460px; }
.report-link:hover { border-color: var(--accent); }
.report-link b { display: block; font-weight: 600; overflow-wrap: anywhere; }
.report-link small { color: var(--accent-text); font-size: 13px; }
.report-ic { flex: none; width: 40px; height: 48px; border-radius: 4px; background: var(--accent-soft); color: var(--accent-text); font-family: var(--f-mono); font-size: 11px; font-weight: 500; display: grid; place-items: center; }
.scan-foot { margin-top: 22px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.scan-msg { padding: 60px 8px; text-align: center; color: var(--muted); }
.scan-msg h1 { color: var(--ink); font-size: 24px; margin-bottom: 8px; }

@media (max-width: 480px) {
  .topbar h1, .scan-head h1 { font-size: 25px; }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .kv dd { margin-bottom: 6px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
