/* ==========================================================================
   BOSIA Discovery — Camada de componentes (sidebar + editorial, Midnight)
   Reutilizável no Preview Visual e na construção real.
   ========================================================================== */

*, *::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.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p, figure, blockquote { margin: 0; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; color: var(--ink); }
h1 { font-size: 30px; line-height: 1.15; }
h2 { font-size: 22px; line-height: 1.25; }
h3 { font-size: 17px; line-height: 1.3; }
h4 { font-size: 13px; line-height: 1.35; letter-spacing: .02em; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
::selection { background: rgba(79, 140, 255, .35); }

.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: absolute; left: 12px; top: -60px; z-index: 60;
  background: var(--brand); color: #fff; padding: 8px 14px; border-radius: 8px;
}
.skip-link:focus { top: 12px; }

/* ---------- Utilitários ---------- */
.muted { color: var(--muted); }
.muted-2 { color: var(--muted-2); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.mono { font-family: ui-monospace, "Cascadia Code", "SFMono-Regular", Consolas, monospace; font-size: .92em; }
.strong { font-weight: 650; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.right { text-align: right; }
.stack { display: flex; flex-direction: column; gap: var(--bosia-space-4); }
.stack-sm { display: flex; flex-direction: column; gap: var(--bosia-space-2); }
.stack-lg { display: flex; flex-direction: column; gap: var(--bosia-space-5); }
.cluster { display: flex; align-items: center; gap: var(--bosia-space-3); flex-wrap: wrap; }
.cluster-sm { display: flex; align-items: center; gap: var(--bosia-space-2); flex-wrap: wrap; }
.between { display: flex; align-items: center; justify-content: space-between; gap: var(--bosia-space-4); flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--bosia-space-5); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--bosia-space-4); }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--bosia-space-4); }
.grid-main-rail { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: var(--bosia-space-5); align-items: start; }
.divider { height: 1px; background: var(--line); border: 0; margin: 0; }
.vdivider { width: 1px; align-self: stretch; background: var(--line); }
.hide-mobile { display: initial; }

/* ---------- Botões ---------- */
.btn {
  --btn-bg: transparent; --btn-ink: var(--ink); --btn-line: var(--line-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px; padding: 0 14px; border-radius: 9px;
  border: 1px solid var(--btn-line); background: var(--btn-bg); color: var(--btn-ink);
  font-size: 13px; font-weight: 600; letter-spacing: .01em; cursor: pointer;
  transition: background .16s ease, border-color .16s ease, color .16s ease, transform .06s ease;
  white-space: nowrap; text-decoration: none;
}
.btn:hover { background: rgba(255, 255, 255, .05); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn-primary { --btn-bg: var(--brand); --btn-ink: #06101f; --btn-line: var(--brand); }
.btn-primary:hover { background: #6b9dff; }
.btn-secondary { --btn-bg: rgba(79, 140, 255, .1); --btn-ink: #b9d1ff; --btn-line: rgba(79, 140, 255, .42); }
.btn-ghost { --btn-line: transparent; --btn-ink: var(--muted); }
.btn-ghost:hover { --btn-ink: var(--ink); background: rgba(255, 255, 255, .04); }
.btn-danger { --btn-bg: rgba(255, 92, 102, .08); --btn-ink: #ff9aa0; --btn-line: rgba(255, 92, 102, .45); }
.btn-danger:hover { background: rgba(255, 92, 102, .16); }
.btn-sm { min-height: 30px; padding: 0 10px; font-size: 12px; border-radius: 7px; }
.btn-lg { min-height: 46px; padding: 0 20px; font-size: 14px; }
.btn-block { width: 100%; }
.btn .spin { width: 13px; height: 13px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; padding: 0; border-radius: 8px;
  border: 1px solid transparent; background: transparent; color: var(--muted);
  cursor: pointer; font-size: 15px; line-height: 1;
}
.icon-btn:hover { background: rgba(255, 255, 255, .06); color: var(--ink); }
.link-btn { border: 0; background: none; color: var(--brand); padding: 0; cursor: pointer; font-weight: 600; }
.link-btn:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Formulários ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 20px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 12px; font-weight: 650; letter-spacing: .03em; color: var(--ink-2); }
.field .req { color: var(--warn); margin-left: 3px; }
.input, .select, .textarea {
  width: 100%; min-height: 40px; padding: 9px 12px;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 9px; color: var(--ink); font-size: 13.5px;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
.textarea { min-height: 104px; resize: vertical; line-height: 1.55; }
.input::placeholder, .textarea::placeholder { color: var(--muted-2); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--line-strong); }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--brand); background: #0c1220;
  box-shadow: 0 0 0 3px rgba(79, 140, 255, .16);
}
.input[aria-invalid="true"], .textarea[aria-invalid="true"], .select[aria-invalid="true"] {
  border-color: var(--danger); box-shadow: 0 0 0 3px rgba(255, 92, 102, .14);
}
.input[disabled], .select[disabled], .textarea[disabled] { opacity: .55; cursor: not-allowed; }
.hint { font-size: 12px; color: var(--muted); }
.error-text { font-size: 12px; color: #ff9aa0; display: flex; gap: 6px; align-items: flex-start; }
.success-text { font-size: 12px; color: #78e3a4; }
.input-group { display: flex; gap: 8px; align-items: stretch; }
.input-group .input { flex: 1 1 auto; }
.input-icon { position: relative; }
.input-icon .input { padding-left: 36px; }
.input-icon .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted-2); font-size: 14px; }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.check input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--brand); }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 38px; height: 22px; border-radius: 999px; background: var(--line-strong); position: relative; transition: background .18s ease; flex: 0 0 auto; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #dfe8fb; transition: transform .18s ease; }
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(16px); background: #06101f; }
.search {
  display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 12px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 9px; color: var(--muted);
  min-width: 220px;
}
.search input { border: 0; background: transparent; outline: none; color: var(--ink); width: 100%; font-size: 13px; }
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.filters .select, .filters .input { min-height: 36px; width: auto; min-width: 150px; }
.filters .search { min-height: 36px; }

/* ---------- Badges, chips, pills ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 650;
  letter-spacing: .02em; border: 1px solid transparent; white-space: nowrap; line-height: 1.5;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.badge-ok { color: #7ce9a6; background: var(--ok-tint); border-color: rgba(47, 212, 110, .32); }
.badge-warn { color: #ffd08a; background: var(--warn-tint); border-color: rgba(255, 182, 72, .32); }
.badge-danger { color: #ff9aa0; background: var(--danger-tint); border-color: rgba(255, 92, 102, .32); }
.badge-info { color: #9fe2f5; background: var(--info-tint); border-color: rgba(89, 194, 232, .3); }
.badge-brand { color: #b9d1ff; background: var(--brand-tint); border-color: rgba(79, 140, 255, .34); }
.badge-neutral { color: var(--muted); background: rgba(139, 156, 192, .1); border-color: rgba(139, 156, 192, .28); }
.badge-brass { color: #ffd9a3; background: var(--brass-tint); border-color: rgba(240, 180, 92, .32); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px;
  border: 1px solid var(--line); border-radius: 7px; background: var(--bg-2);
  font-size: 11.5px; color: var(--ink-2); max-width: 100%;
}
.chip .x { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0; line-height: 1; }
.tag-fact { font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #7ce9a6; }
.tag-decl { font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #9fe2f5; }
.tag-hyp { font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #ffd08a; }
.kbd { font-family: ui-monospace, monospace; font-size: 11px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px; padding: 1px 5px; color: var(--ink-2); background: var(--bg-2); }

/* ---------- Surfaces / cards / KPIs ---------- */
.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-1);
}
.panel-flat { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.panel-head h2, .panel-head h3 { font-size: 18px; }
.panel-head .sub { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.panel-body { min-width: 0; }
.panel-foot { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 14px; }
.section-title { font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }

.kpi-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.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(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 16px 13px; display: flex; flex-direction: column; gap: 5px;
  min-width: 0; position: relative; overflow: hidden;
}
.kpi::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 2px; background: var(--brand); opacity: .65; }
.kpi.is-ok::before { background: var(--ok); }
.kpi.is-warn::before { background: var(--warn); }
.kpi.is-danger::before { background: var(--danger); }
.kpi .k { font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.kpi .v { font-family: var(--serif); font-size: 27px; line-height: 1.05; font-weight: 600; letter-spacing: -.02em; }
.kpi .d { font-size: 11.5px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.kpi .d .up { color: #7ce9a6; font-weight: 650; }
.kpi .d .down { color: #ff9aa0; font-weight: 650; }
.kpi .d .flat { color: var(--muted-2); }
.stat-strip { display: flex; flex-wrap: wrap; gap: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); overflow: hidden; }
.stat-strip .stat { flex: 1 1 160px; padding: 13px 16px; border-right: 1px solid var(--line); min-width: 0; }
.stat-strip .stat:last-child { border-right: 0; }
.stat-strip .stat .k { font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.stat-strip .stat .v { font-family: var(--serif); font-size: 21px; line-height: 1.2; }

.notice {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px;
  border: 1px solid var(--line); border-left: 3px solid var(--brand);
  background: rgba(79, 140, 255, .07); border-radius: 9px; font-size: 13px;
}
.notice .n-icon { flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-tint); color: #b9d1ff; font-size: 11px; font-weight: 700; }
.notice-warn { border-left-color: var(--warn); background: rgba(255, 182, 72, .07); }
.notice-warn .n-icon { background: var(--warn-tint); color: #ffd08a; }
.notice-danger { border-left-color: var(--danger); background: rgba(255, 92, 102, .07); }
.notice-danger .n-icon { background: var(--danger-tint); color: #ff9aa0; }
.notice-ok { border-left-color: var(--ok); background: rgba(47, 212, 110, .07); }
.notice-ok .n-icon { background: var(--ok-tint); color: #7ce9a6; }
.notice strong { color: var(--ink); }
.notice p { color: var(--ink-2); }

/* ---------- App frame ---------- */
.app { display: grid; grid-template-columns: var(--bosia-sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; z-index: 30; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 18px;
  padding: 18px 14px 16px; background: linear-gradient(180deg, #0b101b 0%, #090d16 100%);
  border-right: 1px solid var(--line);
  scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 0; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(150deg, #4f8cff, #2b5bb5); color: #f5f8ff;
  font-family: var(--serif); font-size: 18px; font-weight: 700; box-shadow: 0 6px 16px rgba(47, 106, 214, .35);
}
.brand strong { display: block; font-family: var(--serif); font-size: 17px; letter-spacing: .01em; line-height: 1.1; }
.brand span { display: block; font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); margin-top: 2px; }
.company-switch {
  display: flex; align-items: center; gap: 9px; padding: 10px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--bg-2); color: var(--ink);
}
.company-switch:hover { border-color: var(--line-strong); text-decoration: none; }
.company-switch .co-avatar { width: 28px; height: 28px; border-radius: 7px; background: var(--brass-tint); color: #ffd9a3; display: grid; place-items: center; font-size: 11px; font-weight: 700; flex: 0 0 auto; }
.company-switch .co-name { font-size: 12.5px; font-weight: 650; line-height: 1.25; }
.company-switch .co-meta { font-size: 10.5px; color: var(--muted); }
.company-switch .chev { margin-left: auto; color: var(--muted); font-size: 11px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-link {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
  color: var(--ink-2); font-size: 13px; font-weight: 550; text-decoration: none; min-height: 36px;
}
.side-link .ic { width: 16px; text-align: center; color: var(--muted); font-size: 13px; }
.side-link:hover { background: rgba(255, 255, 255, .045); color: var(--ink); text-decoration: none; }
.side-link.is-active { background: rgba(79, 140, 255, .12); color: #cfe0ff; }
.side-link.is-active .ic { color: var(--brand); }
.side-link .count { margin-left: auto; font-size: 10.5px; color: var(--muted); }
.side-section { display: flex; flex-direction: column; gap: 5px; padding-top: 4px; border-top: 1px solid var(--line-soft); }
.side-label { font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted-2); padding: 0 10px; margin-top: 8px; }
.process-pill {
  display: block; padding: 9px 10px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg-2); color: var(--ink); font-size: 12.5px; line-height: 1.3;
}
.process-pill:hover { border-color: var(--line-strong); text-decoration: none; }
.process-pill small { display: block; color: var(--muted); font-size: 10.5px; margin-top: 2px; }
.stage-list { display: flex; flex-direction: column; gap: 1px; }
.stage-link {
  display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 7px; color: var(--ink-2); font-size: 12px; text-decoration: none; min-height: 32px;
}
.stage-link:hover { background: rgba(255, 255, 255, .045); text-decoration: none; }
.stage-link.is-active { background: rgba(79, 140, 255, .12); color: #cfe0ff; }
.stage-link em { font-style: normal; font-size: 9.5px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted-2); }
.stage-link.is-done .st-dot { background: var(--ok); color: var(--ok); }
.stage-link.is-wait .st-dot { background: var(--warn); color: var(--warn); }
.stage-link.is-locked { color: var(--muted-2); }
.stage-link.is-locked .st-dot { background: var(--line-strong); }
.st-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); position: relative; margin-left: 3px; }
.stage-link.is-active .st-dot { box-shadow: 0 0 0 3px rgba(79, 140, 255, .2); }
.side-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 9px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(79, 140, 255, .16); color: #cfe0ff; font-size: 11px; font-weight: 700; flex: 0 0 auto;
}
.side-foot .who { font-size: 12px; font-weight: 650; line-height: 1.2; }
.side-foot .role { font-size: 10.5px; color: var(--muted); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 25; height: var(--bosia-topbar);
  display: flex; align-items: center; gap: 14px; padding: 0 24px;
  background: rgba(10, 14, 23, .9); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.menu-btn { display: none; }
.crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 12px; color: var(--muted); overflow: hidden; }
.crumbs a { color: var(--muted); white-space: nowrap; }
.crumbs a:hover { color: var(--ink); }
.crumbs .sep { color: var(--muted-2); }
.crumbs .here { color: var(--ink); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.session-chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 10.5px;
  padding: 4px 9px; border-radius: 999px; border: 1px solid rgba(47, 212, 110, .3);
  background: rgba(47, 212, 110, .08); color: #8ee9b0; white-space: nowrap;
}
.session-chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.top-actions .search { min-height: 34px; min-width: 210px; }
.content { width: 100%; max-width: var(--max); margin: 0 auto; padding: 28px 32px 64px; min-width: 0; }

/* ---------- Cabeçalho de página ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head .eyebrow { font-size: 10.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 7px; }
.page-head h1 { margin-bottom: 6px; }
.page-head .lede { color: var(--muted); font-size: 13.5px; max-width: 76ch; }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.page-head .meta-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; font-size: 12px; color: var(--muted); }
.section { margin-top: 26px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 12px; flex-wrap: wrap; }
.section-head h2 { font-size: 19px; }
.section-head .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.breadcrumb-inline { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); }

/* ---------- Tabelas ---------- */
.table-wrap { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); overflow: auto; max-width: 100%; }
table.data { width: 100%; border-collapse: collapse; font-size: 12.5px; min-width: 640px; }
table.data thead th {
  position: sticky; top: 0; z-index: 2; background: #101828; text-align: left;
  padding: 10px 14px; font-size: 10.5px; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.data tbody td { padding: 11px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; color: var(--ink-2); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover td { background: rgba(255, 255, 255, .025); }
table.data tbody tr.is-selected td { background: rgba(79, 140, 255, .08); }
table.data .cell-main { color: var(--ink); font-weight: 600; }
table.data .cell-sub { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
table.data.compact tbody td { padding: 8px 12px; }
.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--muted); flex-wrap: wrap; }
.pagination { display: flex; gap: 4px; }
.pagination .pg { min-width: 28px; height: 28px; padding: 0 8px; display: grid; place-items: center; border-radius: 6px; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; font-size: 11.5px; }
.pagination .pg:hover { border-color: var(--line-strong); color: var(--ink); }
.pagination .pg.is-active { background: var(--brand); border-color: var(--brand); color: #06101f; font-weight: 700; }
.progress { height: 5px; border-radius: 99px; background: var(--line); overflow: hidden; min-width: 60px; }
.progress > span { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.progress.is-ok > span { background: var(--ok); }
.progress.is-warn > span { background: var(--warn); }
.progress-row { display: flex; align-items: center; gap: 8px; }
.progress-row .pct { font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- Tabs / segmented ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  appearance: none; border: 0; background: none; color: var(--muted); cursor: pointer;
  padding: 10px 14px; font-size: 13px; font-weight: 600; border-bottom: 2px solid transparent;
  white-space: nowrap; margin-bottom: -1px;
}
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--ink); border-bottom-color: var(--brand); }
.tab .count { margin-left: 6px; font-size: 10px; padding: 1px 6px; border-radius: 999px; background: rgba(139, 156, 192, .14); color: var(--muted); }
.segmented { display: inline-flex; padding: 3px; gap: 3px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 9px; }
.segmented button { border: 0; background: transparent; color: var(--muted); padding: 5px 11px; border-radius: 6px; font-size: 11.5px; font-weight: 600; cursor: pointer; }
.segmented button:hover { color: var(--ink); }
.segmented button.is-active { background: var(--panel); color: var(--ink); box-shadow: var(--shadow-1); }

/* ---------- Jornada ---------- */
.journey { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.journey-step {
  position: relative; border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  padding: 13px 13px 12px; display: flex; flex-direction: column; gap: 7px; min-height: 132px; text-decoration: none; color: inherit;
}
.journey-step:hover { border-color: var(--line-strong); text-decoration: none; }
.journey-step .step-n { font-size: 10px; font-weight: 700; letter-spacing: .1em; color: var(--muted-2); }
.journey-step .step-name { font-size: 12.5px; font-weight: 650; line-height: 1.3; color: var(--ink); }
.journey-step .step-meta { margin-top: auto; font-size: 10.5px; color: var(--muted); }
.journey-step.is-done { border-color: rgba(47, 212, 110, .28); }
.journey-step.is-current { border-color: rgba(255, 182, 72, .5); box-shadow: 0 0 0 1px rgba(255, 182, 72, .16); }
.journey-step.is-locked { opacity: .62; background: var(--bg-2); }
.journey-step.is-locked .step-name { color: var(--muted); }
.journey-step .lock { font-size: 11px; color: var(--muted-2); }
.stage-state { display: inline-flex; align-items: center; gap: 5px; font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.stage-state.ok { color: #7ce9a6; }
.stage-state.wait { color: #ffd08a; }
.stage-state.draft { color: #b9d1ff; }
.stage-state.lock { color: var(--muted-2); }
.stage-state .si { width: 14px; height: 14px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 8px; background: currentColor; color: #08101d; }

/* ---------- Documento / editorial ---------- */
.document { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.doc-head { padding: 22px 26px 18px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, rgba(79, 140, 255, .05), transparent); }
.doc-head .eyebrow { font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.doc-head h1 { font-size: 27px; margin: 5px 0 8px; }
.doc-meta { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); }
.doc-meta span { display: inline-flex; align-items: center; gap: 5px; }
.doc-body { padding: 6px 26px 26px; max-width: 900px; }
.prose { font-size: 14px; line-height: 1.7; color: var(--ink-2); }
.prose h2 { font-size: 20px; margin: 26px 0 8px; color: var(--ink); }
.prose h3 { font-size: 15.5px; margin: 20px 0 6px; color: var(--ink); font-family: var(--sans); font-weight: 650; }
.prose p { margin: 0 0 12px; }
.prose ul, .prose ol { margin: 0 0 14px; padding-left: 22px; }
.prose li { margin-bottom: 5px; }
.prose li::marker { color: var(--muted); }
.prose strong { color: var(--ink); font-weight: 650; }
.prose blockquote { border-left: 2px solid var(--line-strong); padding: 4px 0 4px 16px; color: var(--muted); margin: 0 0 14px; }
.prose .lead { font-size: 15.5px; color: var(--ink); }
.doc-section { padding: 18px 0; border-bottom: 1px solid var(--line-soft); }
.doc-section:last-child { border-bottom: 0; }
.doc-section .sec-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.doc-section .sec-head h2 { font-size: 18px; }
.doc-section .anchor { font-size: 10.5px; color: var(--muted-2); }
.evidence { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 10px; }
.evidence .ev {
  display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; color: var(--muted);
  border: 1px dashed var(--line-strong); border-radius: 6px; padding: 2px 7px;
}
.doc-toc { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 88px; }
.doc-toc a { font-size: 12px; color: var(--muted); padding: 5px 10px; border-left: 2px solid var(--line); text-decoration: none; }
.doc-toc a:hover { color: var(--ink); }
.doc-toc a.is-active { color: var(--ink); border-left-color: var(--brand); font-weight: 600; }
.quote-card { border: 1px solid var(--line); border-radius: 9px; padding: 14px 16px; background: var(--bg-2); font-size: 13px; color: var(--ink-2); }
.quote-card .who { margin-top: 8px; font-size: 11px; color: var(--muted); }

/* ---------- Fluxograma / diagramas ---------- */
.diagram { background: #0b1120; border: 1px solid var(--line); border-radius: 10px; padding: 16px; overflow-x: auto; }
.diagram svg { min-width: 560px; width: 100%; height: auto; }
.diagram .d-caption { display: flex; justify-content: space-between; gap: 10px; margin-top: 10px; font-size: 10.5px; color: var(--muted); }
.flow-node rect { fill: #121a2a; stroke: #2e3f5e; stroke-width: 1; rx: 8; }
.flow-node text { fill: #dbe6fb; font-family: var(--sans); font-size: 11px; }
.flow-node.is-decision rect { fill: #172238; stroke: #4f8cff; }
.flow-node.is-pain rect { fill: rgba(255, 92, 102, .1); stroke: #ff5c66; }
.flow-edge { stroke: #3a4d72; stroke-width: 1.4; fill: none; marker-end: url(#arrow); }
.flow-label { fill: #8b9cc0; font-family: var(--sans); font-size: 9.5px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11px; color: var(--muted); }
.legend .li { display: inline-flex; align-items: center; gap: 6px; }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; }
.sw-brand { background: var(--brand); }
.sw-ok { background: var(--ok); }
.sw-warn { background: var(--warn); }
.sw-danger { background: var(--danger); }
.sw-muted { background: var(--muted); }
.sw-brass { background: var(--brass); }

/* ---------- Gráficos ---------- */
.chart-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.chart-card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; min-width: 0; }
.chart-card .chart-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.chart-card .chart-head h3 { font-size: 14px; font-family: var(--sans); font-weight: 650; }
.chart-card .chart-head .sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.chart-card .chart-wrap { width: 100%; overflow: hidden; }
.chart-card svg { width: 100%; height: auto; overflow: visible; }
.chart-axis { stroke: #2a3a58; stroke-width: 1; }
.chart-grid-line { stroke: #1c2942; stroke-width: 1; stroke-dasharray: 2 4; }
.chart-text { fill: #8b9cc0; font-family: var(--sans); font-size: 10px; }
.chart-text-sm { fill: #6f81a6; font-family: var(--sans); font-size: 8.5px; }
.chart-value { fill: #dbe6fb; font-family: var(--sans); font-size: 10px; font-weight: 600; }
.chart-legend { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 10px; font-size: 10.5px; color: var(--muted); }
.chart-legend .li { display: inline-flex; align-items: center; gap: 5px; }
.chart-legend .sw { width: 8px; height: 8px; border-radius: 2px; }
.hm-cell { rx: 3; }
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; }
.span-7 { grid-column: span 7; }
.span-8 { grid-column: span 8; }
.span-12 { grid-column: span 12; }

/* ---------- Chat ---------- */
.chat { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; min-height: 0; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 12px 15px; border-bottom: 1px solid var(--line); }
.chat-head .ai-avatar { width: 28px; height: 28px; border-radius: 8px; background: linear-gradient(150deg, #4f8cff, #2b5bb5); color: #f5f8ff; display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.chat-head .ai-name { font-size: 12.5px; font-weight: 650; line-height: 1.2; }
.chat-head .ai-sub { font-size: 10.5px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.chat-head .ai-sub .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--ok); }
.chat-head .ctx { margin-left: auto; font-size: 10px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
.chat-log { flex: 1 1 auto; overflow-y: auto; padding: 15px; display: flex; flex-direction: column; gap: 14px; min-height: 260px; max-height: 560px; }
.msg { display: flex; flex-direction: column; gap: 5px; max-width: 92%; }
.msg .msg-meta { display: flex; align-items: center; gap: 7px; font-size: 10px; color: var(--muted-2); }
.msg .msg-meta .who { color: var(--muted); font-weight: 650; }
.msg .bubble { padding: 10px 13px; border-radius: 11px; font-size: 12.5px; line-height: 1.55; color: var(--ink-2); border: 1px solid var(--line); background: var(--bg-2); }
.msg .bubble p { margin: 0 0 7px; } .msg .bubble p:last-child { margin: 0; }
.msg .bubble ul { margin: 4px 0 0; padding-left: 18px; }
.msg-user { align-self: flex-end; align-items: flex-end; }
.msg-user .bubble { background: rgba(79, 140, 255, .14); border-color: rgba(79, 140, 255, .3); color: #e2ebff; border-bottom-right-radius: 3px; }
.msg-ai .bubble { border-bottom-left-radius: 3px; }
.msg .bubble .tag-row { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.suggestion { border: 1px solid rgba(240, 180, 92, .4); background: rgba(240, 180, 92, .06); border-radius: 9px; padding: 11px 12px; margin-top: 8px; }
.suggestion .s-head { display: flex; align-items: center; gap: 6px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #ffd9a3; }
.suggestion .s-body { font-size: 12px; color: var(--ink-2); margin: 6px 0 9px; }
.typing { display: inline-flex; gap: 4px; align-items: center; padding: 8px 12px; }
.typing span { width: 5px; height: 5px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
.chat-compose { border-top: 1px solid var(--line); padding: 10px 12px 12px; background: var(--bg-2); }
.chat-input { display: flex; align-items: flex-end; gap: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 6px 6px 6px 12px; }
.chat-input textarea { flex: 1 1 auto; border: 0; background: transparent; resize: none; min-height: 38px; max-height: 120px; padding: 8px 0; outline: none; font-size: 12.5px; line-height: 1.45; color: var(--ink); }
.chat-input .compose-actions { display: flex; gap: 4px; align-items: center; }
.send-btn { width: 32px; height: 32px; border-radius: 8px; border: 0; background: var(--brand); color: #06101f; display: grid; place-items: center; cursor: pointer; font-size: 13px; font-weight: 700; }
.chat-hints { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.chat-hints button { border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: 999px; padding: 3px 9px; font-size: 10.5px; cursor: pointer; }
.chat-hints button:hover { color: var(--ink); border-color: var(--line-strong); }
.chat-disclaimer { font-size: 9.5px; color: var(--muted-2); margin-top: 7px; text-align: center; }

/* ---------- Workspace 3 áreas ---------- */
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 372px; gap: 18px; align-items: start; }
.workspace-doc { min-width: 0; }
.workspace-chat { position: sticky; top: calc(var(--bosia-topbar) + 12px); }
.workspace-tabs { display: none; }
.mobile-tabs { display: none; }

/* ---------- Aprovação / fluxo ---------- */
.approval-box { border: 1px solid rgba(255, 182, 72, .38); background: rgba(255, 182, 72, .06); border-radius: 11px; padding: 16px 18px; }
.approval-box .ab-head { display: flex; align-items: center; gap: 9px; font-weight: 650; color: #ffd9a3; font-size: 13px; }
.checklist { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 9px; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; font-size: 12.5px; color: var(--ink-2); }
.checklist .ck { width: 18px; height: 18px; border-radius: 5px; border: 1px solid rgba(47, 212, 110, .45); background: var(--ok-tint); color: #7ce9a6; display: grid; place-items: center; font-size: 10px; flex: 0 0 auto; margin-top: 1px; }
.checklist .ck.pending { border-color: var(--line-strong); background: transparent; color: var(--muted-2); }
.checklist .ck.attention { border-color: rgba(255, 182, 72, .45); background: var(--warn-tint); color: #ffd08a; }
.timeline { display: flex; flex-direction: column; }
.tl-item { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 12px; position: relative; padding-bottom: 18px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before { content: ""; position: absolute; left: 8px; top: 18px; bottom: 0; width: 1px; background: var(--line); }
.tl-item:last-child::before { display: none; }
.tl-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--brand); margin: 5px 0 0 4px; position: relative; z-index: 1; box-shadow: 0 0 0 3px var(--bg); }
.tl-dot.ok { background: var(--ok); } .tl-dot.warn { background: var(--warn); } .tl-dot.danger { background: var(--danger); }
.tl-body { font-size: 12.5px; color: var(--ink-2); }
.tl-body .when { font-size: 10.5px; color: var(--muted-2); margin-top: 2px; }

.diff { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.diff-row { display: grid; grid-template-columns: 1fr 1fr; }
.diff-row > div { padding: 10px 14px; font-size: 12.5px; border-bottom: 1px solid var(--line-soft); min-width: 0; }
.diff-row > div:first-child { border-right: 1px solid var(--line); }
.diff-add { background: rgba(47, 212, 110, .08); color: #b8f2cc; }
.diff-del { background: rgba(255, 92, 102, .07); color: #ffc0c4; text-decoration: line-through; text-decoration-color: rgba(255, 92, 102, .5); }
.diff-muted { color: var(--muted-2); }
.diff-head { background: #101828; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }

/* ---------- Estados ---------- */
.empty-state { text-align: center; padding: 40px 24px; border: 1px dashed var(--line-strong); border-radius: 10px; background: rgba(14, 20, 32, .5); }
.empty-state .es-mark { width: 40px; height: 40px; border-radius: 10px; background: var(--brand-tint); color: #b9d1ff; display: grid; place-items: center; margin: 0 auto 12px; font-size: 16px; }
.empty-state h3 { font-size: 16px; margin-bottom: 5px; }
.empty-state p { color: var(--muted); font-size: 12.5px; max-width: 52ch; margin: 0 auto 14px; }
.loading-line { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; }
.skeleton { background: linear-gradient(90deg, #141d2e 25%, #1b2740 37%, #141d2e 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: 6px; height: 12px; }
.skeleton.w-40 { width: 40%; } .skeleton.w-60 { width: 60%; } .skeleton.w-80 { width: 80%; }
.state-demo { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.state-card { border: 1px solid var(--line); border-radius: 10px; padding: 14px; background: var(--bg-2); }
.state-card .sc-label { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-2); margin-bottom: 8px; }

/* ---------- Autenticação / público ---------- */
.auth-body { min-height: 100vh; display: flex; flex-direction: column; background: radial-gradient(1100px 600px at 18% -10%, rgba(79, 140, 255, .12), transparent 60%), var(--bg); }
.auth-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 28px; }
.auth-top .brand span { color: var(--muted); }
.auth-top .env { font-size: 10.5px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; }
.auth-main { flex: 1 1 auto; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(360px, .95fr); gap: 48px; align-items: center; width: 100%; max-width: 1160px; margin: 0 auto; padding: 32px 28px 64px; }
.auth-editorial { max-width: 520px; }
.auth-editorial .eyebrow { font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--brand); font-weight: 700; margin-bottom: 12px; }
.auth-editorial h1 { font-size: 40px; line-height: 1.08; margin-bottom: 14px; }
.auth-editorial h1 em { font-style: italic; color: #b9d1ff; }
.auth-editorial .lede { font-size: 14.5px; color: var(--muted); line-height: 1.65; margin-bottom: 22px; }
.auth-points { display: flex; flex-direction: column; gap: 10px; }
.auth-points .pt { display: flex; gap: 10px; align-items: flex-start; font-size: 12.5px; color: var(--ink-2); }
.auth-points .pt .n { width: 20px; height: 20px; border-radius: 6px; background: var(--brand-tint); color: #b9d1ff; display: grid; place-items: center; font-size: 9.5px; font-weight: 700; flex: 0 0 auto; }
.auth-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 26px; box-shadow: var(--shadow-2); width: 100%; max-width: 420px; justify-self: end; }
.auth-card h2 { font-size: 22px; margin-bottom: 4px; }
.auth-card .sub { color: var(--muted); font-size: 12.5px; margin-bottom: 18px; }
.auth-card .form-grid { grid-template-columns: 1fr; gap: 14px; }
.auth-foot { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }
.auth-demo { margin-top: 14px; border: 1px dashed var(--line-strong); border-radius: 8px; padding: 9px 11px; font-size: 10.5px; color: var(--muted); line-height: 1.5; }
.auth-shell-center { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 20px; gap: 16px; background: radial-gradient(900px 500px at 50% -5%, rgba(79, 140, 255, .1), transparent 62%), var(--bg); }
.auth-shell-center .brand { padding: 0; }
.state-page { width: 100%; max-width: 520px; text-align: center; }
.state-page .code { font-family: var(--serif); font-size: 56px; line-height: 1; letter-spacing: -.03em; color: #b9d1ff; }
.state-page h1 { font-size: 25px; margin: 8px 0 8px; }
.state-page p { color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.state-page .actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.resource-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 7px; font-size: 11.5px; color: var(--ink-2); background: var(--bg-2); margin-bottom: 14px; }

/* ---------- Drawer / modal inline ---------- */
.overlay-demo { border: 1px solid var(--line-strong); border-radius: 12px; background: rgba(5, 8, 14, .6); padding: 20px; }
.modal { max-width: 520px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 13px; box-shadow: var(--shadow-2); overflow: hidden; }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.modal-head h3 { font-size: 16px; }
.modal-body { padding: 18px 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; background: var(--bg-2); }

/* ---------- Preview Visual (snapshot) ---------- */
.pv-bar {
  position: sticky; top: 0; z-index: 100; height: 56px;
  display: flex; align-items: center; gap: 12px; padding: 0 22px;
  background: rgba(8, 12, 20, .96); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.pv-bar .pv-brand { display: flex; align-items: center; gap: 9px; font-family: var(--serif); font-size: 15px; }
.pv-bar .pv-brand .brand-mark { width: 28px; height: 28px; border-radius: 7px; font-size: 14px; }
.pv-bar .pv-tag { font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: #ffd08a; border: 1px solid rgba(255, 182, 72, .38); background: rgba(255, 182, 72, .08); padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.pv-bar .pv-hint { margin-left: auto; font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.pv-index { position: static; padding: 18px 22px 8px; max-width: 1480px; margin: 0 auto; }
.pv-index .pv-index-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.pv-index h1 { font-size: 18px; }
.pv-index .pv-groups { display: flex; flex-wrap: wrap; gap: 8px; }
.pv-group { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; border: 1px solid var(--line-soft); border-radius: 8px; padding: 5px 6px; background: rgba(18, 26, 42, .5); }
.pv-group .pg-label { font-size: 9px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted-2); padding: 0 3px; }
.pv-link {
  display: inline-flex; align-items: center; gap: 5px; border: 1px solid transparent;
  background: transparent; color: var(--muted); font-size: 10.5px; padding: 4px 8px; border-radius: 6px; cursor: pointer;
  font-family: var(--sans); white-space: nowrap;
}
.pv-link:hover { color: var(--ink); background: rgba(255, 255, 255, .05); }
.pv-link.is-active { color: #cfe0ff; background: rgba(79, 140, 255, .16); border-color: rgba(79, 140, 255, .34); }
.pv-link b { color: var(--muted-2); font-weight: 700; font-size: 9px; }
.pv-main { max-width: 1480px; margin: 0 auto; padding: 8px 22px 56px; }
.pv-screen { display: none; scroll-margin-top: 72px; }
.pv-screen.is-active { display: block; }
.pv-screen-label { display: flex; align-items: center; gap: 8px; margin: 8px 0 12px; font-size: 10.5px; color: var(--muted); }
.pv-screen-label b { color: #cfe0ff; font-size: 10.5px; }
.pv-screen-label .rule { flex: 1; height: 1px; background: var(--line-soft); }
.pv-frame { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--bg); box-shadow: var(--shadow-2); }
.pv-frame .app { min-height: 720px; }
.pv-frame .workspace-chat { position: static; }
.pv-frame .doc-toc { position: static; }
.pv-public { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--bg); box-shadow: var(--shadow-2); }
.pv-note { margin: 10px 0 0; font-size: 10.5px; color: var(--muted-2); }

/* ---------- Animações ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* ---------- Responsivo ---------- */
@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 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .span-3, .span-4, .span-5 { grid-column: span 6; }
  .span-7, .span-8 { grid-column: span 12; }
}
@media (max-width: 1120px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: 286px; transform: translateX(-100%);
    transition: transform .2s ease; box-shadow: var(--shadow-2);
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open::after { content: ""; position: fixed; inset: 0; background: rgba(4, 7, 12, .6); z-index: 29; }
  .menu-btn { display: inline-flex; }
  .workspace { grid-template-columns: 1fr; }
  .workspace-chat { position: static; }
  .grid-main-rail { grid-template-columns: 1fr; }
  .doc-toc { position: static; }
  .content { padding: 22px 22px 56px; }
  .top-actions .search { display: none; }
}
@media (max-width: 860px) {
  .auth-main { grid-template-columns: 1fr; gap: 26px; padding-top: 8px; }
  .auth-editorial h1 { font-size: 32px; }
  .auth-card { justify-self: stretch; max-width: none; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .kpi-grid, .kpi-grid.cols-4, .kpi-grid.cols-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .journey { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span-3, .span-4, .span-5, .span-6, .span-7, .span-8 { grid-column: span 12; }
  .form-grid { grid-template-columns: 1fr; }
  .mobile-tabs { display: flex; margin-bottom: 14px; }
  .hide-mobile { display: none !important; }
  .topbar { padding: 0 16px; }
  .crumbs .crumb-mid { display: none; }
  .content { padding: 18px 16px 48px; }
  .page-head h1, h1 { font-size: 25px; }
  .doc-body { padding: 6px 18px 22px; }
  .doc-head { padding: 18px 18px 15px; }
  .pv-bar .pv-hint { display: none; }
  .pv-main, .pv-index { padding-left: 14px; padding-right: 14px; }
}
@media (max-width: 640px) {
  .stat-strip .stat { flex-basis: 50%; border-bottom: 1px solid var(--line); }
  .stat-strip .stat:nth-child(2n) { border-right: 0; }
  .btn { min-height: 40px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1 1 auto; }
  .journey { grid-template-columns: 1fr; }
  .top-actions .session-chip { display: none; }
  .chat-log { max-height: 420px; }
  .diff-row { grid-template-columns: 1fr; }
  .diff-row > div:first-child { border-right: 0; }
  .pv-group { width: 100%; }
}
@media (max-width: 420px) {
  .content { padding: 14px 12px 44px; }
  .kpi-grid, .kpi-grid.cols-4, .kpi-grid.cols-5 { grid-template-columns: 1fr; }
  .stat-strip .stat { flex-basis: 100%; border-right: 0; }
  .brand strong { font-size: 16px; }
  .panel { padding: 15px; }
  .chart-grid { gap: 12px; }
}

/* ---------- Impressão ---------- */
@media print {
  .sidebar, .topbar, .page-actions, .chat, .pv-bar, .pv-index, .pv-screen-label, .mobile-tabs { display: none !important; }
  .app { grid-template-columns: 1fr; }
  body { background: #fff; color: #111; }
  .panel, .document, .chart-card, .table-wrap { border-color: #ddd; box-shadow: none; background: #fff; }
  .prose, .document { color: #111; }
  .content { max-width: none; padding: 0; }
  .pv-screen { display: block !important; }
  .pv-frame { border: 0; box-shadow: none; }
}

/* ---------- Toast de feedback (progressive enhancement) ---------- */
.toast-region { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: 360px; }
.toast {
  display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px;
  background: #162033; border: 1px solid var(--line-strong); border-left: 3px solid var(--brand);
  border-radius: 9px; box-shadow: var(--shadow-2); font-size: 12.5px; color: var(--ink-2);
  animation: toast-in .18s ease;
}
.toast.ok { border-left-color: var(--ok); }
.toast.warn { border-left-color: var(--warn); }
.toast strong { color: var(--ink); display: block; font-size: 12px; margin-bottom: 2px; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Workspace: alternância de áreas no mobile */
@media (max-width: 860px) {
  .workspace [data-workspace-area="doc"],
  .workspace [data-workspace-area="chat"] { display: none; }
  .workspace [data-workspace-area].is-mobile-active { display: block; }
}

/* Navegação lateral: estado ativo por tela (snapshot e produto) */
.app[data-screen="T10"] .side-link[data-nav="portfolio"],
.app[data-screen="T12"] .side-link[data-nav="portfolio"],
.app[data-screen="T13"] .side-link[data-nav="portfolio"],
.app[data-screen="T14"] .side-link[data-nav="portfolio"],
.app[data-screen="T16"] .side-link[data-nav="portfolio"],
.app[data-screen="T17"] .side-link[data-nav="portfolio"] { background: rgba(79,140,255,.12); color: #cfe0ff; }
.app[data-screen="T40"] .side-link[data-nav="painel"],
.app[data-screen="T41"] .side-link[data-nav="painel"],
.app[data-screen="T42"] .side-link[data-nav="painel"],
.app[data-screen="T43"] .side-link[data-nav="painel"],
.app[data-screen="T44"] .side-link[data-nav="painel"] { background: rgba(79,140,255,.12); color: #cfe0ff; }
.app[data-screen="T50"] .side-link[data-nav="relatorios"],
.app[data-screen="T51"] .side-link[data-nav="relatorios"] { background: rgba(79,140,255,.12); color: #cfe0ff; }
.app[data-screen="T61"] .side-link[data-nav="atividade"] { background: rgba(79,140,255,.12); color: #cfe0ff; }
.app[data-screen="T60"] .side-link[data-nav="conta"] { background: rgba(79,140,255,.12); color: #cfe0ff; }

/* O frame do snapshot simula a aplicação, mas sem prender o scroll da página */
@media (min-width: 1121px) {
  .pv-frame .sidebar { position: static; height: auto; min-height: 720px; }
  .pv-frame .topbar { position: static; }
}

/* Correções de acabamento — ícones e agrupamentos */
.company-switch .co-name,
.company-switch .co-meta { display: block; }
.side-link .ic { flex: 0 0 16px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.side-link.is-active .ic { color: var(--brand); }
.top-actions .search { min-width: 250px; }
.top-actions .search svg { flex: 0 0 auto; color: var(--muted-2); }
.pv-groups { max-height: 216px; overflow-y: auto; padding-right: 4px; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
@media (min-width: 1280px) { .pv-groups { max-height: 236px; } }
.side-foot .who,
.side-foot .role { display: block; }
.pv-index-head .pv-scroll-hint { font-size: 10px; color: var(--muted-2); }
@media (max-width: 860px) { .pv-groups { max-height: 170px; } }

/* Acabamento de cabeçalhos e gráficos */
.page-actions .select { width: auto; }
.chart-text { font-size: 10.5px; }
.chart-text-sm { font-size: 9.5px; }
.chart-value { font-size: 10.5px; }
.flow-label { font-size: 10px; }
.pv-bar .pv-tag { max-width: 46vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 420px) { .pv-bar .pv-tag { max-width: 155px; font-size: 9px; padding: 3px 7px; } }

/* Ajuste fino da navegação de etapas e do seletor de empresa */
.stage-link { align-items: start; gap: 7px; font-size: 11.5px; line-height: 1.35; }
.stage-link em { font-size: 8.5px; letter-spacing: 0; margin-top: 2px; }
.company-switch .co-meta { font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv-bar .pv-jump { margin-left: 4px; font-size: 10.5px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; text-decoration: none; white-space: nowrap; }
.pv-bar .pv-jump:hover { color: var(--ink); border-color: var(--line-strong); text-decoration: none; }
@media (max-width: 520px) { .pv-bar .pv-jump { display: none; } }

/* ==========================================================================
   Passada de polimento — legibilidade, toque, estados e contenção
   Preserva a direção aprovada (sidebar editorial + Midnight).
   ========================================================================== */

/* Marca e títulos: acabamento óptico */
.brand-mark { line-height: 1; letter-spacing: 0; }
h1, h2, h3, .prose h2, .prose h3 { text-wrap: balance; }
.page-head .lede, .prose p, .empty-state p { text-wrap: pretty; }
.kpi .v, .stat-strip .stat .v, table.data .num, .pct, .step-n, .doc-meta { font-variant-numeric: tabular-nums; }
.chart-value, .chart-text { font-variant-numeric: tabular-nums; }

/* Contraste de rótulos auxiliares (AA em todas as superfícies) */
.chart-text-sm { fill: #8496bd; }
.muted-2 { color: var(--muted-2); }

/* Foco visível consistente em controles interativos */
.tab:focus-visible,
.segmented button:focus-visible,
.pv-link:focus-visible,
.pagination .pg:focus-visible,
.side-link:focus-visible,
.stage-link:focus-visible,
.switch input:focus-visible + .track {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.switch input:focus-visible + .track { outline-offset: 3px; }

/* Áreas de toque >= 32px */
.btn-sm { min-height: 32px; }
.segmented button { min-height: 30px; }
.pagination .pg { min-width: 32px; height: 32px; }
.pv-link { min-height: 32px; }
.chip .x { min-width: 24px; min-height: 24px; display: inline-grid; place-items: center; }

/* KPIs e cartões: affordance discreta de drill-down */
.kpi { transition: border-color .16s ease, background-color .16s ease; }
.kpi:hover { border-color: var(--line-strong); }
.chart-card { transition: border-color .16s ease; }
.chart-card:hover { border-color: var(--line-strong); }

/* Cabeçalho, busca e chips */
.top-actions .search input { text-overflow: ellipsis; }
.top-actions .search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(79, 140, 255, .14); }
.session-chip { line-height: 1.6; }

/* Cabeçalho de página: ações alinhadas e sem quebra feia */
.page-head { align-items: flex-end; }
.page-actions .select { min-height: 38px; }

/* Tabelas: contenção e leitura em telas estreitas */
.table-wrap { -webkit-overflow-scrolling: touch; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
table.data tbody td { overscroll-behavior: contain; }
.table-foot { background: rgba(14, 20, 32, .4); }

/* Recursos longos (URLs, tokens de rota) não estouram o contêiner */
.resource-chip { flex-wrap: wrap; max-width: 100%; overflow-wrap: anywhere; text-align: left; }
.resource-chip .mono { overflow-wrap: anywhere; word-break: break-word; }
.doc-meta span { min-width: 0; }
.evidence .ev { max-width: 100%; overflow-wrap: anywhere; }

/* Fechamento da navegação no mobile */
.side-close { display: none; position: absolute; top: 12px; right: 10px; z-index: 2; }
@media (max-width: 1120px) {
  .side-close { display: inline-flex; }
  .brand { padding-right: 40px; }
}

/* Filtros: no mobile, uma coluna com alvos largos e legíveis */
@media (max-width: 640px) {
  .filters { display: grid; grid-template-columns: 1fr; gap: 8px; }
  .filters .select, .filters .input, .filters .search { width: 100%; min-width: 0; }
  .filters .btn { width: 100%; justify-content: center; }
  .grid-main-rail { gap: 16px; }
  .pagination .pg { min-width: 34px; height: 34px; }
}

/* Densidade no menor viewport: KPIs em duas colunas, sem overflow em 360px */
@media (max-width: 420px) {
  .kpi-grid, .kpi-grid.cols-4, .kpi-grid.cols-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { padding: 12px 12px 11px; }
  .kpi .v { font-size: 22px; }
  .kpi .k { font-size: 9.5px; letter-spacing: .05em; }
  .kpi .d { font-size: 10.5px; }
}

/* Evita zoom automático do iOS em campos de formulário */
@media (max-width: 640px) {
  .input, .select, .textarea, .search input, .chat-input textarea { font-size: 16px; }
  .search input { font-size: 16px; }
}

/* Alvos confortáveis em dispositivos de toque */
@media (pointer: coarse) {
  .icon-btn { width: 38px; height: 38px; }
  .side-link, .stage-link { min-height: 38px; }
  .btn-sm { min-height: 34px; }
  .chat-hints button { padding: 6px 11px; font-size: 11px; }
}

/* Contenção de grids: nenhum filho empurra a malha além do viewport */
.stack, .stack-sm, .stack-lg, .panel, .panel-flat, .table-wrap, .chart-card, .document { min-width: 0; }
.grid-2 > *, .grid-3 > *, .grid-4 > *,
.grid-main-rail > *, .workspace > *, .chart-grid > *,
.kpi-grid > *, .journey > *, .auth-main > * { min-width: 0; }
.rail-3 { grid-template-columns: 220px minmax(0, 1fr) 300px; }
.rail-3-wide { grid-template-columns: 230px minmax(0, 1fr) 300px; }
@media (max-width: 1120px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .grid-main-rail, .grid-main-rail.rail-3, .grid-main-rail.rail-3-wide { grid-template-columns: minmax(0, 1fr); }
  .rail-3 .doc-toc { display: none; }
}
@media (max-width: 860px) {
  .grid-2, .grid-3, .grid-4, .auth-main { grid-template-columns: minmax(0, 1fr); }
}

/* Documento: leitura confortável e sumário contido */
.doc-body { width: 100%; }
.doc-toc { max-height: calc(100vh - 160px); overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.pv-frame .doc-toc { max-height: none; overflow: visible; }

/* Chat: rolagem e composição previsíveis */
.chat-log { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.chat-input:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(79, 140, 255, .14); }

/* Sidebar: fechamento no mobile e rolagem suave */
.sidebar { position: sticky; }
@media (max-width: 1120px) { .sidebar { position: fixed; } }
@media (prefers-reduced-motion: no-preference) {
  .sidebar { transition: transform .2s ease; }
}

/* Cabeçalhos de painel: quebra controlada, sem estourar badges */
.panel-head { flex-wrap: wrap; }
.panel-head > div { min-width: 0; }
.panel-head .badge { flex: 0 0 auto; }

/* Selo de ambiente/estado nunca comprime o texto principal */
.page-head .meta-line .badge { flex: 0 0 auto; }

/* A marca mantém contraste e escala mesmo dentro de .brand (o rótulo "Discovery"
   usa regra mais específica que, sem isto, apagava a inicial) */
.brand .brand-mark {
  display: grid; place-items: center;
  font-family: var(--serif); font-size: 18px; font-weight: 700;
  letter-spacing: 0; text-transform: none; color: #f5f8ff; margin-top: 0; line-height: 1;
}
.auth-top .brand .brand-mark, .auth-shell-center .brand .brand-mark { font-size: 18px; }

/* No snapshot, a navegação off-canvas fica acima da barra do preview */
.pv-frame .sidebar { z-index: 120; }

/* Ícones de busca e chevron em SVG acompanham a cor e o alvo do contexto */
.search > svg { flex: 0 0 auto; color: var(--muted-2); }
.company-switch .chev { flex: 0 0 auto; margin-left: auto; color: var(--muted); }

/* Filtros: a busca cresce antes de comprimir o placeholder */
.filters .search { flex: 1 1 240px; }
.filters .search input { min-width: 0; }

/* ---------- Sprint 1: estados de formulário, sessão e conta ---------- */
[hidden] { display: none !important; }

.form-alert { margin-bottom: 16px; }
.form-alert:empty { display: none; }
.form-alert .notice { margin: 0; }
.field-error { font-size: 11.5px; line-height: 1.45; color: #ff9aa0; margin: 0; }
.field-error::before { content: "! "; font-weight: 700; }
.hint { font-size: 11px; line-height: 1.5; color: var(--muted-2); }

.session-chip.is-warn { border-color: rgba(255, 182, 72, .5); color: #ffd08a; }
.session-chip.is-warn .dot { background: var(--warn); }

.avatar[href] { text-decoration: none; }
.side-foot .avatar { flex: 0 0 auto; }

/* Segmentos de preferência tratados como radios */
.segmented [role="radio"] { cursor: pointer; }
.segmented [role="radio"]:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }

/* Ferramentas de desenvolvimento (localhost) */
.dev-result { margin-top: 12px; }
.dev-credentials { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.copy-field { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-2); min-width: 0; }
.copy-field .mono { min-width: 0; overflow-wrap: anywhere; }
[data-totp-code] { overflow-wrap: anywhere; }

/* Diálogo de confirmação */
dialog.bosia-dialog { border: 1px solid var(--line-strong); border-radius: 13px; background: var(--surface); color: var(--ink); padding: 0; width: min(440px, calc(100vw - 32px)); box-shadow: var(--shadow-2); }
dialog.bosia-dialog::backdrop { background: rgba(4, 7, 12, .66); backdrop-filter: blur(2px); }
dialog.bosia-dialog .bosia-dialog-form { display: flex; flex-direction: column; gap: 8px; padding: 20px; }
dialog.bosia-dialog h2 { font-size: 18px; }
dialog.bosia-dialog p { color: var(--muted); font-size: 12.5px; line-height: 1.55; }
dialog.bosia-dialog .bosia-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

/* Densidade escolhida pelo usuário */
:root[data-density="compacta"] .content { padding: 18px 24px 40px; }
:root[data-density="compacta"] .panel { padding: 14px 16px; }
:root[data-density="compacta"] table.data td,
:root[data-density="compacta"] table.data th { padding-top: 7px; padding-bottom: 7px; }
:root[data-density="compacta"] .stack { gap: 10px; }

@media (max-width: 640px) {
  .auth-top { padding: 16px; }
  .auth-top .env { max-width: 48%; text-align: right; font-size: 9.5px; }
  .copy-field { flex-wrap: wrap; }
}

/* Sprint 1: cadastro e alteração de senha */
.auth-switch-note { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--bg-2); }
.auth-switch-note strong { display: block; font-size: 13px; margin-bottom: 3px; }
.center-row { display: flex; justify-content: center; }
.password-details summary {
  cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 8px;
  font-size: 12.5px; font-weight: 650; color: var(--ink-2); padding: 4px 0;
}
.password-details summary::-webkit-details-marker { display: none; }
.password-details summary::before { content: "+"; display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 5px; border: 1px solid var(--line-strong); color: var(--muted); font-size: 12px; }
.password-details[open] summary::before { content: "−"; }
.password-details summary:hover { color: var(--ink); }
.password-details[open] summary { margin-bottom: 10px; }
.password-details .form-grid { margin-top: 4px; }
[data-profile-content][aria-busy="true"] { opacity: .55; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .skeleton, .btn .spin { animation: none; } }

/* Sprint 1: legibilidade e área de toque na tela de acesso (QA visual) */
.auth-top .brand span { font-size: 11px; }
.auth-top .env { font-size: 11px; }
.auth-editorial .eyebrow { font-size: 11px; }
.auth-points .pt .n { font-size: 11px; color: #ffffff; background: rgba(79, 140, 255, .55); }
.auth-card .link-btn.small { min-height: 28px; display: inline-flex; align-items: center; }
