/* =========================================================
   MTC Brazil – checklist interativo (checklist.html)
   ========================================================= */

:root {
  --navy: #23245f;
  --blue: #1e5bb8;
  --red: #d7262f;
  --green: #138a4b;
  --amber: #b26b00;

  --bg: #eef0f4;
  --paper: #ffffff;
  --ink: #0e0f17;
  --ink-2: #3b3d4a;
  --muted: #6b6e7d;
  --line: #dfe2e8;
  --bar: #16171f;           /* faixa de título das seções (preta como no impresso) */
  --done-bg: #eaf6ef;
  --done-ink: #6b7d72;
  --next: #1e5bb8;

  --font-head: "Montserrat", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --radius: 14px;
  --max: 980px;
}

html.night {
  --bg: #07080c;
  --paper: #11131a;
  --ink: #e9ebf2;
  --ink-2: #c3c7d3;
  --muted: #8b90a0;
  --line: #262a36;
  --bar: #000000;
  --done-bg: #0e2219;
  --done-ink: #6f9a82;
  --next: #5b8ff0;
  --red: #ff4d55;
  --green: #2fc172;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: 150px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink-2);
  font-family: var(--font-body); font-size: 16px; line-height: 1.45;
  -webkit-font-smoothing: antialiased; padding-bottom: 96px;
}
img { max-width: 100%; height: auto; display: block; }
button { font: inherit; color: inherit; }

/* ---------- Cabeçalho fixo ---------- */
.cl-header {
  position: sticky; top: 0; z-index: 30;
  background: var(--paper); border-bottom: 1px solid var(--line);
  box-shadow: 0 6px 20px rgba(10, 12, 30, .06);
}
.cl-header-inner {
  width: min(100% - 24px, var(--max)); margin-inline: auto;
  display: flex; align-items: center; gap: 14px; padding: 10px 0 8px;
}
.cl-brand { flex-shrink: 0; display: block; height: 44px; }
.cl-brand img { height: 100%; width: auto; }
.logo-night { display: none !important; }
html.night .logo-day { display: none !important; }
html.night .logo-night { display: block !important; }

.cl-title { display: flex; flex-direction: column; min-width: 0; }
.cl-kicker { font-family: var(--font-head); font-weight: 700; font-size: .68rem; letter-spacing: .16em; text-transform: uppercase; color: var(--blue); }
.cl-title strong { font-family: var(--font-head); font-weight: 800; font-size: 1.05rem; color: var(--ink); letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.cl-tools { margin-left: auto; display: flex; gap: 8px; }
.tool {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: transparent; cursor: pointer;
  font-family: var(--font-head); font-weight: 600; font-size: .78rem; color: var(--ink-2);
}
.tool svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tool[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.tool[hidden] { display: none; }

.cl-tabs {
  width: min(100% - 24px, var(--max)); margin: 0 auto; display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
  padding: 0 0 10px;
}
.cl-tabs button {
  border: 0; cursor: pointer; padding: 11px 10px; border-radius: 10px;
  font-family: var(--font-head); font-weight: 700; font-size: .82rem; letter-spacing: .06em; text-transform: uppercase;
  background: var(--bg); color: var(--muted);
}
.cl-tabs button[aria-selected="true"] { background: var(--navy); color: #fff; }
.cl-tabs button.is-emergency[aria-selected="true"] { background: var(--red); }
html.night .cl-tabs button[aria-selected="true"] { background: #2a2c6e; }
html.night .cl-tabs button.is-emergency[aria-selected="true"] { background: #a5161e; }

/* ---------- Alertas ---------- */
.cl-integrity { width: min(100% - 24px, var(--max)); margin: 14px auto 0; padding: 14px 18px; border-radius: 12px; font-weight: 700; }
.cl-integrity.is-bad { background: var(--red); color: #fff; }

.cl-main { width: min(100% - 24px, var(--max)); margin: 0 auto; }
.cl-disclaimer {
  margin: 16px 0 6px; padding: 12px 16px; border-radius: 12px;
  background: color-mix(in srgb, var(--amber) 12%, var(--paper)); border: 1px solid color-mix(in srgb, var(--amber) 35%, transparent);
  font-size: .86rem; color: var(--ink-2);
}
.cl-disclaimer strong { color: var(--amber); }
html.night .cl-disclaimer strong { color: #f0a63a; }

/* ---------- Uso sem internet ---------- */
.cl-offline {
  margin: 8px 0 6px; padding: 12px 16px; border-radius: 12px; background: var(--paper); border: 1px solid var(--line);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px;
}
.cl-offline[hidden] { display: none; }
.cl-offline-status { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }
.cl-offline-status strong { display: block; color: var(--ink); font-size: .92rem; }
.cl-offline-status span:not(.dot) { font-size: .84rem; color: var(--muted); }
.dot { flex-shrink: 0; width: 12px; height: 12px; border-radius: 50%; margin-top: 4px; background: var(--muted); }
.dot.is-ok { background: var(--green); box-shadow: 0 0 0 4px color-mix(in srgb, var(--green) 20%, transparent); }
.dot.is-offline { background: #e08a00; box-shadow: 0 0 0 4px rgba(224, 138, 0, .2); }
.dot.is-wait { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.cl-offline-actions { display: flex; gap: 8px; }
.cl-offline-actions [hidden] { display: none; }
.cl-btn--primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.cl-ios { flex-basis: 100%; margin: 0; font-size: .84rem; color: var(--ink-2); }
.cl-ios[hidden] { display: none; }
.ios-share svg { width: 16px; height: 16px; vertical-align: -3px; fill: none; stroke: var(--blue); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Grupo ---------- */
.group-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; margin: 22px 0 12px; }
.group-head h1 { margin: 0; font-family: var(--font-head); font-weight: 800; font-size: clamp(1.5rem, 4vw, 2.2rem); letter-spacing: -.02em; color: var(--navy); }
html.night .group-head h1 { color: #9fb1ff; }
.group--emergency .group-head h1 { color: var(--red); }
.group-rev { font-family: var(--font-head); font-weight: 700; font-size: .72rem; letter-spacing: .12em; color: var(--muted); }
.group-disclaimer {
  margin: 0 0 16px; padding: 12px 16px; border: 2px solid var(--ink); border-radius: 10px;
  font-weight: 700; font-size: .8rem; text-align: center; color: var(--ink); background: var(--paper);
}

.group--emergency .group-head { position: relative; padding-top: 18px; }
.group--emergency .group-head::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 10px; border-radius: 4px;
  background: repeating-linear-gradient(-45deg, var(--red) 0 14px, transparent 14px 28px);
}

/* ---------- Índice ---------- */
.index { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; margin-bottom: 22px; }
.index-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px;
  background: var(--paper); border: 1px solid var(--line); text-decoration: none; color: var(--ink);
  font-family: var(--font-head); font-weight: 700; font-size: .74rem; letter-spacing: .02em; line-height: 1.25;
}
.index-item:hover { border-color: var(--next); }
.index-n {
  flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--bg); color: var(--muted); font-size: .72rem;
}
.index-t { flex: 1; }
.index-c { font-family: var(--font-body); font-weight: 600; font-size: .72rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.index-item.is-complete { border-color: color-mix(in srgb, var(--green) 50%, transparent); }
.index-item.is-complete .index-n { background: var(--green); color: #fff; }
.group--emergency .index-n { color: var(--red); }

/* ---------- Seção ---------- */
.sec { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 16px; }
.sec-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--bar); color: #fff; padding: 10px 12px 10px 16px;
}
.sec-head h2 {
  margin: 0; display: flex; align-items: center; gap: 10px;
  font-family: var(--font-head); font-weight: 800; font-size: 1rem; letter-spacing: .02em; color: #fff; line-height: 1.2;
}
.sec-n {
  flex-shrink: 0; min-width: 24px; height: 24px; border-radius: 6px; padding: 0 6px; display: grid; place-items: center;
  background: rgba(255,255,255,.14); font-size: .72rem;
}
.group--emergency .sec-n { background: var(--red); }
.sec-meta { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.sec-count { font-weight: 700; font-size: .8rem; font-variant-numeric: tabular-nums; opacity: .85; }
.sec-reset {
  border: 1px solid rgba(255,255,255,.3); background: transparent; color: #fff; cursor: pointer;
  border-radius: 999px; padding: 5px 11px; font-size: .74rem; font-weight: 600;
}
.sec-reset:hover { background: rgba(255,255,255,.12); }
.sec.is-complete .sec-head { background: var(--green); }
.sec.is-complete .sec-count::before { content: "✓ "; }

.rows { list-style: none; margin: 0; padding: 6px 0; }

/* item marcável */
.step {
  width: 100%; display: flex; align-items: baseline; gap: 10px; text-align: left; cursor: pointer;
  border: 0; background: transparent; padding: 12px 16px; min-height: 48px;
  font-size: 1rem; font-weight: 500; color: var(--ink); letter-spacing: .01em;
  border-left: 4px solid transparent; transition: background .15s;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.rows li + li .step { border-top: 1px solid var(--line); }
.step:hover { background: color-mix(in srgb, var(--next) 6%, transparent); }
.step:focus-visible { outline: 3px solid var(--next); outline-offset: -3px; }
.tick {
  align-self: center; flex-shrink: 0; width: 26px; height: 26px; border-radius: 7px;
  border: 2px solid var(--muted); display: grid; place-items: center; transition: background .15s, border-color .15s;
}
.num { flex-shrink: 0; min-width: 2.2em; font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; }
.item { flex: 0 1 auto; }
.lead { flex: 1 1 24px; min-width: 24px; border-bottom: 2px dotted color-mix(in srgb, var(--ink) 30%, transparent); transform: translateY(-4px); }
.action { flex: 0 1 auto; margin-left: auto; text-align: right; font-weight: 700; }
.mn { font-weight: 800; font-size: 1.15em; color: var(--navy); }
html.night .mn { color: #9fb1ff; }
sub { font-size: .7em; }

.step.is-next { border-left-color: var(--next); }
.step.is-done { background: var(--done-bg); color: var(--done-ink); border-left-color: transparent; }
.step.is-done .item, .step.is-done .action { text-decoration: line-through; text-decoration-thickness: 1.5px; text-decoration-color: color-mix(in srgb, var(--done-ink) 70%, transparent); }
.step.is-done .tick { background: var(--green); border-color: var(--green); }
.step.is-done .tick::after {
  content: ""; width: 7px; height: 13px; border: solid #fff; border-width: 0 3px 3px 0; transform: translateY(-2px) rotate(45deg);
}

/* linhas impressas não marcáveis */
.r-note, .r-cond, .r-emph, .r-box, .r-image { padding: 10px 16px; color: var(--ink); }
.rows li + .r-note, .rows li + .r-cond, .rows li + .r-emph { border-top: 1px solid var(--line); }
.r-note { font-weight: 500; }
.r-cond { font-family: var(--font-head); font-weight: 800; font-size: .88rem; letter-spacing: .02em; background: color-mix(in srgb, var(--ink) 4%, transparent); }
.r-emph { font-weight: 800; text-align: center; }
.r-box { margin: 8px 16px; border: 2px solid var(--ink); border-radius: 8px; font-weight: 800; text-align: center; font-size: .9rem; }
.group--emergency .r-box { border-color: var(--red); }
.r-image img { width: 100%; max-width: 640px; margin: 4px auto; border-radius: 6px; background: #fff; }
html.night .r-image img { filter: invert(.9) hue-rotate(180deg); }

/* ---------- Barra inferior ---------- */
.cl-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: var(--paper); border-top: 1px solid var(--line); box-shadow: 0 -6px 20px rgba(10, 12, 30, .08);
  padding-bottom: env(safe-area-inset-bottom);
}
.cl-bar-inner { width: min(100% - 24px, var(--max)); margin-inline: auto; display: flex; align-items: center; gap: 10px; padding: 10px 0; }
.cl-progress { flex: 1; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 4px 12px; min-width: 0; }
.cl-progress-label { font-family: var(--font-head); font-weight: 700; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cl-progress-track { height: 8px; border-radius: 999px; background: var(--bg); overflow: hidden; }
.cl-progress-track span { display: block; height: 100%; width: 0; background: var(--green); border-radius: inherit; transition: width .25s; }
.cl-progress-count { font-weight: 700; font-size: .85rem; font-variant-numeric: tabular-nums; color: var(--ink); }
.cl-btn { border-radius: 999px; padding: 10px 16px; font-family: var(--font-head); font-weight: 700; font-size: .8rem; cursor: pointer; border: 1px solid var(--line); background: transparent; color: var(--ink); }
.cl-btn--danger { border-color: color-mix(in srgb, var(--red) 50%, transparent); color: var(--red); }

/* ---------- Celular ---------- */
@media (max-width: 640px) {
  html { scroll-padding-top: 170px; }
  .cl-brand { height: 36px; }
  .cl-title strong { font-size: .88rem; white-space: normal; }
  .tool span { display: none; }
  .tool { padding: 9px; }
  .cl-tabs button { font-size: .72rem; letter-spacing: .03em; padding: 11px 6px; }
  .index { grid-template-columns: 1fr; }
  .step { flex-wrap: wrap; row-gap: 2px; padding: 12px 12px; font-size: .95rem; }
  .item { flex: 1 1 calc(100% - 80px); }
  .lead { display: none; }
  .action { flex-basis: 100%; padding-left: calc(26px + 2.2em + 20px); text-align: left; color: var(--blue); }
  html.night .action { color: #8fb3ff; }
  .step.is-done .action { color: var(--done-ink); }
  .sec-head h2 { font-size: .9rem; }
  .cl-progress { grid-template-columns: 1fr auto; }
  .cl-progress-label { grid-column: 1 / -1; }
}

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