*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
html { scroll-behavior: smooth; }
a { color: var(--brand-deep); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
.btn:focus-visible, .search-trigger:focus-visible, .icon-btn:focus-visible, .seg:focus-visible, .tab:focus-visible { outline: none; box-shadow: var(--bosia-ring); }
::selection { background: color-mix(in srgb, var(--brand) 22%, #fff); }
h1, h2, h3, h4, p { margin: 0; }
h1, h2 { font-family: var(--serif); font-weight: 600; letter-spacing: -.015em; font-kerning: normal; }
.num, .kpi .v, .vval, .bv, .lg-val { font-variant-numeric: tabular-nums; }
h1 { font-size: clamp(28px, 3vw, 38px); line-height: 1.12; }
h2 { font-size: 24px; line-height: 1.2; }
h3 { font-size: 16px; line-height: 1.35; font-weight: 650; }
h4 { font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
small { font-size: 12px; }
code, kbd, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
kbd {
  font-size: 11px; border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 5px; padding: 1px 5px; background: var(--surface-2); color: var(--muted);
}
.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;
}
.skip-link { position: fixed; top: 12px; left: 16px; z-index: 300; background: var(--ink); color: #fff; padding: 10px 14px; border-radius: var(--radius); opacity: 0; pointer-events: none; transform: translateY(-160%); transition: transform .15s, opacity .15s; }
.skip-link:focus { opacity: 1; pointer-events: auto; transform: translateY(0); }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; z-index: 40; height: 100vh; display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--surface) 0%, color-mix(in srgb, var(--surface) 92%, var(--bg-2)) 100%);
  border-right: 1px solid var(--line); padding: 20px 16px 16px;
}
.brand { display: flex; gap: 12px; align-items: center; padding: 4px 8px 22px; color: var(--ink); border-radius: var(--radius); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  background: var(--ink); color: #fff; font-family: var(--serif); font-size: 22px; font-weight: 600;
  box-shadow: inset 0 -3px 0 rgba(255,255,255,.14);
}
.brand strong { display: block; font-size: 14px; letter-spacing: .16em; }
.brand small { display: block; color: var(--muted); font-size: 11px; letter-spacing: .04em; margin-top: 1px; }
.nav { display: grid; gap: 2px; padding: 14px 0; border-top: 1px solid var(--line-soft); }
.nav-label { padding: 4px 10px 8px; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 8px 10px;
  border-radius: var(--radius); color: var(--ink); font-size: 13.5px; line-height: 1.3;
  border-left: 2px solid transparent; transition: background var(--bosia-ease), color var(--bosia-ease);
}
.nav-item:hover { background: color-mix(in srgb, var(--brand) 5%, var(--surface)); text-decoration: none; }
.nav-item.is-active { background: var(--brand-tint); border-left-color: var(--brand); color: var(--brand-deep); font-weight: 650; }
.nav-item .nav-ico { width: 18px; text-align: center; color: var(--muted); font-size: 13px; }
.nav-item.is-active .nav-ico { color: var(--brand); }
.nav-item .nav-meta { margin-left: auto; font-size: 11px; color: var(--muted); }
.nav-sub { padding-left: 30px; }
.nav-sub::before { content: ""; position: absolute; left: 15px; top: 50%; width: 4px; height: 4px; border-radius: 50%; background: var(--line-strong); transform: translateY(-50%); }
.nav-sub.is-active::before { background: var(--brand); }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--line-soft); padding-top: 14px; }
.org-card { display: flex; gap: 10px; align-items: center; padding: 8px; border-radius: var(--radius); }
.org-card:hover { background: var(--surface-2); text-decoration: none; }
.avatar {
  width: 32px; height: 32px; flex: 0 0 auto; border-radius: 50%; display: grid; place-items: center;
  background: var(--brand-tint); color: var(--brand-deep); font-size: 11.5px; font-weight: 700; letter-spacing: .03em;
}
.avatar.dark { background: var(--ink); color: #fff; }
.org-card strong { display: block; font-size: 12.5px; line-height: 1.25; }
.org-card small { display: block; color: var(--muted); font-size: 11px; }
.main-col { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; min-height: 64px; display: flex; align-items: center; gap: 16px;
  padding: 0 32px; background: color-mix(in srgb, var(--surface) 92%, transparent);
  border-bottom: 1px solid var(--line); backdrop-filter: blur(10px);
}
.menu-btn { display: none; width: 38px; height: 38px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); }
.top-context { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 12.5px; color: var(--muted); }
.top-context .ctx-name { color: var(--ink); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-context .ctx-sep { color: var(--line-strong); }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 12%, #fff); flex: 0 0 auto; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.search-trigger {
  display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px 0 12px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--muted); font-size: 12.5px;
  transition: border-color var(--bosia-ease), background var(--bosia-ease), box-shadow var(--bosia-ease);
}
.search-trigger:hover { border-color: var(--line-strong); background: var(--surface-2); color: var(--ink); }
.search-trigger kbd { margin-left: 2px; }
.session-badge { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 9px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); font-size: 11px; letter-spacing: .03em; white-space: nowrap; }
.session-badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--brass); }
.user-chip { display: flex; align-items: center; gap: 8px; font-size: 12.5px; padding-left: 6px; }
.page { width: 100%; max-width: 1480px; margin: 0 auto; padding: 40px 40px 80px; }
.page.wide { max-width: none; padding: 28px 28px 64px; }

/* ---------- editorial head ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.page-head > div:first-child { flex: 1 1 auto; min-width: 0; }
.page-head .lede { max-width: 72ch; color: var(--muted); font-size: 15px; line-height: 1.6; margin-top: 10px; }
.eyebrow { display: flex; align-items: center; gap: 8px; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin-bottom: 10px; }
.eyebrow .rule { width: 22px; height: 1px; background: var(--brass); }
.title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.title-row .chip { transform: translateY(2px); }
.breadcrumb { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--brand-deep); }
.breadcrumb .sep { color: var(--line-strong); }
.breadcrumb .here { color: var(--ink); font-weight: 600; }
.head-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; flex: 0 0 auto; max-width: 100%; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.section-head .hint { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.divider { height: 1px; background: var(--line-soft); margin: 24px 0; border: 0; }

/* ---------- layout helpers ---------- */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.grid-main-wide { grid-template-columns: minmax(0, 1fr) 300px; align-items: start; }
.stack { display: grid; gap: 18px; min-width: 0; }
.grid > * { min-width: 0; }
.stack-sm { display: grid; gap: 10px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.muted { color: var(--muted); }
.tiny { font-size: 11.5px; }
.strong { font-weight: 650; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mt-32 { margin-top: 32px; }
.mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }

/* ---------- surfaces ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); min-width: 0; box-shadow: var(--bosia-shadow-1); }
.panel-pad { padding: 24px; }
.panel-tight { padding: 16px; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 20px 24px; border-bottom: 1px solid var(--line-soft); }
.panel-body { padding: 24px; }
.panel-foot { padding: 14px 24px; border-top: 1px solid var(--line-soft); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.inset { background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 16px; }
.rule-card { border-left: 2px solid var(--brass); padding-left: 16px; }
.section-label { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.kicker { font-family: var(--serif); font-size: 19px; line-height: 1.25; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 38px; padding: 8px 14px; border-radius: var(--radius); border: 1px solid transparent;
  font-size: 13px; font-weight: 650; line-height: 1.2; white-space: nowrap;
  transition: background var(--bosia-ease), border-color var(--bosia-ease), color var(--bosia-ease), box-shadow var(--bosia-ease), transform 120ms ease;
}
.btn:active { transform: translateY(1px); }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: inset 0 -1px 0 rgba(0,0,0,.16), 0 1px 1px rgba(23,32,43,.06); }
.btn-primary:hover { background: var(--brand-deep); box-shadow: inset 0 -1px 0 rgba(0,0,0,.16), 0 2px 6px color-mix(in srgb, var(--brand) 26%, transparent); }
.btn-secondary { background: var(--surface); border-color: var(--line-strong); color: var(--ink); box-shadow: var(--bosia-shadow-1); }
.btn-secondary:hover { background: var(--surface-2); border-color: color-mix(in srgb, var(--line-strong) 55%, var(--brand)); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-danger { background: var(--danger-tint); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, #fff); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 16%, #fff); }
.btn-sm { min-height: 30px; padding: 5px 10px; font-size: 12px; }
.btn-lg { min-height: 46px; padding: 11px 18px; font-size: 14px; }
.btn[disabled], .btn.is-disabled { opacity: .48; pointer-events: none; }
.btn.is-loading { color: transparent; position: relative; pointer-events: none; }
.btn.is-loading::after {
  content: ""; position: absolute; width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; animation: spin .7s linear infinite;
}
.btn-secondary.is-loading::after { border-color: var(--line-strong); border-top-color: var(--brand); }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn { width: 36px; height: 36px; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--muted); transition: background var(--bosia-ease), color var(--bosia-ease), border-color var(--bosia-ease); }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }

/* ---------- chips / badges ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 24px; padding: 2px 9px; white-space: nowrap;
  border-radius: 999px; font-size: 11.5px; font-weight: 650; line-height: 1.3; letter-spacing: .005em;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line);
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.chip.plain::before { display: none; }
.chip-ok { background: color-mix(in srgb, var(--ok) 9%, #fff); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 26%, #fff); }
.chip-fail { background: var(--danger-tint); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, #fff); }
.chip-warn { background: var(--warn-tint); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 26%, #fff); }
.chip-info { background: var(--info-tint); color: var(--brand-deep); border-color: color-mix(in srgb, var(--brand) 24%, #fff); }
.chip-neutral { background: var(--surface-2); color: var(--muted); }
.evidence { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 1px 6px; border-radius: 4px; border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); vertical-align: middle; }
.evidence.confirmado { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 26%, #fff); background: color-mix(in srgb, var(--ok) 8%, #fff); }
.evidence.documentado { color: var(--brand-deep); border-color: color-mix(in srgb, var(--brand) 26%, #fff); background: var(--info-tint); }
.evidence.inferido { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 26%, #fff); background: var(--warn-tint); }
.evidence.nao-informado { color: var(--muted); border-style: dashed; }
.tag { display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--line); font-size: 11px; color: var(--muted); white-space: nowrap; }

/* ---------- KPI ---------- */
.kpi-band { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); overflow: hidden; }
.kpi { padding: 18px 20px; border-right: 1px solid var(--line-soft); min-width: 0; }
.kpi:last-child { border-right: 0; }
.kpi .k { display: block; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 650; }
.kpi .v { display: block; font-family: var(--serif); font-size: 34px; line-height: 1.05; font-variant-numeric: tabular-nums; letter-spacing: -.01em; margin-top: 6px; }
.kpi .d { display: block; font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.kpi .d.ok { color: var(--ok); } .kpi .d.warn { color: var(--warn); } .kpi .d.fail { color: var(--danger); }
.kpi.is-button { cursor: pointer; text-align: left; background: var(--surface); border: 0; border-right: 1px solid var(--line-soft); transition: background var(--bosia-ease), box-shadow var(--bosia-ease); }
.kpi.is-button:hover { background: var(--surface-2); }
.kpi.is-button.is-active { background: var(--brand-tint); box-shadow: inset 0 -2px 0 var(--brand); }
.kpi-six { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.kpi-five { grid-template-columns: repeat(5, minmax(0, 1fr)); }

/* ---------- tables ---------- */
.table-wrap { width: 100%; max-width: 100%; overflow-x: auto; border-radius: var(--radius); -webkit-overflow-scrolling: touch; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  position: sticky; top: 0; z-index: 1; text-align: left; padding: 11px 14px;
  background: var(--surface-2); color: var(--muted); font-size: 11px; font-weight: 700;
  letter-spacing: .07em; text-transform: uppercase; border-bottom: 1px solid var(--line); white-space: nowrap;
}
td { padding: 13px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tbody tr:hover { background: color-mix(in srgb, var(--brand) 3.5%, #fff); }
tbody tr:last-child td { border-bottom: 0; }
td .cell-title { font-weight: 650; color: var(--ink); }
td .cell-sub { display: block; color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.table-actions { display: flex; gap: 6px; justify-content: flex-end; }
.empty-row td { padding: 28px; text-align: center; color: var(--muted); }

/* ---------- forms ---------- */
.field { display: grid; gap: 6px; }
.field > label, .label { font-size: 12.5px; font-weight: 650; color: var(--ink); }
.field .help { font-size: 11.5px; color: var(--muted); }
.field .error { font-size: 11.5px; color: var(--danger); display: flex; gap: 5px; align-items: center; }
.input, .select, .textarea {
  width: 100%; min-height: 40px; padding: 9px 12px; background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--radius); font-size: 13.5px;
  transition: border-color var(--bosia-ease), box-shadow var(--bosia-ease), background var(--bosia-ease);
}
.input:hover, .select:hover, .textarea:hover { border-color: color-mix(in srgb, var(--line-strong) 65%, var(--ink)); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 14%, #fff); }
.textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 12%, transparent); }
.input:disabled, .select:disabled, .textarea:disabled { background: var(--surface-2); color: var(--muted); cursor: not-allowed; opacity: .7; }
.input::placeholder, .textarea::placeholder { color: color-mix(in srgb, var(--muted) 70%, #fff); }
.form-grid { display: grid; gap: 16px; }
.form-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.input-group { display: flex; gap: 8px; }
.input-group .input { flex: 1; }
.checkline { display: flex; gap: 9px; align-items: flex-start; font-size: 13px; }
.checkline input { margin-top: 3px; }
.search { position: relative; }
.search .input { padding-left: 34px; }
.search::before { content: ""; position: absolute; left: 13px; top: 50%; width: 10px; height: 10px; border: 1.5px solid var(--muted); border-radius: 50%; transform: translateY(-62%); z-index: 1; }
.search::after { content: ""; position: absolute; left: 22px; top: calc(50% + 2px); width: 5px; height: 1.5px; background: var(--muted); transform: rotate(45deg); z-index: 1; }
.ico-search { position: relative; width: 14px; height: 14px; display: inline-block; flex: 0 0 auto; }
.ico-search::before { content: ""; position: absolute; left: 1px; top: 1px; width: 8px; height: 8px; border: 1.5px solid currentColor; border-radius: 50%; }
.ico-search::after { content: ""; position: absolute; left: 9px; top: 9px; width: 5px; height: 1.5px; background: currentColor; transform: rotate(45deg); }

/* ---------- alerts / banners ---------- */
.banner { display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--bosia-shadow-1); }
.banner .bar { width: 3px; align-self: stretch; border-radius: 2px; background: var(--brand); flex: 0 0 auto; }
.banner .bar.ok { background: var(--ok); } .banner .bar.warn { background: var(--warn); } .banner .bar.fail { background: var(--danger); }
.banner strong { display: block; font-size: 13.5px; }
.banner p { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.banner .banner-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.banner-info { background: var(--info-tint); border-color: color-mix(in srgb, var(--brand) 20%, #fff); }
.banner-warn { background: var(--warn-tint); border-color: color-mix(in srgb, var(--warn) 22%, #fff); }
.banner-fail { background: var(--danger-tint); border-color: color-mix(in srgb, var(--danger) 22%, #fff); }
.banner-ok { background: color-mix(in srgb, var(--ok) 7%, #fff); border-color: color-mix(in srgb, var(--ok) 22%, #fff); }
.callout { border-left: 2px solid var(--brass); padding: 2px 0 2px 14px; color: var(--muted); font-size: 12.5px; }

/* ---------- states ---------- */
.state-row { display: flex; flex-wrap: wrap; gap: 8px; }
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, color-mix(in srgb, var(--line) 40%, #fff) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: 4px; min-height: 10px; }
.skeleton + .skeleton { margin-top: 8px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
.empty { padding: 40px 24px; text-align: center; }
.empty .mark { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 12px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }
.empty h3 { margin-bottom: 4px; }
.empty p { color: var(--muted); font-size: 13px; max-width: 420px; margin: 0 auto 14px; }

/* ---------- steps ---------- */
.steps { display: flex; align-items: flex-start; gap: 0; padding: 18px 0 2px; overflow-x: auto; }
.step { display: flex; align-items: flex-start; gap: 0; min-width: 150px; flex: 1; }
.step:last-child { flex: 0 0 auto; min-width: 110px; }
.step-dot {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto;
  font-size: 11.5px; font-weight: 700; border: 1px solid var(--line-strong); background: var(--surface); color: var(--muted); z-index: 1;
}
.step-label { margin-left: 9px; padding-right: 12px; }
.step-label strong { display: block; font-size: 12.5px; line-height: 1.25; }
.step-label small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.step-line { flex: 1; height: 1px; background: var(--line); margin-top: 14px; min-width: 16px; }
.step.done .step-dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.step.done .step-line { background: color-mix(in srgb, var(--ok) 40%, var(--line)); }
.step.current .step-dot { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 12%, #fff); }
.step.blocked .step-dot { border-style: dashed; }
.step.blocked .step-label strong { color: var(--muted); }
.step a { color: inherit; }
.step a:hover { text-decoration: none; }
.step a:hover .step-label strong { color: var(--brand-deep); }

/* ---------- accordion ---------- */
details.acc { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); overflow: hidden; }
details.acc + details.acc { margin-top: 10px; }
details.acc > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px; padding: 16px 18px; }
details.acc > summary::-webkit-details-marker { display: none; }
details.acc > summary:hover { background: var(--surface-2); }
details.acc > summary .chev { margin-left: auto; width: 8px; height: 8px; flex: 0 0 auto; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(45deg); transition: transform .15s; }
details.acc[open] > summary .chev { transform: rotate(-135deg); }
details.acc > summary .sum-meta { margin-left: auto; color: var(--muted); font-size: 11.5px; }
details.acc .acc-body { padding: 4px 18px 18px; border-top: 1px solid var(--line-soft); }
details.acc[open] > summary { background: var(--surface-2); }
.acc-title { display: block; font-size: 13.5px; font-weight: 650; line-height: 1.35; }
.acc-sub { display: block; color: var(--muted); font-size: 11.5px; margin-top: 2px; line-height: 1.35; }

/* ---------- tabs / segmented ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { padding: 10px 14px; border: 0; background: transparent; color: var(--muted); font-size: 13px; font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; transition: color var(--bosia-ease), border-color var(--bosia-ease); }
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--brand-deep); border-bottom-color: var(--brand); }
.segmented { display: inline-flex; padding: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); gap: 2px; }
.seg { padding: 5px 10px; border: 0; background: transparent; border-radius: 4px; font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; transition: background var(--bosia-ease), color var(--bosia-ease); }
.seg:hover { color: var(--ink); }
.seg.is-active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(23,32,43,.08); }

/* ---------- charts ---------- */
.chart-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 22px; box-shadow: var(--bosia-shadow-1); }
.chart-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.chart-head h3 { font-size: 14px; }
.chart-head p { color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.donut-wrap { display: flex; align-items: center; gap: 22px; }
.donut { position: relative; width: 132px; height: 132px; border-radius: 50%; flex: 0 0 auto; }
.donut::after { content: ""; position: absolute; inset: 26px; border-radius: 50%; background: var(--surface); }
.donut .donut-mid { position: absolute; inset: 0; display: grid; place-items: center; z-index: 1; text-align: center; }
.donut .donut-mid strong { display: block; font-family: var(--serif); font-size: 26px; line-height: 1; }
.donut .donut-mid small { display: block; color: var(--muted); font-size: 11px; letter-spacing: .05em; text-transform: uppercase; margin-top: 3px; }
.legend { display: grid; gap: 8px; min-width: 0; flex: 1; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.legend-item .sw { width: 9px; height: 9px; border-radius: 2px; flex: 0 0 auto; }
.legend-item .lg-val { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar-list { display: grid; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 108px minmax(0, 1fr) 46px; gap: 10px; align-items: center; font-size: 11.5px; }
.bar-row .bl { color: var(--muted); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { display: flex; height: 12px; border-radius: 3px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--line-soft); }
.bar-fill { height: 100%; }
.bar-row .bv { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 600; }
.vbars { display: flex; align-items: flex-end; gap: 14px; height: 150px; padding-top: 18px; border-bottom: 1px solid var(--line); }
.vbar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; }
.vbar .vfill { width: 100%; max-width: 44px; border-radius: 3px 3px 0 0; background: var(--brand); opacity: .85; }
.vbar .vval { font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }
.vbar .vlab { font-size: 11px; color: var(--muted); text-align: center; line-height: 1.2; }
.vbar .vfill.ok { background: var(--ok); } .vbar .vfill.warn { background: var(--warn); } .vbar .vfill.fail { background: var(--danger); }
.line-chart { width: 100%; height: auto; display: block; }
.line-chart .grid-line { stroke: var(--line-soft); stroke-width: 1; }
.line-chart .axis-label { fill: var(--muted); font-size: 9px; font-family: var(--sans); }
.line-chart .series-line { fill: none; stroke: var(--brand); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.line-chart .series-area { fill: color-mix(in srgb, var(--brand) 12%, transparent); }
.line-chart .series-fail { fill: none; stroke: var(--danger); stroke-width: 1.5; stroke-dasharray: 4 3; }
.line-chart .dot { fill: var(--brand); }
.grouped { display: grid; gap: 10px; }
.grouped-row { display: grid; grid-template-columns: 120px minmax(0, 1fr) 64px; gap: 10px; align-items: center; font-size: 11.5px; }
.grouped-track { display: flex; gap: 3px; height: 14px; align-items: center; }
.grouped-track span { height: 100%; border-radius: 2px; }

/* ---------- document / editorial ---------- */
.doc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 40px 44px; box-shadow: var(--bosia-shadow-1); }
.doc-head { border-bottom: 1px solid var(--line); padding-bottom: 18px; margin-bottom: 22px; }
.doc h2 { font-size: 21px; margin: 26px 0 10px; }
.doc h2:first-of-type { margin-top: 0; }
.doc p { font-size: 14.5px; line-height: 1.72; max-width: 78ch; color: color-mix(in srgb, var(--ink) 88%, var(--muted)); }
.doc ul, .doc ol { margin: 8px 0 0; padding-left: 20px; }
.doc li { margin: 5px 0; font-size: 14px; }
.doc-meta { display: flex; gap: 10px 18px; flex-wrap: wrap; color: var(--muted); font-size: 11.5px; margin-top: 10px; }
.doc-meta strong { color: var(--ink); font-weight: 600; }
.doc-section { margin-top: 26px; }
.doc-section h3 { font-family: var(--serif); font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.fact-list { display: grid; gap: 8px; }
.fact { display: flex; gap: 9px; align-items: flex-start; font-size: 13.5px; }
.fact::before { content: ""; width: 4px; height: 4px; border-radius: 50%; background: var(--brass); margin-top: 8px; flex: 0 0 auto; }
.meta-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 20px; }
.meta { display: grid; gap: 2px; }
.meta dt { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.meta dd { margin: 0; font-size: 13px; }

/* ---------- flow diagram ---------- */
.flow { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); align-items: stretch; gap: 10px; padding: 6px 0 2px; }
.flow-step { min-width: 0; max-width: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.flow-step .fs-num { font-size: 11px; font-weight: 700; letter-spacing: .08em; color: var(--brand-deep); text-transform: uppercase; }
.flow-step strong { display: block; font-size: 12.5px; margin-top: 4px; line-height: 1.35; }
.flow-step small { display: block; color: var(--muted); font-size: 11px; margin-top: 5px; }
.flow-arrow { display: none; }
.flow-step.is-exception { border-style: dashed; background: var(--surface-2); }

/* ---------- timeline ---------- */
.timeline { position: relative; display: grid; gap: 0; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 1px; background: var(--line); }
.tl-item { position: relative; padding: 0 0 22px 8px; }
.tl-item::before { content: ""; position: absolute; left: -20px; top: 5px; width: 11px; height: 11px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line-strong); }
.tl-item.ok::before { border-color: var(--ok); background: var(--ok); }
.tl-item.fail::before { border-color: var(--danger); background: var(--danger); }
.tl-item.wait::before { border-color: var(--brand); }
.tl-item .tl-when { font-size: 11px; color: var(--muted); letter-spacing: .03em; }
.tl-item .tl-title { font-size: 13px; font-weight: 650; margin-top: 2px; }
.tl-item .tl-desc { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------- lists ---------- */
.list { display: grid; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line-soft); }
.list-item:last-child { border-bottom: 0; }
.list-item .li-main { min-width: 0; flex: 1; }
.list-item .li-title { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .li-sub { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.file-ico { width: 32px; height: 32px; border-radius: 6px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); font-size: 11px; font-weight: 700; flex: 0 0 auto; }
.file-ico.pdf { color: var(--danger); background: var(--danger-tint); border-color: color-mix(in srgb, var(--danger) 20%, #fff); }
.file-ico.img { color: var(--brand-deep); background: var(--info-tint); border-color: color-mix(in srgb, var(--brand) 20%, #fff); }
.file-ico.doc { color: var(--ok); background: color-mix(in srgb, var(--ok) 8%, #fff); border-color: color-mix(in srgb, var(--ok) 20%, #fff); }
.progress { height: 5px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--brand); border-radius: 3px; }
.progress.ok > span { background: var(--ok); } .progress.warn > span { background: var(--warn); }
.mini-progress { display: flex; gap: 3px; }
.mini-progress i { display: block; width: 14px; height: 4px; border-radius: 2px; background: var(--line); }
.mini-progress i.done { background: var(--ok); } .mini-progress i.current { background: var(--brand); } .mini-progress i.blocked { background: var(--line); }

/* ---------- modal / toast / command ---------- */
dialog { border: 1px solid var(--line); border-radius: var(--radius-xl); padding: 0; background: var(--surface); color: var(--ink); box-shadow: var(--bosia-shadow-3); width: min(560px, calc(100vw - 32px)); }
dialog[open] { animation: dialog-in 180ms var(--bosia-ease); }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }
dialog::backdrop { background: rgba(23,32,43,.34); backdrop-filter: blur(2px); }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 20px 22px 14px; }
.dialog-body { padding: 0 22px 18px; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line-soft); background: var(--surface-2); }
.dialog-close { border: 0; background: transparent; color: var(--muted); font-size: 20px; line-height: 1; padding: 6px; min-width: 32px; min-height: 32px; border-radius: var(--radius); }
.dialog-close:hover { background: var(--surface-2); color: var(--ink); }
#toast-region { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: grid; gap: 8px; width: min(360px, calc(100vw - 32px)); }
.toast { background: var(--ink); color: #fff; border-radius: var(--radius-lg); padding: 12px 14px; font-size: 12.5px; box-shadow: var(--bosia-shadow-2); display: flex; gap: 10px; align-items: flex-start; animation: toast-in 220ms var(--bosia-ease); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.toast .t-mark { color: #8fd6ae; font-weight: 700; }
.command { width: min(640px, calc(100vw - 32px)); }
.command .input { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; min-height: 52px; font-size: 15px; box-shadow: none; }
.command-list { max-height: 320px; overflow: auto; padding: 6px; }
.command-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius); font-size: 13px; color: var(--ink); }
.command-item:focus-visible { outline: none; background: var(--surface-2); box-shadow: inset 0 0 0 2px var(--brand); }
.command-item:hover, .command-item.is-active { background: var(--surface-2); text-decoration: none; }
.command-item .ci-meta { margin-left: auto; font-size: 11px; color: var(--muted); }

/* ---------- auth ---------- */
.auth-body { min-height: 100vh; background: var(--bg); }
.auth-split { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(420px, .95fr); }
.auth-aside { position: relative; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; background: var(--bg-2); border-right: 1px solid var(--line); overflow: hidden; }
.auth-aside::after { content: ""; position: absolute; inset: auto -80px -120px auto; width: 340px; height: 340px; border: 1px solid var(--line-strong); border-radius: 50%; opacity: .5; }
.auth-aside::before { content: ""; position: absolute; inset: auto -20px -60px auto; width: 220px; height: 220px; border: 1px solid var(--line); border-radius: 50%; opacity: .6; }
.auth-brand { display: flex; align-items: center; gap: 12px; }
.auth-quote { max-width: 520px; position: relative; z-index: 1; }
.auth-quote h1 { font-size: clamp(34px, 4vw, 52px); line-height: 1.06; }
.auth-quote p { color: var(--muted); font-size: 15px; margin-top: 18px; max-width: 420px; }
.auth-foot { display: flex; gap: 18px; flex-wrap: wrap; font-size: 11px; color: var(--muted); position: relative; z-index: 1; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px 28px; background: var(--surface); }
.auth-card { width: min(400px, 100%); }
.auth-card h2 { font-size: 28px; margin-bottom: 6px; }
.auth-card .lede { color: var(--muted); font-size: 13.5px; margin-bottom: 24px; }
.auth-card .field + .field { margin-top: 14px; }
.auth-card .btn { width: 100%; margin-top: 20px; }
.auth-hint { margin-top: 18px; padding: 12px 14px; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface-2); font-size: 11.5px; color: var(--muted); }
.auth-hint strong { color: var(--ink); }
.auth-hint-warn { border-style: solid; border-color: color-mix(in srgb, var(--warn) 32%, #fff); background: var(--warn-tint); color: var(--warn); }
.auth-hint-warn strong { color: var(--warn); }
.auth-center { min-height: 100vh; display: grid; place-items: center; padding: 32px; background: var(--bg); }
.auth-center .panel { width: min(520px, 100%); text-align: center; padding: 40px 32px; }
.auth-center .big-code { font-family: var(--serif); font-size: 64px; line-height: 1; color: var(--line-strong); }
.auth-center h1 { font-size: 28px; margin: 12px 0 8px; }
.auth-center p { color: var(--muted); font-size: 13.5px; margin-bottom: 20px; }

/* ---------- snapshot ---------- */
.snap-shell { background: var(--bg); }
.snapshot-top {
  position: sticky; top: 0; z-index: 100; height: 60px; display: flex; align-items: center; gap: 16px;
  padding: 0 22px; background: color-mix(in srgb, #fff 94%, transparent); border-bottom: 1px solid var(--line); backdrop-filter: blur(8px);
}
.snapshot-top .snap-brand { display: flex; align-items: center; gap: 10px; font-size: 12px; font-weight: 700; letter-spacing: .1em; }
.snapshot-top .snap-brand span { width: 26px; height: 26px; border-radius: 7px; background: var(--ink); color: #fff; display: grid; place-items: center; font-family: var(--serif); font-size: 15px; }
.snapshot-top .snap-meta { color: var(--muted); font-size: 11px; border-left: 1px solid var(--line); padding-left: 16px; }
.snapshot-top .snap-nav { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.snapshot-top select { height: 34px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); padding: 0 8px; font-size: 12px; max-width: 230px; }
.snap-intro { max-width: 1100px; margin: 0 auto; padding: 56px 32px 8px; }
.snap-intro h1 { font-size: clamp(34px, 5vw, 60px); max-width: 900px; }
.snap-intro .lede { color: var(--muted); font-size: 16px; max-width: 720px; margin-top: 14px; }
.snap-meta-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.snap-index { max-width: 1100px; margin: 30px auto 0; padding: 0 32px; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.snap-index a { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 8px; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); font-size: 12px; color: var(--ink); line-height: 1.35; }
.snap-index a:hover { border-color: var(--brand); background: var(--brand-tint); text-decoration: none; }
.snap-index .idx-code { font-size: 9.5px; color: var(--muted); font-weight: 700; letter-spacing: .04em; white-space: nowrap; }
.snap-index a > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.snap-section { max-width: 1480px; margin: 0 auto; padding: 44px 32px 8px; scroll-margin-top: 76px; }
.snap-section-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.snap-section-head .snap-code { font-size: 11px; letter-spacing: .1em; font-weight: 700; color: var(--muted); border: 1px solid var(--line); background: var(--surface); padding: 2px 7px; border-radius: 4px; }
.snap-section-head h2 { font-size: 22px; }
.snap-section-head .snap-route { font-size: 11px; color: var(--muted); font-family: ui-monospace, monospace; margin-left: auto; }
.snap-app { border: 1px solid var(--line-strong); border-radius: var(--radius-xl); overflow: hidden; background: var(--bg); box-shadow: 0 10px 30px rgba(23,32,43,.06); }
.snap-app .app { min-height: 0; }
.snap-app .sidebar { position: static; height: auto; }
.snap-app .topbar { position: static; }
.snap-app .page { padding-top: 26px; }
.snap-app .auth-split, .snap-app .auth-center { min-height: 680px; }
.snap-foot { max-width: 1100px; margin: 40px auto 0; padding: 24px 32px 60px; color: var(--muted); font-size: 11.5px; border-top: 1px solid var(--line); }
.foundation { max-width: 1480px; margin: 0 auto; padding: 44px 32px 8px; scroll-margin-top: 76px; }
.token-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 16px; }
.token { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.token .swatch { height: 46px; }
.token .tok-meta { padding: 8px 10px; font-size: 11px; }
.token .tok-meta strong { display: block; font-size: 11px; }
.token .tok-meta span { color: var(--muted); font-family: ui-monospace, monospace; }
.type-spec { display: grid; gap: 10px; margin-top: 14px; }
.type-spec .ts-row { display: flex; align-items: baseline; gap: 16px; padding-bottom: 8px; border-bottom: 1px solid var(--line-soft); }
.type-spec .ts-row span { width: 100px; flex: 0 0 auto; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.type-spec .ts-row > span:last-child { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; text-transform: none; letter-spacing: 0; }
.comp-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 14px; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .grid-main, .grid-main-wide { grid-template-columns: minmax(0, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-band { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi:nth-child(2) { border-right: 0; }
  .kpi:nth-child(1), .kpi:nth-child(2) { border-bottom: 1px solid var(--line-soft); }
}
@media (max-width: 1020px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 272px; transform: translateX(-102%); transition: transform .2s ease; box-shadow: 0 0 40px rgba(23,32,43,.18); }
  .sidebar.is-open { transform: translateX(0); }
  .menu-btn { display: inline-grid; place-items: center; }
  .topbar { padding: 0 16px; }
  .page { padding: 24px 18px 64px; }
  .auth-split { grid-template-columns: 1fr; }
  .auth-aside { min-height: 280px; padding: 28px; }
  .auth-aside .auth-quote h1 { font-size: 32px; }
  .auth-main { padding: 28px 18px; }
}
@media (max-width: 760px) {
  .page-head { flex-direction: column; align-items: flex-start; }
  .list-item { flex-wrap: wrap; }
  .list-item .li-main { flex: 1 1 calc(100% - 44px); }
  .list-item .li-title { white-space: normal; overflow-wrap: anywhere; }
  .type-spec .ts-row { flex-wrap: wrap; gap: 2px 10px; }
  .type-spec .ts-row > span:last-child { flex-basis: 100%; }
  .panel-head { flex-direction: column; align-items: stretch; }
  .panel-head .row { width: 100%; }
  .panel-head .search { width: 100%; }
  .section-head { flex-direction: column; align-items: flex-start; }
  .head-actions { justify-content: flex-start; }
  .grid-2, .grid-3, .grid-4, .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .meta-grid { grid-template-columns: 1fr; }
  .kpi-band { grid-template-columns: 1fr; }
  .kpi { border-right: 0; border-bottom: 1px solid var(--line-soft); }
  .kpi:last-child { border-bottom: 0; }
  .top-context .ctx-extra { display: none; }
  .session-badge { display: none; }
  .user-chip span:last-child { display: none; }
  .search-trigger span { display: none; }
  .search-trigger { padding: 0 10px; }
  .doc { padding: 22px 18px; }
  .banner { flex-direction: column; }
  .banner .banner-actions { margin-left: 0; }
  .donut-wrap { flex-direction: column; align-items: flex-start; }
  .bar-row { grid-template-columns: 88px minmax(0, 1fr) 42px; }
  .snap-section, .foundation, .snap-intro, .snap-index, .snap-foot { padding-left: 16px; padding-right: 16px; }
  .snap-section-head .snap-route { margin-left: 0; width: 100%; }
  .snap-app .sidebar { display: none; }
  .snap-app .app { grid-template-columns: 1fr; }
  .snap-app .topbar { padding: 0 14px; }
  .snap-app .page { padding: 20px 14px 40px; }
  .snapshot-top .snap-meta { display: none; }
  .snapshot-top { padding: 0 14px; }
  .snapshot-top select { max-width: 150px; }
}
@media (max-width: 420px) {
  .title-row { align-items: flex-start; }
  .top-actions { gap: 6px; }
  .btn { padding-left: 11px; padding-right: 11px; }
  .flow-step { min-width: 148px; }
  .doc-meta { gap: 6px 12px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
@media print {
  .sidebar, .topbar, .head-actions, .btn, #toast-region { display: none !important; }
  body { background: #fff; }
  .app { display: block; }
  .page { max-width: none; padding: 0; }
  .panel, .doc { border-color: #ccc; box-shadow: none; }
  a { color: inherit; }
}
.grouped-row .bl { color: var(--muted); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grouped-row .bv { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
@media (max-width: 1180px) {
  .kpi-six { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi-five { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi-six .kpi:nth-child(3), .kpi-five .kpi:nth-child(3) { border-right: 0; }
}
@media (max-width: 760px) {
  .kpi-six, .kpi-five { grid-template-columns: 1fr; }
  .kpi-six .kpi, .kpi-five .kpi { border-right: 0; border-bottom: 1px solid var(--line-soft); }
  .kpi-six .kpi:last-child, .kpi-five .kpi:last-child { border-bottom: 0; }
  .grouped-row { grid-template-columns: 88px minmax(0, 1fr) 52px; }
}
.linkish { border: 0; background: transparent; color: var(--brand-deep); font: inherit; padding: 0; text-align: left; text-decoration: none; cursor: pointer; }
.linkish:hover { text-decoration: underline; }

/* ---------- acabamento (polish pass) ---------- */
.kpi-band { box-shadow: var(--bosia-shadow-1); }
.sidebar { overflow-y: auto; }
.command-foot { display: flex; gap: 16px; flex-wrap: wrap; padding: 10px 16px; border-top: 1px solid var(--line-soft); background: var(--surface-2); color: var(--muted); font-size: 11px; letter-spacing: .02em; }
.command-foot kbd { margin-right: 3px; }
.sidebar-scrim { display: none; }
.step-label strong { overflow-wrap: anywhere; }
.bar-fill, .vfill { transition: width 240ms var(--bosia-ease); }

@media (max-width: 1020px) {
  .sidebar-scrim { display: block; position: fixed; inset: 0; z-index: 39; background: rgba(23, 32, 43, .38); backdrop-filter: blur(1px); opacity: 0; pointer-events: none; transition: opacity var(--bosia-ease); }
  .sidebar.is-open + .sidebar-scrim { opacity: 1; pointer-events: auto; }
  .page { padding: 28px 24px 72px; }
  .topbar { padding: 0 20px; }
}

@media (max-width: 760px) {
  .page { padding: 24px 16px 64px; }
  .panel-head, .panel-body, .panel-foot { padding-left: 16px; padding-right: 16px; }
  .chart-card { padding: 18px; }
  .doc { padding: 28px 20px; }
  .banner { padding: 14px 16px; }
  .panel .table-wrap table, .doc .table-wrap table { min-width: 560px; }
  .head-actions { width: 100%; }
  .step { min-width: 138px; }
  .steps { padding-bottom: 8px; scrollbar-width: thin; }
  .auth-center .panel { padding: 32px 22px; }
  .snap-shell .snapshot-top { gap: 10px; }
}

@media (max-width: 420px) {
  .page { padding: 20px 14px 56px; }
  .btn { min-height: 40px; }
  .btn-sm { min-height: 34px; }
  .chip { min-height: 26px; }
  .title-row h1 { overflow-wrap: anywhere; }
  .head-actions > .btn { flex: 1 1 auto; }
  .snapshot-top .snap-brand { font-size: 11px; letter-spacing: .06em; }
  .snapshot-top select { max-width: 116px; }
  .snap-intro h1 { font-size: 32px; }
  .snap-index { grid-template-columns: 1fr; }
  .type-spec .ts-row { padding-bottom: 10px; }
  .donut { width: 118px; height: 118px; }
  .donut::after { inset: 24px; }
}

@media (max-width: 360px) {
  .page { padding-left: 12px; padding-right: 12px; }
  .topbar { padding: 0 12px; gap: 8px; }
  .top-context .ctx-name { max-width: 130px; }
  .snapshot-top { padding: 0 12px; }
  .snapshot-top select { max-width: 96px; }
  .search-trigger { display: none; }
  .menu-btn { width: 40px; height: 40px; }
}

@media (max-width: 760px) {
  .table-wrap table:has(thead th:nth-child(6)) { min-width: 720px; }
  .table-wrap table:has(thead th:nth-child(8)) { min-width: 860px; }
}

.table-hint { display: none; margin: 8px 0 0; color: var(--muted); font-size: 11px; }
@media (max-width: 760px) {
  .table-wrap th:first-child, .table-wrap td:first-child { min-width: 148px; }
  .table-hint { display: block; }
}

@media (max-width: 760px) {
  .kpi-band, .kpi-six, .kpi-five { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { padding: 16px; border-right: 1px solid var(--line-soft) !important; border-bottom: 1px solid var(--line-soft); }
  .kpi:nth-child(even) { border-right: 0 !important; }
  .kpi:nth-last-child(-n+2) { border-bottom: 0; }
  .kpi .v { font-size: 30px; }
}

/* ---------- acesso seguro: login, sessão e identidade ---------- */
.form-status {
  display: flex; gap: 9px; align-items: flex-start; margin-bottom: 16px;
  padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface-2); color: var(--ink); font-size: 12.5px; line-height: 1.45;
  animation: toast-in 160ms var(--bosia-ease);
}
.form-status[hidden] { display: none; }
.form-status::before {
  content: "!"; flex: 0 0 auto; width: 18px; height: 18px; border-radius: 50%;
  display: grid; place-items: center; font-size: 11px; font-weight: 800;
  background: color-mix(in srgb, var(--muted) 16%, #fff); color: var(--muted);
}
.form-status.is-error {
  border-color: color-mix(in srgb, var(--danger) 32%, #fff);
  background: var(--danger-tint); color: var(--danger);
}
.form-status.is-error::before { background: color-mix(in srgb, var(--danger) 18%, #fff); color: var(--danger); }
.form-status.is-warn {
  border-color: color-mix(in srgb, var(--warn) 32%, #fff);
  background: var(--warn-tint); color: var(--warn);
}
.form-status.is-warn::before { background: color-mix(in srgb, var(--warn) 20%, #fff); color: var(--warn); }
.form-status.is-info {
  border-color: color-mix(in srgb, var(--brand) 28%, #fff);
  background: var(--info-tint); color: var(--brand-deep);
}
.form-status.is-info::before { background: color-mix(in srgb, var(--brand) 18%, #fff); color: var(--brand-deep); }
.input-wrap { position: relative; }
.input-wrap .input { padding-right: 78px; }
.pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  min-height: 30px; padding: 5px 8px; border: 1px solid transparent; border-radius: 5px;
  background: transparent; color: var(--muted); font-size: 11.5px; font-weight: 650;
  transition: background var(--bosia-ease), color var(--bosia-ease);
}
.pw-toggle:hover { background: var(--surface-2); color: var(--ink); }
.auth-card .field .error[hidden] { display: none; }
.auth-card .field .error { margin-top: 1px; }

.user-chip { gap: 9px; }
.logout-form { display: inline-flex; margin: 0 0 0 2px; }
.logout-form .btn { min-height: 30px; padding: 4px 9px; font-size: 11.5px; }
.user-chip > span:not(.avatar) { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[data-admin-nav][hidden] { display: none; }


@media (max-width: 760px) {
  .user-chip { gap: 6px; }
  .user-chip > span:not(.avatar) { display: none; }
  .logout-form .btn { min-height: 32px; padding: 4px 8px; }
}
@media (max-width: 420px) {
  .form-status { font-size: 12px; }
  .auth-card .btn-lg { min-height: 44px; }
}

/* ---------- acesso seguro: estados de sessão e identidade ---------- */
.auth-form-wrap { display: block; }
.form-status.auth-hint { margin-top: 0; border-style: solid; }
.auth-card #login-notice { margin-bottom: 14px; }
.auth-hint[role="alert"] { border-style: solid; }
.auth-center .panel [data-focus-heading] { outline: none; }
.auth-center .panel [data-focus-heading]:focus-visible { outline: 2px solid var(--brand); outline-offset: 4px; border-radius: 4px; }
.auth-center .panel .mono { overflow-wrap: anywhere; }
.pw-toggle:focus-visible { outline: none; box-shadow: var(--bosia-ring); }
.auth-card .btn.is-loading { cursor: progress; }
@media (max-width: 420px) {
  .auth-aside { padding: 24px 18px; }
  .auth-main { padding: 24px 16px; }
  .auth-center { padding: 20px 14px; }
  .auth-center .panel { padding: 28px 18px; }
}

/* ---------- interface de desenvolvimento (DEV-01, somente localhost) ---------- */
.dev-copy-btn {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin-left: 8px;
  padding: 1px 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 650;
  line-height: 1.6;
  letter-spacing: .02em;
  vertical-align: middle;
  transition: background var(--bosia-ease), color var(--bosia-ease), border-color var(--bosia-ease);
}
.dev-copy-btn:hover { background: var(--surface-2); color: var(--ink); border-color: var(--line-strong); }
.dev-copy-btn:focus-visible { outline: none; box-shadow: var(--bosia-ring); }
.dev-totp-inline {
  display: inline-block;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: .16em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
#dev-seed .panel-head { flex-wrap: wrap; }
#dev-seed .panel-head .chip { margin-left: auto; }
#dev-seed td code { overflow-wrap: anywhere; }
@media (max-width: 640px) {
  #dev-seed .panel-head .chip { margin-left: 0; }
  .dev-copy-btn { min-height: 30px; padding: 3px 9px; }
}
[data-dev-seed-grid] { align-items: start; }
[data-dev-seed-grid] > div { min-width: 0; }
[data-dev-totp-card][hidden] { display: none; }
[data-dev-totp-body] form[action="/dev/totp"] .btn { width: 100%; }
[data-dev-totp-body] .row { gap: 8px; }
#dev-totp-codigo { font-size: 20px; }
[data-dev-totp-body] p[role="status"] {
  padding: 14px 16px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--surface-2);
  text-align: center;
}

/* ---------- administração: usuários e papéis (ADM-04) ---------- */
[data-admin-feedback][hidden] { display: none; }
[data-admin-feedback] { align-items: flex-start; }
[data-admin-feedback] .banner-actions { flex: 0 0 auto; }
.admin-filter { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.admin-filter .search { flex: 1 1 220px; min-width: 190px; }
.admin-filter .select-auto { width: auto; min-width: 142px; flex: 0 1 auto; }
.select-auto { width: auto; }
.user-self {
  margin-left: 6px; padding: 0 6px; min-height: 18px; font-size: 10px;
  text-transform: uppercase; letter-spacing: .05em; vertical-align: middle;
}
.skeleton-row td { padding-top: 16px; padding-bottom: 16px; }
.skeleton-row .skeleton { min-height: 8px; }
.edit-identity {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2);
}
.edit-identity .avatar { width: 36px; height: 36px; font-size: 12px; }
.edit-identity strong { display: block; font-size: 13.5px; line-height: 1.3; overflow-wrap: anywhere; }
.edit-identity span:not(.avatar) { display: block; color: var(--muted); font-size: 11.5px; overflow-wrap: anywhere; }
.dialog-body .form-status { margin-bottom: 0; }
.dialog-body .tiny.muted { margin-top: -4px; }
[data-summary-live] .bar-list { gap: 10px; }
[data-summary-live] .bar-row { grid-template-columns: 92px minmax(0, 1fr) 26px; }
@media (max-width: 1020px) {
  .admin-filter { justify-content: flex-start; }
}
@media (max-width: 760px) {
  .admin-filter { width: 100%; }
  .admin-filter .search { flex: 1 1 100%; min-width: 0; }
  .admin-filter .select-auto { flex: 1 1 150px; min-width: 0; }
  .edit-identity { align-items: flex-start; }
}
@media (max-width: 360px) {
  .admin-filter .select-auto { flex: 1 1 100%; }
  .edit-identity .avatar { display: none; }
}

/* EMP-01/02/04 — empresas, contexto e fontes */
[data-empresas-page] .segmented .seg,
[data-empresas-page] .admin-filter .search { min-width: 0; }
[data-fontes-lista] .list-item { align-items: flex-start; }
[data-fontes-lista] .list-item .li-main { min-width: 0; }
[data-fontes-lista] .list-item .table-actions,
[data-projetos-lista] .list-item .table-actions { flex-wrap: wrap; }
[data-fontes-lista] .file-ico,
[data-projetos-lista] .avatar { flex: 0 0 auto; }
[data-contexto-conteudo] .doc-section .banner + .banner { margin-top: 8px; }
[data-contexto-conteudo] .doc-section ul:empty { display: none; }
[data-ctx-negocio] { white-space: pre-line; overflow-wrap: anywhere; }
[data-empresa-descricao] { overflow-wrap: anywhere; }
#nova-fonte .field[hidden] { display: none; }
@media (max-width: 760px) {
  [data-empresas-page] .panel-head .admin-filter { justify-content: flex-start; }
  [data-fontes-lista] .list-item .table-actions,
  [data-projetos-lista] .list-item .table-actions { width: 100%; justify-content: flex-start; }
}
