/* Manual do Processo Sancionatório — SUGESP/RO */
:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-2: #f1efe8;
  --surface-3: #e9e6dc;
  --ink: #17212d;
  --ink-2: #2c3746;
  --muted: #5d6776;
  --line: #e4e1d7;
  --line-strong: #cdc9bc;
  --navy: #1d3557;
  --accent: #2a5d93;
  --accent-soft: rgba(42, 93, 147, 0.09);
  --gold: #a87b1d;
  --gold-soft: rgba(184, 140, 42, 0.12);
  --ok: #2f7d4f;
  --diagram-fill: #ffffff;
  --diagram-line: #8b95a3;
  --hero-bg: linear-gradient(135deg, #e8e9eb 0%, #dfe1e4 55%, #d9dbdf 100%);
  --shadow: 0 1px 2px rgba(20, 30, 45, 0.06), 0 8px 24px rgba(20, 30, 45, 0.06);
  --shadow-lg: 0 12px 40px rgba(20, 30, 45, 0.14);
  --radius: 14px;
  --topbar: 62px;
  --sidebar: 304px;
  --serif: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e131a; --surface: #141b24; --surface-2: #1a2330; --surface-3: #222d3b;
    --ink: #e7eaef; --ink-2: #ccd3dd; --muted: #98a3b2; --line: #243041; --line-strong: #364457;
    --navy: #9cc0ea; --accent: #7fb0e6; --accent-soft: rgba(127, 176, 230, 0.12);
    --gold: #dcb860; --gold-soft: rgba(220, 184, 96, 0.13); --ok: #6fcf97;
    --diagram-fill: #141b24; --diagram-line: #697589;
    --hero-bg: linear-gradient(135deg, #16202c 0%, #121a24 100%);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e131a; --surface: #141b24; --surface-2: #1a2330; --surface-3: #222d3b;
  --ink: #e7eaef; --ink-2: #ccd3dd; --muted: #98a3b2; --line: #243041; --line-strong: #364457;
  --navy: #9cc0ea; --accent: #7fb0e6; --accent-soft: rgba(127, 176, 230, 0.12);
  --gold: #dcb860; --gold-soft: rgba(220, 184, 96, 0.13); --ok: #6fcf97;
  --diagram-fill: #141b24; --diagram-line: #697589;
  --hero-bg: linear-gradient(135deg, #16202c 0%, #121a24 100%);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--topbar) + 18px); }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 16.5px/1.72 var(--sans);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
::selection { background: var(--gold-soft); }

/* progresso de leitura */
.progress { position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 60; }
.progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--gold)); }

/* barra superior */
.topbar {
  position: fixed; inset: 0 0 auto 0; height: var(--topbar); z-index: 50;
  display: flex; align-items: center; gap: 16px; padding: 0 18px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; min-width: 0; width: calc(var(--sidebar) - 34px); }
.brand-mark {
  flex: none; width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
  background: var(--navy); color: #fff; font: 700 19px/1 var(--serif);
}
:root[data-theme="dark"] .brand-mark { color: #0e131a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .brand-mark { color: #0e131a; } }
.brand strong { display: block; font-size: 14.5px; line-height: 1.2; }
.brand em { display: block; font-style: normal; font-size: 12px; color: var(--muted); line-height: 1.2; }
.search { position: relative; flex: 1; max-width: 560px; display: flex; align-items: center; }
.search > svg { position: absolute; left: 13px; color: var(--muted); pointer-events: none; }
.search input {
  width: 100%; height: 40px; padding: 0 40px 0 38px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font: inherit; font-size: 14.5px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.search kbd {
  position: absolute; right: 10px; font: 500 11px/1 var(--mono); color: var(--muted);
  border: 1px solid var(--line-strong); border-radius: 5px; padding: 3px 6px; background: var(--surface-2);
}
.results {
  position: absolute; top: 48px; left: 0; right: 0; max-height: min(70vh, 560px); overflow: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg);
  padding: 6px;
}
.results button {
  display: block; width: 100%; text-align: left; border: 0; background: none; color: var(--ink);
  padding: 9px 12px; border-radius: 8px; cursor: pointer; font: inherit; font-size: 14px; line-height: 1.45;
}
.results button:hover, .results button[aria-selected="true"] { background: var(--accent-soft); }
.results .r-sec { display: block; font-size: 11.5px; font-weight: 600; color: var(--gold); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 2px; }
.results mark, .doc mark.hit { background: var(--gold-soft); color: inherit; border-radius: 3px; padding: 0 1px; box-shadow: 0 0 0 1px color-mix(in srgb, var(--gold) 40%, transparent); }
.results .r-empty { padding: 14px; color: var(--muted); font-size: 14px; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.btn-ghost {
  font-size: 13px; font-weight: 600; color: var(--ink-2); text-decoration: none; padding: 7px 11px;
  border-radius: 8px; border: 1px solid var(--line-strong);
}
.btn-ghost:hover { background: var(--surface-2); }
.icon-btn {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 9px;
  border: 1px solid transparent; background: none; color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--line); }
.i-moon { display: none; }
:root[data-theme="dark"] .i-sun { display: none; }
:root[data-theme="dark"] .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: none; }
  :root:not([data-theme="light"]) .i-moon { display: block; }
}
.menu-btn { display: none; }

/* layout */
.layout { padding-top: var(--topbar); }
.sidebar {
  position: fixed; top: var(--topbar); bottom: 0; left: 0; width: var(--sidebar); overflow-y: auto;
  padding: 18px 12px 40px 16px; border-right: 1px solid var(--line); background: var(--bg);
  scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent;
}
.sidebar-head { font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 0 10px 10px; }
.toc, .toc ul { list-style: none; margin: 0; padding: 0; }
.toc a {
  display: flex; gap: 10px; align-items: baseline; padding: 6px 10px; border-radius: 8px;
  color: var(--ink-2); text-decoration: none; font-size: 14px; line-height: 1.35;
}
.toc a:hover { background: var(--surface-2); color: var(--ink); }
.toc-chapter > a { font-weight: 600; color: var(--ink); }
.toc-num { flex: none; min-width: 26px; font: 600 12px/1.6 var(--mono); color: var(--muted); }
.toc-chapter > ul { display: none; margin: 2px 0 6px 18px; padding-left: 8px; border-left: 1px solid var(--line); }
.toc-chapter.open > ul { display: block; }
.toc-chapter ul a { font-size: 13.2px; padding: 4px 10px; color: var(--muted); }
.toc a.active { background: var(--accent-soft); color: var(--accent); }
.toc a.active .toc-num { color: var(--accent); }
main { margin-left: var(--sidebar); min-width: 0; }

/* capa */
.hero {
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 28px; align-items: center;
  padding: 48px clamp(20px, 4vw, 56px) 40px; background: var(--hero-bg); border-bottom: 1px solid var(--line);
}
.eyebrow { margin: 0 0 14px; font-size: 12.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--gold); }
.hero h1 {
  margin: 0; font: 700 clamp(30px, 3.6vw, 46px)/1.1 var(--serif); letter-spacing: -.01em; color: var(--navy);
  text-wrap: balance;
}
.hero-lead { margin: 18px 0 22px; font-size: 17.5px; line-height: 1.6; color: var(--ink-2); max-width: 60ch; }
.hero-facts { display: flex; gap: 28px; margin: 0 0 18px; padding: 0; }
.hero-facts div { display: flex; flex-direction: column; }
.hero-facts dt { font: 700 30px/1 var(--serif); color: var(--navy); }
.hero-facts dd { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.hero-meta { margin: 0; font-size: 13px; color: var(--muted); }
.hero-art img {
  display: block; width: 100%; height: auto; border-radius: 18px; box-shadow: var(--shadow-lg);
  aspect-ratio: 16 / 9; object-fit: cover;
}

/* atalhos */
.quicks {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px;
  max-width: 1040px; margin: 28px auto 8px; padding: 0 clamp(20px, 4vw, 48px);
}
.quick {
  display: block; padding: 16px 18px; border-radius: var(--radius); background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow); text-decoration: none; color: var(--ink);
  transition: transform .15s, border-color .15s;
}
.quick:hover { transform: translateY(-2px); border-color: var(--accent); }
.quick strong { display: block; font-size: 15.5px; margin-bottom: 2px; }
.quick strong::after { content: " →"; color: var(--accent); }
.quick span { font-size: 13.5px; color: var(--muted); line-height: 1.45; }

/* documento */
.doc { max-width: 860px; margin: 0 auto; padding: 8px clamp(20px, 4vw, 48px) 40px; }
.chapter { padding-top: 26px; }
.chapter + .chapter { border-top: 1px solid var(--line); margin-top: 38px; }
.doc h2 {
  display: flex; align-items: baseline; gap: 14px; margin: 16px 0 14px;
  font: 700 clamp(25px, 2.6vw, 31px)/1.2 var(--serif); color: var(--navy); letter-spacing: -.005em;
}
.doc h2 .h-num {
  flex: none; display: inline-grid; place-items: center; min-width: 44px; height: 44px; padding: 0 8px;
  border-radius: 12px; background: var(--navy); color: var(--bg); font: 700 20px/1 var(--sans);
  transform: translateY(-3px);
}
.doc h3 {
  display: flex; align-items: baseline; gap: 10px; margin: 34px 0 10px;
  font: 600 21px/1.3 var(--serif); color: var(--ink);
}
.doc h3 .h-num { font: 600 14px/1 var(--mono); color: var(--gold); flex: none; }
.h-anchor { margin-left: 4px; opacity: 0; color: var(--muted); text-decoration: none; font: 500 16px var(--sans); transition: opacity .15s; }
h2:hover .h-anchor, h3:hover .h-anchor { opacity: 1; }
.doc p { margin: 0 0 14px; }
.doc ul, .doc ol { margin: 0 0 16px; padding-left: 24px; }
.doc li { margin: 5px 0; }
.doc li::marker { color: var(--gold); font-weight: 600; }
.doc strong { font-weight: 650; color: var(--ink); }
.doc code { font: 500 .88em var(--mono); background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
.doc a[target="_blank"]::after { content: "↗"; font-size: .78em; margin-left: 2px; text-decoration: none; display: inline-block; }

/* paragrafos com termo inicial em negrito */
.term { padding: 2px 0 2px 16px; border-left: 3px solid var(--gold-soft); }
.term > strong:first-child { color: var(--navy); }
.callout-fiscal {
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); border-left: 4px solid var(--accent);
  background: var(--accent-soft); padding: 16px 18px; border-radius: 12px; margin: 18px 0 !important;
}
.note {
  display: flex; gap: 14px; align-items: flex-start; margin: 22px 0; padding: 16px 18px; border-radius: 12px;
  background: var(--gold-soft); border: 1px solid color-mix(in srgb, var(--gold) 30%, transparent);
  font-size: 15px;
}
.note p { margin: 0; }
.note-icon {
  flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--gold); color: var(--bg); font: 700 14px/1 var(--serif); margin-top: 2px;
}

/* tabelas */
.table-wrap {
  margin: 16px 0 22px; overflow-x: auto; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); box-shadow: var(--shadow);
}
.doc table { width: 100%; border-collapse: collapse; font-size: 14.2px; line-height: 1.5; }
.doc th {
  text-align: left; font-weight: 650; font-size: 12.5px; letter-spacing: .02em; color: var(--ink-2);
  background: var(--surface-2); padding: 10px 14px; border-bottom: 1px solid var(--line-strong); white-space: nowrap;
}
.doc td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; min-width: 120px; }
.doc tr:last-child td { border-bottom: 0; }
.doc tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--surface-2) 45%, transparent); }
.doc td:first-child { font-weight: 550; color: var(--ink); }

/* figuras */
.figure { margin: 24px 0 28px; }
.figure-frame {
  border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface);
  box-shadow: var(--shadow); overflow: hidden;
}
.figure-photo img { display: block; width: 100%; height: auto; }
.figure-diagram .figure-frame { padding: 18px 10px 8px; }
.diagram { display: block; width: 100%; height: auto; font-family: var(--sans); }
.figure figcaption { margin-top: 10px; font-size: 13.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; }
.figure figcaption strong { color: var(--ink); }

/* formula */
.formula {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px;
  margin: 18px 0 22px; padding: 22px 18px; border-radius: var(--radius); background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow); font: 500 19px/1.2 var(--serif);
}
.f-var { font-style: italic; color: var(--navy); }
.f-op, .f-paren { color: var(--muted); font-size: 22px; }
.f-paren { font-size: 34px; font-weight: 300; }
.f-frac { display: inline-flex; flex-direction: column; align-items: center; }
.f-top { padding: 0 6px 4px; border-bottom: 1.5px solid var(--ink-2); font-size: 16px; }
.f-bot { padding-top: 4px; font-size: 16px; }

/* checklists */
.checklist { list-style: none; padding: 0 !important; margin: 10px 0 22px !important; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.checklist-head { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.checklist-head .bar { flex: 1; height: 6px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.checklist-head .bar span { display: block; height: 100%; width: 0; background: var(--ok); transition: width .25s; }
.checklist-head button { border: 0; background: none; color: var(--accent); font: 600 12.5px var(--sans); cursor: pointer; padding: 2px 4px; }
.task { margin: 0 !important; border-bottom: 1px solid var(--line); }
.task:last-child { border-bottom: 0; }
.task label { display: flex; gap: 12px; align-items: flex-start; padding: 10px 14px; cursor: pointer; font-size: 15px; line-height: 1.55; }
.task label:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.task input {
  appearance: none; -webkit-appearance: none; flex: none; width: 20px; height: 20px; margin: 2px 0 0;
  border: 1.6px solid var(--line-strong); border-radius: 6px; background: var(--surface); cursor: pointer;
  display: grid; place-items: center; transition: background .15s, border-color .15s;
}
.task input::after { content: ""; width: 10px; height: 6px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); opacity: 0; }
.task input:checked { background: var(--ok); border-color: var(--ok); }
.task input:checked::after { opacity: 1; }
.task input:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 2px; }
.task input:checked + span { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line-strong); }

/* modelos */
.model { margin: 14px 0 26px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.model-bar { display: flex; align-items: center; gap: 10px; padding: 9px 10px 9px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.model-kind { font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--gold); }
.model-title { flex: 1; min-width: 0; font: 500 12.5px var(--mono); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.copy-btn {
  flex: none; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2);
  font: 600 12.5px var(--sans); padding: 6px 12px; border-radius: 8px; cursor: pointer;
}
.copy-btn:hover { border-color: var(--accent); color: var(--accent); }
.copy-btn.done { background: var(--ok); border-color: var(--ok); color: #fff; }
.model pre { margin: 0; padding: 20px 22px; max-height: 520px; overflow: auto; white-space: pre-wrap; word-break: break-word; }
.model code { background: none !important; padding: 0 !important; font: 400 13.6px/1.65 var(--mono) !important; color: var(--ink-2); }

/* perguntas frequentes */
.faq { margin: 0 0 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.faq summary {
  list-style: none; cursor: pointer; padding: 14px 46px 14px 18px; font-weight: 600; position: relative; line-height: 1.45;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: ""; position: absolute; right: 18px; top: 50%; width: 9px; height: 9px; margin-top: -7px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .2s;
}
.faq[open] summary::after { transform: rotate(-135deg); margin-top: -2px; }
.faq[open] summary { border-bottom: 1px solid var(--line); }
.faq p { margin: 0; padding: 14px 18px 16px; color: var(--ink-2); }

/* destaque de navegacao */
.flash { animation: flash 1.8s ease; border-radius: 6px; }
@keyframes flash { 0%, 30% { background: var(--gold-soft); box-shadow: 0 0 0 6px var(--gold-soft); } 100% { background: transparent; box-shadow: 0 0 0 6px transparent; } }

.footer {
  max-width: 860px; margin: 30px auto 0; padding: 26px clamp(20px, 4vw, 48px) 60px;
  border-top: 1px solid var(--line); font-size: 13.5px; color: var(--muted);
}
.to-top {
  position: fixed; right: 22px; bottom: 22px; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg);
  font-size: 18px; cursor: pointer; z-index: 40;
}
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; font-weight: 500;
  transition: opacity .2s, transform .2s; z-index: 70;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.scrim { position: fixed; inset: var(--topbar) 0 0 0; background: rgba(10, 15, 22, .45); z-index: 44; }

/* responsivo */
@media (max-width: 1100px) {
  .quicks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { grid-template-columns: 1fr; }
  .hero-art { max-width: 640px; }
}
@media (max-width: 920px) {
  :root { --sidebar: 300px; }
  .menu-btn { display: grid; }
  .brand { width: auto; }
  .sidebar { transform: translateX(-102%); transition: transform .25s ease; z-index: 45; background: var(--surface); box-shadow: var(--shadow-lg); }
  body.menu-open .sidebar { transform: none; }
  main { margin-left: 0; }
  .btn-ghost { display: none; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .topbar { gap: 8px; padding: 0 10px; }
  .brand > span:last-child { display: none; }
  .search kbd { display: none; }
  .quicks { grid-template-columns: 1fr; margin-top: 18px; }
  .hero { padding-top: 30px; }
  .hero-facts { gap: 18px; }
  .doc h2 .h-num { min-width: 36px; height: 36px; font-size: 16px; }
  .model pre { padding: 16px; }
}

/* impressao */
@media print {
  .topbar, .sidebar, .quicks, .to-top, .toast, .progress, .copy-btn, .h-anchor, .checklist-head button, .scrim { display: none !important; }
  main { margin: 0; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .hero { background: none; padding: 0 0 20px; }
  .hero-art { display: none; }
  .chapter { break-before: page; border: 0 !important; }
  .table-wrap, .model, .figure-frame, .checklist, .faq { box-shadow: none; break-inside: avoid; }
  .model pre { max-height: none; }
  .faq summary::after { display: none; }
  .doc a[target="_blank"]::after { content: ""; }
}
