/* VOICE: a factory's module register for the client — calm, exact, nothing decorative.
   IDEA: the Live Master Modules Matrix as a traveler's dossier — one row per module, one file per module.
   PICTURE: the Matrix itself, and the building in 3D where every module opens its dossier.
   COLOUR and TYPE: West Modular warm neutrals (#F9F8F6 ground, #3F3F41 ink) with the brand bronze #B3A684; Barlow Semi Condensed labels, Inter text.
   LAYOUT: sticky header with tabs; full-width table; a right-hand drawer for the module dossier. */

:root {
  --bg: var(--wm-bg);
  --surface: var(--wm-surface);
  --sunk: var(--wm-sunk);
  --ink: var(--wm-ink);
  --ink2: var(--wm-ink2);
  --muted: var(--wm-muted);
  --line: var(--wm-line);
  --line2: var(--wm-line2);
  --gold: var(--wm-gold);
  --gold-d: var(--wm-gold-d);
  --gold-s: var(--wm-gold-s);
  --ok: var(--wm-ok);
  --ok-s: var(--wm-ok-s);
  --warn: var(--wm-warn);
  --warn-s: var(--wm-warn-s);
  --bad: var(--wm-bad);
  --bad-s: var(--wm-bad-s);
  --info: var(--wm-info);
  --info-s: var(--wm-info-s);
  --f-d: var(--wm-f-d);
  --f-b: var(--wm-f-b);
  --hdr: 58px;
}

* { box-sizing: border-box; min-width: 0; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 var(--f-b);
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--gold-s); color: var(--ink); }
a { color: var(--info); text-underline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.num, td.n { font-variant-numeric: tabular-nums; }

/* header */
header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 max(16px, 2vw);
  min-height: var(--hdr);
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.brand img { height: 30px; width: auto; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) .brand img { filter: invert(1) brightness(1.6); }
}
:root[data-theme=dark] .brand img { filter: invert(1) brightness(1.6); }
.brand b { font: 700 19px/1.05 var(--f-d); letter-spacing: .01em; }
.brand small { display: block; font: 500 12px/1.2 var(--f-b); color: var(--muted); }

nav.tabs {
  display: flex;
  gap: 2px;
  margin-left: 8px;
  flex-wrap: wrap;
  scrollbar-width: none;
}
nav.tabs::-webkit-scrollbar { display: none; }
nav.tabs button {
  border: 0;
  background: none;
  padding: 10px 12px;
  font: 600 15px var(--f-d);
  letter-spacing: .02em;
  color: var(--ink2);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  min-height: 44px;
  white-space: nowrap;
}
nav.tabs button[aria-current=page] { color: var(--ink); border-bottom-color: var(--gold); }
nav.tabs button:hover { color: var(--ink); }

.hdr-r { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.who { font-size: 12.5px; color: var(--muted); }
.role {
  font: 600 11px var(--f-d);
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--gold-s);
  color: var(--gold-d);
}

/* buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  padding: 7px 12px;
  min-height: 36px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  text-decoration: none;
  transition: background-color .15s ease, border-color .15s ease;
}
.btn:hover { border-color: var(--gold); }
.btn.pri { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn.pri:hover { background: var(--gold-d); border-color: var(--gold-d); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.sm { padding: 4px 9px; min-height: 30px; font-size: 12.5px; }
.ic { width: 16px; height: 16px; flex: none; }

main { padding: 16px max(16px, 2vw) 40px; }
.view[hidden] { display: none !important; }

/* KPI strip */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 14px;
}
.kpi { background: var(--surface); padding: 12px 14px; }
.kpi b { display: block; font: 700 28px/1.05 var(--f-d); }
.kpi span { font-size: 12.5px; color: var(--muted); }
.kpi .bar { height: 4px; border-radius: 2px; background: var(--line2); margin-top: 8px; overflow: hidden; }
.kpi .bar i { display: block; height: 100%; background: var(--gold); }

/* toolbar */
.tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.search { position: relative; }
.search input {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 0 10px 0 32px;
  width: 220px;
  font-size: 14px;
}
.search svg { position: absolute; left: 10px; top: 11px; width: 16px; height: 16px; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.chips .lab {
  font: 600 11.5px var(--f-d);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 4px 0 6px;
}
.chip {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12.5px;
  cursor: pointer;
  min-height: 30px;
}
.chip[aria-pressed=true] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
select.sel {
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 0 8px;
  font-size: 13px;
}
.grpbar { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 8px; }
.grpbar .chip { font-size: 12px; }
.count { font-size: 12.5px; color: var(--muted); margin-left: auto; }

/* table */
.tw {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  max-height: calc(100dvh - var(--hdr) - 220px);
  min-height: 320px;
}
table.mx { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; font-size: 12.5px; }
table.mx th, table.mx td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--line2);
  border-right: 1px solid var(--line2);
  white-space: nowrap;
  text-align: center;
  vertical-align: middle;
}
table.mx thead th {
  position: sticky;
  background: var(--sunk);
  font: 600 11.5px/1.2 var(--f-d);
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink2);
  z-index: 3;
}
table.mx thead tr:first-child th { top: 0; height: 30px; color: var(--gold-d); background: var(--sunk); border-bottom: 1px solid var(--line); }
table.mx thead tr:nth-child(2) th { top: 30px; white-space: normal; min-width: 70px; max-width: 130px; cursor: pointer; }
table.mx thead tr:nth-child(2) th:hover { color: var(--ink); }
table.mx th.st, table.mx td.st { position: sticky; left: 0; z-index: 2; background: var(--surface); border-right: 1px solid var(--line); }
table.mx thead th.st { z-index: 4; background: var(--sunk); }
table.mx tbody tr { cursor: pointer; }
table.mx tbody tr:hover td { background: var(--gold-s); }
table.mx tbody tr:hover td.st { background: var(--gold-s); }
table.mx td.l { text-align: left; }
td .mid { font: 700 13.5px var(--f-d); letter-spacing: .02em; color: var(--ink); }
td .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; vertical-align: middle; }
.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font: 600 11px/1.5 var(--f-d);
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.p-ok { background: var(--ok-s); color: var(--ok); }
.p-warn { background: var(--warn-s); color: var(--warn); }
.p-bad { background: var(--bad-s); color: var(--bad); }
.p-info { background: var(--info-s); color: var(--info); }
.p-mute { background: var(--sunk); color: var(--muted); }
.p-gold { background: var(--gold-s); color: var(--gold-d); }
.dc { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 5px; font-size: 11px; font-weight: 700; }
.dc.on { background: var(--ok-s); color: var(--ok); }
.dc.off { color: var(--line); }
.dc.f { background: var(--ok); color: #fff; }
.edited { box-shadow: inset 0 -2px 0 var(--gold); }
.pctb { display: inline-flex; align-items: center; gap: 6px; }
.pctb i { display: inline-block; width: 42px; height: 5px; border-radius: 3px; background: var(--line2); overflow: hidden; }
.pctb i b { display: block; height: 100%; background: var(--gold); }
.empty { padding: 40px; text-align: center; color: var(--muted); }

/* drawer */
.scrim {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 22, .35);
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.scrim.on { opacity: 1; pointer-events: auto; }
aside.dr {
  position: fixed;
  top: 0;
  right: 0;
  height: 100dvh;
  width: min(760px, 100vw);
  background: var(--bg);
  z-index: 41;
  transform: translateX(100%);
  transition: transform .25s cubic-bezier(.2, .8, .2, 1);
  display: flex;
  flex-direction: column;
  box-shadow: -12px 0 40px rgba(0, 0, 0, .18);
}
aside.dr.on { transform: none; }
@media (prefers-reduced-motion: reduce) { aside.dr, .scrim { transition: none; } }
.dr-h { padding: 16px 20px 12px; border-bottom: 1px solid var(--line); background: var(--surface); }
.dr-h .top { display: flex; align-items: flex-start; gap: 12px; }
.dr-h h2 { margin: 0; font: 700 34px/1 var(--f-d); letter-spacing: .01em; }
.dr-h .sub { color: var(--ink2); font-size: 13.5px; margin-top: 4px; }
.dr-h .x { margin-left: auto; }
.dr-h .nav { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.dr-b { overflow: auto; -webkit-overflow-scrolling: touch; padding: 16px 20px 40px; flex: 1; }
.facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--line2);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 16px;
}
.facts div { background: var(--surface); padding: 8px 12px; box-shadow: 0 0 0 .5px var(--line2); }
.facts span { display: block; font: 600 11px var(--f-d); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.facts b { font-weight: 600; font-size: 13.5px; overflow-wrap: anywhere; }
h3.sec {
  font: 700 15px var(--f-d);
  letter-spacing: .05em;
  text-transform: uppercase;
  margin: 20px 0 8px;
  color: var(--gold-d);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
h3.sec .r { margin-left: auto; font: 500 12.5px var(--f-b); letter-spacing: 0; text-transform: none; color: var(--muted); }

/* timeline */
.tl { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
@media (max-width: 700px) { .tl { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.step { background: var(--surface); border: 1px solid var(--line2); border-radius: 10px; padding: 10px; position: relative; }
.step .n { font: 700 12px var(--f-d); letter-spacing: .04em; text-transform: uppercase; color: var(--ink2); display: block; min-height: 30px; }
.step .s { margin: 6px 0 4px; }
.step small { display: block; color: var(--muted); font-size: 11.5px; line-height: 1.35; }
.step.done { border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.step.cur { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }

/* docs */
.dg { border: 1px solid var(--line2); border-radius: 10px; background: var(--surface); overflow: hidden; margin-bottom: 10px; }
.dg h4 {
  margin: 0;
  padding: 8px 12px;
  font: 700 13px var(--f-d);
  letter-spacing: .05em;
  text-transform: uppercase;
  background: var(--sunk);
  display: flex;
  gap: 8px;
  align-items: center;
}
.dg h4 .r { margin-left: auto; font: 500 12px var(--f-b); letter-spacing: 0; text-transform: none; color: var(--muted); }
.dr-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 8px 10px;
  align-items: start;
  padding: 9px 12px;
  border-top: 1px solid var(--line2);
  scroll-margin: 80px;
}
.dr-row .acts { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.dr-row.hl { animation: hl 1.8s cubic-bezier(.23, 1, .32, 1); }
@keyframes hl {
  0%, 35% { background: color-mix(in srgb, var(--gold) 26%, transparent); box-shadow: inset 0 0 0 1px var(--gold); }
  100% { background: transparent; box-shadow: inset 0 0 0 1px transparent; }
}
@media (prefers-reduced-motion: reduce) {
  .dr-row.hl { animation: none; background: color-mix(in srgb, var(--gold) 18%, transparent); }
}
.cpu {
  width: 100%;
  font: inherit;
  font-size: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
}
.dr-row:first-of-type { border-top: 0; }
.dr-row .nm { font-weight: 600; }
.files { display: flex; flex-direction: column; gap: 3px; margin-top: 4px; }
.files a { font-size: 12.5px; display: inline-flex; gap: 6px; align-items: center; overflow-wrap: anywhere; }
.files small { color: var(--muted); }
.tog {
  appearance: none;
  width: 22px;
  height: 22px;
  border: 1.5px solid var(--line);
  border-radius: 6px;
  display: grid;
  place-items: center;
  cursor: pointer;
  background: var(--surface);
  margin: 0;
}
.tog:checked { background: var(--ok); border-color: var(--ok); }
.tog:checked::after {
  content: "";
  width: 6px;
  height: 11px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-1px, -1px);
}
.tog:disabled { cursor: default; }
.tog.ro { pointer-events: none; }

/* form */
.fg { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px 12px; }
.fg label { display: flex; flex-direction: column; gap: 3px; font: 600 11.5px var(--f-d); letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.fg input, .fg textarea {
  font: 14px var(--f-b);
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  padding: 6px 8px;
  min-height: 36px;
}
.fg textarea { min-height: 60px; resize: vertical; }
.fg .full { grid-column: 1 / -1; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0; background: var(--surface); border: 1px solid var(--line2); border-radius: 10px; overflow: hidden; }
.kv div { background: var(--surface); padding: 7px 12px; box-shadow: 0 0 0 .5px var(--line2); }
.kv span { display: block; font: 600 11px var(--f-d); letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.kv b { font-weight: 500; }

/* toast + modal */
#toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 9px;
  font-size: 13.5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 60;
  max-width: 90vw;
}
#toast.on { opacity: 1; transform: translateX(-50%); }
dialog, .dlg {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  padding: 0;
  width: min(720px, 94vw);
  max-height: 86dvh;
}
dialog::backdrop { background: rgba(20, 20, 22, .45); }
dialog .dh, .dlg .dh { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
dialog .dh b, .dlg .dh b { font: 700 20px var(--f-d); }
dialog .db, .dlg .db { padding: 14px 18px; overflow: auto; max-height: 62dvh; }
dialog .df, .dlg .df { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.diff { font-size: 12.5px; border-collapse: collapse; width: 100%; }
.diff td, .diff th { border-bottom: 1px solid var(--line2); padding: 4px 6px; text-align: left; vertical-align: top; }
.diff del { color: var(--bad); }
.diff ins { color: var(--ok); text-decoration: none; }

/* documents view */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.cov { border-collapse: collapse; font-size: 12.5px; width: 100%; min-width: 520px; }
.cov th, .cov td { padding: 6px 8px; border-bottom: 1px solid var(--line2); text-align: right; }
.cov th:first-child, .cov td:first-child { text-align: left; }
.heat { display: inline-block; min-width: 42px; padding: 2px 6px; border-radius: 5px; }

/* 3D */
.sk-bar { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin-bottom: 8px; }
.sk-find { display: flex; align-items: center; gap: 6px; }
.sk-find input {
  height: 32px;
  width: 92px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 9px;
  background: var(--surface);
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
}
.sk-find input.wide { width: 120px; }
.sk-find input:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.sk-more[aria-expanded=true] { border-color: var(--gold); }
.sk-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  align-items: center;
  padding: 8px 10px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}
.sk-filters[hidden] { display: none; }
.lnk {
  border: 0;
  background: none;
  color: var(--gold-d);
  font-weight: 600;
  font-size: 12.5px;
  padding: 4px 6px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.sk-wrap {
  position: relative;
  height: calc(100dvh - var(--hdr) - 170px);
  min-height: 360px;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg);
}
#sk3-stage { position: absolute; inset: 0; }
#sk3-stage canvas { display: block; outline: none; }
#sk3-stage canvas:focus-visible { box-shadow: inset 0 0 0 2px var(--gold); }
.sk-tip {
  position: absolute;
  pointer-events: none;
  background: var(--ink);
  color: var(--bg);
  padding: 5px 9px;
  border-radius: 6px;
  font-size: 12px;
  transform: translate(12px, 12px);
  white-space: nowrap;
  z-index: 6;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
}
.sk-tip.flip { transform: translate(calc(-100% - 12px), 12px); }
.sk-grp {
  position: absolute;
  z-index: 4;
  display: flex;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .1);
  overflow: hidden;
}
.sk-grp button {
  border: 0;
  background: none;
  color: var(--ink);
  font: 600 12px/1 var(--f-d);
  letter-spacing: .06em;
  text-transform: uppercase;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.sk-grp button:hover { background: var(--sunk); }
.sk-grp button[aria-pressed=true] { background: var(--ink); color: var(--bg); }
.sk-grp button:disabled { opacity: .5; cursor: progress; }
.sk-views { left: 12px; top: 12px; flex-direction: column; }
.sk-views .crow { display: flex; align-items: stretch; border-bottom: 1px solid var(--line); }
.sk-views .crow:last-child { border-bottom: 0; }
.sk-views .crow span {
  font: 600 10px/36px var(--f-d);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 8px;
  min-width: 74px;
}
.sk-views .crow button { min-width: 40px; height: 36px; padding: 0 10px; border-left: 1px solid var(--line2); }
.sk-mouse { right: 12px; bottom: 12px; }
.sk-mouse button { width: 42px; height: 40px; border-left: 1px solid var(--line2); }
.sk-mouse button:first-child { border-left: 0; }
.sk-leg {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 4;
  max-width: min(640px, calc(100% - 220px));
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-size: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .1);
}
.sk-leg .k { display: inline-flex; align-items: center; gap: 6px; }
.sk-leg i { width: 12px; height: 12px; border-radius: 3px; border: 1px solid rgba(0, 0, 0, .25); }
.sk-leg .ramp { display: inline-block; width: 110px; height: 10px; border-radius: 5px; background: linear-gradient(90deg, #EDE7D6, #1E7A4C); }
.sk-info {
  position: absolute;
  right: 12px;
  top: 12px;
  width: 320px;
  max-height: calc(100% - 80px);
  overflow: auto;
  z-index: 5;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .14);
}
.sk-info[hidden] { display: none; }
.sk-info .hd { display: flex; gap: 10px; align-items: flex-start; padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }
.sk-info .hd > div { flex: 1; }
.sk-info .eb { font: 600 11px var(--f-d); letter-spacing: .1em; text-transform: uppercase; color: var(--gold-d); }
.sk-info h3 { margin: 4px 0 0; font: 700 26px/1 var(--f-d); letter-spacing: .01em; }
.sk-info .x { border: 1px solid var(--line); background: none; border-radius: 6px; width: 30px; height: 30px; font-size: 17px; cursor: pointer; color: var(--ink); }
.sk-info .bd { padding: 12px 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.sk-info dl { display: grid; grid-template-columns: auto 1fr; gap: 5px 14px; margin: 0; }
.sk-info dt { font: 600 10.5px/1.7 var(--f-d); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.sk-info dd { margin: 0; font-size: 13px; overflow-wrap: anywhere; }
.sk-info .pb { height: 8px; border-radius: 4px; background: var(--sunk); overflow: hidden; }
.sk-info .pb i { display: block; height: 100%; background: var(--gold); }
.sk-info .row { display: flex; gap: 6px; flex-wrap: wrap; }
:root[data-style=brand] .sk-grp button { font-weight: 600; letter-spacing: .1em; }
:root[data-style=brand] .sk-info h3 { font-weight: 300; letter-spacing: .04em; }

.note { font-size: 12.5px; color: var(--muted); }
.drop { border: 1.5px dashed var(--line); border-radius: 10px; padding: 18px; text-align: center; color: var(--muted); }
.drop.over { border-color: var(--gold); background: var(--gold-s); }
.lst { list-style: none; margin: 0; padding: 0; }
.lst li { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line2); align-items: baseline; flex-wrap: wrap; }
.lst li small { color: var(--muted); margin-left: auto; white-space: nowrap; }

/* ===== Modo claro/oscuro y estilo institucional WMM (data-style="brand") ===== */
@font-face { font-family: "Avenir Next WM"; src: url(/fonts/avenir-Light.woff2) format("woff2"); font-weight: 300; font-style: normal; font-display: swap; }
@font-face { font-family: "Avenir Next WM"; src: url(/fonts/avenir-Regular.woff2) format("woff2"); font-weight: 400 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Avenir Next WM"; src: url(/fonts/avenir-It.woff2) format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Avenir Next WM"; src: url(/fonts/avenir-Demi.woff2) format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Avenir Next WM"; src: url(/fonts/avenir-Bold.woff2) format("woff2"); font-weight: 700 800; font-style: normal; font-display: swap; }

.brand .lg-w { display: none; }
.vset { display: inline-flex; align-items: center; gap: 6px; }
.seg2 { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg2 button { border: 0; background: var(--surface); padding: 4px 10px; min-height: 30px; font: 600 12px var(--f-b); color: var(--ink2); cursor: pointer; }
.seg2 button + button { border-left: 1px solid var(--line); }
.seg2 button[aria-pressed=true] { background: var(--ink); color: var(--bg); }
.thm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  min-height: 30px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink2);
  cursor: pointer;
}
.thm:hover, .seg2 button:hover { color: var(--ink); }
.thm .ic-sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) .thm .ic-sun { display: block; }
  :root:not([data-theme=light]) .thm .ic-moon { display: none; }
}
:root[data-theme=dark] .thm .ic-sun { display: block; }
:root[data-theme=dark] .thm .ic-moon { display: none; }
:root[data-theme=light] .thm .ic-sun { display: none; }
:root[data-theme=light] .thm .ic-moon { display: block; }

:root[data-style=brand] {
  --bg: light-dark(#F9F8F6, #2A2B2D);
  --surface: light-dark(#F9F8F6, #333436);
  --sunk: light-dark(#EFEDE8, #3B3C3F);
  --ink: light-dark(#3F3F41, #F2F1ED);
  --ink2: light-dark(#58595B, #CFCEC8);
  --muted: light-dark(#6B6D70, #A9ACAE);
  --line: light-dark(#D4D4CD, #4B4C4F);
  --line2: light-dark(#E6E5E0, #424346);
  --gold: #B3A684;
  --gold-d: light-dark(#7A6F4F, #D4C9A6);
  --gold-s: light-dark(#EFEBE0, #423E33);
  --f-d: "Avenir Next WM", "Avenir Next", Avenir, "Segoe UI", Arial, sans-serif;
  --f-b: "Avenir Next WM", "Avenir Next", Avenir, "Segoe UI", Arial, sans-serif;
  --hdrbg: light-dark(#58595B, #1F2022);
}
:root[data-style=brand] body { font-size: 14px; letter-spacing: .005em; }
:root[data-style=brand] header { background: var(--hdrbg); border-bottom: 1px solid light-dark(#58595B, #3A3B3D); color: #fff; }
:root[data-style=brand] .brand .lg-s { display: none; }
:root[data-style=brand] .brand .lg-w { display: block; height: 40px; filter: none !important; }
:root[data-style=brand] .brand b { font: 300 20px/1.1 var(--f-d); letter-spacing: .06em; text-transform: uppercase; color: #fff; }
:root[data-style=brand] .brand small { color: #D4D4CD; letter-spacing: .04em; }
:root[data-style=brand] nav.tabs button { font: 600 12.5px var(--f-d); letter-spacing: .12em; text-transform: uppercase; color: rgba(255, 255, 255, .72); }
:root[data-style=brand] nav.tabs button:hover { color: #fff; }
:root[data-style=brand] nav.tabs button[aria-current=page] { color: #fff; border-bottom-color: var(--gold); }
:root[data-style=brand] header .who { color: #D4D4CD; }
:root[data-style=brand] header .role { background: var(--gold); color: #2A2B2D; }
:root[data-style=brand] header .btn, :root[data-style=brand] header .thm { background: transparent; border-color: rgba(255, 255, 255, .35); color: #fff; }
:root[data-style=brand] header .btn:hover, :root[data-style=brand] header .thm:hover { border-color: var(--gold); color: #fff; }
:root[data-style=brand] header .seg2 { border-color: rgba(255, 255, 255, .35); }
:root[data-style=brand] header .seg2 button { background: transparent; color: rgba(255, 255, 255, .8); }
:root[data-style=brand] header .seg2 button + button { border-left-color: rgba(255, 255, 255, .35); }
:root[data-style=brand] header .seg2 button[aria-pressed=true] { background: #fff; color: #3F3F41; }
:root[data-style=brand] .kpi b { font-weight: 300; letter-spacing: .01em; }
:root[data-style=brand] .dr-h h2 { font-weight: 300; letter-spacing: .04em; }
:root[data-style=brand] h3.sec, :root[data-style=brand] .dg h4 { font-weight: 600; letter-spacing: .1em; }
:root[data-style=brand] table.mx thead th { font-weight: 600; font-size: 10.5px; letter-spacing: .06em; }
:root[data-style=brand] td .mid { font-weight: 600; }
:root[data-style=brand] .btn.pri { background: var(--ink2); border-color: var(--ink2); }
:root[data-style=brand] .btn.pri:hover { background: var(--gold-d); border-color: var(--gold-d); }

main:has(#v-sky:not([hidden])), main:has(#v-matrix:not([hidden])) { padding-bottom: 12px; }
#v-matrix .tw { max-height: none; }
#v-matrix > p.note, #v-sky > p.note { margin-bottom: 0; }

/* sync OneDrive */
.odl { font-size: 11px; font-weight: 600; color: var(--gold-d); margin-left: 4px; }
.sy-l { margin: 4px 0 12px; padding-left: 18px; max-height: 160px; overflow: auto; font-size: 12.5px; color: var(--ink2); }
.sy-e { color: var(--bad); font-weight: 600; }

/* edición rápida */
.qe-sel {
  position: fixed;
  z-index: 80;
  border: 1.5px solid var(--gold);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: 600 12.5px var(--f-b);
  padding: 0 8px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .16);
  cursor: pointer;
}
.qe-sel:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
table.mx td.qe { cursor: pointer; position: relative; }
table.mx td.qe:hover { box-shadow: inset 0 0 0 1.5px var(--gold); background: var(--gold-s); }
.qev {
  border: 0;
  background: none;
  padding: 2px 6px;
  margin: -2px -6px;
  border-radius: 6px;
  font: inherit;
  font-weight: 600;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  text-decoration: underline dotted var(--muted);
  text-underline-offset: 3px;
}
.qev:hover { background: var(--gold-s); text-decoration-color: var(--gold); }
.qe-pop {
  position: fixed;
  z-index: 80;
  width: min(300px, calc(100vw - 16px));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  animation: qe-in .14s ease-out;
}
@keyframes qe-in { from { opacity: 0; transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) { .qe-pop { animation: none; } }
.qe-pop .qh b { font: 700 15px var(--f-d); margin-right: 8px; }
.qe-pop .qh span { font-size: 12px; color: var(--muted); }
.qe-pop .qo { display: flex; flex-wrap: wrap; gap: 5px; }
.qe-pop .qo button { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 3px 5px; cursor: pointer; min-height: 30px; }
.qe-pop .qo button:hover, .qe-pop .qo button:focus-visible { border-color: var(--gold); }
.qe-pop .qo button[aria-pressed=true] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.qe-pop .qp button { min-width: 46px; font-weight: 600; font-size: 12.5px; }
.qe-pop .qf { display: flex; gap: 6px; }
.qe-pop .qf input { flex: 1; height: 32px; border: 1px solid var(--line); border-radius: 8px; padding: 0 8px; background: var(--surface); }
.qe-pop .qa { display: flex; justify-content: space-between; border-top: 1px solid var(--line2); padding-top: 6px; }

/* ==========================================================================
   Responsive: Tablet (<= 1024px) & Mobile (<= 640px)
   ========================================================================== */

@media (max-width: 1024px) {
  header {
    gap: 8px 12px;
    padding: 6px max(12px, 2vw);
  }
  nav.tabs {
    order: 3;
    width: 100%;
    margin-left: 0;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }
  nav.tabs button {
    flex: 0 0 auto;
    min-height: 44px;
  }
  .hdr-r {
    margin-left: auto;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
  }
  .tw {
    max-height: calc(100dvh - var(--hdr) - 240px);
  }
  #v-sky .sk-wrap {
    height: clamp(360px, 64dvh, 720px);
  }
  .sk-leg {
    max-width: min(520px, calc(100% - 200px));
  }
  .sk-info {
    width: min(300px, calc(100% - 24px));
  }
}

@media (max-width: 760px) {
  .sk-leg { display: none; }
  .sk-info {
    top: auto;
    bottom: 64px;
    left: 12px;
    right: 12px;
    width: auto;
    max-height: 46%;
  }
  .sk-views .crow span { display: none; }
  #v-sky .sk-wrap {
    height: calc(100dvh - 220px);
  }
}

@media (max-width: 640px) {
  header {
    gap: 6px 10px;
    padding: 8px 12px;
  }
  .brand { padding: 4px 0; }
  .brand img { height: 26px; }
  :root[data-style=brand] .brand .lg-w { height: 32px; }
  .brand b { font-size: 16.5px; }
  nav.tabs {
    margin-left: 0;
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    gap: 4px;
  }
  nav.tabs button {
    flex: 0 0 auto;
    min-height: 44px;
    padding: 10px 12px;
  }
  .hdr-r {
    width: 100%;
    margin-left: 0;
    justify-content: space-between;
    gap: 6px;
  }
  main { padding: 12px 12px 28px; }
  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .kpi { padding: 10px 12px; }
  .kpi b { font-size: 24px; }
  .tools { gap: 8px; }
  .search { flex: 1 1 100%; width: 100%; }
  .search input { width: 100%; min-height: 42px; }
  select.sel { flex: 1 1 calc(50% - 4px); min-width: 130px; min-height: 38px; }
  .count { margin-left: 0; width: 100%; }
  .tw {
    max-height: none;
    -webkit-overflow-scrolling: touch;
  }
  aside.dr {
    width: 100vw;
    max-width: 100vw;
  }
  .dr-h { padding: 12px 14px 10px; }
  .dr-h h2 { font-size: 26px; }
  .dr-b { padding: 12px 14px 32px; }
  .dr-row { grid-template-columns: 28px minmax(0, 1fr); }
  .dr-row .acts { grid-column: 2; justify-content: flex-start; }
  dialog, .dlg {
    width: 94vw;
    max-width: 94vw;
    max-height: 90dvh;
  }
  #v-sky .sk-wrap {
    height: calc(100dvh - 220px);
    min-height: 300px;
  }
  .sk-find { flex: 1 1 calc(50% - 6px); }
  .sk-find input, .sk-find input.wide { flex: 1 1 auto; width: auto; min-width: 80px; }
  .cards { grid-template-columns: 1fr; }
}
