/* =========================================================================
   SGC ISO 9001 · John O'Ryan Surveyors
   Lenguaje visual: etiquetas de calibración, sellos de control, papel de
   inspección frío. Una sola familia (Instrument Sans) con ancho variable.
   ========================================================================= */
@font-face { font-family: "Instrument Sans"; font-style: normal; font-display: swap; font-weight: 400 700; font-stretch: 75% 100%;
  src: url(../fonts/instrument-sans-latin-standard-normal.woff2) format("woff2-variations");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Instrument Sans"; font-style: normal; font-display: swap; font-weight: 400 700; font-stretch: 75% 100%;
  src: url(../fonts/instrument-sans-latin-ext-standard-normal.woff2) format("woff2-variations");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+1E00-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+A720-A7FF; }
@font-face { font-family: "Instrument Sans"; font-style: italic; font-display: swap; font-weight: 400 700; font-stretch: 75% 100%;
  src: url(../fonts/instrument-sans-latin-standard-italic.woff2) format("woff2-variations"); }

:root {
  /* Imagen corporativa John O'Ryan Surveyors: azul del logo #234C96 */
  --paper: #EEF1F6;
  --surface: #FFFFFF;
  --surface-2: #F6F8FB;
  --ink: #13203A;
  --ink-2: #3D4B63;
  --ink-3: #69768C;
  --line: #D5DCE7;
  --line-2: #E6EAF1;
  --teal: #234C96;        /* color principal (botones, enlaces, foco) */
  --teal-ink: #1A3A75;
  --teal-wash: #E4EBF7;
  --brand-line: #B9C8E4;
  --ok: #1E7B4F;          /* estados conformes */
  --ok-ink: #17603D;
  --ok-wash: #E1F2E8;
  --amber: #8A6100;
  --amber-mark: #D99A00;
  --amber-wash: #FBEFD0;
  --red: #A62D2D;
  --red-mark: #C23B3B;
  --red-wash: #F9E2E0;
  --grey-wash: #E9EDF3;
  --side: #12264B;
  --side-2: #1B3463;
  --side-ink: #B9C5DB;
  --r-s: 6px;
  --r-m: 10px;
  --focus: 0 0 0 3px rgba(35, 76, 150, .35);
  --font: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--ink); background: var(--paper);
  font-feature-settings: "tnum" 1; }
a { color: var(--teal-ink); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--teal); }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; font-weight: 640; }
h2 { font-size: 1.12rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75em; }
small, .muted { color: var(--ink-3); }
.ico { width: 18px; height: 18px; flex: none; stroke-width: 1.8; vertical-align: -3px; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 4px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ------------------------------------------------------------------ Shell */
.shell { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.side { background: var(--side); color: var(--side-ink); position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; padding: 18px 12px 14px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; color: #fff; text-decoration: none; }
.brand-mark { width: 34px; height: 34px; border-radius: 8px; border: 1.5px solid rgba(255,255,255,.55); display: grid; place-items: center;
  font-stretch: 78%; font-weight: 700; font-size: 13px; letter-spacing: .02em; color: #FFFFFF; }
.brand-logo { display: block; width: 190px; height: auto; }
.brand-sub { display: block; font-size: 11.5px; color: var(--side-ink); letter-spacing: .01em; }
.brand { flex-direction: column; align-items: flex-start; gap: 6px; }
.brand b { display: block; font-size: 14.5px; font-weight: 620; line-height: 1.15; }
.brand span { font-size: 12px; color: #9FB0CC; }
.nav-group { margin-top: 14px; }
.nav-group > p { margin: 0 10px 4px; font-size: 12px; color: #8798B6; font-weight: 520; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 7px; color: var(--side-ink);
  text-decoration: none; font-size: 14px; }
.nav a:hover { background: var(--side-2); color: #fff; }
.nav a.on { background: #21396A; color: #fff; }
.nav a.on .ico { color: #A9C3F0; }
.nav a em { margin-left: auto; font-style: normal; font-size: 11.5px; color: #8798B6; font-stretch: 85%; }
.nav a.on em { color: #A9C3F0; }
.side-foot { margin-top: auto; padding: 14px 10px 0; border-top: 1px solid #26406E; font-size: 12px; color: #8798B6; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { height: 60px; display: flex; align-items: center; gap: 14px; padding: 0 32px; border-bottom: 1px solid var(--line);
  background: rgba(238, 242, 241, .92); backdrop-filter: blur(6px); position: sticky; top: 0; z-index: 20; }
.top form.search { flex: 1; max-width: 460px; position: relative; }
.top form.search .ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.top form.search input { width: 100%; padding: 8px 12px 8px 36px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); font: inherit; font-size: 14px; }
.who { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.who .av { width: 32px; height: 32px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center;
  font-size: 12px; font-weight: 600; }
.who .rol { color: var(--ink-3); font-size: 12px; line-height: 1.1; }
.who a.salir { color: var(--ink-3); padding: 6px; border-radius: 6px; }
.who a.salir:hover { background: var(--grey-wash); color: var(--ink); }
.sug-btn { margin-left: auto; }
.menu-btn { display: none; background: none; border: 0; padding: 6px; color: var(--ink); }
.content { padding: 28px 32px 64px; max-width: 1360px; width: 100%; }

/* ---------------------------------------------------------------- Page head */
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head .t { flex: 1; min-width: 260px; }
.page-head h1 { font-size: 2.05rem; font-stretch: 82%; font-weight: 640; letter-spacing: -.005em; }
.page-head .sub { margin: 6px 0 0; color: var(--ink-2); max-width: 70ch; }
.crumbs { font-size: 13px; color: var(--ink-3); margin-bottom: 6px; display: flex; gap: 6px; align-items: center; }
.crumbs a { color: var(--ink-3); text-decoration: none; }
.crumbs a:hover { color: var(--teal-ink); text-decoration: underline; }
.clause { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 560; color: var(--teal-ink);
  border: 1px solid var(--brand-line); background: var(--teal-wash); padding: 1px 8px; border-radius: 999px; vertical-align: 6px;
  margin-left: 6px; font-stretch: 90%; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* -------------------------------------------------------------------- Tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: -6px 0 22px; overflow-x: auto; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--ink-2); font-size: 14px; border-bottom: 2px solid transparent;
  margin-bottom: -1px; white-space: nowrap; display: flex; gap: 7px; align-items: center; }
.tabs a:hover { color: var(--ink); }
.tabs a.on { color: var(--ink); border-color: var(--teal); font-weight: 580; }
.tabs a .n { font-size: 12px; color: var(--ink-3); background: var(--grey-wash); padding: 0 7px; border-radius: 999px; }

/* ----------------------------------------------------------------- Buttons */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 14px; font-weight: 540; text-decoration: none;
  cursor: pointer; line-height: 1.2; white-space: nowrap; }
.btn:hover { border-color: #B8C5C2; color: var(--ink); background: var(--surface-2); }
.btn-primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-ink); border-color: var(--teal-ink); color: #fff; }
.btn-danger { color: var(--red); }
.btn-sm { padding: 5px 10px; font-size: 13px; border-radius: 7px; }
.btn-sm .ico { width: 15px; height: 15px; }
.btn-link { background: none; border: 0; padding: 0; color: var(--teal-ink); font: inherit; cursor: pointer; text-decoration: underline; }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* ------------------------------------------------------------------ Panels */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); }
.panel-h { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.panel-h h2 { flex: 1; }
.panel-h .muted { font-size: 13px; }
.panel-b { padding: 18px; }
.panel + .panel, .stack > * + * { margin-top: 18px; }
.grid > .panel + .panel, .grid > * + .panel, .foda > * + * { margin-top: 0; }
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-side { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.g-side-l { grid-template-columns: 330px minmax(0, 1fr); align-items: start; }

/* --------------------------------------------- Stat strip (no tarjetas sueltas) */
.stats { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-m); margin-bottom: 22px; }
.stat { padding: 16px 20px; border-left: 1px solid var(--line-2); text-decoration: none; color: inherit; display: block; }
.stat:first-child { border-left: 0; }
a.stat:hover { background: var(--surface-2); }
.stat .v { font-size: 2.3rem; font-weight: 600; font-stretch: 76%; line-height: 1; letter-spacing: -.01em; display: flex;
  align-items: baseline; gap: 4px; }
.stat .v small { font-size: 1rem; font-stretch: 90%; color: var(--ink-3); font-weight: 500; }
.stat .l { font-size: 13.5px; color: var(--ink-2); margin-top: 6px; }
.stat .d { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.stat.warn .v { color: var(--amber); }
.stat.bad .v { color: var(--red); }
.stat.good .v { color: var(--ok-ink); }

/* ----------------------------------------------------- Hang tags (estado) */
.tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 560; padding: 2px 9px 2px 7px;
  border-radius: 4px 999px 999px 4px; background: var(--grey-wash); color: var(--ink-2); white-space: nowrap; line-height: 1.5; }
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--surface); box-shadow: inset 0 0 0 1.5px currentColor; flex: none; }
.tag.ok { background: var(--ok-wash); color: var(--ok-ink); }
.tag.warn { background: var(--amber-wash); color: var(--amber); }
.tag.bad { background: var(--red-wash); color: var(--red); }
.tag.info { background: #E3EBF6; color: #2C4F7C; }
.tag.plain::before { display: none; }
.chip { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-2);
  background: var(--surface); white-space: nowrap; }
.clase { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 6px; font-weight: 700; font-stretch: 80%;
  font-size: 15px; border: 1.5px solid currentColor; }
.clase.A { color: var(--teal-ink); background: var(--teal-wash); }
.clase.B { color: var(--amber); background: var(--amber-wash); }
.clase.C { color: var(--red); background: var(--red-wash); }

/* ------------------------------------------------------------------ Tables */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-weight: 560; color: var(--ink-3); font-size: 12.5px; padding: 10px 14px; border-bottom: 1px solid var(--line);
  background: var(--surface-2); white-space: nowrap; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: #FAFCFB; }
.tbl .code { font-weight: 600; font-stretch: 88%; white-space: nowrap; }
.tbl .num { text-align: right; white-space: nowrap; }
.tbl a.row-link { color: var(--ink); text-decoration: none; font-weight: 540; }
.tbl a.row-link:hover { color: var(--teal-ink); text-decoration: underline; }
.tbl .sub { display: block; font-size: 12.5px; color: var(--ink-3); }
.panel > .tbl-wrap:first-child table th:first-child { border-top-left-radius: var(--r-m); }

/* -------------------------------------------- Matriz de calibración (3 años) */
.matrix { table-layout: fixed; min-width: 980px; }
.matrix th.st { width: 180px; }
.matrix th.yr { width: 196px; }
.matrix td.yr { padding: 8px 8px; }
.matrix th.yr { text-align: center; }
.cert { display: flex; flex-direction: column; gap: 2px; padding: 7px 10px; border: 1px solid var(--line); border-left: 3px solid var(--teal);
  border-radius: 6px; text-decoration: none; color: var(--ink); background: var(--surface); font-size: 12.5px; line-height: 1.3; }
.cert:hover { border-color: var(--teal); color: var(--ink); background: var(--teal-wash); }
.cert b { font-size: 13px; font-weight: 600; display: flex; gap: 5px; align-items: center; white-space: nowrap; overflow: hidden; }
.cert b, .cert span { min-width: 0; }
.cert span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cert b .ico { width: 14px; height: 14px; color: var(--teal); }
.cert span { color: var(--ink-3); }
.cert.nc { border-left-color: var(--red-mark); }
.cert + .cert { margin-top: 4px; }
.cert-empty { display: block; text-align: center; color: var(--ink-3); font-size: 12.5px; border: 1px dashed var(--line); border-radius: 6px;
  padding: 9px 6px; }
.cert-empty.miss { color: var(--red); border-color: #E8B4AF; background: #FDF4F3; }
button.cert-empty { width: 100%; background: none; font: inherit; font-size: 12.5px; cursor: pointer; }
button.cert-empty:hover { border-color: var(--teal); color: var(--teal-ink); }

/* -------------------------------------------------------------- Plan anual */
.plan { font-size: 13px; }
.plan th, .plan td { padding: 7px 4px; text-align: center; }
.plan th:first-child, .plan td:first-child { text-align: left; padding-left: 14px; min-width: 260px; }
.plan .cat td { background: var(--surface-2); font-weight: 600; color: var(--ink-2); text-align: left; padding: 8px 14px; font-size: 12.5px; }
.plan th.now { color: var(--teal-ink); }
.plan td.now { background: #F3FAF8; }
.plan-dot { width: 26px; height: 22px; border-radius: 5px; border: 0; margin: auto; display: grid; place-items: center; cursor: pointer;
  font: inherit; font-size: 11px; font-weight: 700; }
.plan-dot.Programada { background: var(--surface); box-shadow: inset 0 0 0 1.5px #8DA09B; color: var(--ink-3); }
.plan-dot.Realizada { background: var(--teal); color: #fff; }
.plan-dot.Reprogramada { background: var(--amber-wash); box-shadow: inset 0 0 0 1.5px var(--amber-mark); color: var(--amber); }
.plan-dot.Cancelada { background: var(--grey-wash); color: var(--ink-3); text-decoration: line-through; }
.plan-dot.late { background: var(--red-wash); box-shadow: inset 0 0 0 1.5px var(--red-mark); color: var(--red); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); align-items: center; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .plan-dot { width: 18px; height: 15px; cursor: default; margin: 0; }
.progress { height: 8px; background: var(--grey-wash); border-radius: 99px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--teal); border-radius: 99px; }

/* ------------------------------------------------------------------- Forms */
.form { display: grid; gap: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.f3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, .field > .lbl { font-size: 13.5px; font-weight: 560; color: var(--ink-2); }
.field .hint { font-size: 12.5px; color: var(--ink-3); }
.req::after { content: " *"; color: var(--red-mark); }
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input[type=month], input[type=url],
input[type=search], select, textarea {
  font: inherit; font-size: 14.5px; padding: 8px 11px; border-radius: 7px; border: 1px solid #CBD5D2; background: var(--surface); color: var(--ink);
  width: 100%; min-width: 0; }
textarea { min-height: 92px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal); box-shadow: var(--focus); }
input[type=file] { font: inherit; font-size: 13.5px; }
.drop { border: 1.5px dashed #B8C6C2; border-radius: var(--r-m); padding: 18px; background: var(--surface-2); display: flex; align-items: center;
  gap: 14px; cursor: pointer; }
.drop:hover, .drop.over { border-color: var(--teal); background: var(--teal-wash); }
.drop .ico { width: 26px; height: 26px; color: var(--teal); }
.drop b { display: block; font-weight: 580; }
.drop input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.check { display: flex; gap: 9px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--teal); width: 16px; height: 16px; }
.form-foot { display: flex; gap: 10px; justify-content: flex-end; padding-top: 4px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters input[type=search] { width: 260px; }
.filters select { width: auto; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); padding: 2px; }
.seg a { padding: 5px 12px; border-radius: 6px; font-size: 13.5px; color: var(--ink-2); text-decoration: none; white-space: nowrap; }
.seg a.on { background: var(--ink); color: #fff; }
.seg a:not(.on):hover { background: var(--grey-wash); }

/* Escala 1–5 de evaluación */
.score { display: flex; gap: 6px; }
.score input { position: absolute; opacity: 0; }
.score label { width: 40px; height: 36px; border: 1px solid #CBD5D2; border-radius: 7px; display: grid; place-items: center; cursor: pointer;
  font-weight: 600; font-stretch: 85%; color: var(--ink-2); background: var(--surface); }
.score input:checked + label { background: var(--ink); border-color: var(--ink); color: #fff; }
.score input:focus-visible + label { box-shadow: var(--focus); }
.crit { display: grid; grid-template-columns: 1fr auto; gap: 8px 18px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.crit:last-child { border-bottom: 0; }
.crit .w { font-size: 12.5px; color: var(--ink-3); }

/* ----------------------------------------------------- Info list (detalle) */
dl.info { display: grid; grid-template-columns: 150px 1fr; gap: 9px 14px; margin: 0; font-size: 14px; }
dl.info dt { color: var(--ink-3); }
dl.info dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.prose { white-space: pre-wrap; font-size: 14.5px; }
.block-t { font-size: 13px; color: var(--ink-3); font-weight: 560; margin: 0 0 4px; }
.block + .block { margin-top: 16px; }

/* --------------------------------------------------------------- Timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 18px 26px; }
.timeline li::before { content: ""; position: absolute; left: 6px; top: 8px; bottom: -4px; width: 1.5px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline li::after { content: ""; position: absolute; left: 1px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface);
  box-shadow: inset 0 0 0 2.5px var(--teal); }
.timeline li.Correctivo::after { box-shadow: inset 0 0 0 2.5px var(--red-mark); }
.timeline li.cal::after { background: var(--ok); }
.timeline .when { font-size: 12.5px; color: var(--ink-3); }
.timeline .what { font-weight: 580; }

/* ---------------------------------------------------------------- Alertas */
.alerts { list-style: none; margin: 0; padding: 0; }
.alerts li a { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 11px 18px; border-bottom: 1px solid var(--line-2);
  text-decoration: none; color: var(--ink); }
.alerts li:last-child a { border-bottom: 0; }
.alerts li a:hover { background: var(--surface-2); }
.alerts .bar { width: 4px; height: 30px; border-radius: 2px; background: var(--amber-mark); }
.alerts .vencida .bar { background: var(--red-mark); }
.alerts .sin_registro .bar { background: #9AAAA6; }
.alerts .m { font-size: 12.5px; color: var(--ink-3); }
.alerts .t { font-weight: 560; font-size: 14px; }
.alerts .dt { font-size: 13px; color: var(--ink-2); text-align: right; }

.empty { text-align: center; padding: 36px 20px; color: var(--ink-2); }
.empty .ico { width: 30px; height: 30px; color: var(--ink-3); margin-bottom: 8px; }
.empty p { max-width: 46ch; margin: 0 auto 14px; }

/* -------------------------------------------------------------- Flash */
.flashes { display: grid; gap: 8px; margin-bottom: 18px; }
.flash { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: 8px; font-size: 14px; border: 1px solid; }
.flash.ok { background: var(--ok-wash); border-color: #B5DCC5; color: var(--ok-ink); }
.flash.warn { background: var(--amber-wash); border-color: #EBD08F; color: #6B4B00; }
.flash.error { background: var(--red-wash); border-color: #EBB8B3; color: var(--red); }
.flash button { margin-left: auto; background: none; border: 0; color: inherit; cursor: pointer; padding: 0; }

/* -------------------------------------------------------------- Dialog */
dialog { border: 0; border-radius: 12px; padding: 0; width: min(640px, calc(100vw - 32px)); box-shadow: 0 24px 60px rgba(20, 35, 43, .28); color: var(--ink); }
dialog::backdrop { background: rgba(20, 35, 43, .45); }
dialog .panel-h { padding: 16px 20px; }
dialog .panel-b { padding: 20px; }
dialog .x { background: none; border: 0; cursor: pointer; color: var(--ink-3); padding: 4px; border-radius: 6px; }
dialog .x:hover { background: var(--grey-wash); color: var(--ink); }

/* ---------------------------------------------------- Sello documental */
.stamp { display: inline-flex; align-items: center; gap: 6px; border: 1.5px solid var(--red-mark); color: var(--red-mark); border-radius: 4px;
  padding: 2px 8px; font-weight: 700; font-size: 11.5px; font-stretch: 80%; letter-spacing: .04em; transform: rotate(-2deg); }
.stamp.ctrl { border-color: var(--teal); color: var(--teal); }
.doc-ver { display: flex; gap: 14px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.doc-ver:last-child { border-bottom: 0; }
.doc-ver .vnum { font-size: 1.6rem; font-weight: 640; font-stretch: 76%; min-width: 64px; color: var(--ink); line-height: 1; }
.doc-ver.old .vnum { color: var(--ink-3); }
.doc-ver .grow { flex: 1; min-width: 0; }

/* ---------------------------------------------------------------- Mapa ISO */
.iso { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 18px; }
.iso-c { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: 18px 18px 8px; }
.iso-c header { display: flex; gap: 12px; align-items: baseline; margin-bottom: 10px; }
.iso-c header b { font-size: 2.2rem; font-weight: 650; font-stretch: 75%; line-height: 1; color: var(--teal); min-width: 34px; }
.iso-c header h2 { font-size: 1.05rem; }
.iso-c header p { margin: 2px 0 0; font-size: 13px; color: var(--ink-3); }
.iso-c ul { list-style: none; margin: 0; padding: 0; }
.iso-c li a { display: grid; grid-template-columns: 46px 1fr auto; gap: 8px; padding: 9px 0; border-top: 1px solid var(--line-2); text-decoration: none;
  color: var(--ink); font-size: 14px; align-items: baseline; }
.iso-c li a:hover span:nth-child(2) { color: var(--teal-ink); text-decoration: underline; }
.iso-c li a span:first-child { color: var(--ink-3); font-size: 12.5px; font-stretch: 88%; }
.iso-c li a span:last-child { color: var(--ink-3); font-size: 12.5px; }

/* ---------------------------------------------------------------- Charts */
.chart-box { position: relative; height: 240px; }
.chart-box.sm { height: 120px; }
.spark { height: 46px; position: relative; }
.ind-row { display: grid; grid-template-columns: minmax(0, 1.6fr) 130px 120px minmax(120px, 1fr) 120px; gap: 16px; align-items: center;
  padding: 14px 18px; border-bottom: 1px solid var(--line-2); text-decoration: none; color: var(--ink); }
.ind-row:hover { background: var(--surface-2); color: var(--ink); }
.ind-row:last-child { border-bottom: 0; }
.ind-row .big { font-size: 1.7rem; font-weight: 620; font-stretch: 76%; line-height: 1; }
.ind-row .big small { font-size: .8rem; color: var(--ink-3); font-weight: 500; font-stretch: 100%; }

/* ---------------------------------------------------------- Email preview */
.mail { border: 1px solid var(--line); border-radius: var(--r-m); background: var(--surface); overflow: hidden; }
.mail-h { padding: 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line-2); font-size: 13.5px; display: grid; gap: 3px; }
.mail-h span { color: var(--ink-3); display: inline-block; width: 58px; }
.mail-b { padding: 16px; white-space: pre-wrap; font-size: 14px; line-height: 1.6; max-height: 520px; overflow-y: auto; }
.mail-b[contenteditable=true]:focus { outline: none; box-shadow: inset var(--focus); }

/* ---------------------------------------------------------------- Personas */
.person { display: flex; gap: 12px; align-items: center; }
.person .av { width: 36px; height: 36px; border-radius: 50%; background: var(--teal-wash); color: var(--teal-ink); display: grid; place-items: center;
  font-weight: 650; font-size: 13px; flex: none; }
.person .av.lg { width: 64px; height: 64px; font-size: 22px; font-stretch: 85%; }
.folder-meter { display: flex; gap: 3px; }
.folder-meter i { width: 14px; height: 6px; border-radius: 2px; background: var(--line); }
.folder-meter i.on { background: var(--teal); }

/* ---------------------------------------------------------------- Login */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { background: var(--side); color: #DCE3EF; padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden; }
.login-art h1 { font-size: clamp(2.4rem, 4.4vw, 3.8rem); font-stretch: 76%; font-weight: 620; line-height: 1.02; color: #fff; max-width: 12ch; }
.login-art p { max-width: 42ch; color: #A9B7CF; margin-top: 18px; }
.login-tags { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.login-tags .tag { font-size: 13.5px; padding: 4px 13px 4px 10px; }
.login-tags .tag:nth-child(2) { margin-left: 34px; }
.login-tags .tag:nth-child(3) { margin-left: 12px; }
.login-form { display: grid; place-items: center; padding: 32px; }
.login-form form { width: 100%; max-width: 360px; }
.login-form h2 { font-size: 1.5rem; font-stretch: 85%; margin-bottom: 4px; }

/* ----------------------------------------------------- Página pública QR */
.pub { max-width: 640px; margin: 0 auto; padding: 22px 18px 48px; }
.pub-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; font-size: 13px; color: var(--ink-3); }
.pub-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.pub-top { padding: 22px; border-bottom: 1px solid var(--line-2); }
.pub-top h1 { font-size: 1.8rem; font-stretch: 80%; margin: 6px 0 4px; }
.pub-status { display: grid; grid-template-columns: 1fr 1fr; }
.pub-status div { padding: 16px 22px; border-right: 1px solid var(--line-2); }
.pub-status div:last-child { border-right: 0; }
.pub-status b { display: block; font-size: 1.15rem; margin-top: 4px; }

/* -------------------------------------------------------------- Etiquetas */
.labels { display: grid; grid-template-columns: repeat(auto-fill, 86mm); gap: 6mm; }
.label { width: 86mm; height: 50mm; border: 1.5px solid var(--ink); border-radius: 3mm; display: grid; grid-template-columns: 38mm 1fr; padding: 3mm;
  gap: 3mm; background: #fff; break-inside: avoid; position: relative; }
.label .qr svg { width: 38mm; height: 38mm; display: block; }
.label .qr p { font-size: 7.5pt; text-align: center; margin: 1mm 0 0; color: var(--ink-2); }
.label .tx { display: flex; flex-direction: column; min-width: 0; }
.label .tx .co { font-size: 8pt; color: var(--ink-3); }
.label .tx .cd { font-size: 17pt; font-weight: 700; font-stretch: 78%; line-height: 1.05; }
.label .tx .nm { font-size: 9.5pt; font-weight: 560; line-height: 1.2; margin-top: 1mm; }
.label .tx .mt { margin-top: auto; font-size: 7.5pt; color: var(--ink-2); line-height: 1.35; }
.label .tx .crit { all: unset; display: inline-block; margin-top: 1.5mm; font-size: 7.5pt; font-weight: 700; color: #fff; background: var(--red-mark);
  border-radius: 1mm; padding: .3mm 1.6mm; align-self: flex-start; }

/* ---------------------------------------------------------- Asistente IA */
.ai-fab { position: fixed; right: 24px; bottom: 24px; z-index: 60; display: flex; align-items: center; gap: 8px; padding: 11px 18px 11px 14px;
  border-radius: 999px; border: 0; background: var(--ink); color: #fff; font: inherit; font-size: 14.5px; font-weight: 580; cursor: pointer;
  box-shadow: 0 8px 24px rgba(20, 35, 43, .28); }
.ai-fab .ico { color: #A9C3F0; }
.ai-fab:hover { background: #21396A; }
.ai-fab.on { display: none; }
.ai-panel { position: fixed; right: 16px; bottom: 16px; top: 76px; width: 420px; max-width: calc(100vw - 32px); z-index: 61; background: var(--surface);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 24px 60px rgba(20, 35, 43, .25); display: flex; flex-direction: column; overflow: hidden; }
.ai-panel[hidden] { display: none; }
.ai-h { display: flex; gap: 10px; align-items: center; padding: 14px 14px 12px 16px; border-bottom: 1px solid var(--line-2); }
.ai-h b { display: block; font-size: 15px; }
.ai-h small { color: var(--ink-3); font-size: 12.5px; }
.ai-h .x { background: none; border: 0; cursor: pointer; color: var(--ink-3); padding: 5px; border-radius: 6px; }
.ai-h .x:hover { background: var(--grey-wash); color: var(--ink); }
.ai-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--ink); color: #A9C3F0; display: grid; place-items: center; }
.ai-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; background: var(--surface-2); }
.ai-hola p { margin: 0 0 12px; color: var(--ink-2); font-size: 14px; }
.ai-sug { display: grid; gap: 6px; }
.ai-sug button { text-align: left; font: inherit; font-size: 13.5px; padding: 9px 12px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); cursor: pointer; }
.ai-sug button:hover { border-color: var(--teal); background: var(--teal-wash); }
.ai-msg { max-width: 92%; font-size: 14px; line-height: 1.55; padding: 10px 13px; border-radius: 12px; }
.ai-msg p { margin: 0 0 6px; }
.ai-msg p:last-child { margin: 0; }
.ai-msg ul { margin: 4px 0 6px; padding-left: 18px; }
.ai-msg li { margin: 2px 0; }
.ai-msg.user { align-self: flex-end; background: var(--ink); color: #fff; border-bottom-right-radius: 4px; }
.ai-msg.assistant { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.ai-msg:has(.ai-tbl) { max-width: 100%; }
.ai-tbl { margin: 6px 0 8px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.ai-tbl-acc { display: flex; justify-content: flex-end; gap: 4px; padding: 4px 6px; background: var(--surface-2); border-bottom: 1px solid var(--line-2); }
.ai-tbl-acc button { border: 1px solid var(--line); background: var(--surface); border-radius: 5px; font: inherit; font-size: 12px; padding: 2px 8px; cursor: pointer; color: var(--ink-2); }
.ai-tbl-acc button:hover { border-color: var(--teal); color: var(--teal-ink); }
.ai-tbl-s { overflow-x: auto; max-height: 340px; }
.ai-tbl table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
.ai-tbl th, .ai-tbl td { padding: 5px 8px; border-bottom: 1px solid var(--line-2); text-align: left; white-space: nowrap; }
.ai-tbl th { position: sticky; top: 0; background: var(--surface); font-weight: 620; }
.ai-tbl tr:last-child td { border-bottom: 0; }
.ai-msg.wait { color: var(--ink-3); font-style: italic; }
.ai-msg.err { border-color: #EBB8B3; background: var(--red-wash); color: var(--red); }
.ai-in { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line-2); align-items: flex-end; }
.ai-in textarea { min-height: 42px; max-height: 140px; resize: none; }
.ai-in .btn { height: 42px; }
.ai-pie { margin: 0; padding: 0 14px 10px; font-size: 11.5px; color: var(--ink-3); }
@media (max-width: 860px) { .ai-panel { top: 12px; right: 8px; left: 8px; bottom: 8px; width: auto; max-width: none; } .ai-fab span { display: none; } .ai-fab { padding: 13px; } }

/* ---------------------------------------------------------- Responsive */
@media (max-width: 1100px) {
  .g-side, .g-side-l { grid-template-columns: 1fr; }
  .ind-row { grid-template-columns: 1fr 110px 100px; }
  .ind-row .spark, .ind-row .hide-md { display: none; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 270px; z-index: 50; transform: translateX(-100%); transition: transform .2s ease; }
  body.nav-open .side { transform: none; box-shadow: 0 0 0 100vmax rgba(20, 35, 43, .4); }
  .menu-btn { display: block; }
  .top { padding: 0 16px; }
  .content { padding: 20px 16px 48px; }
  .stats { grid-auto-flow: row; grid-template-columns: 1fr 1fr; }
  .stat { border-left: 0; border-top: 1px solid var(--line-2); }
  .stat:nth-child(-n+2) { border-top: 0; }
  .stat:nth-child(even) { border-left: 1px solid var(--line-2); }
  .g2, .g3, .form-grid, .f3 { grid-template-columns: 1fr; }
  .login { grid-template-columns: 1fr; }
  .login-art { padding: 32px 24px; min-height: 280px; }
  .who .nm, .who .rol { display: none; }
  .sug-btn span { display: none; }
  dl.info { grid-template-columns: 1fr; gap: 2px; }
  dl.info dd { margin-bottom: 8px; }
  .page-head h1 { font-size: 1.7rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

@media print {
  .side, .top, .actions, .tabs, .no-print, .flashes { display: none !important; }
  .shell { display: block; }
  body { background: #fff; font-size: 11pt; }
  .content { padding: 0; max-width: none; }
  .panel { border-color: #bbb; break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
  .labels { gap: 4mm; }
}

/* ---------------------------------------------------------- Contexto y riesgos */
.mag { display: inline-grid; place-items: center; min-width: 26px; height: 22px; padding: 0 6px; border-radius: 5px; font-weight: 700; font-size: 12px; font-stretch: 85%; }
.mag.A { background: var(--red-wash); color: var(--red); }
.mag.M { background: var(--amber-wash); color: var(--amber); }
.mag.B { background: var(--teal-wash); color: var(--teal-ink); }
.mag.op.A { background: #E3EBF6; color: #2C4F7C; }
.mag.op.M { background: #EEF3FA; color: #3A6EA5; }
.mag.op.B { background: var(--grey-wash); color: var(--ink-3); }
.mag.none { background: var(--grey-wash); color: var(--ink-3); font-weight: 560; }
.foda { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.foda-q { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); border-top: 4px solid var(--teal); display: flex; flex-direction: column; }
.foda-q.Debilidad { border-top-color: var(--amber-mark); }
.foda-q.Oportunidad { border-top-color: #3A6EA5; }
.foda-q.Amenaza { border-top-color: var(--red-mark); }
.foda-q > header { display: flex; align-items: baseline; gap: 10px; padding: 14px 16px 10px; }
.foda-q > header h2 { font-size: 1.15rem; font-stretch: 85%; flex: 1; }
.foda-q > header small { color: var(--ink-3); }
.foda-q ul { list-style: none; margin: 0; padding: 0 8px 8px; }
.foda-q li a { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: start; padding: 9px 8px; border-radius: 7px;
  text-decoration: none; color: var(--ink); font-size: 14px; line-height: 1.4; }
.foda-q li a:hover { background: var(--surface-2); }
.foda-q li .cod { font-weight: 650; font-stretch: 85%; color: var(--ink-3); font-size: 13px; padding-top: 1px; }
.foda-q li .meta { display: flex; gap: 6px; align-items: center; }
.dot-acc { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); display: inline-block; }
.dot-acc.vencida { background: var(--red-mark); }
.dot-acc.sinfecha { background: var(--amber-mark); }
.dot-acc.none { background: var(--line); }
.heat { display: grid; grid-template-columns: 110px repeat(3, minmax(90px, 1fr)); gap: 6px; max-width: 620px; }
.heat .ax { display: flex; align-items: center; justify-content: center; font-size: 13px; color: var(--ink-3); text-align: center; }
.heat a.cell { aspect-ratio: 1.7; border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-decoration: none;
  font-weight: 650; font-size: 1.9rem; font-stretch: 78%; border: 2px solid transparent; line-height: 1; }
.heat a.cell small { font-size: 11.5px; font-weight: 560; font-stretch: 100%; margin-top: 4px; opacity: .85; }
.heat a.cell.A { background: var(--red-wash); color: var(--red); }
.heat a.cell.M { background: var(--amber-wash); color: var(--amber); }
.heat a.cell.B { background: var(--teal-wash); color: var(--teal-ink); }
.heat a.cell.zero { opacity: .45; }
.heat a.cell.sel, .heat a.cell:hover { border-color: currentColor; }
.nota-int { border: 1px dashed #D8B46A; background: #FFFBF0; border-radius: 8px; padding: 12px 14px; }
.nota-int .block-t { color: var(--amber); display: flex; gap: 6px; align-items: center; }
.acc { border: 1px solid var(--line); border-radius: 9px; padding: 12px 14px; }
.acc + .acc { margin-top: 10px; }
.acc.vencida { border-color: #E8B4AF; background: #FDF6F5; }
.acc-h { display: flex; gap: 10px; align-items: flex-start; }
.acc-h .grow { flex: 1; min-width: 0; }
.acc-avances { margin: 10px 0 0; padding: 10px 0 0; border-top: 1px solid var(--line-2); list-style: none; font-size: 13px; }
.acc-avances li + li { margin-top: 6px; }
.rev-badge { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; }
@media (max-width: 860px) { .foda { grid-template-columns: 1fr; } .heat { grid-template-columns: 70px repeat(3, 1fr); } }

/* -------------------------------------------------------- Acta de revisión */
.acta { display: grid; grid-template-columns: 205px minmax(0, 1fr); gap: 22px; align-items: start; }
.acta-toc { position: sticky; top: 18px; display: flex; flex-direction: column; gap: 1px; font-size: 13px; max-height: calc(100vh - 40px); overflow-y: auto; }
.acta-toc a { display: grid; grid-template-columns: 42px 1fr; padding: 6px 10px; border-radius: 7px; color: var(--ink-2); text-decoration: none; line-height: 1.3; }
.acta-toc a span { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.acta-toc a:hover { background: var(--surface); }
.acta-toc a.on { background: var(--surface); color: var(--teal-ink); font-weight: 600; box-shadow: inset 3px 0 0 var(--teal); }
.acta-body { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.acta-sec { scroll-margin-top: 16px; }
.acta-sec .panel-h h2 span { display: inline-block; min-width: 46px; color: var(--teal); font-variant-numeric: tabular-nums; }
.acta-h3 { font-size: 14px; font-weight: 640; color: var(--teal-ink); margin: 16px 0 6px; }
.acta-h3:first-child { margin-top: 0; }
.acta-txt { width: 100%; resize: vertical; line-height: 1.5; }
.acta-prose p { margin: 0 0 8px; line-height: 1.55; font-size: 14.5px; }
.acta-pie { display: flex; gap: 8px; align-items: center; padding-top: 14px; margin-top: 14px; border-top: 1px solid var(--line-2); }
.acta-edit td { padding: 4px 4px; vertical-align: top; }
.acta-edit input, .acta-edit select, .acta-edit textarea { width: 100%; font-size: 13.5px; padding: 6px 8px; }
.acta-edit input.num { text-align: right; }
.acta-edit tfoot th, .acta-edit tfoot td { padding: 6px 8px; background: var(--surface-2); }
.acta-edit .sel-fuente { font-size: 12px; padding: 4px 6px; margin-bottom: 3px; color: var(--ink-2); }
.acta-edit + .btn, .tbl-wrap + .btn { margin-top: 8px; }
.form .btn[data-add], .form > .btn { justify-self: start; align-self: flex-start; width: auto; }
.acta-edit td.num { vertical-align: middle; }
.acta-body > .panel + .panel { margin-top: 0; }
.encuesta input.num { max-width: 70px; margin-left: auto; display: block; }
.acta-preg { font-size: 12.5px; margin: 10px 0 0; padding-left: 22px; columns: 2; }
.previa { padding: 14px 0; border-bottom: 1px solid var(--line-2); }
.previa:last-of-type { border-bottom: 0; }
.previa-h, .salida-h { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.previa textarea { width: 100%; }
.objetivo { padding: 14px 0; border-bottom: 1px solid var(--line-2); }
.objetivo:first-child { padding-top: 0; }
.salida { padding: 10px 14px; border: 1px solid var(--line-2); border-radius: var(--r-m); margin-bottom: 8px; background: var(--surface-2); }
.salida .acta-prose p { font-size: 14px; }
dl.kv { grid-template-columns: minmax(0, 1fr) auto; max-width: 620px; }
.acta-lista { margin: 0 0 10px; padding-left: 18px; font-size: 14px; }
.acta-fin { display: flex; gap: 14px; align-items: center; justify-content: space-between; padding: 16px 20px; border: 1px dashed var(--line); border-radius: var(--r-m); }
.acta-fin p { margin: 0; }
.aprob { border-color: var(--amber-mark); background: var(--amber-wash); }
@media (max-width: 1100px) { .acta { grid-template-columns: 1fr; } .acta-toc { display: none; } }
