/* =========================================================================
   Portal de evidencias MSPI — sistema visual institucional
   Estilo: accesible y sobrio (gobierno). Contraste AA, foco visible, sin ornamento.
   Escala de espaciado 4/8 · radios 8/12 · fuente del sistema (sin dependencias externas).
   ========================================================================= */
:root {
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;

  --bg: #f2f5fa; --surface: #ffffff; --surface-2: #f7f9fc; --surface-3: #eef2f8;
  --ink: #0e1b2e; --ink-2: #33445e; --muted: #56667f;
  --line: #e0e6ef; --line-strong: #c7d1e0;

  --brand: #1a3c6e; --brand-2: #24508f; --brand-ink: #ffffff; --brand-soft: #e7eef9; --focus: #2563eb;
  --side: #0d2142; --side-2: #14305c; --side-ink: #c8d5ea; --side-ink-strong: #ffffff;

  --ok: #0f6b3f; --ok-soft: #e0f3e8; --ok-solid: #13804b;
  --warn: #8a5400; --warn-soft: #fcf0d6;
  --bad: #a8261d; --bad-soft: #fde8e6;
  --info: #1a4fa3; --info-soft: #e5eeff;
  --neutral: #4d5c73; --neutral-soft: #eaeff6;

  --r-sm: 8px; --r: 12px;
  --shadow-1: 0 1px 2px rgba(15, 30, 55, .05), 0 1px 3px rgba(15, 30, 55, .06);
  --shadow-2: 0 4px 12px rgba(15, 30, 55, .08), 0 2px 4px rgba(15, 30, 55, .05);
  --ease: cubic-bezier(.2, .7, .2, 1);
  font-family: var(--font); color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a1322; --surface: #111c30; --surface-2: #15223a; --surface-3: #1a2a47;
    --ink: #e8eef8; --ink-2: #c3d0e4; --muted: #9fb0c8;
    --line: #243553; --line-strong: #324668;
    --brand: #7fb0ff; --brand-2: #9cc2ff; --brand-ink: #08142a; --brand-soft: #172a4a; --focus: #7fb0ff;
    --side: #08111f; --side-2: #0f1c33; --side-ink: #a9bad4; --side-ink-strong: #ffffff;
    --ok: #5fd29a; --ok-soft: #123425; --ok-solid: #2fb577;
    --warn: #f0b552; --warn-soft: #382a10;
    --bad: #ff9b93; --bad-soft: #3d1a18;
    --info: #8fb8ff; --info-soft: #14284b;
    --neutral: #a9b8cf; --neutral-soft: #1c2b46;
    --shadow-1: none; --shadow-2: 0 6px 20px rgba(0, 0, 0, .45);
  }
}

* { box-sizing: border-box; }
html { scroll-padding-top: 88px; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 16px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.25; margin: 0 0 .5em; letter-spacing: -.01em; text-wrap: balance; }
h1 { font-size: 1.75rem; font-weight: 650; } h2 { font-size: 1.2rem; font-weight: 650; } h3 { font-size: 1.02rem; font-weight: 650; }
a { color: var(--brand); text-underline-offset: 3px; }
p { margin: 0 0 .75em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); } .small { font-size: .875rem; } .nowrap { white-space: nowrap; }
.right { text-align: right; } .center { text-align: center; }
.stack > * + * { margin-top: 1.25rem; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1 1 auto; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ic { flex: none; vertical-align: -.2em; }
.skip-link { position: absolute; left: 8px; top: -60px; z-index: 100; background: var(--brand); color: var(--brand-ink); padding: .6rem 1rem; border-radius: var(--r-sm); text-decoration: none; font-weight: 600; }
.skip-link:focus { top: 8px; }

/* ================================ shell ================================ */
.shell { display: grid; grid-template-columns: 272px minmax(0, 1fr); min-height: 100vh; }
.nav { background: var(--side); color: var(--side-ink); position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; padding: 1.25rem .85rem 1rem; }
.brand { display: flex; gap: .75rem; align-items: center; padding: .25rem .5rem 1.25rem; text-decoration: none; color: var(--side-ink-strong); }
.brand .mark { width: 40px; height: 40px; border-radius: 10px; background: linear-gradient(145deg, #2f6bd0, #1a3c6e); display: grid; place-items: center; flex: none; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18); }
.brand b { display: block; font-family: var(--font-display); font-size: 1.02rem; line-height: 1.2; letter-spacing: -.005em; }
.brand small { display: block; color: var(--side-ink); font-size: .75rem; line-height: 1.3; margin-top: 2px; }
.nav-list { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: .7rem; padding: .62rem .75rem; border-radius: var(--r-sm); color: var(--side-ink); text-decoration: none; font-size: .95rem; position: relative; transition: background .15s var(--ease), color .15s var(--ease); }
.nav a:hover { background: rgba(255, 255, 255, .07); color: var(--side-ink-strong); }
.nav a[aria-current="page"] { background: rgba(255, 255, 255, .12); color: var(--side-ink-strong); font-weight: 600; }
.nav a[aria-current="page"]::before { content: ""; position: absolute; left: -.85rem; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: #6ea4ff; }
.nav a .ic { opacity: .9; }
.nav .sep { font-size: .7rem; text-transform: uppercase; letter-spacing: .09em; color: #7f93b5; margin: 1.35rem .75rem .4rem; font-weight: 600; }
.nav .badge { margin-left: auto; }
.nav :focus-visible { outline-color: #9cc2ff; }
.nav-foot { margin-top: auto; padding: 1rem .5rem 0; font-size: .75rem; color: #7f93b5; line-height: 1.4; border-top: 1px solid rgba(255, 255, 255, .08); }
.badge { background: #e5484d; color: #fff; border-radius: 999px; font-size: .72rem; padding: 1px .5rem; min-width: 1.4rem; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }

.content { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .75rem; padding: .65rem 1.5rem; min-height: 64px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: saturate(1.4) blur(8px); border-bottom: 1px solid var(--line); }
.topbar .ctx { color: var(--muted); font-size: .875rem; min-width: 0; }
.topbar .ctx b { color: var(--ink); font-weight: 600; }
.topbar .spacer { flex: 1; }
.userchip { display: flex; align-items: center; gap: .65rem; padding: .25rem .75rem .25rem .3rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); min-width: 0; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 700; font-size: .8rem; flex: none; }
.userchip .who { line-height: 1.2; min-width: 0; }
.userchip .who b { display: block; font-size: .875rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.userchip .who span { display: block; font-size: .75rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.iconbtn { width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: var(--r-sm); border: 1px solid transparent; background: transparent; color: var(--ink-2); cursor: pointer; transition: background .15s var(--ease); }
.iconbtn:hover { background: var(--surface-3); }
.menu-btn { display: none; }
main { padding: 2rem 1.75rem 4rem; max-width: 1320px; width: 100%; min-width: 0; outline: none; }
.page-head { margin-bottom: 1.5rem; }
.page-head h1 { margin-bottom: .25rem; }
.page-head p { color: var(--muted); margin: 0; max-width: 72ch; }
.scrim { display: none; }

@media (max-width: 960px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .menu-btn { display: inline-grid; }
  .nav { position: fixed; inset: 0 auto 0 0; width: 292px; max-width: 86vw; transform: translateX(-105%); transition: transform .22s var(--ease); z-index: 40; box-shadow: var(--shadow-2); }
  .nav.open { transform: none; }
  .scrim.open { display: block; position: fixed; inset: 0; background: rgba(8, 16, 30, .5); z-index: 30; }
  .topbar { padding: .5rem .85rem; }
  main { padding: 1.25rem 1rem 3rem; }
}
@media (max-width: 600px) {
  .userchip .who { display: none; }
  .userchip { padding: .25rem; }
  .topbar .ctx { display: none; }
  h1 { font-size: 1.5rem; }
  .filters select, .filters input, .filters input[type=search] { width: 100%; min-width: 0; }
}

/* ============================== controles =============================== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 40px; border: 1px solid var(--line-strong); background: var(--surface); padding: .45rem 1rem; border-radius: var(--r-sm); cursor: pointer; text-decoration: none; color: var(--ink); line-height: 1.2; font-weight: 550; transition: background .15s var(--ease), border-color .15s var(--ease), box-shadow .15s var(--ease); }
.btn:hover { background: var(--surface-3); border-color: var(--line-strong); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); font-weight: 600; box-shadow: var(--shadow-1); }
.btn.primary:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 55%, var(--line)); background: var(--surface); }
.btn.danger:hover { background: var(--bad-soft); }
.btn.ok { background: var(--ok-solid); color: #fff; border-color: var(--ok-solid); font-weight: 600; }
.btn.ok:hover { filter: brightness(1.08); }
.btn.sm { min-height: 32px; padding: .25rem .7rem; font-size: .875rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
label.f { display: block; font-weight: 600; margin-bottom: .3rem; font-size: .9rem; color: var(--ink-2); }
label.f .opt { font-weight: 400; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=url], select, textarea {
  width: 100%; min-height: 44px; padding: .55rem .75rem; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); transition: border-color .15s var(--ease), box-shadow .15s var(--ease); }
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--line-strong)); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 28%, transparent); }
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
input:disabled, textarea:disabled, select:disabled { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
.field + .field { margin-top: 1rem; }
.hint { color: var(--muted); font-size: .85rem; margin-top: .25rem; }
.err { color: var(--bad); font-size: .9rem; margin: .5rem 0 0; min-height: 1.2em; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-1); padding: 1.25rem 1.4rem; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(min(360px, 100%), 1fr)); }
a.card-link { display: block; text-decoration: none; color: inherit; transition: border-color .15s var(--ease), box-shadow .15s var(--ease), transform .15s var(--ease); }
a.card-link:hover { border-color: color-mix(in srgb, var(--brand) 55%, var(--line)); box-shadow: var(--shadow-2); transform: translateY(-1px); }

.chip { display: inline-flex; align-items: center; gap: .3rem; padding: .14rem .6rem .14rem .45rem; border-radius: 999px; font-size: .78rem; font-weight: 650; white-space: nowrap; line-height: 1.35; }
.chip .ic { vertical-align: 0; }
.chip.pendiente { background: var(--neutral-soft); color: var(--neutral); }
.chip.borrador { background: var(--warn-soft); color: var(--warn); }
.chip.enviado { background: var(--info-soft); color: var(--info); }
.chip.devuelto { background: var(--bad-soft); color: var(--bad); }
.chip.aprobado { background: var(--ok-soft); color: var(--ok); }
.tag { display: inline-block; background: var(--brand-soft); color: var(--brand); padding: .1rem .55rem; border-radius: 6px; font-size: .78rem; font-weight: 700; letter-spacing: .01em; font-variant-numeric: tabular-nums; }

.banner { border-radius: var(--r); padding: .85rem 1.1rem; border: 1px solid; display: flex; gap: .75rem; align-items: flex-start; }
.banner.bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 40%, transparent); color: var(--ink); }
.banner.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.banner.info { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 35%, transparent); }
.banner.ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.banner > .ic { margin-top: .2rem; }
.banner.bad > .ic { color: var(--bad); } .banner.ok > .ic { color: var(--ok); } .banner.info > .ic { color: var(--info); } .banner.warn > .ic { color: var(--warn); }
.banner p:last-child { margin-bottom: 0; }

/* =============================== tablas ================================= */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-1); }
table { border-collapse: collapse; width: 100%; font-size: .94rem; }
th, td { padding: .7rem 1rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
th { background: var(--surface-2); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; position: sticky; top: 0; white-space: nowrap; border-bottom: 1px solid var(--line-strong); }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .12s var(--ease); }
tbody tr.link { cursor: pointer; }
tbody tr.link:hover, tbody tr.link:focus-within { background: var(--brand-soft); }
td a.rowlink { color: var(--brand); text-decoration: none; font-weight: 650; font-variant-numeric: tabular-nums; }
td a.rowlink:hover { text-decoration: underline; }
td .sub { color: var(--muted); font-size: .8rem; margin-top: 2px; }
.empty { padding: 3rem 1rem; text-align: center; color: var(--muted); display: grid; justify-items: center; gap: .6rem; }
.empty .ic { color: var(--line-strong); }

.filters { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: 1rem; align-items: center; }
.filters select, .filters input { width: auto; min-width: 180px; }
.filters input[type=search] { min-width: 280px; }
.tabs { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.tab { border: 1px solid var(--line-strong); background: var(--surface); padding: .38rem .9rem; min-height: 36px; border-radius: 999px; cursor: pointer; font-size: .9rem; transition: background .15s var(--ease); }
.tab:hover { background: var(--surface-3); }
.tab[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); font-weight: 600; }
.tab .n { opacity: .75; margin-left: .35rem; font-size: .8rem; font-variant-numeric: tabular-nums; }

/* ================================ barras =============================== */
.stacked { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--neutral-soft); gap: 1px; }
.stacked > i { display: block; height: 100%; }
.seg-aprobado { background: var(--ok-solid); } .seg-enviado { background: #3b82f6; } .seg-devuelto { background: #e5484d; }
.seg-borrador { background: #e3a21a; } .seg-pendiente { background: transparent; }
.legend { display: flex; flex-wrap: wrap; gap: .25rem 1rem; font-size: .8rem; color: var(--muted); margin-top: .65rem; }
.legend span::before { content: ""; display: inline-block; width: .65rem; height: .65rem; border-radius: 3px; margin-right: .35rem; background: currentColor; vertical-align: -1px; }
.legend .l-aprobado::before { background: var(--ok-solid); } .legend .l-enviado::before { background: #3b82f6; }
.legend .l-devuelto::before { background: #e5484d; } .legend .l-borrador::before { background: #e3a21a; }
.legend .l-pendiente::before { background: var(--neutral-soft); border: 1px solid var(--line-strong); }
.meter { position: relative; height: 10px; background: var(--neutral-soft); border-radius: 999px; overflow: hidden; min-width: 120px; }
.meter > i { position: absolute; inset: 0 auto 0 0; display: block; border-radius: 999px; }
.meter .rep { background: color-mix(in srgb, #3b82f6 38%, transparent); }
.meter .val { background: var(--brand); }
.score { font-variant-numeric: tabular-nums; font-weight: 650; }
.kpi { font-family: var(--font-display); font-size: 2.1rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.kpi small { font-size: .95rem; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.kpi-label { color: var(--muted); font-size: .875rem; margin-bottom: .25rem; }
.gauge { position: relative; width: 112px; height: 112px; flex: none; }
.gauge .g-track { stroke: var(--neutral-soft); } .gauge .g-val { stroke: var(--brand); }
.gauge .g-num { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1; }
.gauge .g-num b { font-family: var(--font-display); font-size: 1.7rem; font-variant-numeric: tabular-nums; }
.gauge .g-num span { font-size: .72rem; color: var(--muted); margin-top: 3px; }
.kpi-card { display: flex; gap: 1.1rem; align-items: center; }

/* ================================= tarea ================================ */
.task-layout { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 1.5rem; align-items: start; }
@media (max-width: 1080px) { .task-layout { grid-template-columns: minmax(0, 1fr); } }
.crumbs { font-size: .9rem; margin-bottom: 1rem; }
.crumbs a { display: inline-flex; align-items: center; gap: .35rem; text-decoration: none; color: var(--muted); font-weight: 550; }
.crumbs a:hover { color: var(--brand); }
.norm { white-space: pre-wrap; font-size: .94rem; line-height: 1.6; color: var(--ink-2); max-width: 75ch; }
details > summary { cursor: pointer; font-weight: 600; margin-bottom: .5rem; }
.ref { background: var(--surface-2); border-left: 3px solid var(--brand); padding: .7rem .9rem; border-radius: 0 var(--r-sm) var(--r-sm) 0; white-space: pre-wrap; font-size: .92rem; color: var(--ink-2); }
.ref + .ref { margin-top: .6rem; }
dl.kv { margin: 0; } dl.kv dt { font-weight: 650; font-size: .76rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-top: 1rem; }
dl.kv dd { margin: .2rem 0 0; white-space: pre-wrap; }
.levels { display: grid; gap: .5rem; }
.level { display: flex; gap: .75rem; align-items: flex-start; border: 1px solid var(--line-strong); border-radius: var(--r-sm); padding: .65rem .85rem; cursor: pointer; background: var(--surface); transition: border-color .15s var(--ease), background .15s var(--ease); }
.level:hover { border-color: color-mix(in srgb, var(--brand) 50%, var(--line-strong)); }
.level:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand); }
.level:has(input:disabled) { cursor: default; opacity: .85; }
.level input { margin-top: .3rem; width: 18px; height: 18px; accent-color: var(--brand); flex: none; }
.level b { display: block; font-size: .95rem; } .level span { color: var(--muted); font-size: .85rem; }
.ev-list { list-style: none; margin: 0; padding: 0; }
.ev-list li { display: flex; gap: .75rem; align-items: center; padding: .65rem 0; border-bottom: 1px solid var(--line); }
.ev-list li:last-child { border-bottom: 0; }
.ev-ico { flex: none; width: 40px; height: 40px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-size: .66rem; font-weight: 750; text-transform: uppercase; letter-spacing: .03em; }
.ev-main { min-width: 0; flex: 1; }
.ev-main a, .ev-main b { overflow-wrap: anywhere; font-weight: 600; }
.drop { display: grid; justify-items: center; gap: .3rem; border: 2px dashed var(--line-strong); border-radius: var(--r); padding: 1.25rem; text-align: center; color: var(--muted); cursor: pointer; background: var(--surface-2); margin-top: 1rem; transition: border-color .15s var(--ease), background .15s var(--ease); }
.drop:hover, .drop:focus-within { border-color: var(--brand); }
.drop.over { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.drop b { color: var(--ink); } .drop .ic { color: var(--brand); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: .5rem 0 .5rem 1.1rem; border-left: 2px solid var(--line-strong); margin-left: .4rem; position: relative; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: .85rem; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 3px solid var(--brand); }
.sticky-actions { position: sticky; bottom: 0; background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(8px); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-2); padding: .85rem 1.1rem; display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; z-index: 5; }
.sticky-actions .hint { margin: 0; flex: 1 1 220px; }

.stepper { list-style: none; display: flex; gap: 0; margin: 1rem 0 0; padding: 0; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: .55rem; color: var(--muted); font-size: .9rem; font-weight: 550; padding-right: .5rem; }
.step + .step::before { content: ""; width: 36px; height: 2px; background: var(--line-strong); margin-right: .5rem; border-radius: 2px; }
.step .dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: .8rem; font-weight: 700; background: var(--neutral-soft); color: var(--neutral); flex: none; }
.step.done { color: var(--ok); } .step.done .dot { background: var(--ok-solid); color: #fff; }
.step.done + .step::before { background: var(--ok-solid); }
.step.current { color: var(--ink); font-weight: 650; } .step.current .dot { background: var(--brand); color: var(--brand-ink); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 22%, transparent); }
.step.bad { color: var(--bad); font-weight: 650; } .step.bad .dot { background: var(--bad); color: #fff; }

/* ================================ matriz =============================== */
.matrix th.area { white-space: normal; min-width: 104px; max-width: 128px; font-size: .68rem; text-align: center; line-height: 1.25; vertical-align: bottom; }
.matrix td.cell { text-align: center; vertical-align: middle; }
.matrix td.cell input { width: 20px; height: 20px; accent-color: var(--brand); cursor: pointer; }
.matrix td.t { min-width: 300px; }
.matrix tbody tr:hover { background: var(--surface-2); }

/* ================================ login ================================ */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.login-aside { background: radial-gradient(1200px 600px at 0% 0%, #1d4a8c 0%, transparent 60%), linear-gradient(160deg, #0d2142 0%, #0a1a35 100%); color: #e6eefb; padding: 3rem clamp(1.5rem, 5vw, 4.5rem); display: flex; flex-direction: column; justify-content: space-between; gap: 2rem; }
.login-aside .brand { padding: 0; }
.login-aside h2 { font-size: clamp(1.6rem, 2.6vw, 2.25rem); color: #fff; max-width: 18ch; margin: 0 0 1rem; font-weight: 650; }
.login-aside p { color: #b9cae6; max-width: 46ch; }
.login-points { list-style: none; padding: 0; margin: 1.75rem 0 0; display: grid; gap: .9rem; }
.login-points li { display: flex; gap: .8rem; align-items: flex-start; color: #d4e0f4; }
.login-points .ic { color: #7fb0ff; margin-top: .15rem; }
.login-aside small { color: #8ea4c8; }
.login-main { display: grid; place-items: center; padding: 2rem 1.25rem; background: var(--bg); }
.login-card { width: min(430px, 100%); }
.login-card h1 { font-size: 1.6rem; margin-bottom: .35rem; }
.login-card .lead { color: var(--muted); margin-bottom: 1.5rem; }
.login-card .btn.primary { width: 100%; min-height: 46px; margin-top: .75rem; }
.login-solo { min-height: 100vh; display: grid; place-items: center; padding: 1.25rem; }
.login-solo .card { width: min(440px, 100%); padding: 2rem; }
@media (max-width: 880px) {
  .login { grid-template-columns: minmax(0, 1fr); }
  .login-aside { padding: 1.5rem 1.25rem; gap: 1rem; }
  .login-aside h2, .login-aside p, .login-points, .login-aside small { display: none; }
}

/* ============================ toasts / dialog ============================ */
#toasts { position: fixed; right: 1rem; bottom: 1rem; display: grid; gap: .5rem; z-index: 100; max-width: min(400px, calc(100vw - 2rem)); }
.toast { display: flex; gap: .6rem; align-items: flex-start; background: var(--ink); color: var(--bg); padding: .75rem 1rem; border-radius: var(--r-sm); box-shadow: var(--shadow-2); animation: toast-in .2s var(--ease); }
.toast.bad { background: var(--bad); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
dialog { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); color: var(--ink); padding: 1.5rem; width: min(500px, calc(100vw - 2rem)); box-shadow: var(--shadow-2); }
dialog::backdrop { background: rgba(8, 16, 30, .55); backdrop-filter: blur(2px); }
dialog h2 { margin-top: 0; }
dialog .actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1.25rem; }
code.secret { display: block; padding: .75rem 1rem; background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: var(--r-sm); font-size: 1.1rem; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; user-select: all; margin: .6rem 0; }

fieldset.plain { border: 0; padding: 0; margin: 0; min-width: 0; }
legend.label-like { font-weight: 600; font-size: .9rem; margin-bottom: .4rem; padding: 0; color: var(--ink-2); }
.w160 { min-width: 160px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  a.card-link:hover, .btn:active { transform: none; }
}
@media print { .nav, .topbar, .filters, .btn, .sticky-actions { display: none !important; } .shell { display: block; } main { padding: 0; } }

/* ============================ mapa de procesos ============================ */
tr.macro-row td { background: var(--surface-2); font-weight: 650; border-bottom: 1px solid var(--line-strong); padding-block: .55rem; }
td.chk { width: 52px; vertical-align: middle; }
td.chk input { width: 20px; height: 20px; accent-color: var(--brand); cursor: pointer; }
ul.subs { margin: .4rem 0 .2rem; padding-left: 1.1rem; color: var(--ink-2); font-size: .88rem; }
ul.subs li + li { margin-top: .15rem; }
details summary { font-size: .9rem; }
.tag.sug { background: var(--warn-soft); color: var(--warn); }
select.owner-select { min-height: 36px; padding: .3rem .5rem; min-width: 210px; max-width: 280px; font-size: .9rem; }
td.owner-cell { min-width: 230px; }

/* ============================ notificaciones ============================ */
.notif-wrap { position: relative; }
#bell { position: relative; }
.bell-badge { position: absolute; top: 2px; right: 1px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: #e5484d; color: #fff; font-size: .68rem; font-weight: 700; line-height: 18px; text-align: center; font-variant-numeric: tabular-nums; box-shadow: 0 0 0 2px var(--surface); }
.bell-badge.read { background: var(--neutral-soft); color: var(--muted); box-shadow: 0 0 0 2px var(--surface), inset 0 0 0 1px var(--line-strong); }
.notif-panel { position: absolute; right: 0; top: calc(100% + 8px); width: min(400px, calc(100vw - 24px)); max-height: min(70vh, 560px); overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-2); z-index: 60; }
.notif-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .75rem 1rem; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); }
.notif-list { list-style: none; margin: 0; padding: 0; }
.notif-item { display: flex; gap: .75rem; padding: .75rem 1rem; text-decoration: none; color: inherit; border-bottom: 1px solid var(--line); position: relative; }
.notif-list li:last-child .notif-item { border-bottom: 0; }
.notif-item:hover { background: var(--surface-2); }
.notif-item.unread { background: var(--brand-soft); }
.notif-item.unread::before { content: ""; position: absolute; left: 5px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: var(--brand); }
.notif-ico { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--neutral-soft); color: var(--neutral); }
.notif-ico.enviado { background: var(--info-soft); color: var(--info); }
.notif-ico.devuelto { background: var(--bad-soft); color: var(--bad); }
.notif-ico.aprobado { background: var(--ok-soft); color: var(--ok); }
.notif-ico.evidencia { background: var(--warn-soft); color: var(--warn); }
.notif-main { display: grid; gap: 1px; min-width: 0; font-size: .9rem; }
.notif-main > span { color: var(--ink-2); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.notif-loading { padding: 1rem; margin: 0; }
@media (max-width: 600px) { .notif-wrap { position: static; } .notif-panel { position: fixed; left: 12px; right: 12px; top: 60px; width: auto; } }

/* ================================ catálogo ================================ */
tr.dim td { opacity: .55; }
tr.dim td:last-child { opacity: 1; }
.checks { display: grid; gap: .35rem; max-height: 210px; overflow-y: auto; padding: .15rem; }
.checks .level { padding: .4rem .7rem; }
