/* SECU85 · Buzón de altas — puesto de administración CRA.
   Editorial y sobrio: papel, tinta, filetes y un único rojo de señal. */

:root {
  --paper: #f1f2f3;
  --surface: #ffffff;
  --sunk: #e5e7ea;
  --ink: #111316;
  --ink-2: #353a41;
  --muted: #565c64;
  --rule: #d3d6da;
  --rule-2: #a9aeb5;
  --red: #b0122a;
  --red-soft: #f7e3e5;
  --ok: #17613a;      --ok-bg: #e2f0e6;
  --warn: #7f4c00;    --warn-bg: #fbedd3;
  --bad: #a3201a;     --bad-bg: #f8e1df;
  --info: #1d4a86;    --info-bg: #e2eaf6;
  --done: #2b4a36;    --done-bg: #e6ece4;
  --mark: #fff0a8;
  --serif: "Iowan Old Style", "Charter", "Source Serif Pro", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --r: 3px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
p, li, dd { text-wrap: pretty; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.5 var(--sans); font-feature-settings: "tnum" 1; }
a { color: var(--info); text-underline-offset: 2px; }
a:hover { color: var(--ink); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
h1, h2, h3, h4 { margin: 0; }
p { margin: 0 0 .6em; }
s { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: #fff; padding: 8px 12px; z-index: 50; }
.skip:focus { left: 8px; top: 8px; }
.skip:hover, .btn-ink:hover, .btn-danger:hover { color: #fff; }
.mono, .ref { font-family: var(--mono); font-size: max(12px, .9em); letter-spacing: -.01em; }
.small { font-size: 13px; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.t-bad { color: var(--bad); }
.pre { white-space: pre-wrap; }

/* ---------- Estructura ---------- */
.app { display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; height: 100vh; height: 100dvh; }
.main { min-height: 0; overflow: auto; }
.main[data-view="buzon"], .main[data-view="fichas"] { overflow: hidden; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 24px; background: var(--ink); color: #fff; border-bottom: 4px solid var(--red); }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mark { display: grid; place-items: center; width: 34px; height: 34px; background: var(--red); color: #fff; font: 800 16px/1 var(--sans); letter-spacing: -.02em; flex: none; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font: 800 19px/1.05 var(--sans); letter-spacing: .06em; }
.brand-sub { font-size: 12px; color: #c9ccd1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.clock { margin: 0 8px 0 0; font-size: 13px; color: #d9dbde; white-space: nowrap; }
.clock b { color: #fff; font-size: 15px; }
.clock-sim { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; border: 1px solid #6b7079; padding: 0 5px; border-radius: 2px; margin-left: 4px; }

.sections { display: flex; gap: 0; padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--rule-2); overflow-x: auto; scrollbar-width: none; }
.sections::-webkit-scrollbar { display: none; }
.sections a { display: inline-flex; align-items: center; gap: 6px; padding: 11px 14px 9px; color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: 14px; border-bottom: 3px solid transparent; white-space: nowrap; }
.sections a:hover { color: var(--ink); background: var(--paper); }
.sections a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink); }
.count { font: 700 12px/1 var(--sans); background: var(--ink); color: #fff; padding: 3px 6px; border-radius: 10px; }
.count:empty { display: none; }
.count-alert { background: var(--bad); }

.foot { display: flex; flex-wrap: wrap; gap: 4px 20px; padding: 6px 24px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--rule); background: var(--surface); }
.foot span + span::before { content: "·"; margin-right: 20px; color: var(--rule-2); }

/* ---------- Botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 7px 14px; border: 1px solid transparent; border-radius: var(--r); font-weight: 600; font-size: 14px; line-height: 1.2; cursor: pointer; text-decoration: none; text-align: center; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-ink { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn-ink:hover:not(:disabled) { background: #2a2f36; color: #fff; }
.top .btn-ink { background: var(--red); border-color: var(--red); }
.top .btn-ink:hover:not(:disabled) { background: #8f0e22; }
.btn-line { background: var(--surface); color: var(--ink); border-color: var(--ink); }
.btn-line:hover:not(:disabled) { background: var(--sunk); color: var(--ink); }
.btn-quiet { background: transparent; color: #fff; border-color: #5c616a; }
.btn-quiet:hover { border-color: #fff; color: #fff; }
.btn-danger { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn-sm { min-height: 30px; padding: 4px 10px; font-size: 13px; }
.sim { font-weight: 400; opacity: .75; font-size: .9em; }
.link { background: none; border: 0; padding: 0; color: var(--info); text-decoration: underline; cursor: pointer; }

.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--ink); border-radius: var(--r); overflow: hidden; }
.seg button { border: 0; border-left: 1px solid var(--ink); background: var(--surface); padding: 6px 11px; font-size: 13px; font-weight: 600; cursor: pointer; }
.seg button:first-child { border-left: 0; }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }

input[type="search"], input:not([type]), select, textarea { width: 100%; min-height: 36px; padding: 7px 10px; border: 1px solid var(--rule-2); border-radius: var(--r); background: var(--surface); }
input:focus, select:focus, textarea:focus { border-color: var(--ink); }
textarea { resize: vertical; line-height: 1.5; }
input[readonly] { background: transparent; border-color: transparent; padding-left: 0; }
input[aria-invalid="true"] { border-color: var(--bad); background: #fff7f6; }

/* ---------- Píldoras y confianza ---------- */
.pill { display: inline-block; padding: 1px 7px; border-radius: 2px; font-size: 12px; font-weight: 600; line-height: 1.5; white-space: nowrap; border: 1px solid transparent; }
.pill-ok { background: var(--ok-bg); color: var(--ok); border-color: #b9d8c3; }
.pill-info { background: var(--info-bg); color: var(--info); border-color: #bccde6; }
.pill-warn { background: var(--warn-bg); color: var(--warn); border-color: #ecd09c; }
.pill-bad { background: var(--bad); color: #fff; }
.pill-done { background: var(--done-bg); color: var(--done); border-color: #c5d2c5; }
.pill-muted { background: var(--sunk); color: var(--ink-2); border-color: var(--rule); }
.conf { display: inline-block; font: 600 12px/1.4 var(--mono); padding: 0 5px; border-radius: 2px; white-space: nowrap; }
.conf-ok { color: var(--ok); background: var(--ok-bg); }
.conf-warn { color: var(--warn); background: var(--warn-bg); }
.conf-bad { color: #fff; background: var(--bad); }
.conf-edit { color: var(--info); background: var(--info-bg); font-family: var(--sans); }
.same { font-size: 12px; color: var(--ok); font-weight: 600; }

/* ---------- Encabezados ---------- */
.h-page { font: 600 26px/1.15 var(--serif); letter-spacing: -.01em; }
.h-detail { font: 600 22px/1.25 var(--serif); margin: 2px 0 10px; overflow-wrap: anywhere; }
.h-col { font: 700 12px/1.3 var(--sans); text-transform: uppercase; letter-spacing: .09em; color: var(--ink); padding-bottom: 8px; margin: 0 0 12px; border-bottom: 2px solid var(--ink); display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.h-col * + .h-col, section > .h-col:not(:first-child) { margin-top: 26px; }
.h-note { font: 400 13px/1.3 var(--sans); text-transform: none; letter-spacing: 0; color: var(--muted); }
a.h-note { color: var(--info); }
.h-sub { font: 700 13px/1.3 var(--sans); margin: 0 0 8px; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.kicker { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; margin: 0; overflow-wrap: anywhere; }
.kicker .ref { text-transform: none; letter-spacing: 0; color: var(--ink); font-weight: 600; }
.summary { color: var(--ink-2); margin: 4px 0 0; }
.summary b { color: var(--ink); }
.lead-sm { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.note { font-size: 13px; color: var(--ink-2); background: var(--sunk); padding: 7px 10px; margin: 14px 0; }

/* ---------- Bandeja ---------- */
.inbox { display: grid; grid-template-columns: minmax(330px, 390px) minmax(0, 1fr); height: 100%; min-height: 0; }
.pane { min-height: 0; overflow: auto; }
.list-pane { border-right: 1px solid var(--rule-2); background: var(--surface); display: flex; flex-direction: column; overflow: hidden; }
.list-head { padding: 18px 20px 14px; border-bottom: 1px solid var(--rule-2); }
.list-head .summary { font-size: 13px; }
.filters { display: grid; gap: 8px; margin-top: 12px; }
.filter-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.list { overflow: auto; flex: 1; min-height: 0; }
.group-h { position: sticky; top: 0; z-index: 1; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; padding: 9px 20px 7px; background: var(--paper); border-bottom: 1px solid var(--rule); font: 700 13px/1.3 var(--sans); }
.group-name { overflow-wrap: anywhere; }
.group-sub { font-weight: 400; color: var(--muted); }
.group-n { margin-left: auto; font-weight: 600; font-size: 12px; color: var(--ink-2); }
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: grid; gap: 3px; padding: 11px 20px 11px 17px; border-left: 3px solid transparent; border-bottom: 1px solid var(--rule); color: var(--ink); text-decoration: none; }
.row:hover { background: var(--paper); color: var(--ink); }
.row[aria-current="true"] { background: #e9ebee; box-shadow: inset 0 0 0 1px var(--ink); }
.row.prio-alta { border-left-color: var(--red); }
.row.prio-media { border-left-color: var(--rule-2); }
.row-top { display: flex; gap: 8px; align-items: baseline; font-size: 12px; color: var(--muted); }
.row-top .ref { color: var(--ink); font-weight: 600; }
.row-age { margin-left: auto; white-space: nowrap; font-weight: 600; color: var(--ink-2); }
.row-subj { font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row-inst { font-size: 12px; color: var(--muted); }
.row-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; }
.row-prio { color: var(--muted); }
.empty { padding: 24px 20px; color: var(--muted); }

/* ---------- Detalle ---------- */
.detail-pane { background: var(--paper); }
.detail-empty { max-width: 520px; padding: 48px 32px; }
.detail-empty p { font-size: 15px; }
.detail { container-type: inline-size; container-name: detail; }
.d-head { padding: 18px 28px 16px; background: var(--surface); border-bottom: 1px solid var(--rule-2); }
.back { display: none; font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.d-meta { display: flex; flex-wrap: wrap; gap: 6px 24px; margin: 0 0 12px; font-size: 13px; }
.d-meta div { display: flex; gap: 6px; align-items: baseline; }
.d-meta dt { color: var(--muted); }
.d-meta dd { margin: 0; font-weight: 600; }
.prio-txt { text-transform: capitalize; }
.prio-txt.prio-alta { color: var(--red); }
.banner { padding: 9px 12px; border-radius: var(--r); border: 1px solid; font-size: 14px; }
.banner p { margin: 0; }
.banner-ok { background: var(--ok-bg); border-color: #b9d8c3; }
.banner-info { background: var(--info-bg); border-color: #bccde6; }
.banner-warn { background: var(--warn-bg); border-color: #ecd09c; }
.banner-bad { background: var(--bad-bg); border-color: var(--bad); }
.banner-bad b { color: var(--bad); }
.banner-done { background: var(--done-bg); border-color: #c5d2c5; }
.banner-muted { background: var(--sunk); border-color: var(--rule); }

.pane-switch { display: none; margin: 12px 16px 0; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.split > section { padding: 20px 28px 32px; min-width: 0; }
.corr { border-right: 1px solid var(--rule-2); }
.ficha { background: var(--surface); }
.split-even > section:first-child { border-right: 1px solid var(--rule-2); }

/* Correo y adjuntos */
.mail { background: var(--surface); border: 1px solid var(--rule); padding: 14px 16px; margin-bottom: 16px; }
.mail-meta { font-size: 13px; color: var(--ink-2); border-bottom: 1px solid var(--rule); padding-bottom: 8px; margin-bottom: 10px; overflow-wrap: anywhere; }
.lbl { display: inline-block; min-width: 44px; color: var(--muted); }
.mail-body { font-size: 15px; overflow-wrap: anywhere; }
.mail-body blockquote { margin: 10px 0 0; padding: 8px 0 0; border-top: 1px dashed var(--rule-2); color: var(--muted); font-size: 14px; }
.mail-out { border-top: 2px solid var(--ink); background: #f8f9fa; }
mark { background: var(--mark); color: inherit; padding: 0 2px; border-radius: 2px; box-shadow: inset 0 -1px 0 #d4b300; }
mark.ev-plain { background: transparent; box-shadow: none; padding: 0; }
mark.ev-missing { background: var(--bad-bg); box-shadow: inset 0 -1px 0 var(--bad); color: var(--bad); }
mark.flash { animation: flash 1.6s ease-out 1; outline: 2px solid var(--red); outline-offset: 1px; background: var(--mark); }
@keyframes flash { 0%, 30% { background: #ffd23f; } 100% { background: var(--mark); } }
.atts { margin-top: 4px; }
.att-tabs { display: flex; flex-wrap: wrap; gap: 0; border-bottom: 1px solid var(--ink); }
.att-tabs button { display: grid; text-align: left; gap: 0; padding: 7px 12px; border: 1px solid transparent; border-bottom: 0; background: transparent; cursor: pointer; max-width: 100%; }
.att-tabs button[aria-selected="true"] { background: var(--surface); border-color: var(--ink); margin-bottom: -1px; border-bottom: 1px solid var(--surface); }
.att-name { font: 600 13px/1.3 var(--mono); overflow-wrap: anywhere; }
.att-info { font-size: 12px; color: var(--muted); }
.doc { background: var(--sunk); padding: 16px; border: 1px solid var(--ink); border-top: 0; }
.doc-page { background: #fff; padding: 22px 24px; border: 1px solid var(--rule-2); font-family: var(--serif); font-size: 14px; line-height: 1.55; max-width: 620px; margin: 0 auto; }
.doc-kicker { font: 600 12px/1.3 var(--sans); text-transform: uppercase; letter-spacing: .1em; color: var(--red); }
.doc-title { font: 700 17px/1.3 var(--serif); margin: 0 0 12px; }
.doc-grid { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 14px; margin: 0 0 14px; font-size: 13.5px; }
.doc-grid dt { color: var(--muted); font-family: var(--sans); font-size: 12px; padding-top: 2px; }
.doc-grid dd { margin: 0; overflow-wrap: anywhere; }
.doc-clause { font-size: 13px; color: #2c2f34; }
.doc-sign { margin-top: 14px; padding-top: 10px; border-top: 1px dashed var(--rule-2); font-family: var(--sans); font-size: 13px; }
.doc-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.doc-table th, .doc-table td { text-align: left; padding: 5px 6px; border-bottom: 1px solid var(--rule); vertical-align: top; overflow-wrap: anywhere; }
.doc-table th { color: var(--muted); font-family: var(--sans); font-weight: 400; width: 42%; }
.doc-hash { font-size: 12px; color: var(--muted); margin: 8px 0 0; overflow-wrap: anywhere; }
.thread { margin-top: 18px; }

/* Ficha propuesta */
.fields { border-top: 1px solid var(--rule); }
.frow { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--rule); }
.frow label { font-size: 13px; color: var(--ink-2); }
.frow input { min-height: 32px; padding: 5px 8px; }
.fctl { min-width: 0; }
.fside { display: flex; gap: 6px; align-items: center; justify-content: flex-end; }
.ferr { color: var(--bad); font-size: 12px; margin: 3px 0 0; font-weight: 600; }
.has-err label { color: var(--bad); font-weight: 600; }
.ev-btn { border: 0; background: none; padding: 2px 0; color: var(--info); font-size: 12px; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; white-space: nowrap; }
.ev-btn:hover { color: var(--ink); }
.rulebox { margin-top: 18px; padding: 12px 14px; border: 1px solid var(--rule-2); background: var(--paper); }
.checks { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.checks li { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--rule); align-items: baseline; }
.checks li:last-child { border-bottom: 0; }
.checks .ck { font-weight: 800; }
.checks .ok .ck { color: var(--ok); }
.checks .ko .ck { color: var(--bad); }
.checks .ko > span:nth-child(2) { font-weight: 600; }
.checks .got { color: var(--muted); font-size: 12px; text-align: right; overflow-wrap: anywhere; max-width: 260px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 18px; }
.why { flex-basis: 100%; margin: 0; font-size: 12px; color: var(--bad); font-weight: 600; }
.conflicts { margin-top: 16px; border: 1px solid var(--warn); background: var(--warn-bg); padding: 12px 14px; }
.conflicts ol { margin: 0; padding-left: 20px; }
.conflicts li { padding: 4px 0; font-size: 14px; }
.conflicts li span { margin-right: 6px; }
.kv { margin: 0; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0; font-size: 14px; }
.kv > div { display: contents; }
.kv dt, .kv dd { padding: 6px 0; border-bottom: 1px solid var(--rule); }
.kv dt { color: var(--muted); font-size: 13px; padding-right: 16px; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.kv-stack { grid-template-columns: minmax(0, 1fr); }
.kv-stack dt { border-bottom: 0; padding-bottom: 0; font-weight: 600; color: var(--ink); }
.kv-stack dd { font-size: 13px; color: var(--ink-2); }
.kv-stack .pill { margin-right: 4px; }
.trace { margin-top: 26px; border-top: 1px solid var(--rule-2); padding-top: 10px; font-size: 13px; }
.trace summary { cursor: pointer; font-weight: 700; }
.trace ol { list-style: none; padding: 0; margin: 8px 0; }
.trace li { display: grid; grid-template-columns: 92px 72px minmax(0, 1fr); gap: 8px; padding: 4px 0; border-bottom: 1px dotted var(--rule); }
.trace .t { color: var(--muted); white-space: nowrap; }
.o { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.o-sistema { color: var(--muted); }
.o-regla { color: var(--info); }
.o-operador { color: var(--ink); }
.o-svn { color: var(--red); }

.steps { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 6px; font-size: 14px; }
.steps li { display: flex; gap: 10px; align-items: center; }
.steps li::before { content: ""; flex: none; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--rule-2); }
.steps .step-done::before { content: "✓"; display: grid; place-items: center; color: #fff; background: var(--ok); border-color: var(--ok); font-size: 11px; font-weight: 800; }
.steps .step-now { font-weight: 600; }
.steps .step-now::before { border-color: var(--info); border-top-color: transparent; animation: spin .8s linear infinite; }
.steps .step-todo { color: var(--muted); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Tablas ---------- */
.tbl-wrap { width: 100%; overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; background: var(--surface); }
.tbl th, .tbl td { text-align: left; vertical-align: top; padding: 8px 10px; border-bottom: 1px solid var(--rule); overflow-wrap: break-word; word-break: normal; }
.tbl thead th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); border-bottom: 2px solid var(--ink); white-space: nowrap; background: var(--surface); position: sticky; top: 0; }
.tbl tbody th { font-weight: 600; }
.tbl-diff tr.is-changed { background: var(--warn-bg); }
.tbl-diff tr.is-changed th { color: var(--warn); }
.tbl-diff input { min-height: 32px; padding: 4px 8px; }
.tbl-cmp tr.is-same td:last-child { color: var(--ink); }
.tbl-ops tr.is-err { background: var(--bad-bg); }
.tbl-ops th.mono { white-space: nowrap; }

/* ---------- Páginas ---------- */
.page { padding: 22px 28px 40px; max-width: 1400px; }
.page-head { margin-bottom: 18px; }
.filters-inline { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; align-items: center; }
.filters-inline input { max-width: 340px; }
.svn-grid, .rules-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; align-items: start; }
.aside { background: var(--surface); border: 1px solid var(--rule-2); padding: 16px 18px; }
.aside .h-col:not(:first-child) { margin-top: 22px; }
.aside .checks li { grid-template-columns: 18px minmax(0, 1fr); }
.aside .checks .got { grid-column: 2; text-align: left; max-width: none; }
.switch, .check, .radio { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; padding: 4px 0; cursor: pointer; }
.switch input, .check input, .radio input { margin-top: 3px; accent-color: var(--ink); width: 16px; height: 16px; flex: none; }
.rule-form fieldset { border: 0; border-top: 2px solid var(--ink); padding: 12px 0 18px; margin: 0 0 10px; min-width: 0; }
.rule-form legend { font: 600 18px/1.3 var(--serif); padding: 0 10px 0 0; }
.rule-form legend .ref { font-size: 13px; background: var(--ink); color: #fff; padding: 1px 6px; margin-right: 6px; vertical-align: 2px; }
.radio-row { display: grid; gap: 4px; margin: 8px 0 12px; }
.range label { font-size: 14px; font-weight: 600; }
.range-row { display: flex; gap: 12px; align-items: center; margin: 4px 0 10px; }
.range-row input { flex: 1; accent-color: var(--red); }
.range-row output { font: 700 15px var(--mono); min-width: 52px; }
.fs-sub { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 14px 0 4px; font-weight: 700; }
.sticky-actions { position: sticky; bottom: 0; background: var(--paper); padding: 12px 0; margin-top: 0; border-top: 1px solid var(--rule-2); }

.timeline { list-style: none; margin: 0 0 10px; padding: 0 0 0 14px; box-shadow: inset 2px 0 0 var(--rule-2); }
.timeline li { position: relative; padding: 0 0 14px 4px; }
.timeline li::before { content: ""; position: absolute; left: -20px; top: 6px; width: 10px; height: 10px; background: var(--surface); border: 2px solid var(--ink); border-radius: 50%; }
.tl-head { margin: 0; font-size: 14px; }
.tl-head .t { color: var(--muted); font-size: 13px; }
.diff { list-style: none; margin: 4px 0 0; padding: 0; font-size: 13px; }
.diff li { overflow-wrap: anywhere; }
.diff-l { color: var(--muted); }
.plain { list-style: none; padding: 0; margin: 0; }
.plain li { padding: 6px 0; border-bottom: 1px solid var(--rule); font-size: 14px; overflow-wrap: anywhere; }
.hits { padding: 10px 20px; margin: 0; border-bottom: 1px solid var(--rule); }

/* ---------- Diálogo ---------- */
.modal { border: 0; padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); background: var(--surface); color: var(--ink); border-top: 4px solid var(--ink); }
.modal-wide { width: min(720px, calc(100vw - 24px)); }
.modal::backdrop { background: rgba(17, 19, 22, .55); }
.m-form { display: flex; flex-direction: column; max-height: calc(100dvh - 28px); }
.m-head { padding: 16px 22px 10px; border-bottom: 1px solid var(--rule); }
.m-head h2 { font: 600 21px/1.25 var(--serif); margin-top: 2px; }
.m-body { padding: 14px 22px; overflow: auto; }
.m-foot { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; align-items: center; padding: 12px 22px; border-top: 1px solid var(--rule); background: var(--paper); }
.lbl-b { display: block; font-size: 13px; font-weight: 700; margin: 12px 0 4px; }
.kv-mail { font-size: 14px; }
.guide { list-style: none; margin: 0; padding: 0; counter-reset: g; }
.guide li { counter-increment: g; position: relative; padding: 10px 0 10px 34px; border-bottom: 1px solid var(--rule); }
.guide li::before { content: counter(g); position: absolute; left: 0; top: 10px; width: 24px; height: 24px; display: grid; place-items: center; background: var(--ink); color: #fff; font-size: 12px; font-weight: 700; }
.guide p { margin: 2px 0 4px; color: var(--ink-2); }

/* ---------- Avisos ---------- */
.toasts { position: fixed; right: 16px; bottom: 44px; display: grid; gap: 8px; z-index: 40; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--ink); color: #fff; padding: 10px 14px; border-top: 3px solid var(--ok); font-size: 14px; transition: opacity .4s, transform .4s; overflow-wrap: anywhere; }
.toast-warn { border-top-color: #e8a317; }
.toast-bad { border-top-color: var(--red); }
.toast.out { opacity: 0; transform: translateY(6px); }

/* ---------- Detalle estrecho (container query) ---------- */
@container detail (max-width: 780px) {
  .pane-switch { display: inline-flex; }
  .split { grid-template-columns: minmax(0, 1fr); }
  .split > section { padding: 16px; }
  .corr { border-right: 0; }
  .split[data-pane="corr"] .ficha, .split[data-pane="ficha"] .corr { display: none; }
  .split-even > section { display: block !important; }
  .split-even > section:first-child { border-right: 0; border-bottom: 1px solid var(--rule-2); }
  .d-head { padding: 14px 16px; }
}
@container detail (max-width: 480px) {
  .frow { grid-template-columns: minmax(0, 1fr) auto; }
  .frow label { grid-column: 1 / -1; }
  .frow .fctl { grid-column: 1; }
  .checks li { grid-template-columns: 18px minmax(0, 1fr); }
  .checks .got { grid-column: 2; text-align: left; }
  .doc { padding: 8px; }
  .doc-page { padding: 14px; }
  .doc-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .doc-grid dd { margin-bottom: 6px; }
  .trace li { grid-template-columns: minmax(0, 1fr); gap: 0; }
}

/* ---------- Escritorio medio ---------- */
@media (max-width: 1180px) {
  .svn-grid, .rules-grid { grid-template-columns: minmax(0, 1fr); }
  .inbox { grid-template-columns: minmax(300px, 340px) minmax(0, 1fr); }
}

/* ---------- Móvil y tableta: un panel cada vez ---------- */
@media (max-width: 900px) {
  .app { height: auto; min-height: 100dvh; }
  .main, .main[data-view="buzon"], .main[data-view="fichas"] { overflow: visible; }
  .inbox { display: block; height: auto; }
  .list-pane { border-right: 0; overflow: visible; }
  .list { overflow: visible; }
  .pane { overflow: visible; }
  .inbox[data-sel="1"] .list-pane { display: none; }
  .inbox[data-sel="0"] .detail-pane { display: none; }
  .back { display: inline-block; }
  .group-h { position: static; }
  .foot { display: none; }
  .tbl thead th { position: static; }
}

@media (max-width: 640px) {
  .top { padding: 8px 12px; flex-wrap: wrap; gap: 8px; }
  .brand-sub { white-space: normal; font-size: 12px; }
  .top-tools { width: 100%; justify-content: flex-start; }
  .clock { flex-basis: 100%; margin: 0; }
  .top-tools .btn { min-height: 34px; padding: 6px 10px; font-size: 13px; }
  .top-tools .btn-ink { flex: 1; }
  .sections { padding: 0 6px; }
  .sections a { padding: 10px 10px 8px; font-size: 13px; }
  .list-head { padding: 14px 14px 12px; }
  .group-h, .row { padding-left: 14px; padding-right: 14px; }
  .row { padding-left: 11px; }
  .h-page { font-size: 22px; }
  .h-detail { font-size: 19px; }
  .page { padding: 16px 14px 32px; }
  .filters-inline input { max-width: none; }
  .modal, .modal-wide { width: calc(100vw - 12px); max-height: calc(100dvh - 12px); }
  .m-head, .m-body, .m-foot { padding-left: 14px; padding-right: 14px; }
  .m-foot .btn { flex: 1 1 auto; }

  /* Tablas en bloques: cada fila se lee de arriba abajo */
  .tbl thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .tbl, .tbl tbody, .tbl tr, .tbl th, .tbl td { display: block; width: 100%; }
  .tbl tr { padding: 10px 12px; border-bottom: 1px solid var(--rule-2); }
  .tbl th, .tbl td { border: 0; padding: 2px 0; }
  .tbl td[data-label]:not([data-label=""])::before { content: attr(data-label); display: inline-block; min-width: 96px; margin-right: 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
  .tbl tbody th { margin-bottom: 2px; }
  .tbl td .btn { margin-top: 6px; }
  .tbl-audit td[data-label="Hora"]::before, .tbl-audit td[data-label="Origen"]::before { display: none; }
  .tbl-audit td[data-label="Hora"] { font-weight: 700; }
}
@media (max-width: 360px) {
  .brand-name { font-size: 17px; }
  .mark { width: 30px; height: 30px; font-size: 14px; }
  .seg button { padding: 6px 8px; }
  .filter-row { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Tablas de comparación: columnas fijas para que los correos largos partan dentro de la celda */
.tbl-diff, .tbl-cmp { table-layout: fixed; }
.tbl-diff thead th:first-child, .tbl-cmp thead th:first-child { width: 28%; }
@media (max-width: 640px) { .tbl-diff, .tbl-cmp { table-layout: auto; } }
