/* Inter (rsms.me/inter, licença OFL), guardada no próprio sistema */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/inter-latin.woff2") format("woff2");
}

/* Cores tiradas do logo ISO FOR ALL: azul-marinho #0f2747, azul #1765c1 e azul-claro #5bbdeb.
   Vermelho só para erro, atraso e exclusão. */
:root {
  --brand: #0f2747;       /* azul-marinho do logo: cabeçalhos das páginas públicas, avisos */
  --brand-light: #5bbdeb; /* azul-claro do logo */
  --login-bg: linear-gradient(160deg, #0f2747 0%, #164079 100%);
  --red: #d92d20;
  --red-dark: #b42318;
  --brand-word: #0f2747; /* palavra ISO FOR ALL nos títulos */
  --bg: #f5f7fa;
  --surface: #ffffff;
  --border: #e3e8ef;
  --text: #1b2738;
  --muted: #5d6b7e;
  --primary: #1765c1;
  --primary-hover: #11519c;
  --primary-soft: #e8f1fb;
  --primary-text: #11519c;
  --focus: rgba(23, 101, 193, .25);
  --ok: #15794a;
  --ok-bg: #e5f4ec;
  --warn: #93590a;
  --warn-bg: #fdf2dc;
  --err: #b42318;
  --err-bg: #fdecea;
  --info: #1765c1;
  --info-bg: #e8f1fb;
  --gray-bg: #eef2f6;
  --heading: #0f2747;
  --surface-2: #f8fafc;
  --hover: #f3f7fc;
  --input-bg: #ffffff;
  --input-border: #cfd7e2;
  --label: #334155;
  --badge-text: #475569;
  --changed: #fff6d8;
  --bar: #1765c1;
  --bar-hover: #11519c;
  --side-bg: #ffffff;
  --side-2: #f2f5f9;    /* hover */
  --side-3: #e8f1fb;    /* item ativo */
  --side-text: #3a4759;
  --side-active: #11519c;
  --side-title: #8592a5;
  --side-foot: #8592a5;
  --side-border: #e3e8ef;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15, 39, 71, .05);
  --shadow-lg: 0 12px 32px rgba(15, 39, 71, .14);
  color-scheme: light;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  font-size: 14px;
  color: var(--text);
}

/* ---------- Modo escuro ---------- */
:root[data-theme="dark"] {
  color-scheme: dark;
  --brand: #142844;
  --login-bg: linear-gradient(160deg, #0b1220 0%, #142844 100%);
  --bg: #0b1220;
  --surface: #111a2a;
  --surface-2: #0e1725;
  --hover: #152036;
  --border: #1f2a3d;
  --text: #dfe6ef;
  --muted: #93a1b5;
  --heading: #f1f5fa;
  --brand-word: #ffffff;
  --primary: #2f80d6;
  --primary-hover: #4a94e3;
  --primary-soft: #142844;
  --primary-text: #a9cff7;
  --focus: rgba(74, 155, 232, .35);
  --input-bg: #0e1725;
  --input-border: #2a3850;
  --label: #c3cedb;
  --gray-bg: #1a2537;
  --badge-text: #c3cedb;
  --ok: #5fcf96;   --ok-bg: #10301f;
  --warn: #f0bf5e; --warn-bg: #35290f;
  --err: #ff8a80;  --err-bg: #3f1917;
  --info: #7ab8f5; --info-bg: #142844;
  --changed: #4a4020;
  --bar: #4a9be8;
  --bar-hover: #7ab8f5;
  --side-bg: #0e1626;
  --side-2: #142035;
  --side-3: #16294a;
  --side-text: #c3cedb;
  --side-active: #a9cff7;
  --side-title: #6f7f95;
  --side-foot: #6f7f95;
  --side-border: #1f2a3d;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
svg.i { width: 18px; height: 18px; flex: 0 0 auto; vertical-align: -4px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; }
.mt { margin-top: 16px; }
.num { font-variant-numeric: tabular-nums; }
.empty-ico { color: var(--muted); }
.empty-ico svg.i { width: 36px; height: 36px; }

/* ---------- Login ---------- */
.login { min-height: 100%; display: grid; place-items: center; padding: 16px; background: var(--login-bg); }
.login-card { width: 100%; max-width: 420px; background: var(--surface); border-radius: 14px; padding: 32px 28px;
  box-shadow: 0 20px 50px rgba(5, 15, 35, .35); display: grid; gap: 14px; }
.login-logo { width: 200px; max-width: 100%; margin: 0 auto; display: block; }
.login-card { position: relative; }
.login-card h1 { text-align: center; font-size: 22px; color: var(--heading); }
.login-card h1 span { color: var(--brand-word); font-weight: 800; }
.login-theme { position: absolute; top: 12px; right: 12px; }
.login-card p { margin: 0; }
.login-card > p.muted:first-of-type { text-align: center; margin-top: -8px; }
:root[data-theme="dark"] .login-logo, :root[data-theme="dark"] .mod-logo { background: #fff; border-radius: 10px; padding: 8px; }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 248px; flex: 0 0 248px; background: var(--side-bg); color: var(--side-text); border-right: 1px solid var(--side-border);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 30; }
.brand { padding: 14px 14px 4px; text-align: center; }
.brand img { max-width: 100%; max-height: 80px; width: auto; height: auto; display: inline-block; vertical-align: top;
  background: #fff; border-radius: 10px; padding: 8px; }
.menu { padding: 0 0 16px; flex: 1; }
.menu-group { margin-top: 12px; }
.menu-group-title { padding: 4px 22px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--side-title); }
.menu a { display: flex; align-items: center; gap: 10px; margin: 1px 10px; padding: 7px 12px; border-radius: 7px; color: var(--side-text); font-weight: 500; }
.menu a svg.i { color: var(--side-title); }
.menu a:hover { background: var(--side-2); text-decoration: none; }
.menu a.active { background: var(--side-3); color: var(--side-active); font-weight: 600; }
.menu a.active svg.i { color: currentColor; }
.sidebar-foot { padding: 12px 22px; color: var(--side-foot); border-top: 1px solid var(--side-border); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px; padding: 0 24px; min-height: 56px; }
.crumb { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--muted); white-space: nowrap; }
.crumb svg.i { width: 16px; height: 16px; }
.crumb b { color: var(--heading); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.crumb b:empty, .crumb .module-name + svg:has(+ b:empty) { display: none; }
.app-name { flex: 1; min-width: 0; font-size: 17px; line-height: 1.2; color: var(--heading); white-space: nowrap; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; }
.app-name strong { color: var(--brand-word); font-weight: 700; }
.topbar-user { display: flex; align-items: center; gap: 6px; padding-left: 12px; margin-left: 4px; border-left: 1px solid var(--border); }
.user-txt { display: grid; line-height: 1.25; margin-right: 4px; max-width: 200px; }
.user-txt strong { font-size: 13.5px; font-weight: 600; color: var(--heading); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-txt small { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 32px; height: 32px; flex: 0 0 32px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-text);
  display: grid; place-items: center; font-weight: 700; font-size: 12.5px; text-transform: uppercase; }
#menu-toggle { display: none; }
.view { padding: 24px 28px 48px; max-width: 1440px; width: 100%; }

@media (max-width: 900px) {
  .sidebar { position: fixed; left: -260px; transition: left .2s; }
  .sidebar.open { left: 0; box-shadow: var(--shadow-lg); }
  .app-name { font-size: 14px; }
  #menu-toggle { display: inline-grid; }
  .view { padding: 16px; }
  .topbar { padding: 0 12px; }
  .crumb .module-name, .crumb .module-name + svg, .user-txt { display: none; }
}

/* ---------- Componentes ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-body { padding: 18px 20px; }
.card-head { padding: 14px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.card-head h3 { font-size: 15px; color: var(--heading); flex: 1; }
.section-title { font-size: 14px; font-weight: 600; color: var(--heading); margin: 22px 0 10px;
  padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.section-title:first-child { margin-top: 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); border-radius: 8px; padding: 7px 14px; font: inherit; font-weight: 500; line-height: 20px; cursor: pointer; white-space: nowrap;
  transition: background-color .12s, border-color .12s; }
.btn svg.i { width: 16px; height: 16px; }
.btn:focus-visible, .icon-btn:focus-visible, .menu a:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.btn:hover { background: var(--hover); text-decoration: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.danger:hover { background: var(--red-dark); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 7px; }
.btn.block { width: 100%; padding: 11px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.icon-btn { border: 0; background: transparent; font-size: 20px; cursor: pointer; width: 36px; height: 36px; border-radius: 8px; display: inline-grid; place-items: center;
  color: var(--muted); flex: 0 0 auto; }
.icon-btn:hover { background: var(--gray-bg); color: var(--heading); }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head .grow { flex: 1; min-width: 240px; }
.page-head h1 { font-size: 22px; color: var(--heading); }

label { display: grid; gap: 5px; font-size: 13px; font-weight: 500; color: var(--label); }
label.inline { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; }
input, select, textarea { font: inherit; color: var(--text); border: 1px solid var(--input-border); border-radius: 8px; padding: 8px 10px;
  background: var(--input-bg); width: 100%; min-width: 0; }
input[type=checkbox], input[type=radio] { width: auto; }
textarea { resize: vertical; min-height: 90px; }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--focus); outline-offset: 0; border-color: var(--primary); }
input[readonly] { background: var(--surface-2); color: var(--muted); }
label.req { display: flex; flex-wrap: wrap; column-gap: 3px; row-gap: 5px; align-content: start; }
label.req > * { order: 1; flex: 1 0 100%; }
.req::after { content: "*"; color: var(--err); order: 0; }
.grid { display: grid; gap: 14px 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.span3 { grid-column: span 3; }
.span-all { grid-column: 1 / -1; }
@media (max-width: 900px) {
  .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span3 { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
  .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); }
  .span2, .span3 { grid-column: 1 / -1; }
}
.seg { display: inline-flex; border: 1px solid var(--input-border); border-radius: 8px; overflow: hidden; }
.seg label { display: block; padding: 7px 14px; cursor: pointer; font-weight: 500; border-right: 1px solid var(--input-border); }
.seg label:last-child { border-right: 0; }
.seg input { display: none; }
.seg label:has(input:checked) { background: var(--primary); color: #fff; }

.alert { padding: 10px 14px; border-radius: 8px; font-size: 13px; }
.alert.error { background: var(--err-bg); color: var(--err); }
.alert.warn { background: var(--warn-bg); color: var(--warn); }
.alert.info { background: var(--info-bg); color: var(--info); }
.alert.ok { background: var(--ok-bg); color: var(--ok); }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--gray-bg); color: var(--badge-text); }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.err { background: var(--err-bg); color: var(--err); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.navy { background: var(--primary); color: #fff; }
.badge.ok::before, .badge.warn::before, .badge.err::before, .badge.info::before { content: ""; display: inline-block; width: 6px; height: 6px;
  border-radius: 50%; background: currentColor; margin-right: 6px; vertical-align: 1px; }

/* Tabelas */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.tbl th { font-size: 12.5px; color: var(--muted); background: var(--surface-2); font-weight: 600; white-space: nowrap; }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr.click:hover { background: var(--hover); }
.tbl td.num, .tbl th.num { text-align: right; }
.tbl .empty { text-align: center; color: var(--muted); padding: 30px; }
.pager { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; gap: 12px; flex-wrap: wrap; }

.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.filters .wide { grid-column: span 2; }

/* Detalhe */
.dl { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 18px; }
.dl > div { min-width: 0; }
.dl dt { font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.dl dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.dl .full { grid-column: 1 / -1; }
.dl .half { grid-column: span 2; }
@media (max-width: 900px) { .dl { grid-template-columns: repeat(2, minmax(0, 1fr)); } .dl .half { grid-column: 1 / -1; } }
.textbox { background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; white-space: pre-wrap; font-weight: 400; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); padding: 0 12px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 12px 14px; font: inherit; font-weight: 500; color: var(--muted); cursor: pointer;
  border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs button.active { color: var(--primary-text); border-bottom-color: var(--primary); }
.tabs .count { background: var(--gray-bg); border-radius: 999px; padding: 0 7px; font-size: 11px; margin-left: 4px; }

.locked-note { display: flex; align-items: center; gap: 8px; }

/* Autocomplete */
.ac { position: relative; }
.ac-list { position: absolute; z-index: 50; left: 0; right: 0; top: 100%; margin-top: 2px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; box-shadow: 0 8px 24px rgba(0,0,0,.12); max-height: 320px; overflow-y: auto; }
.ac-item { padding: 8px 12px; cursor: pointer; border-bottom: 1px solid var(--border); font-weight: 400; }
.ac-item:last-child { border-bottom: 0; }
.ac-item:hover, .ac-item.hl { background: var(--hover); }
.ac-item b { color: var(--heading); }
.ac-msg { padding: 10px 12px; color: var(--muted); font-weight: 400; }
.picked { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); background: var(--surface-2); border-radius: 6px; padding: 8px 10px; }
.picked .grow { flex: 1; min-width: 0; font-weight: 400; }

/* Anexos */
.dropzone { border: 2px dashed var(--input-border); border-radius: 8px; padding: 18px; text-align: center; color: var(--muted); cursor: pointer; }
.dropzone.over { border-color: var(--primary); background: var(--hover); }
.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-top: 14px; }
.file { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface); display: flex; flex-direction: column; }
.file .thumb { height: 120px; background: var(--gray-bg); display: grid; place-items: center; cursor: pointer; overflow: hidden; }
.file .thumb img { width: 100%; height: 100%; object-fit: cover; }
.file .thumb .ext { font-size: 22px; font-weight: 700; color: var(--bar); }
.file .meta { padding: 8px 10px; font-size: 12px; display: grid; gap: 2px; }
.file .name { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file .acts { display: flex; gap: 4px; padding: 0 8px 8px; }
.pending-files { display: grid; gap: 6px; margin-top: 10px; }
.pending-files div { display: flex; justify-content: space-between; gap: 8px; padding: 6px 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 22px; border-left: 2px solid var(--border); margin-left: 6px; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--bar); }
.timeline li:last-child { border-left-color: transparent; }
.timeline .when { font-size: 12px; color: var(--muted); }

/* Itens 5W2H */
.itens td { padding: 6px; }
.itens input, .itens select, .itens textarea { padding: 6px 8px; font-size: 13px; }
.itens textarea { min-height: 38px; }

/* 5W2H (plano de ação) */
.w5h2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
.w5h2-item { border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2); padding: 8px 12px; min-width: 0; }
.w5h2-item:first-child, .w5h2-item:nth-child(2), .w5h2-item:nth-child(6) { grid-column: 1 / -1; }
.w5h2-k { font-size: 12.5px; color: var(--muted); margin-bottom: 3px; font-weight: 600; }
.w5h2-v { font-weight: 400; overflow-wrap: anywhere; }
@media (max-width: 700px) { .w5h2 { grid-template-columns: minmax(0, 1fr); } }

/* Análise de causa por método (plano de ação) */
.analise-pq { display: grid; grid-template-columns: 110px minmax(0, 1fr); align-items: center; gap: 10px; margin-bottom: 6px; }
.analise-pq span { font-weight: 600; color: var(--label); }
.analise-porques { margin: 0; padding-left: 22px; }
.analise-porques li { margin: 3px 0; }
.ishikawa { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 14px; }
@media (max-width: 700px) { .ishikawa { grid-template-columns: minmax(0, 1fr); } .analise-pq { grid-template-columns: minmax(0, 1fr); gap: 2px; } }
.pareto-bar { display: block; height: 10px; background: var(--gray-bg); border-radius: 5px; overflow: hidden; }
.pareto-bar span { display: block; height: 100%; background: var(--bar); }
.pareto-a td { font-weight: 600; }
.tbl.fmea th, .tbl.fmea td { vertical-align: top; }
.tbl.fmea textarea { min-width: 120px; }
.tbl.fmea select { min-width: 56px; }
.analise-det { margin-bottom: 4px; }

/* Código / link copiável */
.copybox { display: flex; gap: 8px; align-items: center; }
.copybox input { font-family: Consolas, monospace; font-size: 13px; }
.help-list { margin: 8px 0 0; padding-left: 18px; font-weight: 400; color: var(--text); }
.help-list li { margin: 4px 0; }

/* Painel */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { padding: 16px 18px; }
.kpi .label { font-size: 13px; color: var(--muted); font-weight: 500; }
.kpi .value { font-size: 26px; letter-spacing: -.01em; font-weight: 700; color: var(--heading); margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: 12px; color: var(--muted); }
.kpi.alert-kpi .value { color: var(--err); }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.hbars { display: grid; gap: 10px; }
.hbar { display: grid; grid-template-columns: 130px 1fr 44px; align-items: center; gap: 10px; font-size: 13px; }
.hbar .track { height: 10px; border-radius: 999px; background: var(--gray-bg); position: relative; overflow: hidden; }
.hbar .fill { height: 100%; background: var(--bar); border-radius: 999px; min-width: 2px; }
.hbar .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar:hover .fill { background: var(--bar-hover); }
.vbars { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; align-items: end; height: 180px; padding-top: 18px;
  border-bottom: 1px solid var(--border); }
.vbar { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; position: relative; }
.vbar .fill { width: 70%; max-width: 34px; background: var(--bar); border-radius: 4px 4px 0 0; min-height: 0; }
.vbar:hover .fill { background: var(--bar-hover); }
.vbar .v { font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.vlabels { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; font-size: 11px; color: var(--muted); text-align: center; margin-top: 6px; }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(8, 18, 36, .5); z-index: 100; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--surface); border-radius: 12px; width: 100%; max-width: 560px; max-height: calc(100vh - 32px); display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal.wide { max-width: 1000px; }
.modal-head { padding: 14px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; }
.modal-head h3 { flex: 1; font-size: 16px; color: var(--heading); }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.viewer img { max-width: 100%; display: block; margin: 0 auto; }
.viewer iframe { width: 100%; height: 75vh; border: 0; }
.changed { background: var(--changed); border-radius: 4px; box-shadow: 0 0 0 4px var(--changed); }

/* Toasts */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 200; display: grid; gap: 8px; }
.toast { background: var(--brand); color: #fff; padding: 11px 16px; border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.2); max-width: 380px; font-size: 13px; }
.toast.error { background: var(--err); }
.toast.ok { background: var(--ok); }

.spinner { width: 22px; height: 22px; border: 3px solid var(--border); border-top-color: var(--bar); border-radius: 50%; animation: spin .8s linear infinite; margin: 30px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Impressão ---------- */
.print-only { display: none; }
@media print {
  @page { size: A4; margin: 12mm; }
  :root, :root[data-theme="dark"] { --bg: #fff; --surface: #fff; --surface-2: #f6f6f6; --text: #000; --muted: #444; --heading: #0f2747;
    --border: #bbb; --label: #333; --changed: #fff6d8; }
  body { background: #fff; color: #000; font-size: 11px; }
  .sidebar, .topbar, .no-print, .tabs, .toasts { display: none !important; }
  .print-only { display: block !important; }
  .view { padding: 0; max-width: none; }
  .card { box-shadow: none; border: 1px solid #bbb; break-inside: avoid; }
  .tab-panel { display: block !important; }
  .print-head { display: flex !important; align-items: center; gap: 16px; border-bottom: 2px solid #0f2747; padding-bottom: 8px; margin-bottom: 12px; }
  .print-head img { height: 54px; }
}


/* ======================================================================
   Seleção de módulo
   ====================================================================== */
.mod-wrap { width: 100%; max-width: 860px; background: var(--surface); border-radius: 12px; padding: 26px 28px; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.mod-head { display: flex; align-items: center; gap: 18px; margin-bottom: 20px; flex-wrap: wrap; }
.mod-head .grow { flex: 1; min-width: 220px; }
.mod-logo { width: 110px; height: auto; }
.mod-head h1 { font-size: 22px; color: var(--heading); }
.mod-head h1 span { color: var(--brand-word); font-weight: 800; }
.mod-head p { margin: 4px 0 0; color: var(--muted); }
.mod-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.mod-card { position: relative; display: grid; gap: 8px; text-align: left; font: inherit; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 12px; padding: 20px; cursor: pointer; transition: transform .12s, box-shadow .12s, border-color .12s; }
.mod-card:hover, .mod-card:focus-visible { transform: translateY(-2px); box-shadow: var(--shadow-lg); outline: none; border-color: var(--primary); }
.mod-card.last { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.mod-ico { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-text); }
.mod-ico svg.i { width: 24px; height: 24px; }
.mod-name { font-size: 17px; font-weight: 700; color: var(--heading); padding-right: 96px; }
.mod-desc { font-size: 13px; color: var(--muted); }
.mod-last { position: absolute; top: 12px; right: 12px; font-size: 11px; background: var(--info-bg); color: var(--info); padding: 2px 8px; border-radius: 999px; font-weight: 600; }
.mod-foot { margin-top: 18px; display: flex; justify-content: flex-end; }
.module-name { overflow: hidden; text-overflow: ellipsis; }
#switch-module { flex: 0 0 auto; }
@media (max-width: 900px) { #switch-module { padding: 5px 8px; } .mod-wrap { padding: 18px 16px; } }

/* ======================================================================
   Módulo Controle de Documentos
   ====================================================================== */
.gq-kpis .kpi { border-top: 4px solid var(--border); }
.kpi-info { border-top: 4px solid var(--info) !important; }
.kpi-ok { border-top: 4px solid var(--ok) !important; }
.kpi-warn { border-top: 4px solid var(--warn) !important; }
.kpi-err { border-top: 4px solid var(--err) !important; }
.kpi-neutral { border-top: 4px solid var(--bar) !important; }
.gq-tbl td { vertical-align: middle; }
.tbl tr.row-late td:first-child { box-shadow: inset 3px 0 0 var(--err); }
.tbl tr.row-today td { background: var(--info-bg); }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr.click:hover { background: var(--hover); }
.clamp2, .clamp3 { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
.clamp2 { -webkit-line-clamp: 2; }
.clamp3 { -webkit-line-clamp: 3; max-width: 420px; }
.mono { font-family: Consolas, "Cascadia Mono", monospace; font-variant-numeric: tabular-nums; }
.chip { display: inline-block; padding: 1px 8px; border: 1px solid var(--border); background: var(--surface-2); border-radius: 6px; font-size: 12px; white-space: nowrap; margin: 1px 0; }
.status-sel { width: auto; min-width: 140px; padding: 5px 8px; font-size: 13px; }
.status-sel.ok { border-color: var(--ok); color: var(--ok); }
.status-sel.err { border-color: var(--err); color: var(--err); }

.prog { display: flex; align-items: center; gap: 6px; min-width: 150px; }
.prog-bar { flex: 1; height: 8px; background: var(--gray-bg); border-radius: 999px; overflow: hidden; min-width: 60px; }
.prog-bar span { display: block; height: 100%; background: var(--info); border-radius: 999px; }
.prog-bar span.done { background: var(--ok); }
.prog-in { width: 64px; padding: 4px 6px; font-size: 13px; text-align: right; }

.hbar .fill.ok { background: var(--ok); }
.hbar .fill.warn { background: var(--warn); }
.hbar .fill.err { background: var(--err); }

.gq-form fieldset { border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px 14px; margin: 0; min-width: 0; }
.gq-form legend { font-weight: 600; color: var(--heading); padding: 0 6px; font-size: 13px; }
.gq-fs { margin: 0 0 18px !important; }
.gq-fs > legend { font-size: 14px; }
.gq-fs.inner { margin-top: 14px !important; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px 14px; }
.normas-box { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.gut-out { align-self: end; padding: 8px 0; }
.gut-crit { margin-bottom: 16px; }
.gut-crit > summary { padding: 12px 16px; cursor: pointer; }
.riscos td { vertical-align: top; }

.swot-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 1100px) { .swot-grid { grid-template-columns: minmax(0, 1fr); } }
.swot-q { border: 1px solid var(--border); border-top: 4px solid var(--bar); border-radius: 8px; padding: 12px 14px; background: var(--surface); min-width: 0; }
.swot-q h3 { font-size: 15px; color: var(--heading); }
.swot-q p { margin: 2px 0 8px; }
.swot-q.q-f { border-top-color: var(--ok); }
.swot-q.q-w { border-top-color: var(--warn); }
.swot-q.q-o { border-top-color: var(--info); }
.swot-q.q-t { border-top-color: var(--err); }
.swot-q select { min-width: 86px; }

.cal-nav { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 14px; border-bottom: 1px solid var(--border); }
.cal-nav h3 { font-size: 16px; color: var(--heading); min-width: 190px; text-align: center; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 10px 16px; color: var(--muted); }
.cal-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: -1px; margin-right: 4px; }
.cal-dot.info, .cal-ev.info { background: var(--info); }
.cal-dot.err, .cal-ev.err { background: var(--err); }
.cal-dot.ok, .cal-ev.ok { background: var(--ok); }
.cal-dot.sol, .cal-ev.sol { background: var(--bar); }
.cal { overflow-x: auto; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(110px, 1fr)); min-width: 780px; }
.cal-wd { padding: 8px; font-size: 12px; font-weight: 600; text-align: center; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--border); }
.cal-cell { min-height: 104px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 4px 5px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell.out { background: var(--surface-2); }
.cal-cell.out .cal-day { opacity: .5; }
.cal-cell.today { box-shadow: inset 0 0 0 2px var(--info); }
.cal-day { font-size: 12px; color: var(--muted); }
.cal-ev { border: 0; color: #fff; font: inherit; font-size: 11px; text-align: left; padding: 2px 6px; border-radius: 4px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
:root[data-theme="dark"] .cal-ev { color: #10131a; }

.caps { list-style: none; margin: 0; padding: 0; }
.caps li { display: flex; align-items: flex-start; gap: 14px; padding: 12px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.caps li:last-child { border-bottom: 0; }
.caps .grow { flex: 1; min-width: 200px; }
.cap-num { font-size: 18px; font-weight: 700; color: var(--info); min-width: 30px; }
.ebook-prev { font-family: Arial, Helvetica, sans-serif; font-size: 11pt; line-height: 1.5; color: var(--text); }
.ebook-prev .eyebrow { font-size: 8.5pt; letter-spacing: .12em; text-transform: uppercase; color: var(--info); }
.ebook-prev h3 { font-size: 12pt; margin: 2px 0; color: var(--heading); }
.ebook-prev .regua { height: 1.5px; background: var(--info); margin-bottom: 10px; }
.ebook-prev ul { padding-left: 0; list-style: none; }
.ebook-prev li::before { content: "- "; }

/* Tabelas do módulo: compactas e com a coluna de ações sempre visível */
.gq-tbl th, .gq-tbl td { padding: 8px 9px; font-size: 13px; }
.gq-tbl th { font-size: 11px; }
.gq-tbl tr > :last-child { position: sticky; right: 0; background: var(--surface); box-shadow: -8px 0 8px -8px rgba(20,18,30,.25); z-index: 1; }
.gq-tbl thead tr > :last-child { background: var(--surface-2); }
.gq-tbl tbody tr.click:hover > :last-child { background: var(--hover); }
.gq-tbl tr.row-today > :last-child { background: var(--info-bg); }
.gq-tbl .btn.sm { padding: 4px 8px; }
.prog { min-width: 130px; }
.prog-bar { min-width: 44px; }
.prog-in { width: 58px; }

.swot-itens { display: grid; gap: 10px; }
.swot-item { border: 1px solid var(--border); border-radius: 6px; padding: 8px; background: var(--surface-2); display: grid; gap: 8px; }
.swot-item textarea { min-height: 54px; }
.swot-notas { display: flex; flex-wrap: wrap; align-items: end; gap: 8px 12px; }
.swot-notas label { font-size: 12px; }
.swot-notas select { width: 130px; padding: 6px 8px; }
.swot-score { display: grid; text-align: center; min-width: 44px; }
.swot-score b { font-size: 18px; color: var(--heading); }
.swot-trat { flex: 1; min-width: 160px; align-self: center; }

/* Calendário: arrastar prazos */
.cal-hint { margin-left: auto; color: var(--muted); }
.cal-ev.movel { cursor: grab; }
.cal-ev.movel:active { cursor: grabbing; }
.cal-ev.dragging { opacity: .45; }
.cal-cell.drop-over { background: var(--info-bg); box-shadow: inset 0 0 0 2px var(--info); }

/* Pesquisas de satisfação */
.pq-row { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.pq-row input { flex: 1; }
.pq-n { min-width: 26px; color: var(--muted); text-align: right; }
.pq-tbl td { vertical-align: middle; }
.pq-tbl tr.pq-low td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.pq-track { display: block; height: 10px; background: var(--gray-bg); border-radius: 999px; overflow: hidden; min-width: 90px; }
.pq-fill { display: block; height: 100%; background: var(--bar); border-radius: 999px; }
.pq-dist { display: flex; gap: 2px; height: 10px; border-radius: 3px; overflow: hidden; min-width: 80px; background: var(--gray-bg); }
.pq-dist span { display: block; min-width: 0; }
.d-b { background: var(--err); }
.d-n { background: var(--warn); }
.d-a { background: var(--ok); }
.pq-leg { display: inline-flex; align-items: center; gap: 6px; }
.pq-leg i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-left: 6px; }
.pq-pessoas { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.pq-media { margin: 8px 0 6px; } .pq-media b { font-size: 30px; color: var(--heading); }
.pq-obs { margin: 8px 0 0; padding-left: 18px; } .pq-obs li { margin-bottom: 8px; }
ul.pq-obs.card { padding-left: 34px; }

/* Matriz de riscos (probabilidade × severidade) */
.mx-card { margin-bottom: 16px; }
.mx-wrap { display: flex; align-items: center; gap: 10px; max-width: 560px; }
.mx-ylabel { writing-mode: vertical-rl; transform: rotate(180deg); font-size: 12px; color: var(--muted); }
.mx { flex: 1; display: grid; grid-template-columns: 96px repeat(3, minmax(0, 1fr)); gap: 4px; }
.mx-rl { font-size: 12px; color: var(--muted); align-self: center; text-align: right; padding-right: 6px; }
.mx-cl { font-size: 12px; color: var(--muted); text-align: center; }
.mx-cel { height: 58px; border-radius: 6px; display: flex; align-items: center; justify-content: center; position: relative; }
.mx-cel b { font-size: 22px; color: var(--heading); }
.mx-cel span { position: absolute; top: 4px; right: 7px; font-size: 11px; color: var(--muted); }
.mx-ok { background: var(--ok-bg); } .mx-warn { background: var(--warn-bg); } .mx-err { background: var(--err-bg); }
.mx-foot { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; }
.mx-leg { display: inline-flex; gap: 6px; align-items: center; }
.mx-leg i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-left: 8px; border: 1px solid var(--border); }

/* ======================================================================
   Módulo Instruções de Trabalho
   ====================================================================== */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-x { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 0 0 0 4px; font: inherit; }
.mt-s { margin-top: 8px; }
.it-etapas-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .it-etapas-wrap { grid-template-columns: minmax(0, 1fr); } }
.it-preview { position: sticky; top: 84px; }
.etapa { border: 1px solid var(--border); border-left: 4px solid var(--bar); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; background: var(--surface-2); display: grid; }
.etapa.et-inicio, .etapa.et-fim { border-left-color: var(--info); }
.etapa.et-decisao { border-left-color: var(--warn); }
.etapa.crit { border-left-color: var(--err); background: var(--err-bg); }
.et-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.et-head .grow { flex: 1; }
.et-num { min-width: 26px; height: 26px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 700; padding: 0 6px; }
.quest { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; background: var(--surface-2); }
.quest-ops { display: grid; gap: 6px; margin: 4px 0 8px 34px; }
.quest-ops label { display: flex; align-items: center; gap: 8px; }
.quest-ops input[type=text], .quest-ops input:not([type]) { flex: 1; }
.itd-fluxo { text-align: center; overflow-x: auto; padding: 8px; border: 1px solid var(--border); border-radius: 8px; background: #fff; min-height: 80px; }
.itd-fluxo svg { max-width: 100%; height: auto; }
.qr-box { text-align: center; display: grid; gap: 8px; justify-items: center; }
.qr-img { width: min(320px, 80vw); height: auto; background: #fff; padding: 8px; border-radius: 8px; }
.tr-topo { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; }
@media (max-width: 1000px) { .tr-topo { grid-template-columns: minmax(0, 1fr); } }
.tr-qr { display: flex; gap: 16px; align-items: center; }
.tr-qr > img { width: 170px; height: 170px; background: #fff; padding: 6px; border-radius: 8px; border: 1px solid var(--border); flex: 0 0 auto; }
@media (max-width: 600px) { .tr-qr { flex-direction: column; } }
.tr-num { font-size: 15px; margin: 4px 0 8px; } .tr-num b { font-size: 32px; color: var(--heading); }
.ass-mini { height: 34px; max-width: 140px; background: #fff; border: 1px solid var(--border); border-radius: 4px; }
.part-lista { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 6px; max-height: 420px; overflow-y: auto; padding: 2px; }
.part { display: flex; gap: 8px; align-items: center; font-weight: 400; border: 1px solid var(--border); border-radius: 6px; padding: 7px 10px; background: var(--surface-2); }
.part.fora { border-style: dashed; }
.part:has(input:checked) { border-color: var(--primary); background: var(--info-bg); }
.mx-legenda { display: flex; flex-wrap: wrap; gap: 6px; }
.mx-tbl-wrap { max-height: 70vh; }
.mx-tbl th, .mx-tbl td { white-space: nowrap; }
.mx-tbl .mx-sticky { position: sticky; left: 0; background: var(--surface); z-index: 1; min-width: 220px; white-space: normal; }
.mx-tbl thead th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); }
.mx-tbl thead .mx-sticky { z-index: 3; background: var(--surface-2); }
.mx-c { text-align: center; font-weight: 700; } .mx-c span { font-size: 15px; } .mx-c small { display: block; font-weight: 400; font-size: 10px; }
.mx-ok { background: var(--ok-bg); color: var(--ok); } .mx-warn { background: var(--warn-bg); color: var(--warn); } .mx-err { background: var(--err-bg); color: var(--err); }
.mx-none { color: var(--muted); } .mx-na { text-align: center; color: var(--border); }
.it-passo-a-passo { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
/* documento da IT dentro do sistema (cores do tema) */
.itd-meta { border-color: var(--border) !important; }
.itd-h { border-color: var(--border) !important; color: var(--heading); }
.itd-passos li, .itd-epis li { border-color: var(--border) !important; }
:root[data-theme="dark"] .itd-crit { background: var(--err-bg); color: var(--err); }
:root[data-theme="dark"] .itd-meta { background: var(--surface-2); }
:root[data-theme="dark"] .itd-pn { background: var(--primary); }

/* Procedimentos */
.pdf-frame { width: 100%; height: 78vh; border: 1px solid var(--border); border-radius: 8px; background: #525659; display: block; }
.save-bar { position: sticky; bottom: 0; z-index: 10; display: flex; justify-content: flex-end; align-items: center; gap: 12px; padding: 10px 16px; margin-top: 10px;
  background: var(--warn-bg); color: var(--warn); border: 1px solid var(--border); border-radius: 8px; font-weight: 600; }
.proc-item { border: 1px solid var(--border); border-left: 4px solid var(--primary); border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; background: var(--surface-2); display: grid; gap: 8px; }
.proc-sub { border: 1px dashed var(--border); border-radius: 6px; padding: 8px 10px; margin: 0 0 8px 28px; background: var(--surface); display: grid; gap: 6px; }
.proc-anexo { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; background: var(--surface-2); }
.proc-form textarea { min-height: 70px; }

/* Alerta de vencimento de documentos */
.venc-alerta { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.venc-alerta .grow { flex: 1; min-width: 240px; display: grid; gap: 3px; }
tr.row-venc td:first-child { box-shadow: inset 4px 0 0 var(--err); }
tr.row-avencer td:first-child { box-shadow: inset 4px 0 0 var(--warn); }

/* Quadros de indicadores clicáveis (aplicam filtros) */
.kpi-click { cursor: pointer; transition: transform .12s, box-shadow .12s; }
.kpi-click:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(20, 20, 50, .12); }
.kpi-click:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.kpi-click.active { outline: 2px solid var(--primary); outline-offset: -2px; }

/* Usuários e permissões */
.perm-tbl th.perm-cel, .perm-tbl td.perm-cel { text-align: center; width: 120px; }
.perm-tbl td.perm-cel label { display: inline-flex; padding: 4px 10px; cursor: pointer; }
.perm-tbl td.perm-cel input { width: 17px; height: 17px; cursor: pointer; }
.perm-off { opacity: .45; pointer-events: none; }
.perm-mod { margin-top: 12px; }

/* Mapeamento do processo: quadros do editor na mesma disposição do PDF */
.mapa-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1.2fr); gap: 14px; }
.mapa-col { display: grid; gap: 10px; align-content: start; }
.mapa-q { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface); display: grid; gap: 6px; padding-bottom: 8px; }
.mapa-q > textarea, .mapa-q > [data-tab-lista], .mapa-q > .btn { margin: 0 8px; }
.mapa-q > .btn { justify-self: start; }
.mapa-qt { display: flex; background: var(--brand); color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.mapa-qt span { flex: 1; text-align: center; padding: 4px 6px; }
.mapa-qt span + span { border-left: 1px solid rgba(255,255,255,.35); flex: 2; }
.mapa-lin { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr) auto; gap: 6px; margin-bottom: 6px; align-items: start; }
.mapa-q[data-lista=Saidas] .mapa-lin { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) auto; }
.mapa-q[data-lista=Saidas] .mapa-qt span:first-child { flex: 2; }
.mapa-q[data-lista=Saidas] .mapa-qt span + span { flex: 1; }
.mapa-lin textarea, .mapa-q > textarea { font-size: 12.5px; padding: 5px 7px; overflow-wrap: normal; word-break: normal; }
@media (max-width: 1100px) { .mapa-grid { grid-template-columns: 1fr; } }
.mapa-q textarea, .mapa-lin textarea, .mapa-perg textarea { resize: none; overflow: hidden; line-height: 1.35; }
.mapa-perg { display: grid; gap: 4px; font-weight: 600; }
.mapa-perg textarea { font-weight: 400; }

/* Controle de documentos: tabela compacta, sem rolagem horizontal */
.gq-tbl th { white-space: normal; }
.gq-tbl .chip { white-space: normal; }

/* Convocação da equipe: dados da CI + membros em linhas */
.conv-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 16px; align-items: start; }
@media (max-width: 1200px) { .conv-grid { grid-template-columns: 1fr; } }
.conv-membro { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) minmax(0, 1.2fr) auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
.conv-membro input { width: 100%; }
@media (max-width: 760px) { .conv-membro { grid-template-columns: 1fr 1fr; } }

/* Controle de Legislação: diferenças entre versões */
.df { border: 1px solid var(--border); border-radius: 8px; max-height: 70vh; overflow: auto; font-size: 13px; line-height: 1.5; background: var(--surface); }
.df-ln { padding: 3px 10px 3px 26px; position: relative; border-bottom: 1px solid var(--border); white-space: pre-wrap; overflow-wrap: anywhere; }
.df-s { position: absolute; left: 9px; font-weight: 700; }
.df-eq { color: var(--muted); }
.df-add { background: #e7f8ec; color: #14532d; }
.df-del { background: #fdecec; color: #7f1d1d; text-decoration: line-through; text-decoration-color: rgba(127,29,29,.45); }
.df-mod { background: #fff8e6; }
.df ins, .df-leg ins { background: #bbf0cb; color: #14532d; text-decoration: none; border-radius: 3px; padding: 0 1px; }
.df del, .df-leg del { background: #fbcaca; color: #7f1d1d; border-radius: 3px; padding: 0 1px; }
.df-omit { padding: 4px 10px; text-align: center; color: var(--muted); font-size: 12px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.df-leg { display: inline-block; padding: 0 6px; border-radius: 4px; margin: 0 2px; }
.df-texto { white-space: pre-wrap; padding: 10px 12px; }
:root[data-theme="dark"] .df-add { background: #12321f; color: #b7f0c9; }
:root[data-theme="dark"] .df-del { background: #3a1717; color: #f6c1c1; }
:root[data-theme="dark"] .df-mod { background: #33290f; }
.ver-grid { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 16px; align-items: start; }
.ver-lista { display: grid; gap: 6px; position: sticky; top: 84px; }
.ver-item { text-align: left; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); padding: 8px 10px; cursor: pointer; font: inherit; color: inherit; }
.ver-item.active { border-color: var(--primary); box-shadow: inset 3px 0 0 var(--primary); background: var(--surface-2); }
.ia-resumo { border: 1px solid var(--border); border-left: 4px solid var(--info); border-radius: 8px; padding: 10px 12px; background: var(--surface-2); }
.dd { display: grid; gap: 2px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.dd > span { font-size: 12px; color: var(--muted); }
.dd > b { font-weight: 500; overflow-wrap: anywhere; }
@media (max-width: 900px) { .ver-grid { grid-template-columns: 1fr; } .ver-lista { position: static; } }

/* Celular: barra superior compacta (botões só com ícone) e calendário do mês cabendo na tela */
@media (max-width: 600px) {
  .so-largo { display: none; }
  .topbar { padding: 8px 10px; gap: 6px; min-height: 56px; }
  .topbar-user { gap: 6px; }
  .topbar .btn.sm { padding: 5px 8px; }
  .topbar .theme-btn { display: none; }
  .cal-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); min-width: 0; }
  .cal-wd { padding: 6px 0; font-size: 11px; }
  .cal-cell { min-height: 62px; padding: 2px; }
  .cal-ev { font-size: 10px; padding: 1px 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .cal-hint { display: none; }
}
