/* COMFICA · Formatos SST — mobile first, sin dependencias externas */
:root {
  --brand: #1f4f96;
  --brand-600: #183f78;
  --brand-50: #eaf1fb;
  --brand-100: #d4e2f6;
  --accent: #e8604c;
  --ok: #148a5c;
  --ok-50: #e5f6ee;
  --warn: #b7791f;
  --warn-50: #fdf3e1;
  --bad: #c93a3a;
  --bad-50: #fdecec;
  --ink: #142033;
  --ink-2: #4a5873;
  --ink-3: #8592a8;
  --line: #e1e6ef;
  --bg: #f3f6fb;
  --card: #ffffff;
  --radius: 16px;
  --radius-sm: 11px;
  --shadow: 0 1px 2px rgba(20, 32, 51, .06), 0 6px 24px rgba(20, 32, 51, .06);
  --shadow-lg: 0 18px 50px rgba(20, 32, 51, .18);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink);
  font: 16px/1.5 var(--font); -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 45%, transparent); outline-offset: 2px; border-radius: 8px; }
h1, h2, h3, p { margin: 0; }
.hidden { display: none !important; }

.ic { width: 1.2em; height: 1.2em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Layout ---------- */
.app { min-height: 100vh; }
.wrap { max-width: 760px; margin: 0 auto; padding: 20px 16px 48px; }
.wrap--wz { padding-bottom: 120px; }
.loading { display: flex; gap: 12px; align-items: center; justify-content: center; min-height: 60vh; color: var(--ink-2); }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--brand-100); border-top-color: var(--brand); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.title { font-size: clamp(1.6rem, 5vw, 2.1rem); line-height: 1.15; letter-spacing: -.02em; font-weight: 800; }
.title--sm { font-size: clamp(1.3rem, 4.4vw, 1.6rem); }
.lead { color: var(--ink-2); margin-top: 6px; }
.muted { color: var(--ink-3); font-size: .9rem; }
.empty { color: var(--ink-2); text-align: center; padding: 28px 12px; background: var(--card); border-radius: var(--radius); border: 1px dashed var(--line); }

/* ---------- Logo / topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; background: rgba(255, 255, 255, .86); backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--line);
}
.logo { display: inline-flex; flex-direction: column; line-height: 1; user-select: none; }
.logo__word { display: inline-flex; align-items: center; font-weight: 800; font-size: 1.55rem; letter-spacing: -.01em; color: #7d93b6; }
.logo__o {
  display: inline-block; width: .78em; height: .78em; margin: 0 .03em; border-radius: 50%;
  border: .16em dashed #7d93b6; box-shadow: inset 0 0 0 .1em #fff, inset 0 0 0 .2em var(--accent);
}
.logo__sub { align-self: flex-end; margin-top: 2px; font-size: .58rem; font-weight: 800; letter-spacing: .12em; color: var(--accent); }
.who-chip { display: flex; align-items: center; gap: 8px; padding: 5px 12px 5px 5px; border-radius: 999px; background: var(--brand-50); transition: background .2s; }
.who-chip:hover { background: var(--brand-100); }
.who-chip__txt { display: flex; flex-direction: column; text-align: left; line-height: 1.15; }
.who-chip__txt b { font-size: .9rem; }
.who-chip__txt small { font-size: .72rem; color: var(--brand); font-weight: 600; }

.avatar {
  --hue: 210; flex: none; display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  font-weight: 700; font-size: .95rem; color: hsl(var(--hue) 55% 28%); background: hsl(var(--hue) 70% 90%);
}
.avatar--sm { width: 34px; height: 34px; font-size: .78rem; }
.avatar--lg { width: 58px; height: 58px; font-size: 1.2rem; }

/* ---------- Onboarding ---------- */
.onb-steps { display: flex; gap: 6px; margin-bottom: 18px; }
.onb-steps span { height: 5px; width: 34px; border-radius: 9px; background: var(--line); }
.onb-steps span.on { background: var(--brand); }
.search { position: relative; margin: 20px 0 14px; }
.search .ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.search .input { padding-left: 44px; }
.people, .adder__list { display: grid; gap: 8px; }
.person, .opt-card {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; text-align: left;
  background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius); transition: border-color .15s, transform .15s, box-shadow .15s;
}
.person:hover, .opt-card:hover { border-color: var(--brand); box-shadow: var(--shadow); }
.person:active, .opt-card:active { transform: scale(.99); }
.person--sm { padding: 8px 10px; border-radius: var(--radius-sm); }
.person__txt { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.person__txt b { font-weight: 650; overflow: hidden; text-overflow: ellipsis; }
.person__txt small { color: var(--ink-3); }
.person__go { color: var(--ink-3); }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--brand); font-weight: 600; margin-bottom: 14px; }
.me-card { display: flex; align-items: center; gap: 14px; padding: 14px; margin-bottom: 22px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.me-card div { display: flex; flex-direction: column; }
.me-card small { color: var(--ink-3); }
.roles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 20px; }
.role {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 20px 18px; min-height: 150px;
  background: var(--card); border: 2px solid var(--line); border-radius: 20px; text-align: left; transition: all .18s;
}
.role:hover { border-color: var(--brand); transform: translateY(-2px); box-shadow: var(--shadow); }
.role b { font-size: 1.25rem; margin-top: auto; }
.role small { color: var(--ink-3); font-weight: 600; }
.role__num { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 13px; background: var(--brand-50); color: var(--brand); font-weight: 800; font-size: 1.3rem; }
.role--sug { border-color: var(--brand); background: linear-gradient(180deg, var(--brand-50), #fff 70%); }
.role--sug small { color: var(--brand); }
.role--sug .role__num { background: var(--brand); color: #fff; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px;
  border-radius: 14px; font-weight: 650; border: 1.5px solid transparent; transition: background .15s, transform .1s, box-shadow .15s; white-space: nowrap;
}
.btn:active { transform: scale(.98); }
.btn--primary { background: var(--brand); color: #fff; box-shadow: 0 6px 16px rgba(31, 79, 150, .28); }
.btn--primary:hover { background: var(--brand-600); }
.btn--success { background: var(--ok); color: #fff; box-shadow: 0 6px 16px rgba(20, 138, 92, .28); }
.btn--danger { background: var(--bad); color: #fff; }
.btn--ghost { background: var(--card); border-color: var(--line); color: var(--ink); }
.btn--ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn--soft { background: var(--ok-50); color: var(--ok); }
.btn--sm { min-height: 38px; padding: 0 12px; border-radius: 10px; font-size: .88rem; }
.btn--block { width: 100%; }
.icon-btn { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; color: var(--ink-2); flex: none; }
.icon-btn:hover { background: var(--bg); color: var(--ink); }
.icon-btn--sm { width: 34px; height: 34px; }
.link { color: var(--brand); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Home ---------- */
.hero { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.hero__eyebrow { display: block; color: var(--ink-3); font-weight: 600; }
.hero__eyebrow::first-letter { text-transform: uppercase; }
.ring {
  --p: 0; flex: none; display: grid; place-items: center; width: 84px; height: 84px; border-radius: 50%;
  background: radial-gradient(closest-side, var(--bg) 76%, transparent 77%), conic-gradient(var(--ok) calc(var(--p) * 1%), var(--brand-100) 0);
}
.ring b { font-size: 1.25rem; }
.fcards { display: grid; gap: 14px; }
.fcard { position: relative; padding: 18px; background: var(--card); border-radius: 20px; border: 1.5px solid var(--line); box-shadow: var(--shadow); }
.fcard h2 { font-size: 1.12rem; line-height: 1.3; margin: 2px 0 6px; }
.fcard p { color: var(--ink-2); font-size: .93rem; margin-bottom: 14px; }
.fcard__top { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.fcard__num { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--bg); font-weight: 800; font-size: .85rem; color: var(--ink-2); }
.fcard__ic { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; background: var(--brand-50); color: var(--brand); }
.fcard__ic .ic { width: 22px; height: 22px; }
.fcard__top .pill { margin-left: auto; }
.fcard__code { color: var(--ink-3); font-weight: 700; letter-spacing: .04em; font-size: .75rem; }
.fcard--next { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-50), var(--shadow); }
.fcard--done .fcard__num { background: var(--ok); color: #fff; }
.fcard--done .fcard__ic { background: var(--ok-50); color: var(--ok); }
.fcard--locked { opacity: .62; box-shadow: none; }
.fcard--locked .fcard__ic { background: var(--bg); color: var(--ink-3); }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; font-size: .76rem; font-weight: 700; white-space: nowrap; }
.pill .ic { width: 14px; height: 14px; }
.pill--ok { background: var(--ok-50); color: var(--ok); }
.pill--lock { background: var(--bg); color: var(--ink-3); }
.pill--draft { background: var(--warn-50); color: var(--warn); }
.pill--todo { background: #fff0ed; color: var(--accent); }
.pill--me { background: var(--brand); color: #fff; }
.done-box { text-align: center; padding: 26px 18px; margin-bottom: 18px; border-radius: 22px; color: #fff; background: linear-gradient(135deg, var(--ok), #0e6b47); box-shadow: var(--shadow-lg); }
.done-box__ic { display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 18px; background: rgba(255, 255, 255, .18); margin-bottom: 10px; }
.done-box__ic .ic { width: 28px; height: 28px; }
.done-box p { opacity: .9; margin: 4px 0 16px; }
.done-box__actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.done-box .btn--primary { background: #fff; color: var(--ok); box-shadow: none; }
.done-box .btn--ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .45); }
.foot-note { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 22px; color: var(--ink-3); font-size: .82rem; }
.foot-note .ic { width: 14px; height: 14px; }

/* ---------- Wizard ---------- */
.wz-head {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  background: rgba(255, 255, 255, .9); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
}
.wz-head__t { display: flex; flex-direction: column; flex: 1; line-height: 1.2; }
.wz-head__t small { color: var(--ink-3); font-weight: 700; font-size: .74rem; letter-spacing: .04em; }
.saved { display: inline-flex; align-items: center; gap: 4px; color: var(--ok); font-size: .78rem; font-weight: 700; }
.saved .ic { width: 14px; height: 14px; }
.wz-bar { position: sticky; top: 58px; z-index: 19; height: 4px; background: var(--brand-100); }
.wz-bar__fill { height: 100%; background: linear-gradient(90deg, var(--brand), #3f7fd6); border-radius: 0 4px 4px 0; transition: width .3s; }
.step-head { display: flex; gap: 14px; align-items: flex-start; margin: 8px 0 22px; }
.step-head__ic { flex: none; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 15px; background: var(--brand); color: #fff; box-shadow: 0 8px 18px rgba(31, 79, 150, .25); }
.step-head__ic .ic { width: 24px; height: 24px; }
.wz-foot {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; gap: 10px; justify-content: space-between;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: rgba(255, 255, 255, .94); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.wz-foot .btn:last-child { flex: 1; max-width: 320px; margin-left: auto; }

/* ---------- Fields ---------- */
.fields { display: grid; grid-template-columns: repeat(6, 1fr); gap: 18px 12px; }
.field { grid-column: span 6; min-width: 0; }
.field--c3 { grid-column: span 3; }
.field--c3:nth-last-of-type(1):nth-of-type(odd) { grid-column: span 6; }
@media (min-width: 620px) { .field--c3 { grid-column: span 2; } }
.lbl { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-weight: 650; font-size: .95rem; }
.lbl--sm { font-size: .8rem; color: var(--ink-2); }
.count { display: inline-grid; place-items: center; min-width: 24px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--brand-50); color: var(--brand); font-size: .75rem; font-weight: 800; }
.hint { margin-top: 6px; color: var(--ink-3); font-size: .82rem; }
.input {
  width: 100%; min-height: 50px; padding: 12px 14px; background: var(--card); border: 1.5px solid var(--line); border-radius: 13px;
  transition: border-color .15s, box-shadow .15s; appearance: none;
}
textarea.input { resize: vertical; min-height: 84px; }
select.input { padding-right: 34px; background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-50); }
.input--sm { min-height: 42px; padding: 9px 12px; border-radius: 10px; font-size: .93rem; }
textarea.input--sm { min-height: 60px; }
.has-error .input, .has-error .sig, .has-error .decl { border-color: var(--bad); }
.err { display: flex; align-items: center; gap: 6px; margin-top: 8px; color: var(--bad); font-weight: 600; font-size: .87rem; }
.err .ic { width: 16px; height: 16px; }
.presets, .chips { display: flex; flex-wrap: wrap; gap: 8px; }
.presets { margin-top: 8px; }
.preset { padding: 6px 12px; border-radius: 999px; background: var(--card); border: 1.5px solid var(--line); font-size: .85rem; font-weight: 600; color: var(--ink-2); }
.preset:hover, .preset.on { border-color: var(--brand); color: var(--brand); background: var(--brand-50); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 42px; padding: 8px 14px; border-radius: 999px; background: var(--card);
  border: 1.5px solid var(--line); font-weight: 600; font-size: .9rem; color: var(--ink-2); transition: all .15s; text-align: left;
}
.chip .ic { width: 16px; height: 16px; color: var(--ink-3); }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip.on .ic { color: #fff; }
.chip__n { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #fff; color: var(--brand); font-size: .75rem; font-weight: 800; }
.chips--sm .chip { min-height: 36px; padding: 6px 12px; font-size: .84rem; }
.adder-row { display: flex; gap: 8px; margin-top: 10px; }
.adder-row .input { flex: 1; min-width: 0; }

.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.tiles--compact { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
.tile {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-height: 120px; padding: 14px;
  background: var(--card); border: 2px solid var(--line); border-radius: 18px; text-align: left; transition: all .15s;
}
.tiles--compact .tile { min-height: 96px; align-items: center; text-align: center; justify-content: center; padding: 12px 8px; }
.tiles--compact .tile b { font-size: .85rem; line-height: 1.2; }
.tile b { font-size: 1.05rem; }
.tile small { color: var(--ink-3); font-size: .8rem; line-height: 1.3; }
.tile__ic { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; background: var(--bg); color: var(--ink-2); margin-bottom: auto; }
.tiles--compact .tile__ic { margin-bottom: 4px; }
.tile__ic .ic { width: 22px; height: 22px; }
.tile__tick { position: absolute; top: 10px; right: 10px; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); color: transparent; }
.tile__tick .ic { width: 14px; height: 14px; stroke-width: 3; }
.tile.on { border-color: var(--brand); background: var(--brand-50); }
.tile.on .tile__ic { background: var(--brand); color: #fff; }
.tile.on .tile__tick { background: var(--brand); border-color: var(--brand); color: #fff; }

.opt-cards { display: grid; gap: 8px; }
.opt-card.on { border-color: var(--brand); background: var(--brand-50); }
.radio { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line); flex: none; }
.opt-card.on .radio { background: var(--brand); border-color: var(--brand); color: #fff; }
.radio .ic { width: 14px; height: 14px; stroke-width: 3; }

.decl { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: var(--radius); background: var(--card); border: 1.5px solid var(--line); cursor: pointer; font-size: .93rem; }
.decl input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.decl__box { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--line); color: transparent; }
.decl__box .ic { width: 16px; height: 16px; stroke-width: 3; }
.decl.on { border-color: var(--ok); background: var(--ok-50); }
.decl.on .decl__box { background: var(--ok); border-color: var(--ok); color: #fff; }
.decl:focus-within { box-shadow: 0 0 0 4px var(--brand-50); }

/* Segmented answers */
.seg { display: inline-flex; gap: 4px; padding: 4px; background: var(--bg); border-radius: 12px; flex-wrap: wrap; }
.seg__b { min-width: 56px; min-height: 40px; padding: 0 12px; border-radius: 9px; font-weight: 700; font-size: .9rem; color: var(--ink-2); transition: all .12s; }
.seg__b:hover { background: #fff; }
.seg__b.on { background: var(--brand); color: #fff; box-shadow: 0 2px 6px rgba(20, 32, 51, .18); }
.seg__b--si.on { background: var(--ok); }
.seg__b--no.on { background: var(--bad); }
.seg__b--na.on { background: var(--ink-2); }
.seg--sm .seg__b { min-height: 34px; min-width: 0; font-size: .82rem; padding: 0 10px; }

/* Checklist */
.chk { background: var(--card); border: 1.5px solid var(--line); border-radius: 18px; overflow: hidden; }
.chk + .chk { margin-top: 12px; }
.chk__head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--brand-50); }
.chk__head h3 { font-size: .95rem; flex: 1; color: var(--brand-600); }
.chk__count { font-size: .8rem; font-weight: 800; color: var(--ink-3); }
.chk__count.ok { color: var(--ok); }
.chk__row { display: grid; gap: 10px; padding: 14px; border-top: 1px solid var(--line); border-left: 4px solid transparent; }
.chk__row p { font-size: .93rem; }
.chk__row.is-si { border-left-color: var(--ok); }
.chk__row.is-no { border-left-color: var(--bad); background: var(--bad-50); }
.chk__row.is-na { border-left-color: var(--ink-3); }
@media (min-width: 620px) { .chk__row { grid-template-columns: 1fr auto; align-items: center; } .chk__row .input { grid-column: 1 / -1; } }

/* EPP B/M */
.epp { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px 8px 14px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.epp__sel { display: flex; align-items: center; gap: 10px; flex: 1; min-height: 40px; text-align: left; font-size: .93rem; }
.box { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; border: 2px solid var(--line); flex: none; }
.box .ic { width: 14px; height: 14px; stroke-width: 3; }
.epp.on .box { background: var(--brand); border-color: var(--brand); color: #fff; }
.epp.on .epp__sel { font-weight: 650; }
.epp.bad { background: var(--bad-50); }

/* Crew */
.crew-list { display: grid; gap: 10px; }
.crew { padding: 12px 14px; background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius); display: grid; gap: 10px; }
.crew__top { display: flex; align-items: center; gap: 12px; }
.crew__ex { display: flex; flex-direction: column; gap: 6px; }
.crew__ex small { color: var(--ink-3); font-weight: 600; font-size: .78rem; }
.switch { display: flex; align-items: center; gap: 10px; font-size: .9rem; font-weight: 600; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch__ui { position: relative; width: 46px; height: 28px; border-radius: 999px; background: var(--line); transition: background .15s; flex: none; }
.switch__ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .15s; }
.switch input:checked + .switch__ui { background: var(--ok); }
.switch input:checked + .switch__ui::after { transform: translateX(18px); }
.switch input:focus-visible + .switch__ui { box-shadow: 0 0 0 4px var(--brand-50); }
.adder { margin-top: 10px; border: 1.5px dashed var(--brand-100); border-radius: var(--radius); background: #fafcff; }
.adder summary { display: flex; align-items: center; gap: 8px; padding: 14px; font-weight: 700; color: var(--brand); cursor: pointer; list-style: none; }
.adder summary::-webkit-details-marker { display: none; }
.adder__list { padding: 0 10px 10px; }
.adder__ext { padding: 10px 14px 14px; border-top: 1px solid var(--line); }
.adder__ext small { color: var(--ink-3); font-weight: 600; }
.adder__ext .adder-row { margin-top: 6px; flex-wrap: wrap; }
.adder__ext .input:nth-child(2) { max-width: 120px; }

/* Hazards (ATS) */
.hz { padding: 14px; background: var(--card); border: 1.5px solid var(--line); border-radius: 18px; display: grid; gap: 12px; }
.hz + .hz { margin-top: 12px; }
.hz__head { display: flex; align-items: center; gap: 10px; }
.hz__head h3 { font-size: 1rem; flex: 1; }
.hz__n { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; background: var(--brand); color: #fff; font-weight: 800; font-size: .85rem; flex: none; }
.hz__item { display: grid; gap: 8px; padding: 12px; border-radius: 14px; background: var(--bg); }
.hz__title { display: flex; align-items: center; gap: 8px; }
.hz__title b { flex: 1; }
.hz__title .ic { color: var(--warn); }
.mini { display: grid; gap: 4px; }
.mini small, .hz__tools small { color: var(--ink-3); font-weight: 600; font-size: .78rem; }
.hz__tools { display: grid; gap: 8px; padding-top: 4px; border-top: 1px dashed var(--line); }

/* Signature */
.sig { position: relative; height: 180px; border: 2px dashed var(--brand-100); border-radius: var(--radius); background: #fff; touch-action: none; overflow: hidden; }
.sig__canvas { display: block; width: 100%; height: 180px; cursor: crosshair; }
.sig__ph { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--ink-3); pointer-events: none; font-weight: 600; }
.sig::after { content: ""; position: absolute; left: 24px; right: 24px; bottom: 44px; border-bottom: 1.5px solid var(--line); pointer-events: none; }
.sig__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.sig-done { border: 1.5px solid var(--ok); border-radius: var(--radius); background: #fff; overflow: hidden; }
.sig-done img { display: block; width: 100%; max-height: 160px; object-fit: contain; }
.sig-done__bar { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: var(--ok-50); font-size: .9rem; }
.ok { display: inline-flex; align-items: center; gap: 6px; color: var(--ok); font-weight: 700; }
.sig-mini { margin: 4px 0 6px; }
.sig-mini img { display: block; width: 100%; max-height: 110px; object-fit: contain; border: 1px solid var(--line); border-radius: 12px; background: #fff; }

/* ---------- Modal / toast ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: end center; padding: 16px; background: rgba(15, 25, 45, .45); backdrop-filter: blur(3px); animation: fade .15s; }
@media (min-width: 620px) { .overlay { place-items: center; } }
.modal { width: 100%; max-width: 440px; padding: 22px; border-radius: 22px; background: var(--card); box-shadow: var(--shadow-lg); animation: up .2s ease-out; }
.modal h2 { font-size: 1.25rem; margin-bottom: 6px; }
.modal p { color: var(--ink-2); }
.modal__actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.modal__actions .btn { flex: 1; }
.modal__actions--col { flex-direction: column; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(16px); opacity: 0; } }
.toast {
  position: fixed; left: 50%; bottom: 92px; z-index: 60; display: flex; align-items: center; gap: 8px; max-width: calc(100% - 32px);
  padding: 12px 16px; border-radius: 14px; background: var(--ink); color: #fff; font-weight: 600; font-size: .92rem; box-shadow: var(--shadow-lg);
  transform: translate(-50%, 20px); opacity: 0; transition: all .25s; pointer-events: none;
}
.toast.in { transform: translate(-50%, 0); opacity: 1; }
.toast--err { background: var(--bad); }

/* ---------- Report ---------- */
.report-bar { position: sticky; top: 0; z-index: 20; display: flex; justify-content: space-between; gap: 10px; padding: 10px 16px; background: rgba(255, 255, 255, .92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.report { max-width: 960px; margin: 0 auto; padding: 16px; display: grid; gap: 20px; }
.sheet { background: #fff; border: 1px solid #c9d3e3; border-radius: 6px; padding: 18px; box-shadow: var(--shadow); font-size: .86rem; }
.sheet__head { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding-bottom: 12px; border-bottom: 2px solid #8fa6cc; }
.sheet__title { text-align: center; }
.sheet__title small { font-weight: 800; letter-spacing: .1em; color: var(--ink-2); }
.sheet__title h2 { font-size: 1rem; color: var(--brand-600); }
.sheet__meta { display: grid; grid-template-columns: auto auto; gap: 1px 8px; margin: 0; font-size: .74rem; }
.sheet__meta dt { color: var(--ink-3); }
.sheet__meta dd { margin: 0; font-weight: 700; }
.sheet__sec { margin-top: 14px; }
.sheet__sec h3 { padding: 5px 10px; margin-bottom: 8px; font-size: .8rem; letter-spacing: .04em; text-transform: uppercase; color: #fff; background: #8fa6cc; border-radius: 3px; }
.kv { display: grid; grid-template-columns: minmax(120px, 34%) 1fr; margin: 0 0 8px; border: 1px solid #d7deea; }
.kv dt, .kv dd { margin: 0; padding: 6px 8px; border-bottom: 1px solid #d7deea; }
.kv dt { background: #f4f7fb; font-weight: 650; }
.kv dd { white-space: pre-wrap; overflow-wrap: anywhere; }
.tbl-wrap { overflow-x: auto; margin-bottom: 8px; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { border: 1px solid #d7deea; padding: 5px 7px; text-align: left; vertical-align: top; }
.tbl th { background: #f4f7fb; font-weight: 700; }
.chk-t td:not(:first-child):not(:last-child), .chk-t th:not(:first-child):not(:last-child) { text-align: center; width: 44px; font-weight: 800; }
.sig-cell { display: block; height: 38px; max-width: 120px; object-fit: contain; }
.sig-cell--lg { height: 70px; max-width: 220px; }
.sheet__foot { margin-top: 14px; padding-top: 8px; border-top: 1px solid var(--line); color: var(--ink-3); font-size: .75rem; }

@media print {
  @page { size: A4; margin: 10mm; }
  body { background: #fff; }
  .no-print, .topbar, .toast { display: none !important; }
  .report { padding: 0; max-width: none; gap: 0; }
  .sheet { box-shadow: none; border: 0; padding: 0; break-after: page; }
  .sheet:last-child { break-after: auto; }
  .tbl tr, .kv dt, .kv dd { break-inside: avoid; }
  .tbl-wrap { overflow: visible; }
  .sheet__sec h3 { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
