/* ==========================================================================
   BOSIA Discovery — Design System (fundação de frontend reutilizável)
   Layout: sidebar-editorial · Paleta: Ocean Light
   Escala de espaçamento em múltiplos de 8px · Contraste AA · Responsivo 360px
   ========================================================================== */

:root {
  /* Fallbacks do design system — a fonte de verdade da paleta é public/theme.css (Ocean Light). */
  --bg: #f1f7fb; --bg-2: #e4eef7; --panel: #ffffff; --ink: #0f2433; --muted: #567084;
  --line: #cfe0ee; --line-soft: #e4eef7; --line-strong: #b7cddf;
  --brand: #0e7bb8; --brand-deep: #0b5f8f; --brand-tint: #e7f3fa;
  --ok: #157f4b; --ok-tint: #e8f5ee; --warn: #8a5a00; --warn-tint: #fbf3e3;
  --danger: #b42318; --danger-tint: #fbeceb; --info: #0e7bb8; --info-tint: #e7f3fa;
  --c1: #0e7bb8; --c2: #6a8f4e; --c3: #157f4b; --c4: #a9843f; --c5: #567084; --c6: #b7cddf;
  --radius: 8px; --radius-sm: 6px; --radius-lg: 12px; --radius-xl: 16px;
  --sans: "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans);
  font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, p, ul, ol, figure { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--brand-tint); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.serif { font-family: var(--serif); }
.divider { height: 1px; background: var(--line); border: 0; margin: 24px 0; }

/* ---- Shell --------------------------------------------------------------- */
.app-shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; align-self: start; height: 100vh; overflow-y: auto;
  background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column;
  padding: 16px 12px; gap: 8px; z-index: 40; }
.brand { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: var(--radius); }
.brand:hover { text-decoration: none; background: var(--bg); }
.brand-mark { width: 32px; height: 32px; border-radius: 6px; background: var(--brand); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 15px; letter-spacing: .5px; flex: 0 0 auto; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-weight: 650; font-size: 14px; color: var(--ink); letter-spacing: .2px; }
.brand-sub { font-size: 11px; color: var(--muted); letter-spacing: .4px; text-transform: uppercase; }
.nav-group { margin-top: 8px; }
.nav-label { font-size: 10.5px; letter-spacing: .9px; text-transform: uppercase; color: var(--muted);
  font-weight: 650; padding: 8px; }
.nav-item { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 6px;
  color: var(--ink); font-size: 13.5px; font-weight: 500; line-height: 1.3; }
.nav-item:hover { background: var(--bg); text-decoration: none; }
.nav-item.active { background: var(--brand-tint); color: var(--brand-deep); font-weight: 650; }
.nav-item.active .nav-icon { color: var(--brand); }
.app-shell[data-screen="painel"] [data-nav="painel"],
.app-shell[data-screen="empresas"] [data-nav="empresas"],
.app-shell[data-screen="governanca"] [data-nav="governanca"],
.app-shell[data-screen="empresa"] [data-nav="empresa"],
.app-shell[data-screen="fontes"] [data-nav="fontes"],
.app-shell[data-screen="versoes"] [data-nav="versoes"],
.app-shell[data-screen="aprovacoes"] [data-nav="aprovacoes"] {
  background: var(--brand-tint); color: var(--brand-deep); font-weight: 650;
}
.app-shell[data-screen="painel"] [data-nav="painel"] .nav-icon,
.app-shell[data-screen="empresas"] [data-nav="empresas"] .nav-icon,
.app-shell[data-screen="governanca"] [data-nav="governanca"] .nav-icon,
.app-shell[data-screen="empresa"] [data-nav="empresa"] .nav-icon,
.app-shell[data-screen="fontes"] [data-nav="fontes"] .nav-icon,
.app-shell[data-screen="versoes"] [data-nav="versoes"] .nav-icon,
.app-shell[data-screen="aprovacoes"] [data-nav="aprovacoes"] .nav-icon { color: var(--brand); }
.nav-icon { width: 18px; height: 18px; flex: 0 0 auto; color: var(--muted); display: grid; place-items: center; }
.nav-icon svg { width: 18px; height: 18px; }
.nav-icon svg, .btn svg, .icon-btn svg, .pend svg, .chat-title svg { fill: none; stroke: currentColor; }
.nav-item .badge-count { margin-left: auto; }
.nav-item.is-locked { color: var(--muted); }
.sidebar .journey { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 8px; }
.jstep { display: grid; grid-template-columns: 20px 1fr; gap: 8px; align-items: start; padding: 7px 8px;
  border-radius: 6px; color: var(--ink); }
.jstep:hover { background: var(--bg); text-decoration: none; }
.jstep.active { background: var(--brand-tint); }
.jstep .jdot { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center;
  border: 1.5px solid var(--line-strong); font-size: 10px; font-weight: 700; color: var(--muted);
  margin-top: 1px; background: var(--panel); }
.jstep.done .jdot { background: var(--ok); border-color: var(--ok); color: #fff; }
.jstep.current .jdot { background: var(--brand); border-color: var(--brand); color: #fff; }
.jstep.blocked { opacity: .72; }
.jstep .jmeta { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.jstep .jname { font-size: 12.5px; font-weight: 600; }
.jstep .jstatus { font-size: 11px; color: var(--muted); }
.jstep.current .jstatus { color: var(--brand-deep); font-weight: 600; }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.user { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 6px; }
.user:hover { background: var(--bg); text-decoration: none; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--bg-2); color: var(--brand-deep);
  display: grid; place-items: center; font-size: 11.5px; font-weight: 700; flex: 0 0 auto;
  border: 1px solid var(--line); }
.user-info { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.user-name { font-size: 12.5px; font-weight: 600; }
.user-role { font-size: 11px; color: var(--muted); }
.sidebar-scrim { display: none; }

/* Contexto persistente da jornada (empresa → processo → etapa) */
.side-context { display: flex; flex-direction: column; gap: 2px; margin: 2px 0 6px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--bg); padding: 8px; }
.side-context-label { font-size: 10px; letter-spacing: 1px; text-transform: uppercase; font-weight: 700;
  color: var(--muted); padding: 2px 4px 4px; }
.side-context-empresa, .side-context-processo, .side-context-etapa {
  display: flex; flex-direction: column; gap: 1px; padding: 5px 6px; border-radius: 6px;
  color: var(--ink); text-decoration: none; min-width: 0; }
.side-context-empresa:hover, .side-context-processo:hover { background: var(--panel); text-decoration: none; }
.side-context-empresa { border-left: 2px solid var(--brand); }
.side-context-processo { border-left: 2px solid color-mix(in srgb, var(--brand) 45%, var(--line)); }
.side-context-etapa { border-left: 2px solid var(--line-strong); }
.side-context-kicker { font-size: 9.5px; letter-spacing: .8px; text-transform: uppercase; color: var(--muted); font-weight: 650; }
.side-context-name { font-size: 12px; font-weight: 600; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-context-resume { display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  margin-top: 6px; padding: 6px 8px; border-radius: 6px; background: var(--brand); color: #fff;
  font-size: 11.5px; font-weight: 650; }
.side-context-resume:hover { background: var(--brand-deep); text-decoration: none; }
.side-context-resume svg { fill: none; stroke: currentColor; }

/* ---- Topbar -------------------------------------------------------------- */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; height: 64px; display: flex; align-items: center;
  gap: 16px; padding: 0 24px; background: color-mix(in srgb, var(--panel) 92%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.icon-btn.menu-btn { display: none; }
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); min-width: 0; flex: 1 1 auto; overflow: hidden; }
.crumbs a { color: var(--muted); white-space: nowrap; }
.crumbs .sep { color: var(--line-strong); }
.crumbs strong { color: var(--ink); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-search { margin-left: auto; display: flex; align-items: center; gap: 8px; min-width: 210px;
  max-width: 320px; height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--bg); color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.topbar-search > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-search kbd { margin-left: auto; font-family: var(--sans); font-size: 10px; border: 1px solid var(--line-strong);
  border-radius: 4px; padding: 1px 4px; color: var(--muted); background: var(--panel); }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.icon-btn { width: 34px; height: 34px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel);
  display: grid; place-items: center; color: var(--muted); cursor: pointer; position: relative; }
.icon-btn:hover { background: var(--bg); color: var(--ink); }
.icon-btn svg { width: 17px; height: 17px; }
.pend { display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--panel); font-size: 12px; font-weight: 600; color: var(--ink); }
.pend:hover { text-decoration: none; background: var(--bg); }
.pend .num { min-width: 18px; height: 18px; border-radius: 9px; background: var(--danger-tint); color: var(--danger);
  display: grid; place-items: center; font-size: 11px; }
.content { width: 100%; max-width: 1480px; margin: 0 auto; padding: 32px; }
.content-wide { max-width: 1480px; }

/* ---- Page head ----------------------------------------------------------- */
.page-head { display: flex; align-items: flex-start; gap: 24px; justify-content: space-between;
  margin-bottom: 24px; flex-wrap: wrap; }
.page-head > div { max-width: 100%; min-width: 0; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 11px; letter-spacing: .8px;
  text-transform: uppercase; color: var(--brand); font-weight: 700; margin-bottom: 8px; }
.display { font-family: var(--serif); font-weight: 600; font-size: 32px; line-height: 1.12; letter-spacing: -.4px; color: var(--ink); }
.display-sm { font-family: var(--serif); font-weight: 600; font-size: 24px; line-height: 1.2; letter-spacing: -.2px; }
.page-sub { margin-top: 8px; color: var(--muted); font-size: 14px; max-width: 72ch; }
.head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---- Buttons ------------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px;
  padding: 0 14px; border-radius: 6px; border: 1px solid transparent; font-size: 13px; font-weight: 600;
  cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, color .15s; }
.btn svg { width: 15px; height: 15px; }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn-primary:hover { background: var(--brand-deep); border-color: var(--brand-deep); }
.btn-secondary { background: var(--panel); color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:hover { background: var(--bg); }
.btn-ghost { background: transparent; color: var(--ink); border-color: transparent; }
.btn-ghost:hover { background: var(--bg); }
.btn-danger { background: var(--panel); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, #fff); }
.btn-danger:hover { background: var(--danger-tint); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; }
.btn-lg { height: 44px; padding: 0 18px; font-size: 14px; }
.btn[disabled], .btn.is-disabled { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; }

/* ---- Panels / cards ------------------------------------------------------ */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(15, 36, 51, .04); min-width: 0; }
.panel-head { display: flex; align-items: flex-start; gap: 16px; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.panel-title { font-size: 14px; font-weight: 650; letter-spacing: -.1px; }
.panel-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.panel-body { padding: 20px; }
.panel-body.tight { padding: 0; }
.panel-foot { padding: 12px 20px; border-top: 1px solid var(--line-soft); display: flex;
  align-items: center; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.panel-note { font-size: 12px; color: var(--muted); }

/* ---- KPI ----------------------------------------------------------------- */
.kpi-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi-grid.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; display: flex; flex-direction: column; gap: 8px; min-width: 0; justify-content: space-between; }
.kpi-label { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted);
  font-weight: 650; line-height: 1.3; }
.kpi-value { font-size: 26px; font-weight: 650; line-height: 1; letter-spacing: -.6px; font-variant-numeric: tabular-nums; }
.kpi-value small { font-size: 13px; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.kpi-delta { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; }
.kpi-delta.up { color: var(--ok); }
.kpi-delta.down { color: var(--danger); }
.kpi-delta.flat { color: var(--muted); }
.kpi-note { font-size: 11px; color: var(--muted); line-height: 1.4; }

/* ---- Forms --------------------------------------------------------------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.form-grid .span-2 { grid-column: span 2; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.field .req { color: var(--danger); }
.input, .select, .textarea { width: 100%; border: 1px solid var(--line-strong); border-radius: 6px;
  background: var(--panel); padding: 9px 11px; font-size: 13.5px; color: var(--ink); min-height: 38px; }
.input::placeholder, .textarea::placeholder { color: color-mix(in srgb, var(--muted) 72%, #fff); }
.input:hover, .select:hover, .textarea:hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--line-strong)); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
.textarea { min-height: 112px; resize: vertical; line-height: 1.55; }
.help { font-size: 11.5px; color: var(--muted); line-height: 1.4; }
.error-text { font-size: 11.5px; color: var(--danger); font-weight: 600; display: flex; gap: 4px; align-items: center; }
.field.has-error .input, .field.has-error .select, .field.has-error .textarea { border-color: var(--danger); }
.search { position: relative; display: flex; align-items: center; }
.search svg { position: absolute; left: 10px; width: 15px; height: 15px; color: var(--muted); pointer-events: none; }
.search .input { padding-left: 32px; }
.input-group { display: flex; }
.input-group .input { border-radius: 6px 0 0 6px; }
.input-group .btn { border-radius: 0 6px 6px 0; height: 38px; }
.dropzone { border: 1.5px dashed var(--line-strong); border-radius: var(--radius); padding: 24px;
  text-align: center; background: var(--bg); color: var(--muted); font-size: 12.5px; }
.dropzone strong { color: var(--ink); display: block; margin-bottom: 4px; font-size: 13px; }
.unit-row { display: grid; grid-template-columns: 1.4fr .8fr 1fr auto; gap: 8px; align-items: end; }

/* ---- Filters / chips / segmented ---------------------------------------- */
.filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.filters .search { min-width: 240px; flex: 1 1 260px; }
.chips { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 8px;
  border-radius: 13px; border: 1px solid var(--line); background: var(--panel); font-size: 11.5px;
  color: var(--ink); font-weight: 500; white-space: nowrap; }
.chip .x { border: 0; background: transparent; cursor: pointer; color: var(--muted); padding: 0; line-height: 1; font-size: 14px; }
.chip.is-on { background: var(--brand-tint); border-color: color-mix(in srgb, var(--brand) 35%, #fff); color: var(--brand-deep); }
.chip-tab { cursor: pointer; }
.segmented { display: inline-flex; padding: 3px; background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 7px; gap: 2px; }
.segmented button { border: 0; background: transparent; padding: 5px 10px; border-radius: 5px; cursor: pointer;
  font-size: 11.5px; font-weight: 600; color: var(--muted); }
.segmented button.is-on { background: var(--panel); color: var(--ink); box-shadow: 0 1px 2px rgba(15,36,51,.08); }
.segmented button:hover { color: var(--ink); }

/* ---- Tabs ---------------------------------------------------------------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tab { border: 0; background: transparent; padding: 10px 12px; font-size: 13px; font-weight: 600;
  color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab.is-on { color: var(--brand-deep); border-bottom-color: var(--brand); }

/* ---- Tables -------------------------------------------------------------- */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.table th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px;
  color: var(--muted); font-weight: 700; padding: 10px 12px; background: var(--bg);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 2; white-space: nowrap; }
table.table td { padding: 11px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.table tbody tr:hover { background: color-mix(in srgb, var(--bg) 65%, #fff); }
table.table tbody tr:last-child td { border-bottom: 0; }
table.table .num { text-align: right; font-variant-numeric: tabular-nums; }
table.table .actions { text-align: right; white-space: nowrap; }
table.table .strong { font-weight: 600; color: var(--ink); }
table.table .sub { display: block; font-size: 11px; color: var(--muted); margin-top: 1px; }
.table-compact td, .table-compact th { padding: 8px 12px; }

/* ---- Badges / status ----------------------------------------------------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 10px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .2px; text-transform: uppercase; white-space: nowrap;
  border: 1px solid transparent; }
.badge.ok { background: var(--ok-tint); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 22%, #fff); }
.badge.warn { background: var(--warn-tint); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 24%, #fff); }
.badge.danger { background: var(--danger-tint); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 22%, #fff); }
.badge.info { background: var(--info-tint); color: var(--brand-deep); border-color: color-mix(in srgb, var(--brand) 22%, #fff); }
.badge.neutral { background: var(--bg-2); color: var(--muted); border-color: var(--line); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; }
.status.ok { color: var(--ok); }
.status.warn { color: var(--warn); }
.status.danger { color: var(--danger); }
.status.info { color: var(--brand-deep); }
.status.muted { color: var(--muted); }
.badge-count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger-tint);
  color: var(--danger); font-size: 10.5px; font-weight: 700; display: inline-grid; place-items: center; }

/* ---- Evidence markers ---------------------------------------------------- */
.evidence { display: inline-flex; align-items: center; gap: 4px; padding: 1px 6px; border-radius: 4px;
  font-size: 10px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase; vertical-align: 1px; }
.evidence.fact { background: var(--ok-tint); color: var(--ok); }
.evidence.user { background: var(--info-tint); color: var(--brand-deep); }
.evidence.hyp { background: var(--warn-tint); color: var(--warn); }
.evidence.sem-marcador { background: var(--bg-2); color: var(--muted); font-weight: 600; }

/* Proveniência, reuso e conversa da etapa 1 */
.prov-counts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.prov-count { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg);
  padding: 8px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.prov-count strong { font-family: var(--serif); font-size: 20px; line-height: 1; color: var(--ink); }
.prov-count .evidence { align-self: flex-start; font-size: 9.5px; padding: 1px 5px; }
.prov-block { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.prov-block-title { font-size: 11px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--muted); }
.prov-source-list { display: flex; flex-direction: column; gap: 6px; }
.prov-source-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; min-width: 0; }
.prov-source-row a { color: var(--brand-deep); font-weight: 600; text-decoration: none; word-break: break-word; }
.prov-source-row a:hover { text-decoration: underline; }
.prov-source-row .sub { flex-basis: 100%; padding-left: 2px; }
.prov-section-sources { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.prov-section-label { font-size: 10px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--muted); }
.prov-source { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line);
  background: var(--bg); border-radius: 999px; padding: 2px 8px; font-size: 10.5px; color: var(--ink); max-width: 100%; }
.prov-source a { color: var(--brand-deep); text-decoration: none; }
.prov-source a:hover { text-decoration: underline; }

/* ---- Grid helpers -------------------------------------------------------- */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, .85fr); gap: 24px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: 148px minmax(0, 1fr); gap: 8px 16px; font-size: 12.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--ink); font-weight: 500; }

/* ---- Editorial document -------------------------------------------------- */
.doc { max-width: 860px; }
.doc-head { border-bottom: 1px solid var(--line); padding-bottom: 16px; margin-bottom: 24px; }
.doc-kicker { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.doc-title { font-family: var(--serif); font-size: 27px; font-weight: 600; line-height: 1.18; letter-spacing: -.3px; }
.doc-meta { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; color: var(--muted);
  font-size: 11.5px; margin-top: 12px; }
.doc-body { font-size: 13.5px; line-height: 1.7; color: var(--ink); }
.doc-section { padding: 20px 0; border-bottom: 1px solid var(--line-soft); scroll-margin-top: 88px; }
.doc-section.is-highlight { background: color-mix(in srgb, var(--brand) 8%, transparent); border-radius: 10px; box-shadow: inset 3px 0 0 var(--brand); padding-left: 14px; padding-right: 14px; transition: background .4s ease; }
.doc-section:last-child { border-bottom: 0; }
.doc-section h3 { font-family: var(--serif); font-size: 19px; font-weight: 600; margin-bottom: 8px; letter-spacing: -.1px; }
.doc-section h3 .sec-num { color: var(--brand); font-size: 13px; font-family: var(--sans); font-weight: 700;
  display: inline-block; min-width: 24px; vertical-align: 2px; }
.doc-body p { margin: 8px 0; }
.doc-body ul, .doc-body ol { margin: 8px 0 8px 20px; padding: 0; }
.doc-body li { margin: 4px 0; }
.doc-body strong { font-weight: 650; }
.callout { border-left: 3px solid var(--brand); background: var(--brand-tint); padding: 12px 14px;
  border-radius: 0 6px 6px 0; font-size: 12.5px; line-height: 1.6; margin: 12px 0; }
.callout.warn { border-color: var(--warn); background: var(--warn-tint); }
.callout.danger { border-color: var(--danger); background: var(--danger-tint); }
.diagram { border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg);
  padding: 16px; margin: 12px 0; }
.flow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.flow-node { background: var(--panel); border: 1px solid var(--line-strong); border-radius: 6px;
  padding: 7px 10px; font-size: 11.5px; font-weight: 600; min-height: 34px; display: flex;
  flex-direction: column; justify-content: center; }
.flow-node small { font-weight: 500; color: var(--muted); font-size: 10px; }
.flow-node.decision { border-style: dashed; border-color: var(--warn); background: var(--warn-tint); }
.flow-node.start { border-color: var(--brand); background: var(--brand-tint); }
.flow-arrow { color: var(--muted); font-size: 14px; }
.diagram-fallback { margin-top: 12px; font-size: 11.5px; color: var(--muted); }
.doc-actions > .btn-primary, .doc-actions > .btn-danger { margin-left: auto; }
.doc-actions { position: sticky; bottom: 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  background: var(--panel); border-top: 1px solid var(--line); padding: 12px 0; margin-top: 8px; z-index: 10;
  box-shadow: 0 -6px 12px color-mix(in srgb, var(--bg) 80%, transparent); }

/* ---- Workspace + chat ---------------------------------------------------- */
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; align-items: start; }
.doc-column { min-width: 0; }
.chat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  display: flex; flex-direction: column; position: sticky; top: 80px; max-height: calc(100vh - 96px);
  overflow: hidden; }
.chat-head { padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center;
  gap: 8px; justify-content: space-between; }
.chat-title { font-size: 13px; font-weight: 650; display: flex; align-items: center; gap: 6px; }
.chat-context { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.chat-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; min-height: 320px; }
.msg { display: flex; flex-direction: column; gap: 4px; max-width: 94%; }
.msg.user { align-self: flex-end; align-items: flex-end; }
.msg-role { font-size: 10px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); }
.msg-bubble { background: var(--bg); border: 1px solid var(--line-soft); border-radius: 8px; padding: 9px 11px;
  font-size: 12.5px; line-height: 1.55; }
.msg.user .msg-bubble { background: var(--brand); color: #fff; border-color: var(--brand); }
.msg.system .msg-bubble { background: transparent; border-style: dashed; color: var(--muted); font-size: 11.5px; }
.msg-meta { font-size: 10px; color: var(--muted); }
.revision { border: 1px solid color-mix(in srgb, var(--warn) 32%, #fff); background: var(--warn-tint);
  border-radius: 8px; padding: 10px; font-size: 12px; }
.revision-head { display: flex; align-items: center; gap: 6px; font-weight: 700; color: var(--warn);
  font-size: 11px; text-transform: uppercase; letter-spacing: .4px; margin-bottom: 6px; }
.diff { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10.5px; line-height: 1.5;
  background: var(--panel); border: 1px solid var(--line); border-radius: 5px; padding: 6px 8px; margin: 6px 0; }
.diff .add { color: var(--ok); }
.diff .rem { color: var(--danger); }
.revision-actions { display: flex; gap: 6px; }
.composer { border-top: 1px solid var(--line); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.composer textarea { width: 100%; border: 1px solid var(--line-strong); border-radius: 6px; padding: 9px 10px;
  font-size: 12.5px; resize: none; min-height: 62px; background: var(--bg); line-height: 1.5; }
.composer textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
.composer-actions { display: flex; align-items: center; gap: 8px; }
.composer-actions .hint { font-size: 10.5px; color: var(--muted); margin-right: auto; }
.attach { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); cursor: pointer; }
.chat-note { padding: 8px 12px; font-size: 10.5px; color: var(--muted); background: var(--bg); border-top: 1px solid var(--line-soft); line-height: 1.45; }
.suggestions { display: flex; gap: 6px; flex-wrap: wrap; }
.suggestion { border: 1px solid var(--line); background: var(--panel); border-radius: 12px; padding: 4px 8px;
  font-size: 10.5px; color: var(--brand-deep); cursor: pointer; }
.suggestion:hover { background: var(--brand-tint); }

/* ---- Journey trail (dashboard) ------------------------------------------ */
.journey-trail { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.trail-step { border: 1px solid var(--line); border-radius: 6px; padding: 10px; background: var(--bg);
  display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.trail-step .n { font-size: 10px; color: var(--muted); font-weight: 700; letter-spacing: .5px; }
.trail-step .t { font-size: 11.5px; font-weight: 650; line-height: 1.25; }
.trail-step .s { font-size: 10px; color: var(--muted); margin-top: auto; }
.trail-step.done { border-color: color-mix(in srgb, var(--ok) 32%, #fff); background: var(--ok-tint); }
.trail-step.current { border-color: var(--brand); background: var(--brand-tint); }
.trail-step.blocked { opacity: .68; }

/* ---- Opportunities ------------------------------------------------------- */
.opp-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.opp-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); padding: 16px;
  display: flex; flex-direction: column; gap: 10px; }
.opp-card.is-selected { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
.opp-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.opp-title { font-family: var(--serif); font-size: 18px; font-weight: 600; line-height: 1.2; }
.opp-problem { font-size: 12px; color: var(--muted); line-height: 1.55; }
.opp-meta { display: flex; gap: 16px; flex-wrap: wrap; font-size: 11px; color: var(--muted); }
.opp-meta b { color: var(--ink); font-weight: 600; }
.opp-check { display: flex; align-items: center; gap: 8px; font-size: 11.5px; font-weight: 600; }
.opp-check input { width: 16px; height: 16px; accent-color: var(--brand); }
.selection-bar { position: sticky; bottom: 16px; margin-top: 20px; background: var(--brand-deep); color: #fff;
  border-radius: var(--radius); padding: 12px 16px; display: flex; align-items: center; gap: 16px;
  justify-content: space-between; flex-wrap: wrap; box-shadow: 0 8px 24px rgba(15,36,51,.18); z-index: 12; }
.selection-bar .btn-secondary { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.28); }
.selection-bar .btn-secondary:hover { background: rgba(255,255,255,.2); }
.opp-card .opp-objective { font-size: 12px; color: var(--ink); line-height: 1.5; }
.opp-card .opp-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; padding-top: 4px; }
.opp-card .opp-list { display: flex; flex-wrap: wrap; gap: 6px; }
.opp-tag { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg); color: var(--muted); font-size: 10.5px; line-height: 1.6; }
.opp-matrix-table { width: 100%; border-collapse: separate; border-spacing: 6px; table-layout: fixed; }
.opp-matrix-table th { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted);
  font-weight: 700; text-align: center; padding: 2px; }
.opp-matrix-table thead th:first-child { text-align: left; letter-spacing: .2px; text-transform: none; font-weight: 600; }
.opp-matrix-table tbody th { text-align: left; font-size: 10.5px; color: var(--ink); letter-spacing: .2px; text-transform: none; }
.opp-matrix-table td { padding: 0; }
.opp-matrix-cell { width: 100%; min-height: 58px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px; cursor: pointer; color: var(--ink); transition: border-color .15s var(--ease), box-shadow .15s var(--ease), background .15s var(--ease); }
.opp-matrix-cell b { font-size: 18px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.opp-matrix-cell span { font-size: 9px; color: var(--muted); line-height: 1.2; }
.opp-matrix-cell:hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); }
.opp-matrix-cell[data-level="1"] { background: color-mix(in srgb, var(--brand) 7%, var(--panel)); border-color: color-mix(in srgb, var(--brand) 18%, var(--line)); }
.opp-matrix-cell[data-level="2"] { background: color-mix(in srgb, var(--brand) 14%, var(--panel)); border-color: color-mix(in srgb, var(--brand) 30%, var(--line)); }
.opp-matrix-cell[data-level="3"] { background: color-mix(in srgb, var(--brand) 22%, var(--panel)); border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); }
.opp-matrix-cell.is-on { box-shadow: inset 0 0 0 2px var(--brand); border-color: var(--brand); }
.opp-matrix-cell:disabled { opacity: .5; cursor: default; }
.opp-matrix-cell:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.opp-lista-selecionadas { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px;
  font-size: 12.5px; color: var(--ink); }
.modal-card.wide { max-width: 1080px; }
.compare-table { min-width: 640px; }
.compare-table th[scope="row"] { width: 160px; min-width: 140px; background: var(--bg); font-size: 10.5px;
  letter-spacing: .3px; text-transform: uppercase; color: var(--muted); vertical-align: top; }
.compare-table td { vertical-align: top; font-size: 11.5px; line-height: 1.5; min-width: 180px; overflow-wrap: anywhere; }
.compare-table th[scope="col"] { min-width: 180px; vertical-align: top; }
.compare-title { display: block; font-family: var(--serif); font-size: 14px; font-weight: 600; letter-spacing: 0;
  text-transform: none; color: var(--ink); margin-bottom: 4px; }
.compare-col.is-selected { background: color-mix(in srgb, var(--brand) 6%, var(--panel)); }
.opp-detail-grid { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 10px 18px; font-size: 12.5px; }
.opp-detail-grid dt { color: var(--muted); font-weight: 600; }
.opp-detail-grid dd { margin: 0; line-height: 1.55; overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .opp-detail-grid { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .opp-detail-grid dd { margin-bottom: 10px; }
  .opp-matrix-table { border-spacing: 3px; }
  .opp-matrix-cell { min-height: 48px; }
  .opp-matrix-cell b { font-size: 15px; }
  .opp-matrix-cell span { font-size: 8px; }
  .opp-matrix-table th { font-size: 9px; }
}

/* ---- Timeline ------------------------------------------------------------- */
.timeline { display: flex; flex-direction: column; }
.tl-item { display: grid; grid-template-columns: 22px 1fr; gap: 12px; padding-bottom: 16px; position: relative; }
.tl-item:not(:last-child)::before { content: ""; position: absolute; left: 9px; top: 18px; bottom: 0;
  width: 1px; background: var(--line); }
.tl-dot { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--line-strong);
  background: var(--panel); display: grid; place-items: center; font-size: 9px; color: var(--muted); z-index: 1; }
.tl-item.done .tl-dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.tl-item.current .tl-dot { background: var(--brand); border-color: var(--brand); color: #fff; }
.tl-body { min-width: 0; }
.tl-title { font-size: 12.5px; font-weight: 600; }
.tl-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ---- Charts --------------------------------------------------------------- */
.chart { position: relative; width: 100%; min-width: 0; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; font-size: 11px; color: var(--muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: 5px; }
.chart-legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.chart-grid line { stroke: var(--line-soft); stroke-width: 1; }
.chart-axis text { fill: var(--muted); font-size: 9.5px; font-family: var(--sans); }
.chart-empty { display: grid; place-items: center; min-height: 180px; color: var(--muted); font-size: 12px; }
.chart-note { font-size: 10.5px; color: var(--muted); margin-top: 8px; }
.charts-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.charts-grid .span-2 { grid-column: span 2; }

/* ---- States --------------------------------------------------------------- */
.state-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.state-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); padding: 20px;
  display: flex; flex-direction: column; gap: 12px; min-height: 190px; }
.state-label { font-size: 10px; letter-spacing: .8px; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  gap: 8px; padding: 32px 16px; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--bg); }
.empty-icon { width: 40px; height: 40px; border-radius: 50%; background: var(--brand-tint); color: var(--brand);
  display: grid; place-items: center; }
.empty-title { font-weight: 650; font-size: 13px; }
.empty-text { color: var(--muted); font-size: 12px; max-width: 42ch; }
.skeleton { background: linear-gradient(90deg, var(--bg-2) 25%, var(--bg) 37%, var(--bg-2) 63%);
  background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: 4px; height: 12px; }
.skeleton.w-60 { width: 60%; } .skeleton.w-40 { width: 40%; } .skeleton.w-80 { width: 80%; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.alert { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--panel); font-size: 12.5px; line-height: 1.5; }
.alert .alert-ico { flex: 0 0 auto; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; }
.alert.info { border-color: color-mix(in srgb, var(--brand) 28%, #fff); background: var(--brand-tint); }
.alert.info .alert-ico { background: var(--brand); color: #fff; }
.alert.warn { border-color: color-mix(in srgb, var(--warn) 30%, #fff); background: var(--warn-tint); }
.alert.warn .alert-ico { background: var(--warn); color: #fff; }
.alert.danger { border-color: color-mix(in srgb, var(--danger) 28%, #fff); background: var(--danger-tint); }
.alert.danger .alert-ico { background: var(--danger); color: #fff; }
.alert.ok { border-color: color-mix(in srgb, var(--ok) 28%, #fff); background: var(--ok-tint); }
.alert.ok .alert-ico { background: var(--ok); color: #fff; }
.alert strong { display: block; margin-bottom: 2px; }
.progress { height: 6px; border-radius: 3px; background: var(--bg-2); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--brand); border-radius: 3px; }
.meter { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--muted); }
.meter .bar { flex: 1; height: 6px; border-radius: 3px; background: var(--bg-2); overflow: hidden; }
.meter .bar span { display: block; height: 100%; background: var(--brand); }
.footer-note { margin-top: 24px; font-size: 11px; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dot-sep { width: 3px; height: 3px; border-radius: 50%; background: var(--line-strong); }

/* ---- Auth (login) --------------------------------------------------------- */
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(420px, .95fr); }
.auth-brand { background: var(--brand-deep); color: #fff; padding: 48px; display: flex; flex-direction: column;
  justify-content: space-between; position: relative; overflow: hidden; }
.auth-brand .brand-name, .auth-brand .brand-sub { color: #fff; }
.auth-brand .brand-mark { background: #fff; color: var(--brand-deep); }
.auth-graphic { position: absolute; inset: 0; opacity: .1; pointer-events: none; }
.auth-copy { position: relative; max-width: 520px; }
.auth-kicker { font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: #b9d9ee; font-weight: 700; margin-bottom: 16px; }
.auth-title { font-family: var(--serif); font-size: 38px; line-height: 1.14; font-weight: 600; letter-spacing: -.5px; }
.auth-text { margin-top: 16px; color: #cfe3f1; font-size: 14px; line-height: 1.65; max-width: 44ch; }
.auth-points { display: flex; flex-direction: column; gap: 12px; margin-top: 32px; }
.auth-point { display: flex; gap: 10px; align-items: flex-start; font-size: 12.5px; color: #dcebf5; }
.auth-point b { color: #fff; display: block; font-size: 13px; margin-bottom: 1px; }
.auth-point .pin { width: 22px; height: 22px; border-radius: 50%; background: color-mix(in srgb, #ffffff 16%, var(--brand-deep));
  display: grid; place-items: center; font-size: 11px; flex: 0 0 auto; }
.auth-form-wrap { display: grid; place-items: center; padding: 32px; background: var(--bg); }
.auth-form { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 16px; }
.auth-form h1 { font-family: var(--serif); font-size: 26px; font-weight: 600; }
.auth-form .page-sub { margin-top: -8px; }
.auth-alt { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; flex-wrap: wrap; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.check input { accent-color: var(--brand); }
.password-wrap { position: relative; }
.password-wrap .input { padding-right: 40px; }
.password-wrap button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0;
  background: transparent; color: var(--muted); cursor: pointer; padding: 4px;
  min-width: 28px; min-height: 28px; display: grid; place-items: center; border-radius: var(--radius-sm); }
.password-wrap button:hover { background: var(--bg); color: var(--ink); }

/* ---- Modal / toast -------------------------------------------------------- */
.overlay { position: fixed; inset: 0; background: rgba(9, 27, 40, .48); display: none; z-index: 90; }
.overlay.is-open { display: block; }
.modal { position: fixed; inset: 0; display: none; place-items: center; padding: 16px; z-index: 100; }
.modal.is-open { display: grid; }
.modal-card { width: 100%; max-width: 520px; background: var(--panel); border-radius: var(--radius-lg);
  border: 1px solid var(--line); box-shadow: 0 24px 64px rgba(9,27,40,.24); overflow: hidden; }
.modal-head { padding: 20px 24px 0; }
.modal-title { font-family: var(--serif); font-size: 21px; font-weight: 600; }
.modal-body { padding: 12px 24px 20px; display: flex; flex-direction: column; gap: 12px; font-size: 13px; }
.modal-foot { padding: 16px 24px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }
.toast-wrap { position: fixed; right: 24px; bottom: 24px; display: flex; flex-direction: column; gap: 8px; z-index: 120; }
.toast { background: var(--ink); color: #fff; border-radius: 6px; padding: 10px 14px; font-size: 12px;
  box-shadow: 0 8px 24px rgba(9,27,40,.22); max-width: 360px; display: flex; gap: 8px; align-items: center; }

/* ---- Snapshot (docs/preview-visual.html) --------------------------------- */
.snapshot { background: var(--bg-2); }
.snapshot-index { position: static; background: var(--panel); border-bottom: 1px solid var(--line);
  padding: 24px 32px; }
.snapshot-index-inner { max-width: 1480px; margin: 0 auto; }
.snapshot-index h1 { font-family: var(--serif); font-size: 26px; font-weight: 600; }
.snapshot-index p { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.snapshot-nav { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.snapshot-nav a { font-size: 11.5px; border: 1px solid var(--line); border-radius: 12px; padding: 3px 9px;
  color: var(--ink); background: var(--bg); }
.snapshot-nav a:hover { background: var(--brand-tint); text-decoration: none; }
.preview-section { max-width: 1480px; margin: 0 auto; padding: 32px; scroll-margin-top: 24px; }
.preview-label { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.preview-label .pid { font-size: 11px; font-weight: 700; letter-spacing: .8px; color: var(--brand); text-transform: uppercase; }
.preview-label h2 { font-family: var(--serif); font-size: 22px; font-weight: 600; }
.preview-label p { color: var(--muted); font-size: 12px; }
.preview-frame { border: 1px solid var(--line-strong); border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: 0 8px 32px rgba(15,36,51,.08); background: var(--bg); }
.snapshot .preview-frame .app-shell { min-height: auto; }
.snapshot .preview-frame .sidebar { position: static; height: auto; min-height: 100%; align-self: stretch; }
.snapshot .preview-frame .topbar { position: static; }
.snapshot .preview-frame .chat { position: static; max-height: none; }
.snapshot .preview-frame .content { padding: 24px; }
.snapshot .preview-frame .doc-actions { position: static; }
.snapshot .preview-frame .selection-bar { position: static; }
.snapshot .menu-btn, .snapshot .sidebar-scrim { display: none !important; }
.snapshot .preview-frame .auth-shell { min-height: 680px; }
.preview-frame .chart { max-width: 100%; }

/* ---- Premium polish layer ------------------------------------------------ */
/* Refinamento visual: escala, ritmo, foco visível e acabamento dos estados.
   Mantém o Design Freeze (sidebar-editorial · Ocean Light) sem redesenho. */
:root {
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px;
  --space-5: 24px; --space-6: 32px; --space-7: 40px;
  --shadow-1: 0 1px 2px rgba(15, 36, 51, .05);
  --shadow-2: 0 8px 24px rgba(15, 36, 51, .09);
  --shadow-3: 0 20px 48px rgba(9, 27, 40, .18);
  --ease: cubic-bezier(.2, .7, .3, 1);
}
html { scroll-behavior: smooth; }
body {
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word;
}
h1, h2, h3, .display, .display-sm, .doc-title, .auth-title { text-wrap: balance; }
.page-sub, .doc-body p, .empty-text, .panel-sub { text-wrap: pretty; }
.sidebar, .chat-log, .table-wrap, .tabs { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.sidebar::-webkit-scrollbar, .chat-log::-webkit-scrollbar, .table-wrap::-webkit-scrollbar { width: 10px; height: 10px; }
.sidebar::-webkit-scrollbar-thumb, .chat-log::-webkit-scrollbar-thumb, .table-wrap::-webkit-scrollbar-thumb {
  background: var(--line-strong); border: 3px solid var(--panel); border-radius: 999px;
}

/* Shell */
.sidebar { padding: 20px 12px 12px; gap: 4px; }
.brand { padding: 8px 8px 12px; margin-bottom: 4px; }
.brand-mark { width: 34px; height: 34px; border-radius: 8px; font-size: 16px;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .18); }
.nav-group { margin-top: 4px; }
.nav-label { padding: 12px 10px 4px; font-size: 10px; letter-spacing: 1px; }
.nav-item { min-height: 36px; padding: 8px 10px; border-radius: 7px;
  transition: background .15s var(--ease), color .15s var(--ease), box-shadow .15s var(--ease); }
.nav-item.active,
.app-shell[data-screen="painel"] [data-nav="painel"],
.app-shell[data-screen="empresas"] [data-nav="empresas"],
.app-shell[data-screen="governanca"] [data-nav="governanca"],
.app-shell[data-screen="empresa"] [data-nav="empresa"],
.app-shell[data-screen="fontes"] [data-nav="fontes"],
.app-shell[data-screen="versoes"] [data-nav="versoes"],
.app-shell[data-screen="aprovacoes"] [data-nav="aprovacoes"] {
  box-shadow: inset 2px 0 0 var(--brand);
}
.jstep { min-height: 36px; padding: 7px 10px; transition: background .15s var(--ease); }
.jstep .jdot { width: 19px; height: 19px; }
.sidebar-foot { padding-top: 12px; }

/* Topbar */
.topbar { padding: 0 28px; box-shadow: 0 1px 0 color-mix(in srgb, var(--line) 70%, transparent); }
.crumbs { gap: 6px; }
.crumbs a:hover { color: var(--ink); }
.topbar-search { height: 38px; border-radius: 7px; transition: border-color .15s var(--ease), background .15s var(--ease); }
.topbar-search:hover { border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); background: var(--panel); }
.icon-btn { transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease); }
.icon-btn:hover { border-color: var(--line-strong); }
.pend { transition: background .15s var(--ease), border-color .15s var(--ease); }
.pend:hover { border-color: color-mix(in srgb, var(--brand) 32%, var(--line)); }

/* Cabeçalho e ritmo editorial */
.display { font-size: 34px; }
.page-sub { font-size: 14.5px; line-height: 1.6; }
.page-head { margin-bottom: 28px; }
.panel-head { padding: 18px 22px; }
.panel-body { padding: 22px; }
.panel-foot { padding: 14px 22px; }

/* Botões */
.btn { height: 36px; border-radius: 7px; transition: background .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease), box-shadow .15s var(--ease), transform .1s var(--ease); }
.btn:active { transform: translateY(1px); }
.btn-primary { box-shadow: 0 1px 2px color-mix(in srgb, var(--brand) 30%, transparent); }
.btn-primary:hover { box-shadow: 0 3px 10px color-mix(in srgb, var(--brand) 28%, transparent); }
.btn-secondary:hover, .btn-ghost:hover { border-color: var(--line-strong); }
.btn[disabled], .btn.is-disabled { filter: saturate(.55); }
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after { content: ""; position: absolute; width: 16px; height: 16px;
  border: 2px solid rgba(255, 255, 255, .45); border-top-color: #fff; border-radius: 50%;
  animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* KPIs e cartões */
.kpi { padding: 18px 18px 16px; transition: border-color .15s var(--ease), box-shadow .15s var(--ease), transform .15s var(--ease); }
.kpi:hover { border-color: color-mix(in srgb, var(--brand) 34%, var(--line)); box-shadow: var(--shadow-2); transform: translateY(-1px); }
.kpi-label { font-size: 10.5px; letter-spacing: .7px; }
.kpi-value { font-size: 30px; letter-spacing: -.8px; }
.kpi-value small { font-size: 12px; }
.kpi-note { font-size: 11.5px; }
.panel { box-shadow: var(--shadow-1); }
.opp-card, .state-card { transition: border-color .15s var(--ease), box-shadow .15s var(--ease); }
.opp-card:hover, .state-card:hover { border-color: color-mix(in srgb, var(--brand) 28%, var(--line)); box-shadow: var(--shadow-2); }
.opp-title { font-size: 19px; }

/* Formulários */
.input, .select, .textarea { border-radius: 7px; transition: border-color .15s var(--ease), box-shadow .15s var(--ease), background .15s var(--ease); }
.input:disabled, .select:disabled, .textarea:disabled { background: var(--bg); color: var(--muted); cursor: not-allowed; }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { outline: none; }
.field label { letter-spacing: .1px; }
.help { font-size: 12px; }

/* Chips, tabs e segmented */
.chip { height: 28px; transition: background .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease); }
.chip-tab { height: 32px; }
.chip-tab:hover, .chip.is-on:hover { background: var(--brand-tint); border-color: color-mix(in srgb, var(--brand) 40%, #fff); }
.chip .x { min-width: 20px; min-height: 20px; display: inline-grid; place-items: center; border-radius: 50%; }
.chip .x:hover { background: color-mix(in srgb, var(--ink) 10%, transparent); color: var(--ink); }
.segmented button { min-height: 30px; transition: background .15s var(--ease), color .15s var(--ease), box-shadow .15s var(--ease); }
.tab { min-height: 40px; border-radius: 7px 7px 0 0; transition: background .15s var(--ease), color .15s var(--ease); }
.tab:hover { background: color-mix(in srgb, var(--bg) 70%, transparent); }
.tabs { scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }

/* Tabelas como componente de primeira classe */
table.table th { padding: 11px 14px; background: color-mix(in srgb, var(--bg) 72%, var(--panel));
  box-shadow: inset 0 -1px 0 var(--line); }
table.table td { padding: 12px 14px; }
table.table tbody tr { transition: background .12s var(--ease); }
table.table tbody tr:focus-within { background: var(--brand-tint); }
table.table tbody tr:hover { background: color-mix(in srgb, var(--bg) 80%, #fff); }
.table-wrap { border-radius: 0 0 var(--radius) var(--radius); }

/* Badges e status */
.badge { padding: 3px 8px; border-radius: 999px; letter-spacing: .35px; }
.status .dot { box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 14%, transparent); }

/* Chat / revisão */
.chat { border-radius: 10px; box-shadow: var(--shadow-1); }
.msg-bubble { border-radius: 4px 10px 10px 10px; }
.msg.user .msg-bubble { border-radius: 10px 4px 10px 10px; }
.msg-role { letter-spacing: .6px; }
.composer textarea { border-radius: 7px; }
.revision { border-radius: 10px; }
.diff { border-radius: 7px; }
.suggestion { min-height: 28px; transition: background .15s var(--ease), border-color .15s var(--ease); }
.suggestion:hover { border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); }

/* Estados e feedback */
.alert { border-left-width: 3px; box-shadow: var(--shadow-1); }
.empty { border-radius: 10px; }
.state-card { border-radius: 10px; }
.progress, .meter .bar { height: 7px; }
.selection-bar { border: 1px solid color-mix(in srgb, var(--brand) 40%, #062033); }

/* Gráficos */
.chart rect { transition: opacity .12s var(--ease); }
.chart rect:hover { opacity: .82; }
.chart svg text { font-variant-numeric: tabular-nums; }
.chart-legend { gap: 14px; }
.chart-legend span { font-size: 11.5px; }

/* Snapshot */
.snapshot-index { box-shadow: var(--shadow-1); }
.snapshot-nav a { min-height: 28px; display: inline-flex; align-items: center; transition: background .15s var(--ease), border-color .15s var(--ease); }
.snapshot-nav a:hover { border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); }
.preview-label h2 { letter-spacing: -.2px; }

/* Foco visível consistente em alvos interativos */
.nav-item:focus-visible, .jstep:focus-visible, .tab:focus-visible, .chip-tab:focus-visible,
.segmented button:focus-visible, .suggestion:focus-visible, .snapshot-nav a:focus-visible {
  outline: 2px solid var(--brand); outline-offset: 2px;
}

@media (min-width: 1440px) {
  .content { padding: 40px 40px 56px; }
}

/* ---- Responsive ----------------------------------------------------------- */
@media (max-width: 1280px) {
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi-grid.cols-5, .kpi-grid.cols-4 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .journey-trail { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .chat { position: static; max-height: none; }
  .grid-main { grid-template-columns: minmax(0, 1fr); }
  .charts-grid { grid-template-columns: minmax(0, 1fr); }
  .charts-grid .span-2 { grid-column: auto; }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-brand { padding: 32px; min-height: 320px; }
  .auth-title { font-size: 30px; }
}
@media (max-width: 1279px) {
  .snapshot .preview-frame .sidebar { display: none; }
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; height: 100vh; width: 272px;
    transform: translateX(-100%); transition: transform .2s ease; box-shadow: 0 0 0 1px var(--line); }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar-scrim.is-open { display: block; position: fixed; inset: 0; background: rgba(9,27,40,.4); z-index: 35; }
  .icon-btn.menu-btn { display: grid; }
  .content { padding: 24px; }
  .page-head { gap: 16px; }
  .state-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
  /* Alvos de toque confortáveis sem comprimir a hierarquia do desktop. */
  .snapshot-nav a, .segmented button, .suggestion, .chip-tab, .btn-sm { min-height: 32px; display: inline-flex; align-items: center; }
  .password-wrap button { width: 32px; height: 32px; }
  .chip .x { min-width: 24px; min-height: 24px; }
  .display { font-size: 27px; }
  .topbar { padding: 0 16px; gap: 8px; height: 56px; }
  .topbar-search { display: none; }
  .content { padding: 20px 16px 40px; }
  .kpi-grid, .kpi-grid.cols-5, .kpi-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid .span-2 { grid-column: auto; }
  .grid-2, .grid-3, .opp-grid { grid-template-columns: minmax(0, 1fr); }
  .journey-trail { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .unit-row { grid-template-columns: 1fr 1fr; }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 2px 0; }
  .kv dt { font-size: 11px; }
  .kv dd { margin-bottom: 8px; }
  .preview-section { padding: 20px 12px; }
  .auth-brand { padding: 24px; }
  .doc-title { font-size: 23px; }
  .doc-actions { position: static; }
  .col-optional { display: none; }
  .toast-wrap { right: 12px; left: 12px; bottom: 12px; }
  .toast { max-width: none; }
}
@media (max-width: 640px) {
  .crumbs a:not(:first-child), .crumbs .sep { display: none; }
  .crumbs strong::before { content: "·"; margin-right: 8px; color: var(--line-strong); }
}
@media (max-width: 480px) {
  .pend-label, .meta-sep { display: none; }
  .doc-meta { gap: 4px 12px; }
  .kpi-grid, .kpi-grid.cols-5, .kpi-grid.cols-4 { grid-template-columns: minmax(0, 1fr); }
  .state-grid { grid-template-columns: minmax(0, 1fr); }
  .page-head { flex-direction: column; }
  .head-actions { width: 100%; }
  .head-actions .btn { flex: 1 1 auto; }
  .content { padding: 16px 12px 32px; }
  .chart-legend { font-size: 10px; }
  .journey-trail { grid-template-columns: minmax(0, 1fr); }
  .topbar-actions .btn span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* ==========================================================================
   Sprint 1 — acesso, sessão e conta
   ========================================================================== */
[hidden] { display: none !important; }

.logout-link {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px;
  border: 0; border-radius: 6px; background: transparent; color: var(--muted);
  font-size: 12.5px; font-weight: 600; cursor: pointer; text-align: left;
}
.logout-link svg { width: 16px; height: 16px; flex: 0 0 auto; fill: none; stroke: currentColor; }
.logout-link:hover { background: var(--danger-tint); color: var(--danger); }
.logout-link:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* T20 / T21 / T22 — foco total no estado, sem shell de navegação */
.state-focus-mode .app-shell { grid-template-columns: minmax(0, 1fr); }
.state-focus-mode .sidebar,
.state-focus-mode .sidebar-scrim,
.state-focus-mode .topbar { display: none !important; }
.state-focus-mode .main { min-height: 100vh; }
.state-focus-mode .content {
  max-width: none; min-height: 100vh; display: grid; place-items: center;
  padding: 48px 24px;
}
.state-focus { width: 100%; display: grid; place-items: center; }
.state-focus-card {
  width: 100%; max-width: 620px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: 0 1px 2px rgba(15, 36, 51, .04);
  padding: 40px; display: flex; flex-direction: column; gap: 16px;
}
.state-focus-card .display { font-size: 30px; }
.state-focus-icon {
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  font-size: 22px; font-weight: 700; line-height: 1;
}
.state-focus-icon.warn { background: var(--warn-tint); color: var(--warn); }
.state-focus-icon.danger { background: var(--danger-tint); color: var(--danger); }
.state-focus-icon.neutral { background: var(--bg-2); color: var(--muted); }
.state-focus-card .alert { margin-top: 4px; }
.state-focus-card .row .btn { flex: 0 1 auto; }
.state-context {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px;
  padding: 10px 12px; border: 1px dashed var(--line-strong); border-radius: var(--radius);
  background: var(--bg); font-size: 12px;
}
.state-context-label { font-size: 11px; letter-spacing: .6px; text-transform: uppercase; font-weight: 700; color: var(--muted); }
.state-context code { font-size: 11.5px; color: var(--ink); word-break: break-all; }
.state-context .muted { font-size: 11.5px; }
.state-focus-card .status { font-size: 12px; }
.state-focus-card .status.ok { background: var(--ok-tint); border-radius: var(--radius); padding: 8px 10px; }
#conta-empresas .sub { display: block; margin-top: 2px; font-size: 10.5px; color: var(--muted); }
#conta-empresas code { font-size: 10.5px; word-break: break-all; }
#conta-id { word-break: break-all; }

@media (max-width: 640px) {
  .state-focus-mode .content { padding: 24px 16px; }
  .state-focus-card { padding: 24px; }
  .state-focus-card .display { font-size: 25px; }
  .state-focus-card .row .btn { flex: 1 1 100%; }
}

/* Pendências reais do usuário (contagem nunca simulada) */
.notif-wrap { position: relative; }
.notif-panel {
  position: absolute; right: 0; top: calc(100% + 8px); width: 360px; max-width: min(360px, calc(100vw - 24px));
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: 0 12px 32px rgba(15, 36, 51, .16); z-index: 60; overflow: hidden;
}
.notif-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px;
  padding: 14px 16px; border-bottom: 1px solid var(--line-soft); }
.notif-list { max-height: 340px; overflow-y: auto; }
.notif-item { display: block; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); color: var(--ink); }
.notif-item:last-child { border-bottom: 0; }
.notif-item:hover { background: var(--bg); text-decoration: none; }
.notif-item .notif-title { font-size: 12.5px; font-weight: 650; }
.notif-item .notif-desc { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.notif-item .notif-meta { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 10.5px; color: var(--muted); }
.notif-empty { padding: 20px 16px; text-align: center; color: var(--muted); font-size: 12px; }
@media (max-width: 640px) {
  .notif-panel { position: fixed; left: 12px; right: 12px; top: 64px; width: auto; }
}

@media (max-width: 480px) {
  .auth-form-wrap { padding: 24px 16px 32px; }
  .auth-title { font-size: 26px; }
  .auth-form { max-width: none; }
  .auth-alt { align-items: flex-start; }
}

/* ---- Sprint 4 · Empresas e processos (T02–T04) --------------------------- */
.unit-row-simple { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.unit-row-simple .field { gap: 0; }
.status[href] { text-decoration: none; }
.status[href]:hover { text-decoration: underline; }
#empresa-meta .chip { max-width: 100%; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
#empresa-meta a.chip { display: inline-block; line-height: 26px; }
#empresa-processos-corpo .meter { min-width: 140px; }
@media (max-width: 640px) {
  .unit-row-simple { grid-template-columns: minmax(0, 1fr); }
  .unit-row-simple .btn { justify-self: start; }
}

/* ---- Sprint 7 · Fontes e evidências (T07) -------------------------------- */
#fontes-meta { row-gap: 6px; }
#fontes-meta .chip { max-width: 100%; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
#fontes-meta a.chip { display: inline-block; line-height: 26px; }

.fontes-progresso { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line-soft); }
#fontes-progresso-passos .tl-item.done .tl-dot { background: var(--ok); border-color: var(--ok); color: #fff; }
#fontes-progresso-passos .tl-item.current .tl-dot { background: var(--brand); border-color: var(--brand); color: #fff; }
#fontes-progresso-bar { transition: width .5s var(--ease, ease); }

#fontes-tabela tbody tr.is-selected { background: var(--brand-tint); }
#fontes-tabela tbody tr.is-selected td { border-bottom-color: color-mix(in srgb, var(--brand) 22%, #fff); }
#fontes-tabela .fonte-cell { min-width: 220px; max-width: 360px; }
#fontes-tabela .fonte-url { display: block; color: var(--muted); font-size: 10.5px; margin-top: 2px; word-break: break-all; }
#fontes-tabela .fonte-cell .strong { display: block; }
#fontes-tabela .actions .btn { margin-left: 4px; }
#fontes-tabela .actions .icon-btn { vertical-align: middle; }

.fontes-detail-head { display: flex; flex-direction: column; gap: 8px; padding-bottom: 14px; border-bottom: 1px solid var(--line-soft); }
.fontes-detail-title { font-family: var(--serif); font-size: 20px; line-height: 1.2; color: var(--ink); }
.fontes-detail-url { font-size: 11.5px; color: var(--muted); word-break: break-all; }
.fontes-detail-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 0 0; }
.fontes-pill-row { display: flex; flex-wrap: wrap; gap: 6px; }
.fontes-section { padding-top: 16px; }
.fontes-section + .fontes-section { margin-top: 16px; border-top: 1px solid var(--line-soft); }
.fontes-section-title { font-size: 11px; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); font-weight: 700; margin-bottom: 10px; }
.fontes-list { display: flex; flex-direction: column; gap: 8px; }
.fontes-list-item { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); padding: 10px 12px; min-width: 0; }
.fontes-list-item.is-failure { border-color: color-mix(in srgb, var(--danger) 24%, #fff); background: var(--danger-tint); }
.fontes-list-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.fontes-list-main { min-width: 0; font-size: 12.5px; font-weight: 600; color: var(--ink); word-break: break-word; }
.fontes-list-meta { font-size: 11px; color: var(--muted); margin-top: 3px; word-break: break-word; }
.fontes-list-text { font-size: 12px; color: var(--ink); margin-top: 6px; line-height: 1.55; }
.fontes-list-text .fontes-list-meta { display: inline; margin-left: 6px; }
.fontes-empty-inline { border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); padding: 14px; text-align: center; font-size: 12px; color: var(--muted); background: var(--bg); }
.fontes-kv { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 6px 12px; font-size: 12px; }
.fontes-kv dt { color: var(--muted); }
.fontes-kv dd { margin: 0; color: var(--ink); word-break: break-word; }
.fontes-bullets { margin: 0; padding-left: 18px; font-size: 12px; line-height: 1.55; }
.fontes-bullets li { margin: 2px 0; }
.fontes-evidence-link { color: var(--brand-deep); font-weight: 600; text-decoration: none; }
.fontes-evidence-link:hover { text-decoration: underline; }
.fontes-evidence-toolbar { margin-bottom: 12px; }
.fontes-evidence-toolbar .search { max-width: 420px; }
.fontes-evidence-toolbar .search .input { padding-left: 34px; }
#fontes-evidencia-conteudo { display: flex; flex-direction: column; gap: 12px; }
.fontes-coverage { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); padding: 12px 14px; }
.fontes-coverage-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.fontes-coverage-cell { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.fontes-coverage-num { font-family: var(--serif); font-size: 19px; line-height: 1.1; color: var(--ink); }
.fontes-coverage-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 650; }
.fontes-coverage-bar { height: 6px; border-radius: 999px; background: var(--bg-2); overflow: hidden; margin: 10px 0 8px; }
.fontes-coverage-bar > span { display: block; height: 100%; background: var(--ok); border-radius: inherit; }
.fontes-coverage .panel-note { margin: 0; }
.fontes-evidence-count { margin: 0; }
.fontes-evidence-doc { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); overflow: hidden; }
.fontes-evidence-doc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; background: var(--bg-2); border-bottom: 1px solid var(--line); }
.fontes-evidence-doc-title { min-width: 0; font-size: 12px; font-weight: 700; color: var(--ink); word-break: break-word; }
.fontes-evidence-section { padding: 10px 12px; }
.fontes-evidence-section + .fontes-evidence-section { border-top: 1px solid var(--line-soft); }
.fontes-evidence-section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.fontes-evidence-section-head .strong { font-size: 11.5px; color: var(--ink); }
.fontes-evidence-item { background: var(--panel); }
.fontes-evidence-item + .fontes-evidence-item { margin-top: 8px; }
.fontes-evidence-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.fontes-evidence-actions .btn { text-decoration: none; }
.fontes-evidence-extra[hidden] { display: none; }
.fontes-evidence-extra .fontes-evidence-item:first-child { margin-top: 8px; }
.fontes-evidence-more { margin-top: 8px; }

@media (max-width: 640px) {
  #fontes-tabela .fonte-cell { min-width: 180px; }
  .fontes-kv { grid-template-columns: minmax(0, 1fr); gap: 2px 0; }
  .fontes-kv dt { font-size: 10.5px; }
  .fontes-kv dd { margin-bottom: 6px; }
  .fontes-detail-actions .btn { flex: 1 1 auto; }
  .fontes-coverage-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fontes-evidence-toolbar .search { max-width: none; }
  .fontes-evidence-doc-head { flex-direction: column; align-items: flex-start; }
  #fontes-form .row.between > .row { width: 100%; }
  #fontes-form .row.between > .row .btn { flex: 1 1 auto; }
  .fontes-list-top { flex-direction: column; }
}

/* ---- Sprint 9 · Arquivos privados e extração com OCR (T08) --------------- */
#arquivos-meta { row-gap: 6px; }
#arquivos-meta .chip { max-width: 100%; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
#arquivos-meta a.chip { display: inline-block; line-height: 26px; }

.arq-dropzone { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 28px 24px; transition: border-color .15s var(--ease), background .15s var(--ease); }
.arq-dropzone:hover, .arq-dropzone:focus-visible { border-color: var(--brand); background: var(--brand-tint); outline: none; }
.arq-dropzone.is-drag { border-color: var(--brand); background: var(--brand-tint); }
.arq-drop-icon { width: 42px; height: 42px; border-radius: 50%; background: var(--brand-tint); color: var(--brand); display: grid; place-items: center; margin-bottom: 2px; }
.arq-drop-icon svg { width: 22px; height: 22px; }
.arq-dropzone .btn { margin-top: 10px; }

.arq-fila { border-top: 1px solid var(--line-soft); padding-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.arq-fila-head .panel-title { font-size: 13px; }
.arq-fila-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); padding: 10px 12px; }
.arq-fila-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.arq-fila-icon { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 6px; background: var(--panel); border: 1px solid var(--line); color: var(--brand); display: grid; place-items: center; }
.arq-fila-icon svg { width: 15px; height: 15px; }
.arq-fila-main .strong { display: block; font-size: 12.5px; word-break: break-word; }
.arq-fila-progress { grid-column: 1 / -1; height: 5px; }
.arq-fila-erro { grid-column: 1 / -1; font-size: 11px; color: var(--danger); font-weight: 600; }
.arq-fila-aviso { grid-column: 1 / -1; font-size: 11px; color: var(--warn); font-weight: 600; line-height: 1.45; }

.arq-conteudo {
  margin: 0; max-height: 260px; overflow: auto; white-space: pre-wrap; word-break: break-word;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 14px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px; line-height: 1.6; color: var(--ink);
}

.arq-tabela .arq-file-cell { min-width: 220px; max-width: 360px; }
.arq-tabela .arq-file-cell .strong { display: block; word-break: break-word; }
.arq-tabela .arq-file-meta { display: block; color: var(--muted); font-size: 10.5px; margin-top: 2px; }
.arq-tabela .arq-row-error { display: block; color: var(--danger); font-size: 10.5px; margin-top: 3px; line-height: 1.4; }
.arq-tabela tbody tr { cursor: pointer; }
.arq-tabela tbody tr.is-selected { background: var(--brand-tint); }
.arq-tabela tbody tr.is-selected td { border-bottom-color: color-mix(in srgb, var(--brand) 22%, #fff); }
.arq-tabela .actions { white-space: nowrap; }
.arq-tabela .actions .btn, .arq-tabela .actions .icon-btn { margin-left: 4px; }
.arq-tabela .actions .icon-btn { vertical-align: middle; }
.arq-poll-dot { display: inline-block; width: 6px; height: 6px; margin-left: 6px; border-radius: 50%; background: var(--brand); animation: arq-pulse 1.4s ease-in-out infinite; }
@keyframes arq-pulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }

.arq-uso-grupos { display: flex; flex-direction: column; gap: 10px; }
.arq-uso-grupo { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); padding: 12px; }
.arq-uso-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.arq-uso-titulo { font-size: 12.5px; font-weight: 700; color: var(--ink); word-break: break-word; }
.arq-uso-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; font-size: 10.5px; color: var(--muted); }
.arq-uso-meta code { font-size: 10px; color: var(--muted); word-break: break-all; }
.arq-uso-arquivos { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.arq-uso-arquivo { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); padding: 4px 8px 4px 7px; font-size: 10.5px; color: var(--ink); min-width: 0; }
.arq-uso-arquivo > svg { flex: 0 0 auto; color: var(--brand); }
.arq-uso-arquivo.is-removido { opacity: .72; }
.arq-uso-arquivo .badge { font-size: 9.5px; padding: 1px 6px; }
.arq-tipos { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.arq-tipo-row { display: grid; grid-template-columns: 48px minmax(0, 1fr) 28px; align-items: center; gap: 8px; font-size: 11px; color: var(--muted); }
.arq-tipo-nome { font-weight: 700; color: var(--ink); }
.arq-tipo-bar { height: 6px; border-radius: 999px; background: var(--bg-2); overflow: hidden; }
.arq-tipo-bar > span { display: block; height: 100%; border-radius: inherit; background: var(--brand); }
.arq-tipo-num { text-align: right; font-variant-numeric: tabular-nums; }

@media (max-width: 640px) {
  .arq-tabela .arq-file-cell { min-width: 160px; max-width: none; }
  .arq-tabela .col-optional { display: none; }
  .arq-fila-item { grid-template-columns: minmax(0, 1fr); }
  .arq-fila-item > .badge { justify-self: start; }
  .fontes-detail-actions .btn { flex: 1 1 auto; }
  .arq-uso-head { flex-direction: column; }
  .arq-uso-head .btn { align-self: flex-start; }
}

@media (max-width: 520px) {
  .prov-counts { grid-template-columns: minmax(0, 1fr); }
  .prov-source-row { align-items: flex-start; }
  #ws-chat-panel .panel-body.tight { padding: 0; }
}

/* ---- Versionamento e aprovação (T09/T10/T11) ----------------------------- */
.diagram-code { margin: 0; padding: 12px; border-radius: 6px; background: var(--panel); border: 1px solid var(--line);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10.5px; line-height: 1.55;
  color: var(--ink); white-space: pre-wrap; word-break: break-word; }
.diff-list { display: flex; flex-direction: column; gap: 12px; }
.diff-item { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); padding: 12px; }
.diff-item .diff { margin: 6px 0 0; }
.version-summary { max-width: 340px; font-size: 12px; line-height: 1.5; color: var(--ink); }
.actions { text-align: right; white-space: nowrap; }
.actions > * + * { margin-left: 6px; }
#aprovacoes-etapas .status { width: 100%; text-decoration: none; }
#aprovacoes-etapas .status:hover { text-decoration: none; background: var(--bg); border-radius: 6px; }
#aprovacoes-etapas .status .sub { font-size: 11px; color: var(--muted); }
#aprovacoes-timeline .callout { width: 100%; }
#ws-recuperado-corpo .status { width: 100%; text-decoration: none; min-width: 0; flex-wrap: wrap; row-gap: 2px; }
#ws-recuperado-corpo .status:hover { background: var(--bg); border-radius: 6px; }
#ws-recuperado-corpo .status .sub { font-size: 11px; color: var(--muted); }
.table .actions { vertical-align: middle; }

@media (max-width: 760px) {
  .version-summary { max-width: none; }
  .actions { white-space: normal; }
  #aprovacoes-etapas .status { flex-wrap: wrap; row-gap: 4px; }
  #aprovacoes-etapas .status .sub { margin-left: 0 !important; }
}
.chat-context-banner { display: flex; flex-direction: column; gap: 3px; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: 6px; background: var(--bg); font-size: 11px; line-height: 1.5; color: var(--ink); }
.chat-context-banner strong { color: var(--brand-deep); }
.chat-context-banner span { color: var(--muted); }

/* ---- Guarda responsiva (smartphone 360px) -------------------------------- */
/* Chips e etiquetas nunca podem empurrar a página além da viewport; textos
   longos de contexto (empresa, processo, versão) quebram dentro do cartão. */
.chip { max-width: 100%; }
.doc-body, .doc-section, .doc-meta, .kv dd, .status, .msg-bubble,
.prov-source-row, .prov-source, .chat-context-banner, .panel-sub { overflow-wrap: anywhere; }
.grid-main > *, .workspace > *, .stack > *, .row > *, .between > * { min-width: 0; }
.panel, .doc, .doc-body, .chat, .msg, .msg-bubble { max-width: 100%; }
/* Seletores com width:auto crescem até o texto da maior opção e estouram a
   viewport em telas de 360px; limitar à largura disponível do contêiner. */
.panel-head > * { min-width: 0; }
.panel-head .row { max-width: 100%; }
#dash2-cobertura-doc, #dash2-fonte-tipo, #dash2-fonte-status { max-width: 100%; }

@media (max-width: 480px) {
  .chip { white-space: normal; height: auto; min-height: 28px; }
  .chip .x { flex: 0 0 auto; }
  .badge { white-space: normal; }
  .row > .btn, .head-actions > .btn { max-width: 100%; }
}

/* ---- Documento estruturado: tabelas, diagramas e chat rico (T06) --------- */
figure.diagram { margin: 12px 0; }
.diagram-caption { font-size: 10.5px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase;
  color: var(--muted); margin-bottom: 8px; }
.diagram-fallback { margin-top: 8px; }
.diagram-code { margin-top: 10px; }
.doc-table-wrap { margin: 12px 0; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--panel); overflow-x: auto; max-width: 100%; min-width: 0; }
.doc-table { min-width: 460px; }
.doc-table caption { caption-side: top; text-align: left; padding: 10px 14px 0; font-size: 11px;
  font-weight: 700; letter-spacing: .3px; text-transform: uppercase; color: var(--muted); }
.doc-table th, .doc-table td { overflow-wrap: anywhere; }
.doc-section .doc-table + p { margin-top: 10px; }

.composer-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.attach { border: 0; background: transparent; padding: 0; }
.attach:hover { color: var(--brand-deep); }
.attach:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
.attach:disabled { opacity: .5; cursor: not-allowed; }
.chat-attachments { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 10px;
  border: 1px dashed var(--line-strong); border-radius: 6px; background: var(--bg); }
.chat-attachments-label { flex-basis: 100%; font-size: 9.5px; font-weight: 700; letter-spacing: .4px;
  text-transform: uppercase; color: var(--muted); }
.chat-attachment { display: inline-flex; align-items: center; gap: 5px; max-width: 100%;
  border: 1px solid var(--line); border-radius: 12px; background: var(--panel); padding: 3px 8px;
  font-size: 10.5px; color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
a.chat-attachment:hover { border-color: var(--brand); color: var(--brand-deep); }
.chat-attachment-remove { border: 0; background: transparent; color: var(--muted); cursor: pointer;
  font-size: 13px; line-height: 1; padding: 0 0 0 2px; }
.chat-attachment-remove:hover { color: var(--danger); }
.chat-commands { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 6px;
  max-height: 190px; overflow-y: auto; padding: 10px; border: 1px solid var(--line);
  border-radius: 6px; background: var(--bg); }
.chat-commands .suggestion { text-align: left; border-radius: 6px; padding: 6px 8px; }
.msg-suggestions { display: flex; flex-wrap: wrap; gap: 6px; }
.msg-suggestions .suggestion { text-align: left; }
.msg-attachments { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }

@media (max-width: 480px) {
  .chat-commands { grid-template-columns: minmax(0, 1fr); max-height: 240px; }
  .composer-tools { gap: 8px; }
  .doc-table { min-width: 380px; }
}

/* ---- Sprint 14: workspace conversacional (T06/T09/T10) ------------------- */
.doc-head .doc-title { margin: 4px 0 0; }
.doc-meta { gap: 8px 22px; }
.doc-meta-item { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.doc-meta-label { font-size: 9.5px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); }
.doc-meta-value { font-size: 12px; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.doc-section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.doc-section-head h3 { margin-bottom: 0; }
.doc-section-ask { font-size: 10.5px; white-space: nowrap; }
.doc-section-ask:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.approval-gate { background: var(--brand-tint); border-color: color-mix(in srgb, var(--brand) 35%, #fff); }
.approval-gate .revision-head { color: var(--brand-deep); }
.approval-gate .revision-actions { flex-wrap: wrap; }
.approval-gate .revision-actions .btn { text-decoration: none; }
.diff-list { display: flex; flex-direction: column; gap: 6px; margin: 6px 0; }
.diff-item { border-top: 1px dashed color-mix(in srgb, var(--warn) 30%, #fff); padding-top: 6px; }
.diff-item .strong { font-size: 11px; }
.chat-section-context { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 6px 10px; border: 1px solid color-mix(in srgb, var(--brand) 30%, #fff);
  border-radius: 6px; background: var(--brand-tint); font-size: 10.5px; color: var(--brand-deep); }
.chat-section-context[hidden] { display: none; }
.chat-section-clear { border: 0; background: transparent; color: var(--brand-deep); cursor: pointer;
  font-size: 15px; line-height: 1; padding: 0 2px; }
.chat-section-clear:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

@media (max-width: 480px) {
  .doc-section-ask { white-space: normal; text-align: left; }
  .doc-meta { gap: 8px 14px; }
}
.chat-diagram .diagram { margin: 8px 0 0; padding: 12px; }
.chat-diagram .diagram-code { max-height: 140px; overflow: auto; }
.chat-stage-ref { margin: 8px 0 0; font-size: 11.5px; }
.chat-stage-ref .chip { text-decoration: none; }
.chat-transparency { border: 1px solid var(--line); border-radius: 6px; background: var(--panel); padding: 8px 10px; font-size: 11px; }
.chat-transparency summary { cursor: pointer; font-weight: 650; color: var(--brand-deep); }
.chat-transparency summary:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.chat-transparency ul { margin: 6px 0 0 18px; padding: 0; }
.chat-transparency .prov-block-title { margin-top: 8px; font-size: 10px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.chat-next-action { margin-top: 6px; }
.chat-next-action .btn { text-decoration: none; }
.doc-head-sources { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.doc-head-sources .doc-meta-label { margin-right: 2px; }
.doc-head-sources a, .doc-head-sources span { font-size: 11px; color: var(--brand-deep); background: var(--brand-tint);
  border: 1px solid color-mix(in srgb, var(--brand) 22%, #fff); border-radius: 12px; padding: 2px 8px;
  text-decoration: none; overflow-wrap: anywhere; }
.doc-head-sources a:hover { border-color: var(--brand); text-decoration: underline; }

/* ---- Sprint 16 · conclusão da jornada, transparência e versionamento ---- */
.completion-banner { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap;
  border: 1px solid color-mix(in srgb, var(--ok) 30%, #fff); background: var(--ok-tint);
  border-radius: var(--radius); padding: 18px 20px; margin-bottom: 20px; box-shadow: var(--shadow-1); }
.completion-banner[hidden] { display: none; }
.completion-mark { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: var(--ok); color: #fff; }
.completion-mark svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.completion-body { flex: 1 1 340px; min-width: 0; }
.completion-body h2 { margin: 2px 0 4px; font-size: 19px; color: var(--ink); }
.completion-body p { margin: 0; font-size: 12.5px; color: var(--muted); max-width: 70ch; }
.completion-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.completion-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.completion-actions .btn { text-decoration: none; }
.doc-transparency { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px;
  padding-top: 10px; border-top: 1px dashed var(--line-strong, var(--line)); }
.doc-transparency .dt-label { display: inline-flex; align-items: center; gap: 4px; font-size: 9.5px; font-weight: 700;
  letter-spacing: .5px; text-transform: uppercase; color: var(--muted); margin-right: 2px; }
.doc-transparency .chip { font-size: 10.5px; }
.version-flags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.version-flags .badge { font-size: 9px; padding: 1px 6px; }

@media (max-width: 640px) {
  .completion-banner { flex-direction: column; }
  .completion-actions { width: 100%; }
  .completion-actions .btn { flex: 1 1 auto; justify-content: center; }
  .doc-transparency { gap: 5px; }
}

/* ---- Sprint 18 · cobertura de evidências e vínculos de revisão/aprovação ---- */
.evidence.missing { background: var(--warn-tint); color: var(--warn); border: 1px dashed color-mix(in srgb, var(--warn) 40%, #fff); }
.coverage-block { gap: 8px; }
.coverage-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.coverage-head div { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.coverage-head strong { font-family: var(--serif); font-size: 20px; color: var(--ink); }
.coverage-head span { font-size: 11px; color: var(--muted); }
.coverage-progress { margin: 2px 0; }
.coverage-legend { display: flex; flex-wrap: wrap; gap: 5px; }
.coverage-missing summary { cursor: pointer; font-size: 11.5px; font-weight: 600; color: var(--brand-deep); padding: 4px 0; }
.coverage-missing summary:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.coverage-missing ul { margin: 4px 0 6px 18px; padding: 0; font-size: 11.5px; color: var(--muted); }
.coverage-missing li { margin: 3px 0; }
.msg-prov { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.msg-prov .msg-provenance { font-size: 9.5px; }
.revision-link a { color: var(--brand-deep); font-weight: 600; }
.journey-flow { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: 12px; padding-top: 10px;
  border-top: 1px dashed var(--line); font-size: 10.5px; color: var(--muted); }
.journey-flow .jf-step { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 2px 7px; }
.journey-flow .jf-done { background: var(--ok-tint); border-color: color-mix(in srgb, var(--ok) 28%, #fff); color: var(--ok); font-weight: 600; }
.journey-flow .jf-arrow { color: var(--muted); }
.journey-flow .jf-sep { font-style: italic; }
@media (max-width: 640px) {
  .coverage-head strong { font-size: 18px; }
  .journey-flow { font-size: 10px; }
}

/* ---- Sprint 19 · ficha de caracterização da Etapa 2 (contexto-processo) ---- */
.proc-ficha .panel-body { gap: 0; }
.proc-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px;
  background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.proc-fact { display: flex; flex-direction: column; gap: 3px; min-width: 0; background: var(--panel); padding: 12px 14px; }
.proc-fact.wide { grid-column: 1 / -1; }
.proc-fact-label { font-size: 9.5px; font-weight: 700; letter-spacing: .55px; text-transform: uppercase; color: var(--muted); }
.proc-fact-value { font-size: 13px; font-weight: 600; color: var(--ink); line-height: 1.45; overflow-wrap: anywhere; }
.proc-block { border-top: 1px solid var(--line-soft); padding-top: 18px; margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.proc-block-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.proc-block-title { font-family: var(--serif); font-size: 17px; font-weight: 600; color: var(--ink); line-height: 1.2; }
.proc-block-sub { font-size: 11.5px; color: var(--muted); max-width: 72ch; margin-top: 2px; }
.proc-activities { margin: 0; padding-left: 20px; display: grid; gap: 5px; color: var(--ink); font-size: 13px; }
.proc-activities li { padding-left: 2px; line-height: 1.45; overflow-wrap: anywhere; }
.proc-activities li::marker { color: var(--brand); font-weight: 700; font-size: 11px; }
.proc-char-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.proc-char { display: flex; flex-direction: column; gap: 6px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--panel); padding: 10px 12px; min-width: 0; }
.proc-char-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.proc-char-label { font-size: 11px; font-weight: 700; color: var(--ink); line-height: 1.3; }
.proc-char-head .badge { font-size: 9px; padding: 1px 6px; }
.proc-char-value { font-size: 11.5px; color: var(--muted); line-height: 1.5; overflow-wrap: anywhere; }
.proc-char-ask { align-self: flex-start; border: 0; background: transparent; padding: 0; cursor: pointer;
  font-size: 10.5px; font-weight: 650; color: var(--brand-deep); text-decoration: underline; text-underline-offset: 2px; }
.proc-char-ask:hover { color: var(--brand); }
.proc-char-ask:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
.proc-hyp-list { display: flex; flex-direction: column; gap: 8px; }
.proc-hyp { border: 1px solid color-mix(in srgb, var(--warn) 28%, #fff); border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--warn-tint) 55%, #fff); padding: 10px 12px; }
.proc-hyp-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.proc-hyp-top strong { font-size: 12px; color: var(--ink); }
.proc-hyp-text { font-size: 11.5px; color: var(--ink); opacity: .82; line-height: 1.5; margin-top: 4px; overflow-wrap: anywhere; }
.proc-hyp-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.proc-states { display: flex; flex-direction: column; gap: 6px; }
.proc-state { display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--panel); padding: 10px 12px; }
.proc-state-dot { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; margin-top: 4px; background: var(--muted); }
.proc-state.ok .proc-state-dot { background: var(--ok); }
.proc-state.warn .proc-state-dot { background: var(--warn); }
.proc-state.info .proc-state-dot { background: var(--brand); }
.proc-state-body { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.proc-state-body strong { font-size: 11.5px; color: var(--ink); }
.proc-state-body span { font-size: 11px; color: var(--muted); line-height: 1.45; overflow-wrap: anywhere; }
.proc-state-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.proc-state-actions .btn { text-decoration: none; }
.proc-actions { flex-wrap: wrap; margin-top: 4px; }
.proc-actions .btn { text-decoration: none; }
@media (max-width: 720px) {
  .proc-char-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 480px) {
  .proc-facts { grid-template-columns: minmax(0, 1fr); }
  .proc-state { flex-direction: column; }
  .proc-state-actions { width: 100%; }
  .proc-state-actions .btn { flex: 1 1 auto; justify-content: center; }
  .proc-hyp-actions .btn { flex: 1 1 auto; justify-content: center; }
}
.proc-block[id] { scroll-margin-top: 92px; }

/* ---- Sprint 20 · dores, gargalos, indicadores e revisão da Etapa 2 ---- */
.proc-ai-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.proc-ai-note { font-size: 11.5px; color: var(--muted); line-height: 1.55; max-width: 78ch; }
.proc-ai-note strong { color: var(--ink); }
.proc-signal-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.proc-signal { gap: 7px; }
.proc-signal .proc-char-label { font-size: 11.5px; }
.proc-signal-list { margin: 0; padding-left: 16px; display: grid; gap: 4px; color: var(--ink); font-size: 11.5px; }
.proc-signal-list li { line-height: 1.45; overflow-wrap: anywhere; }
.proc-signal-list li::marker { color: var(--brand); font-weight: 700; }
.proc-signal .proc-hyp-actions { margin-top: auto; padding-top: 4px; }
.proc-review { border-top-color: color-mix(in srgb, var(--brand) 30%, var(--line-soft)); }
.proc-review .status { margin-top: 2px; }
.proc-review .field { margin: 0; }
@media (max-width: 980px) {
  .proc-signal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .proc-signal-grid { grid-template-columns: minmax(0, 1fr); }
  .proc-signal .proc-hyp-actions .btn { flex: 1 1 auto; justify-content: center; }
}

/* ---- Sprint 21 · Mermaid renderizado + fallback textual (RF16) ----------- */
.diagram-caption { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.diagram-context { font-size: 10px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--muted); }
.diagram-canvas { margin: 10px 0 4px; padding: 12px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--panel); overflow-x: auto; }
.diagram-canvas svg { display: block; width: 100%; height: auto; max-height: 460px; min-width: 260px; }
.diagram-loading { padding: 18px 6px; text-align: center; font-size: 12px; color: var(--muted); }
.diagram-canvas .dg-node-shape { fill: var(--panel); stroke: var(--brand); stroke-width: 1.4; }
.diagram-canvas .dg-node--decision .dg-node-shape { fill: var(--warn-tint); stroke: var(--warn); stroke-dasharray: 4 3; }
.diagram-canvas .dg-node-text { fill: var(--ink); font-family: var(--sans); font-size: 12px; font-weight: 600; }
.diagram-canvas .dg-edge-path { fill: none; stroke: var(--muted); stroke-width: 1.5; }
.diagram-canvas .dg-edge-dashed { stroke-dasharray: 5 4; }
.diagram-canvas .dg-arrow-head { fill: var(--muted); }
.diagram-canvas .dg-edge-label-bg { fill: var(--panel); stroke: var(--line); stroke-width: 1; }
.diagram-canvas .dg-edge-label { fill: var(--muted); font-family: var(--sans); font-size: 10.5px; font-weight: 600; }
.diagram-fallback { margin-top: 10px; font-size: 11.5px; color: var(--muted); }
.diagram-fallback-label { display: inline-block; margin-bottom: 4px; font-size: 10px; font-weight: 700;
  letter-spacing: .5px; text-transform: uppercase; color: var(--muted); }
.diagram-fallback p { margin: 0; line-height: 1.55; }
.diagram-tools { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.diagram-consistency { margin-top: 10px; display: grid; gap: 6px; }
.asis-diagram { margin-top: 10px; }
#exportacao-diagramas .diagram { margin: 0; }
#exportacao-diagramas .diagram + .diagram { margin-top: 16px; }
.diagram-source { margin-top: 8px; }
.diagram-source summary { cursor: pointer; font-size: 11px; font-weight: 650; color: var(--brand); }
.diagram-source[open] summary { margin-bottom: 6px; }
.diagram-failure { display: grid; gap: 4px; padding: 12px; border: 1px solid color-mix(in srgb, var(--warn) 45%, var(--line));
  background: var(--warn-tint); border-radius: var(--radius-sm); font-size: 12px; line-height: 1.5; color: var(--ink); }
.diagram-failure strong { color: var(--warn); }
.diagram--text-only .diagram-canvas { display: none; }
.diagram--failed .diagram-canvas { padding: 0; border: 0; background: transparent; }
.md-heading { margin: 14px 0 6px; font-size: 14px; font-weight: 650; color: var(--ink); }
.md-list { margin: 8px 0; padding-left: 20px; display: grid; gap: 4px; }
.md-code { margin: 10px 0; padding: 12px; border-radius: 6px; background: var(--bg-2);
  border: 1px solid var(--line); font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.doc-body blockquote { margin: 10px 0; padding: 8px 12px; border-left: 3px solid var(--line-strong);
  color: var(--muted); background: var(--bg); border-radius: 0 6px 6px 0; }
.doc-body code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 4px; padding: 1px 4px; }
.doc-body p + p { margin-top: 8px; }
#ws-asis-ficha .proc-facts { margin-bottom: 0; }
#ws-asis-ficha .proc-char-value { overflow-wrap: anywhere; }
@media (max-width: 720px) {
  .diagram-canvas { padding: 8px; }
  .diagram-canvas svg { min-width: 220px; }
}

/* ---- Sprint 23 · Diagnóstico fundamentado da Etapa 4 ---------------------- */
.diag-facts { margin-bottom: 0; }
.diag-grid { margin-top: 2px; }
.diag-card { border-left: 3px solid var(--line-strong); }
.diag-card:has(.badge.ok) { border-left-color: var(--ok); }
.diag-card:has(.badge.warn) { border-left-color: var(--warn); }
.diag-evidence-check { display: grid; gap: 6px; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--bg); }
.diag-evidence-check .status { margin: 0; }
.diag-tables { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.diag-table-block { min-width: 0; }
.diag-table-block .table-wrap { margin-top: 2px; }
.diag-hyp-block { margin-top: 0; }
.diag-hyp-reason { display: block; margin-top: 2px; font-size: 10.5px; color: var(--muted); }
.diag-hyp .proc-hyp-actions .btn { text-decoration: none; }
#ws-diagnostico-ficha .proc-char-value { overflow-wrap: anywhere; }
#ws-diagnostico-ficha .doc-table-wrap { border-radius: var(--radius-sm); }
@media (max-width: 720px) {
  .diag-grid { grid-template-columns: minmax(0, 1fr); }
  .diag-evidence-check { padding: 10px 12px; }
  .diag-hyp .proc-hyp-actions .btn { flex: 1 1 auto; justify-content: center; }
}

.tobe-facts { margin-bottom: 0; }
.tobe-block .tobe-text { margin: 0; font-size: 12.5px; line-height: 1.6; color: var(--ink); max-width: 84ch; overflow-wrap: anywhere; }
.tobe-block .proc-signal-list { font-size: 12px; }
.tobe-vinculos li { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.tobe-vinculos .badge { flex: 0 0 auto; font-size: 9px; }
.tobe-levers { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tobe-lever { border-left: 3px solid var(--line-strong); }
.tobe-lever:has(.badge.ok) { border-left-color: var(--ok); }
.tobe-lever:has(.badge.warn) { border-left-color: var(--warn); }
#ws-tobe-ficha .doc-table-wrap { border-radius: var(--radius-sm); }
#ws-tobe-ficha .proc-char-value { overflow-wrap: anywhere; }
.tobe-alts .tobe-alt-request { flex-wrap: wrap; }
.tobe-alt-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tobe-alt { display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); }
.tobe-alt-on { border-color: color-mix(in srgb, var(--brand) 55%, var(--line));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 26%, transparent); }
.tobe-alt-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.tobe-alt-title { font-family: var(--serif); font-size: 15px; font-weight: 600; color: var(--ink); line-height: 1.25; overflow-wrap: anywhere; }
.tobe-alt-summary { margin: 0; font-size: 12px; line-height: 1.55; color: var(--muted); overflow-wrap: anywhere; }
.tobe-alt-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.tobe-alt-detail { margin: 0; display: grid; gap: 7px; }
.tobe-alt-detail div { display: grid; gap: 2px; }
.tobe-alt-detail dt { font-size: 9.5px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); }
.tobe-alt-detail dd { margin: 0; font-size: 11.5px; line-height: 1.5; color: var(--ink); overflow-wrap: anywhere; }
.tobe-alt-actions { flex-wrap: wrap; margin-top: auto; padding-top: 4px; }
.tobe-alt-actions .btn { text-decoration: none; }
.tobe-alt-empty { padding: 16px 12px; }
.tobe-comparison { display: grid; gap: 8px; margin-top: 12px; }
.tobe-compare-wrap { border: 1px solid var(--line); border-radius: var(--radius-sm); }
.tobe-compare { margin: 0; min-width: 680px; }
.tobe-compare caption { caption-side: top; text-align: left; padding: 10px 12px; font-size: 11px; color: var(--muted); line-height: 1.45; }
.tobe-compare th[scope="row"] { width: 190px; background: var(--bg); font-size: 10.5px; letter-spacing: .3px; text-transform: uppercase; color: var(--muted); vertical-align: top; }
.tobe-compare td { font-size: 11.5px; line-height: 1.5; vertical-align: top; overflow-wrap: anywhere; }
.tobe-compare th[scope="col"] { min-width: 180px; }
.tobe-compare-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tobe-compare-hint { font-size: 11px; line-height: 1.5; color: var(--muted); flex: 1 1 220px; }
.tobe-compare-col { display: table-cell; }
.tobe-compare-title { display: block; margin-bottom: 5px; font-family: var(--serif); font-size: 13px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--ink); }
.tobe-compare-col.is-adopted { background: color-mix(in srgb, var(--ok) 8%, var(--panel)); box-shadow: inset 0 3px 0 var(--ok); }
.tobe-compare-col.is-adopted .tobe-compare-title { color: var(--ok); }
@media (max-width: 980px) {
  .tobe-levers { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tobe-alt-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .tobe-levers { grid-template-columns: minmax(0, 1fr); }
  .tobe-alt-actions .btn { flex: 1 1 auto; justify-content: center; }
  .tobe-compare { min-width: 560px; }
  .tobe-compare th[scope="row"] { width: 150px; }
}
.tobe-entregas .table-wrap, .tobe-vinculo .table-wrap { margin-top: 2px; }
.tobe-entregas .tobe-text { font-size: 12px; }

/* Sprint 27 · Oportunidades: cobertura de tipos e solicitação de alternativa por chat */
.opp-coverage { display: grid; gap: 8px; margin-top: 12px; }
.opp-coverage-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.opp-coverage-head strong { font-size: 11px; letter-spacing: .35px; text-transform: uppercase; color: var(--muted); }
.opp-coverage-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.opp-coverage-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 9px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--panel) 88%, var(--bg)); min-width: 0; }
.opp-coverage-list li.is-absent { border-style: dashed; background: var(--bg); }
.opp-coverage-label { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ink); min-width: 0; overflow-wrap: anywhere; }
.opp-coverage-label .dot { width: 7px; height: 7px; border-radius: 999px; background: currentColor; flex: 0 0 auto; }
.opp-coverage-list .badge { flex: 0 0 auto; }
.opps-chat-log { display: grid; gap: 8px; margin: 12px 0; max-height: 300px; overflow: auto;
  padding: 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); }
.opps-chat-empty { font-size: 11.5px; line-height: 1.5; color: var(--muted); }
.opps-chat-msg { display: grid; gap: 4px; padding: 9px 11px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--panel); max-width: 92%; min-width: 0; }
.opps-chat-msg.is-user { justify-self: end; background: color-mix(in srgb, var(--brand) 8%, var(--panel));
  border-color: color-mix(in srgb, var(--brand) 30%, var(--line)); }
.opps-chat-msg.is-ia { justify-self: start; }
.opps-chat-msg-head { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-size: 10px; color: var(--muted); letter-spacing: .25px; text-transform: uppercase; }
.opps-chat-msg-head strong { font-size: 10.5px; color: var(--ink); letter-spacing: .3px; }
.opps-chat-msg-body { font-size: 12px; line-height: 1.55; color: var(--ink); overflow-wrap: anywhere; }
.opps-chat-sugestoes { display: flex; flex-wrap: wrap; gap: 6px; }
.opps-chat-sugestoes .btn { flex: 0 1 auto; }
.opps-chat-revision { display: grid; gap: 4px; padding: 9px 11px; border-left: 3px solid var(--warn);
  border-radius: var(--radius-sm); background: var(--warn-tint); font-size: 11.5px; line-height: 1.5; color: var(--ink); }
.opps-chat-revision strong { font-size: 11px; letter-spacing: .3px; text-transform: uppercase; color: var(--warn); }
.opps-chat-revision a { color: var(--brand); font-weight: 600; text-decoration: none; }
.opps-chat-revision a:hover, .opps-chat-revision a:focus-visible { text-decoration: underline; }
@media (max-width: 720px) {
  .opp-coverage-list { grid-template-columns: minmax(0, 1fr); }
  .opps-chat-msg { max-width: 100%; }
  .opps-chat-sugestoes .btn { flex: 1 1 46%; justify-content: center; }
}

/* ==========================================================================
   Sprint 28 · PRD por oportunidade selecionada (T14) e exportação fiel (T15)
   - Sumário editorial, requisitos priorizados, critérios verificáveis.
   - Estados de aprovação e de exportação com ícone + texto (nunca só cor).
   ========================================================================== */
.prd-sumario { display: grid; gap: 2px; }
.prd-sumario a { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 8px; align-items: center;
  padding: 7px 8px; border-radius: var(--radius-sm); color: var(--ink); font-size: 12px; line-height: 1.35; }
.prd-sumario a:hover, .prd-sumario a:focus-visible { background: var(--bg); text-decoration: none; }
.prd-sumario .prd-sum-num { color: var(--brand); font-weight: 700; font-size: 11px; font-variant-numeric: tabular-nums; }
.prd-sumario .prd-sum-label { min-width: 0; overflow-wrap: anywhere; }
.prd-sumario .prd-sum-state { width: 8px; height: 8px; border-radius: 999px; flex: 0 0 auto; }
.prd-sumario a.is-missing { color: var(--muted); }
.prd-sumario a.is-missing .prd-sum-num { color: var(--muted); }
.prd-sumario a.is-missing .prd-sum-state { background: transparent; border: 1px dashed var(--muted); }
.prd-sumario a.is-filled .prd-sum-state { background: var(--ok); }

.prd-secao-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.prd-secao-missing { border-left: 3px solid var(--warn); background: var(--warn-tint); padding: 10px 12px;
  border-radius: var(--radius-sm); font-size: 12px; color: var(--ink); }
.prd-req-prio { white-space: nowrap; }
.prd-req-prio .badge { font-size: 10px; }
.prd-texto-longo p { margin: 0 0 8px; }
.prd-texto-longo p:last-child { margin-bottom: 0; }
.prd-vinculo-linha { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); }
.prd-vinculo-linha .muted { font-size: 11px; }
.prd-vinculo-linha a { font-weight: 600; }
.prd-vinculo-linha.is-ausente { border-style: dashed; color: var(--muted); }
.prd-aprovacao-bloco { display: grid; gap: 10px; }
.prd-aprovacao-carimbo { display: grid; gap: 2px; padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid color-mix(in srgb, var(--ok) 26%, var(--line)); background: var(--ok-tint); }
.prd-aprovacao-carimbo strong { color: var(--ok); font-size: 12px; }
.prd-aprovacao-carimbo span { font-size: 11.5px; color: var(--ink); }
.prd-acoes { display: flex; flex-wrap: wrap; gap: 8px; }
.prd-acoes .btn { flex: 0 1 auto; }

.export-formatos { display: flex; flex-wrap: wrap; gap: 8px; }
.export-formatos .btn { min-width: 0; }
.export-formatos .btn[aria-pressed="true"] { background: var(--brand-tint); border-color: color-mix(in srgb, var(--brand) 42%, var(--line)); color: var(--brand-deep); }
.export-estado { display: grid; gap: 8px; }
.export-progresso { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.export-progresso .dot { width: 8px; height: 8px; border-radius: 999px; background: var(--brand); animation: export-pulse 1.1s ease-in-out infinite; }
@keyframes export-pulse { 0%, 100% { opacity: .35; transform: scale(.85); } 50% { opacity: 1; transform: scale(1); } }
.export-arquivo { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--ok) 26%, var(--line)); background: var(--ok-tint); border-radius: var(--radius-sm); }
.export-arquivo strong { font-size: 12px; color: var(--ok); }
.export-arquivo .panel-note { margin: 0; }
@media (prefers-reduced-motion: reduce) { .export-progresso .dot { animation: none; } }

.prd-evidencia-list { display: grid; gap: 8px; }
.prd-evidencia { display: grid; gap: 5px; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); }
.prd-evidencia-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; }
.prd-evidencia-secao { font-size: 11px; color: var(--muted); text-align: right; }
.prd-evidencia-trecho { font-size: 12.5px; line-height: 1.5; color: var(--ink); }
.prd-evidencia-fonte { font-size: 11px; color: var(--muted); overflow-wrap: anywhere; }

.ws-prd-list { display: grid; gap: 10px; }
.ws-prd-card { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); }
.ws-prd-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.ws-prd-card-title { font-family: var(--serif); font-size: 15px; font-weight: 600; line-height: 1.3; }
.ws-prd-card-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.ws-prd-card-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ws-prd-kpis { display: flex; flex-wrap: wrap; gap: 6px; }

.export-checklist { display: grid; gap: 6px; }
.export-check { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); font-size: 12px; }
.export-check .badge { flex: 0 1 auto; text-align: right; }
.export-secoes-escolha { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 6px; }
.export-secoes-escolha .check { padding: 7px 9px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); font-size: 12px; }
.export-previa-codigo { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px; line-height: 1.55; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px; max-height: 420px; overflow: auto; }

@media (max-width: 640px) {
  .ws-prd-card-head { flex-direction: column; }
  .ws-prd-card-actions { flex-direction: column; align-items: stretch; }
  .export-check { align-items: flex-start; }
}

@media print {
  .sidebar, .sidebar-scrim, .topbar, .toast-wrap, .no-print, .notif-wrap { display: none !important; }
  .app-shell { display: block !important; }
  .main { margin: 0 !important; }
  .content { padding: 0 !important; max-width: none !important; }
  .panel { border: 1px solid #9aa8b3 !important; box-shadow: none !important; break-inside: avoid; }
  .page-head .head-actions, .page-head .eyebrow { display: none !important; }
  body { background: #fff !important; }
  a[href]::after { content: "" !important; }
  #exportacao-previa, #prd-secoes { break-inside: auto; }
  .doc-section { break-inside: avoid; }
}
.btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }

/* ==========================================================================
   Sprint 31 · T12 Análise de impacto — decisão seletiva
   - Nada é sobrescrito automaticamente; cada sugestão exige confirmação.
   - Estados com ícone/rótulo textual (nunca somente cor) e layout 360px.
   ========================================================================== */
.impacto-aside { align-self: start; }
.impacto-decisao { position: sticky; top: 80px; }
.impacto-resumo { display: grid; gap: 6px; padding: 12px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--bg); }
.impacto-resumo-linha { display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  font-size: 12px; color: var(--muted); }
.impacto-resumo-linha strong { font-family: var(--serif); font-size: 18px; line-height: 1; color: var(--ink);
  font-variant-numeric: tabular-nums; }
.impacto-distribuicao { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--bg-2); }
.impacto-distribuicao span { display: block; height: 100%; transition: width .35s var(--ease); }
.impacto-distribuicao .is-pendente, .impacto-legenda i.is-pendente { background: var(--warn); }
.impacto-distribuicao .is-aplicada, .impacto-legenda i.is-aplicada { background: var(--ok); }
.impacto-distribuicao .is-descartada, .impacto-legenda i.is-descartada { background: var(--line-strong); }
.impacto-legenda { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 10.5px; color: var(--muted); }
.impacto-legenda span { display: inline-flex; align-items: center; gap: 5px; }
.impacto-legenda i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; flex: 0 0 auto; }
.impacto-acoes { display: flex; flex-direction: column; gap: 8px; }
.impacto-confirmacao { display: flex; flex-direction: column; gap: 10px; padding: 12px;
  border: 1px solid color-mix(in srgb, var(--warn) 34%, var(--line)); border-radius: var(--radius-sm);
  background: var(--warn-tint); }
.impacto-confirmacao strong { font-size: 12.5px; color: var(--warn); }
.impacto-bloqueio { border-left: 3px solid var(--warn); }
.impacto-lista { display: flex; flex-direction: column; gap: 12px; }
.impacto-sugestao { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel);
  padding: 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), background .15s var(--ease); }
.impacto-sugestao:hover { border-color: color-mix(in srgb, var(--brand) 38%, var(--line)); }
.impacto-sugestao.is-selected { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
.impacto-sugestao.is-done { background: color-mix(in srgb, var(--bg) 72%, var(--panel)); }
.impacto-sugestao-top { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.impacto-sugestao-check { display: flex; align-items: center; padding-top: 3px; }
.impacto-sugestao-check input { width: 16px; height: 16px; accent-color: var(--brand); }
.impacto-sugestao-conteudo { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.impacto-sugestao-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.impacto-sugestao-title { font-family: var(--serif); font-size: 15px; font-weight: 600; line-height: 1.3;
  color: var(--ink); overflow-wrap: anywhere; }
.impacto-sugestao-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 4px;
  font-size: 11px; color: var(--muted); }
.impacto-sugestao-diff { margin: 0; font-size: 12.5px; line-height: 1.6; color: var(--ink); overflow-wrap: anywhere; }
.impacto-sugestao-acoes { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 2px; }
.impacto-sugestao-acoes .btn { flex: 0 1 auto; }
.impacto-fallback { font-size: 12px; }
.impacto-estados { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.impacto-estado { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); }
.impacto-estado strong { font-size: 12px; color: var(--ink); }
.impacto-estado span { font-size: 11px; line-height: 1.5; color: var(--muted); overflow-wrap: anywhere; }
.impacto-doc-acoes { display: flex; flex-wrap: wrap; gap: 6px; }

@media (max-width: 1100px) {
  .impacto-decisao { position: static; }
}
@media (max-width: 720px) {
  .impacto-estados { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .impacto-sugestao-acoes .btn { flex: 1 1 46%; justify-content: center; }
}
@media (max-width: 480px) {
  .impacto-estados { grid-template-columns: minmax(0, 1fr); }
  .impacto-sugestao { padding: 12px; }
  .impacto-sugestao-acoes .btn { flex: 1 1 100%; }
}

#impacto-kpi-status { font-size: 18px; line-height: 1.25; letter-spacing: -.2px; overflow-wrap: anywhere; }
@media (max-width: 480px) {
  #impacto-kpi-status { font-size: 17px; }
}

@media (max-width: 480px) {
  #impacto-filtro { display: flex; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  #impacto-filtro button { flex: 0 0 auto; }
}

/* ==========================================================================
   Sprint 33 — Dashboards de decisão e relatórios auditáveis
   ========================================================================== */
.print-only { display: none; }

.dash-toolbar { margin-bottom: 20px; }
.dash-filters { align-items: flex-end; gap: 10px 12px; }
.dash-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.dash-field > span { font-size: 10px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); }
.dash-field .input, .dash-field .select { min-width: 0; }
.dash-field .input[type="date"] { min-width: 138px; }
.dash-check { display: inline-flex; align-items: center; gap: 8px; min-height: 34px; font-size: 12px; color: var(--ink); }
.dash-check input { accent-color: var(--brand); }
.dash-filters .segmented { margin-bottom: 0; }
.dash-filter-pop { position: relative; }
.dash-filter-pop summary { list-style: none; cursor: pointer; display: flex; flex-direction: column; gap: 4px; padding: 0; }
.dash-filter-pop summary::-webkit-details-marker { display: none; }
.dash-filter-pop summary > .dash-filter-label { font-size: 10px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); }
.dash-filter-pop summary > span:last-child {
  display: inline-flex; align-items: center; min-height: 36px; padding: 0 12px; border: 1px solid var(--line-strong);
  border-radius: var(--radius); background: var(--panel); font-size: 12.5px; font-weight: 600; color: var(--ink); white-space: nowrap;
}
.dash-filter-pop summary:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: var(--radius); }
.dash-filter-pop[open] summary > span:last-child { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-tint); }
.dash-filter-pop-body {
  position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; min-width: 270px; max-height: 280px; overflow: auto;
  background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: var(--shadow-2);
  padding: 10px; display: flex; flex-direction: column; gap: 2px;
}
.dash-filter-pop-body .dash-check { min-height: 30px; padding: 2px 6px; border-radius: 6px; }
.dash-filter-pop-body .dash-check:hover { background: var(--bg); }
.dash-filter-pop-body .dash-check span { overflow-wrap: anywhere; }

.chart-data { margin-top: 12px; border-top: 1px solid var(--line-soft); padding-top: 10px; }
.chart-data .table-wrap { max-height: 330px; overflow: auto; }
.chart-data .table td, .chart-data .table th { font-size: 11.5px; padding: 8px 10px; }

.th-sort { border: 0; background: transparent; color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; padding: 0; }
.th-sort:hover, .th-sort:focus-visible { color: var(--brand-deep); text-decoration: underline; }

.dash-track { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.dash-step { position: relative; min-width: 0; }
.dash-step:not(:last-child)::after {
  content: ""; position: absolute; top: 17px; left: calc(50% + 18px); right: calc(-50% + 18px);
  height: 2px; background: var(--line); z-index: 0;
}
.dash-step-link { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 6px; align-items: center; text-align: center;
  padding: 4px 2px 8px; border-radius: var(--radius); color: var(--ink); text-decoration: none; }
.dash-step-link:hover { background: var(--bg); text-decoration: none; }
.dash-step-dot { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700;
  border: 2px solid var(--line-strong); background: var(--panel); color: var(--muted); }
.dash-step.done .dash-step-dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.dash-step.current .dash-step-dot { background: var(--brand); border-color: var(--brand); color: #fff; }
.dash-step.blocked .dash-step-dot { background: var(--bg-2); color: var(--muted); border-style: dashed; }
.dash-step.done:not(:last-child)::after { background: color-mix(in srgb, var(--ok) 50%, var(--line)); }
.dash-step-body { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; width: 100%; }
.dash-step-name { font-size: 11.5px; font-weight: 650; line-height: 1.25; overflow-wrap: anywhere; }
.dash-step-meta { font-size: 10.5px; color: var(--muted); line-height: 1.3; overflow-wrap: anywhere; }
.dash-step .badge { font-size: 8.5px; padding: 1px 6px; }

.dash-audit-detail { border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); margin: 12px; padding: 14px; }
.dash-audit-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.dash-kv { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 6px 14px; margin: 0; font-size: 12px; }
.dash-kv dt { color: var(--muted); font-weight: 650; }
.dash-kv dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }

.dash-report-desc { display: flex; flex-direction: column; gap: 3px; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--bg); margin-bottom: 14px; font-size: 12px; color: var(--muted); line-height: 1.5; }
.dash-report-desc strong { color: var(--ink); font-size: 13px; }
.dash-report-desc .badge { align-self: flex-start; margin-top: 4px; }
.dash-report-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.dash-report-totais { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 16px; }
.dash-report-totais .kpi { padding: 14px 16px; }
.dash-report-totais .kpi-value { font-size: 22px; }
#reports-resultado { margin-top: 6px; }

@media (max-width: 1080px) {
  .dash-track { grid-template-columns: repeat(4, minmax(0, 1fr)); row-gap: 18px; }
  .dash-step:not(:last-child)::after { display: none; }
  .dash-report-totais { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .dash-filters { align-items: stretch; }
  .dash-field { flex: 1 1 100%; }
  .dash-field .select, .dash-field .input, .dash-field .input[type="date"] { width: 100%; min-width: 0; }
  .dash-filter-pop { flex: 1 1 100%; }
  .dash-filter-pop summary > span:last-child { width: 100%; justify-content: space-between; }
  .dash-filter-pop-body { position: static; margin-top: 6px; min-width: 0; width: 100%; box-shadow: none; }
  .dash-track { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-report-totais { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-kv { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .dash-kv dt { margin-top: 8px; }
}
@media (max-width: 420px) {
  .dash-track { grid-template-columns: minmax(0, 1fr); }
  .dash-report-totais { grid-template-columns: minmax(0, 1fr); }
  .dash-step-link { flex-direction: row; text-align: left; gap: 10px; align-items: flex-start; }
  .dash-step-body { align-items: flex-start; }
}

@media print {
  @page { margin: 14mm; }
  body.app-body { background: #fff; }
  .sidebar, .topbar, .sidebar-scrim, .no-print, .head-actions, .dash-toolbar, .toast-wrap, .notif-panel { display: none !important; }
  .main { margin: 0 !important; }
  .content { max-width: none !important; width: 100% !important; padding: 0 !important; }
  .print-only { display: flex !important; flex-direction: column; gap: 2px; border-bottom: 1px solid #999;
    padding-bottom: 8px; margin-bottom: 16px; font-size: 10.5px; color: #333; }
  .print-only strong { font-size: 14px; color: #111; }
  .panel, .kpi { box-shadow: none !important; break-inside: avoid; }
  .charts-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .charts-grid .span-2 { grid-column: span 2; }
  .chart-data[hidden] { display: none !important; }
  a[href]::after { content: ""; }
}

.dash-daily { margin-top: 12px; border-top: 1px solid var(--line-soft); padding-top: 10px; }
.dash-daily > summary { cursor: pointer; font-size: 12px; font-weight: 650; color: var(--brand-deep); }
.dash-daily > summary:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
.dash-daily > div { margin-top: 10px; }

/* Sprint 34 — detalhamento dos painéis e paginação de relatórios */
.dash-drill { margin-top: 18px; }
.dash-drill .panel-body { padding-top: 6px; }
.dash-drill .table-wrap { margin: 0; }
.dash-total-groups { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.dash-total-group { border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); padding: 12px 14px; }
.dash-total-title { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.dash-total-group .chips { margin: 0; }
.dash-pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 14px; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--radius) var(--radius); background: var(--panel); }
.dash-pager-info { font-size: 12px; color: var(--muted); }
.dash-pager-size { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.dash-pager-size .select { width: auto; min-width: 74px; }
.dash-pager .btn[disabled] { opacity: .45; cursor: not-allowed; }
@media (max-width: 640px) {
  .dash-pager { justify-content: flex-start; }
  .dash-pager .row { width: 100%; }
  .dash-pager .row .btn { flex: 1 1 0; }
}
@media print {
  .dash-pager { display: none !important; }
  .dash-total-groups { break-inside: avoid; }
}
@media print {
  .print-report-foot { margin-top: 14px; border-top: 1px solid #999; padding-top: 6px; font-size: 10px; color: #333; }
}

/* Sprint 36 — agrupamentos e linha do tempo dos relatórios auditáveis */
.dash-report-groups { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.dash-report-groups:empty { display: none; }
.dash-report-timeline { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); padding: 14px 16px; margin-bottom: 16px; }
.dash-report-timeline[hidden] { display: none; }
.dash-timeline { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.dash-timeline li { display: grid; grid-template-columns: minmax(120px, 220px) auto 1fr; align-items: baseline; gap: 8px;
  padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); background: var(--bg); }
.dash-timeline li > span:last-child { color: var(--muted); font-size: 12px; }
.dash-timeline .badge { justify-self: start; }
@media (max-width: 640px) {
  .dash-timeline li { grid-template-columns: 1fr; }
  .dash-report-timeline { padding: 12px; }
}
.dash-group-branch { display: flex; flex-direction: column; gap: 8px; }
.dash-group-children { display: flex; flex-wrap: wrap; gap: 6px; padding-left: 14px; border-left: 1px dashed var(--line); }
.dash-group-children .chip { background: var(--panel); }
@media (max-width: 640px) {
  .dash-group-children { padding-left: 10px; }
}
@media print {
  .dash-report-groups, .dash-report-timeline { break-inside: avoid; }
  .dash-group-branch { break-inside: avoid; }
}

/* ==========================================================================
   Sprint 38 · Experiência responsiva, acessível e fiel ao Design Freeze (1/3)
   Desktop: navegação + documento + chat simultâneos.
   Tablet: navegação em painel, documento prioritário e chat em gaveta.
   Smartphone: abas Jornada/Documento/Chat, contexto em folha e ação fixa.
   ========================================================================== */

/* Acesso rápido por teclado (primeiro elemento focável da página) */
.skip-link {
  position: fixed; left: 12px; top: 8px; z-index: 120; padding: 10px 16px;
  border-radius: var(--radius); background: var(--brand-deep); color: #fff;
  font-size: 13px; font-weight: 700; box-shadow: var(--shadow-2, 0 8px 24px rgba(15, 36, 51, .18));
  transform: translateY(-160%); transition: transform .16s ease;
}
.skip-link:focus-visible { transform: translateY(0); text-decoration: none; outline: 3px solid #fff; outline-offset: 2px; }

/* Estado global de rede — offline / indisponível */
.net-banner {
  position: sticky; top: 0; z-index: 110; display: flex; align-items: center; gap: 10px;
  padding: 8px 16px; border-bottom: 1px solid color-mix(in srgb, var(--warn) 30%, var(--line));
  background: var(--warn-tint); color: var(--warn); font-size: 12.5px; font-weight: 600;
}
.net-banner[hidden] { display: none !important; }
.net-banner.is-offline { background: var(--warn-tint); color: var(--warn); }
.net-banner.is-unavailable { background: var(--danger-tint); color: var(--danger); border-bottom-color: color-mix(in srgb, var(--danger) 30%, var(--line)); }
.net-banner-dot { width: 9px; height: 9px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
#net-banner-text { flex: 1 1 auto; min-width: 0; }
.net-banner .btn { flex: 0 0 auto; }

/* Foco visível reforçado e ordem lógica */
a:focus-visible, button:focus-visible, [tabindex]:focus-visible, summary:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--brand-deep); outline-offset: 2px; border-radius: 4px;
}
[aria-busy="true"] { cursor: progress; }

/* Status sempre com ícone + texto (nunca apenas cor) */
.badge.ok::before { content: "✓"; font-size: 9px; line-height: 1; }
.badge.warn::before { content: "!"; font-size: 10px; line-height: 1; }
.badge.danger::before { content: "×"; font-size: 11px; line-height: 1; }
.badge.info::before { content: "i"; font-size: 9.5px; font-weight: 800; line-height: 1; font-style: italic; }
.badge.neutral::before { content: "•"; font-size: 10px; line-height: 1; }
.status .dot { box-shadow: 0 0 0 2px color-mix(in srgb, currentColor 16%, transparent); }

/* Resumo de erros de formulário associado aos campos */
.form-error-summary {
  border: 1px solid color-mix(in srgb, var(--danger) 26%, var(--line)); border-radius: var(--radius);
  background: var(--danger-tint); color: var(--danger); padding: 12px 14px; font-size: 12.5px;
}
.form-error-summary ul { margin: 6px 0 0; padding-left: 18px; }
.form-error-summary a { color: inherit; font-weight: 700; text-decoration: underline; }

/* Documento/chat: estados com ícone e texto legíveis */
.doc-state-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.doc-state-row .badge::before { display: inline-block; }

/* ---- Desktop (>=1280): três áreas simultâneas, chat fixo ---------------- */
.app-shell[data-screen="workspace"] .grid-main {
  grid-template-columns: minmax(0, 1fr) 380px; gap: 24px;
}
.app-shell[data-screen="workspace"] .grid-main > .stack:last-child { gap: 16px; }
.app-shell[data-screen="workspace"] #ws-chat-panel { position: sticky; top: 80px; }
.app-shell[data-screen="workspace"] #ws-chat-panel .chat { position: static; max-height: calc(100vh - 180px); }
.tablet-chat-toggle, .tablet-chat-close, .chat-scrim { display: none; }
.mobile-ws-context, .mobile-ws-tabs, .ws-mobile-action { display: none; }

/* ---- Tablet (768–1279): navegação recolhível, documento prioritário,
        chat em gaveta e tabelas com colunas priorizadas -------------------- */
@media (min-width: 768px) and (max-width: 1279px) {
  .app-shell[data-screen="workspace"] .grid-main { grid-template-columns: minmax(0, 1fr); }
  .app-shell[data-screen="workspace"] #ws-jornada-panel { order: 5; }
  .app-shell[data-screen="workspace"] #ws-chat-panel {
    position: fixed; top: 0; right: 0; bottom: 0; left: auto; width: min(430px, 92vw);
    max-height: 100vh; overflow-y: auto; z-index: 86; border-radius: 0; border-left: 1px solid var(--line);
    border-top: 0; border-right: 0; border-bottom: 0; box-shadow: -18px 0 40px rgba(15, 36, 51, .2);
    transform: translateX(104%); transition: transform .22s ease, visibility 0s .22s; padding: 16px;
    visibility: hidden; pointer-events: none;
  }
  .app-shell[data-screen="workspace"] #ws-chat-panel.is-drawer-open {
    transform: translateX(0); visibility: visible; pointer-events: auto; transition: transform .22s ease;
  }
  .app-shell[data-screen="workspace"] #ws-chat-panel .chat { position: static; max-height: none; }
  .tablet-chat-toggle { display: inline-flex; }
  .tablet-chat-close { display: inline-grid; }
  .chat-scrim.is-open {
    display: block; position: fixed; inset: 0; z-index: 85;
    background: rgba(9, 27, 40, .42);
  }
  .table-priority th.col-optional, .table-priority td.col-optional { display: none; }
  .table-priority tbody tr.is-expanded td.col-optional { display: table-cell; }
  .table-priority tbody tr { cursor: pointer; }
  .table-priority tbody tr:focus-visible { outline: 3px solid var(--brand-deep); outline-offset: -3px; }
  .table-priority tbody tr td:first-child { position: relative; }
  .table-priority tbody tr td:first-child::after {
    content: " ⋯"; color: var(--brand); font-weight: 800; font-size: 11px;
  }
  .table-priority tbody tr.is-expanded td:first-child::after { content: " ⌃"; }
}

/* ---- Smartphone (<768): abas fixas, contexto em folha, ação fixa -------- */
@media (max-width: 767px) {
  .app-shell[data-screen="workspace"] .content { padding-bottom: 104px; }
  .app-shell[data-screen="workspace"] .grid-main {
    grid-template-columns: minmax(0, 1fr); gap: 14px;
  }
  .app-shell[data-screen="workspace"] .grid-main > .stack { gap: 14px; }
  .app-shell[data-screen="workspace"] #ws-chat-panel {
    position: static; width: auto; max-height: none; border-radius: var(--radius);
    transform: none; box-shadow: none; border: 1px solid var(--line); padding: 0;
  }
  .tablet-chat-toggle, .tablet-chat-close, .chat-scrim { display: none !important; }

  .mobile-ws-context { display: block; margin-bottom: 12px; }
  .mobile-context-trigger {
    display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px;
    padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--panel); color: var(--ink); text-align: left; cursor: pointer;
  }
  .mobile-context-trigger:hover { border-color: var(--bosia-border-2); background: var(--bg); }
  .mobile-context-icon { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center;
    background: var(--brand-tint); color: var(--brand-deep); flex: 0 0 auto; }
  .mobile-context-icon svg { width: 17px; height: 17px; }
  .mobile-context-copy { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
  .mobile-context-kicker { font-size: 9.5px; font-weight: 700; letter-spacing: .7px;
    text-transform: uppercase; color: var(--muted); }
  .mobile-context-name { font-size: 12.5px; font-weight: 650; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap; }
  .mobile-context-caret { color: var(--muted); flex: 0 0 auto; }
  .mobile-context-sheet {
    position: fixed; left: 12px; right: 12px; top: 64px; z-index: 88;
    background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--radius-lg);
    box-shadow: 0 18px 44px rgba(15, 36, 51, .22); padding: 14px;
    display: flex; flex-direction: column; gap: 8px;
  }
  .mobile-context-sheet[hidden] { display: none !important; }
  .mobile-context-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  .mobile-context-sheet-head strong { font-size: 13px; }
  .mobile-context-option { display: flex; flex-direction: column; gap: 1px; padding: 8px 10px;
    border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--ink); }
  .mobile-context-option:hover { background: var(--bg); text-decoration: none; }
  .mobile-context-actions { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 4px; }
  .mobile-context-actions .btn { flex: 1 1 auto; }

  .mobile-ws-tabs {
    display: flex; gap: 4px; position: sticky; top: 56px; z-index: 24;
    margin: 0 0 14px; padding: 6px; border: 1px solid var(--line); border-radius: 10px;
    background: color-mix(in srgb, var(--panel) 94%, transparent);
    backdrop-filter: blur(8px); box-shadow: 0 1px 2px rgba(15, 36, 51, .05);
  }
  .mobile-ws-tab {
    flex: 1 1 0; min-height: 40px; border: 0; border-radius: 7px; background: transparent;
    color: var(--muted); font-size: 12.5px; font-weight: 700; cursor: pointer;
  }
  .mobile-ws-tab.is-active { background: var(--brand); color: #fff; }
  .mobile-ws-tab:focus-visible { outline: 3px solid var(--brand-deep); outline-offset: 2px; }

  .ws-pane { display: none; }
  .ws-pane.is-active { display: block; }

  .ws-mobile-action {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
    display: flex; align-items: center; gap: 10px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--panel) 96%, transparent); backdrop-filter: blur(10px);
    border-top: 1px solid var(--line); box-shadow: 0 -10px 28px rgba(15, 36, 51, .12);
  }
  .ws-mobile-action[hidden] { display: none !important; }
  .ws-mobile-action-label { flex: 1 1 auto; font-size: 11px; font-weight: 700; letter-spacing: .4px;
    text-transform: uppercase; color: var(--muted); min-width: 0; }
  .ws-mobile-action .btn { flex: 0 0 auto; min-height: 42px; }

  /* Tabelas em cartões com campos essenciais e detalhe expandido */
  table.table-cards { display: block; min-width: 0; width: 100%; border-collapse: separate; }
  table.table-cards thead {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
  }
  table.table-cards tbody { display: block; }
  table.table-cards tbody tr {
    display: block; border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--panel); padding: 8px 12px; margin-bottom: 10px;
  }
  table.table-cards tbody tr:hover { background: var(--panel); }
  table.table-cards tbody tr:focus-visible { outline: 3px solid var(--brand-deep); outline-offset: 1px; }
  table.table-cards tbody td {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
    width: auto; max-width: 100%; padding: 5px 0; border: 0; text-align: left; min-width: 0;
  }
  table.table-cards tbody td::before {
    content: attr(data-label); flex: 0 0 40%; font-size: 9.5px; font-weight: 700;
    letter-spacing: .5px; text-transform: uppercase; color: var(--muted); line-height: 1.5;
  }
  table.table-cards tbody td.num { text-align: left; }
  table.table-cards tbody td.actions { justify-content: flex-end; }
  table.table-cards tbody td.col-optional { display: none; }
  table.table-cards tbody tr.is-expanded td.col-optional { display: flex; }
  table.table-cards tbody td:empty { display: none; }
  table.table-priority tbody tr td:first-child::after { content: " ⋯"; color: var(--brand); font-weight: 800; font-size: 11px; }
  table.table-priority tbody tr.is-expanded td:first-child::after { content: " ⌃"; }
}

/* Telas fora do workspace mantêm a ação primária visível no topo; em
   smartphones os cabeçalhos quebram sem esconder a próxima ação. */
@media (max-width: 767px) {
  .page-head .head-actions .btn { min-height: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  .skip-link, .app-shell[data-screen="workspace"] #ws-chat-panel { transition: none !important; }
}

@media print {
  .net-banner, .skip-link, .mobile-ws-tabs, .mobile-ws-context,
  .ws-mobile-action, .tablet-chat-toggle, .tablet-chat-close, .chat-scrim { display: none !important; }
  .ws-pane { display: block !important; }
}

/* Chat: enviando, erro com nova tentativa e revisão pendente */
.chat-send-state {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border: 1px solid color-mix(in srgb, var(--brand) 28%, var(--line));
  border-radius: var(--radius-sm); background: var(--brand-tint);
  color: var(--brand-deep); font-size: 11.5px; font-weight: 600;
}
.chat-send-state[hidden] { display: none !important; }
.chat-send-spinner {
  width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto;
  border: 2px solid color-mix(in srgb, var(--brand) 30%, #fff);
  border-top-color: var(--brand); animation: bosia-spin .8s linear infinite;
}
@keyframes bosia-spin { to { transform: rotate(360deg); } }
#ws-chat-erro .btn { align-self: flex-start; }
@media (prefers-reduced-motion: reduce) { .chat-send-spinner { animation: none; } }
