/* BOSIA Discovery — camada de aplicação (Sprint 1: acesso, papéis e auditoria)
   Preserva o Design Freeze: layout sidebar-dense, paleta slate e tokens --bosia-*. */

a { color: var(--brand); }
a:hover { text-decoration: underline; }
.sb-brand-title { font-size: 14px; letter-spacing: -.01em; color: #fff; font-weight: 650; }
.sb-logout { margin-left: auto; }
.sb-logout .btn { color: var(--bosia-sidebar-text); }
.sb-logout .btn:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.top-user { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: #fff; font-size: 10.5px; font-weight: 700; flex: none; }
.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; }

/* Alerts from design system need a little breathing room in the dense shell. */
.bosia-alert { margin-bottom: 14px; font-size: 12.5px; }
.bosia-alert.warn { background: var(--warn-tint); border-color: color-mix(in srgb, var(--warn) 30%, #fff); color: var(--ink); }
.bosia-alert.ok { background: var(--ok-tint); border-color: color-mix(in srgb, var(--ok) 28%, #fff); color: var(--ink); }
.bosia-alert.error { background: var(--danger-tint); border-color: color-mix(in srgb, var(--danger) 28%, #fff); color: var(--ink); }
.bosia-alert.info { background: var(--brand-tint); border-color: color-mix(in srgb, var(--brand) 26%, #fff); color: var(--ink); }
.bosia-alert .btn-link { color: var(--brand); }
.bosia-empty { background: var(--surface); }

/* Lists / key-value blocks */
.plain-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.plain-list li { position: relative; padding-left: 18px; font-size: 12.2px; color: var(--ink-2); line-height: 1.5; }
.plain-list li::before { content: ""; position: absolute; left: 2px; top: 7px; width: 6px; height: 6px; border-radius: 50%; background: var(--brand); opacity: .7; }
.kv-list { margin: 0; display: flex; flex-direction: column; gap: 11px; }
.kv-list > div { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 12px; align-items: baseline; }
.kv-list dt { font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.kv-list dd { margin: 0; font-size: 12.3px; color: var(--ink); word-break: break-word; }
.quick-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.mt-16 { margin-top: 16px; }
.mt-8 { margin-top: 8px; }

/* Filtering */
.field-inline { min-width: 260px; }
.field-inline .input { height: 32px; min-height: 32px; }
.empty-filter { padding: 18px; text-align: center; color: var(--muted); font-size: 12px; }
[data-filter-target][hidden] { display: none !important; }

/* Forms */
.form-card { max-width: 720px; padding: 20px; }
.form-card form { margin: 0; }
.form-actions { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.field-error { color: var(--danger); font-size: 11px; margin-top: 4px; font-weight: 600; }
.input.is-invalid { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-tint); }
.password-wrap { position: relative; display: flex; }
.password-wrap .input { padding-right: 82px; }
.pwd-toggle { position: absolute; right: 3px; top: 3px; height: 28px; }
.req { color: var(--danger); }

/* Auth screen */
.auth-body { min-height: 100vh; background: var(--bg); }
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); }
.auth-brand { position: relative; overflow: hidden; padding: 56px clamp(28px, 6vw, 72px); display: flex; flex-direction: column; justify-content: center; color: var(--bosia-sidebar-text); background: linear-gradient(155deg, #0e1822 0%, #142331 55%, #1b3350 100%); }
.auth-brand::after { content: ""; position: absolute; inset: auto -80px -120px auto; width: 320px; height: 320px; border-radius: 50%; background: radial-gradient(circle, rgba(47, 111, 235, .28), transparent 65%); }
.auth-mark { width: 42px; height: 42px; font-size: 15px; margin-bottom: 22px; }
.auth-brand .eyebrow { color: #8fb4f5; }
.auth-brand h1 { color: #fff; font-family: var(--serif); font-size: clamp(27px, 3vw, 38px); line-height: 1.14; letter-spacing: -.02em; max-width: 18ch; margin: 0 0 14px; }
.auth-brand > p { color: #b9c8d8; font-size: 13.5px; line-height: 1.6; max-width: 46ch; margin: 0; }
.auth-points { list-style: none; padding: 0; margin: 26px 0 0; display: flex; flex-direction: column; gap: 10px; }
.auth-points li { position: relative; padding-left: 22px; font-size: 12.4px; color: #c8d4e0; }
.auth-points li::before { content: ""; position: absolute; left: 2px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: #4d85f2; box-shadow: 0 0 0 3px rgba(77, 133, 242, .18); }
.auth-panel { display: flex; flex-direction: column; justify-content: center; padding: 48px clamp(24px, 5vw, 64px); background: var(--surface); }
.auth-panel-head { margin-bottom: 18px; }
.auth-panel-head h2 { font-family: var(--serif); font-size: 27px; letter-spacing: -.01em; margin: 0 0 5px; }
.auth-form .field { margin-bottom: 15px; }
.auth-submit { width: 100%; height: 40px; font-size: 13px; margin-top: 4px; }
.login-dev { margin-top: 18px; font-size: 12px; color: var(--muted); padding: 12px; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface-2); }
.auth-foot { margin-top: 26px; font-size: 10.8px; }
.dev-body { min-height: 100vh; background: var(--bg); }
.dev-content { max-width: 1040px; }
.dev-content .page-head { margin-top: 16px; }
.dev-content .card { margin-top: 14px; }

/* Password/copy helpers */
.pwd-value { background: var(--surface-2); border: 1px solid var(--line); border-radius: 5px; padding: 3px 8px; }
[data-copy-target] { white-space: nowrap; }

@media (max-width: 900px) {
  .auth-shell { grid-template-columns: minmax(0, 1fr); }
  .auth-brand { padding: 34px 24px; }
  .auth-brand h1 { font-size: 27px; max-width: none; }
  .auth-points { display: none; }
  .auth-panel { padding: 32px 24px 48px; }
}
@media (max-width: 640px) {
  .kv-list > div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .field-inline { min-width: 0; width: 100%; }
  .card-head { flex-wrap: wrap; }
  .row-actions { justify-content: flex-start; }
  .form-card { padding: 14px; }
  .sb-foot .who { font-size: 11px; }
}

/* Ajustes de contraste/legibilidade verificados (WCAG-AA e fonte mínima) */
.eyebrow { font-size: 11px; }
.auth-brand { background-color: #0e1822; }
.auth-foot { font-size: 11.5px; }
.auth-brand > p { color: #c8d4e0; }
.login-dev { font-size: 12px; }
.btn-sm { min-height: 28px; }
.badge { font-size: 11px; }
.sb-brand span { font-size: 11px; }

/* ---------- Sprint 2: empresas, processos e continuidade ---------- */
.t-link { font-weight: 600; color: var(--ink); }
.t-link:hover { color: var(--brand); text-decoration: none; }
.crumb-link { color: var(--brand); font-weight: 600; }
.crumb-link:hover { text-decoration: underline; }
.form-wide { max-width: 860px; }
.inline-form { display: flex; gap: 8px; align-items: flex-end; margin: 10px 0 14px; flex-wrap: wrap; }
.inline-form .grow { flex: 1 1 240px; margin-bottom: 0; }
.narrativa { font-size: 12.6px; color: var(--ink-2); line-height: 1.68; white-space: pre-wrap; word-break: break-word; }
.journey-body { padding: 16px; }
.journey-note { margin-top: 14px; align-items: flex-start; }
.journey-note .hint { margin-top: 4px; }
.continuity-card { margin-bottom: 16px; }
.retomar { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.retomar .rt-main { min-width: 0; flex: 1; }
.retomar .rt-label { font-size: 9.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 650; }
.retomar .rt-title { font-size: 14px; font-weight: 650; margin-top: 2px; }
.retomar .rt-sub { font-size: 11.5px; color: var(--muted); margin-top: 1px; line-height: 1.45; }
.retomar .btn { flex: none; }
.empty-retomar { background: #fff; border-style: dashed; }
.bosia-empty .e-ico { width: 40px; height: 40px; border-radius: 10px; margin: 0 auto 10px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); font-weight: 700; font-size: 12px; }
.bosia-empty h4 { font-size: 12.5px; font-weight: 650; margin-bottom: 3px; }
.bosia-empty p { font-size: 11.5px; color: var(--muted); max-width: 52ch; margin: 0 auto 12px; }
.jstep { cursor: default; }
.jstep.current .j-title { color: var(--brand); }
@media (max-width: 640px) {
  .retomar { flex-direction: column; align-items: stretch; }
  .retomar .btn { width: 100%; }
  .inline-form { flex-direction: column; align-items: stretch; }
  .inline-form .btn { width: 100%; }
}

/* ---------- Sprint 3: investigação de sites e ingestão de documentos ---------- */
.invest-card, .file-card { margin-bottom: 14px; }
.invest-card:last-child, .file-card:last-child { margin-bottom: 0; }
.inv-head-main { min-width: 0; flex: 1 1 360px; }
.inv-head-main .t-main { font-size: 13px; word-break: break-word; }
.prog-wrap { height: 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; margin: 4px 0 6px; }
.prog-bar { height: 100%; background: var(--brand); border-radius: 999px; transition: width .35s ease; }
.prog-meta { font-size: 11px; color: var(--muted); margin-bottom: 12px; }
.processing-line { display: flex; align-items: center; gap: 8px; padding: 9px 12px; margin: 0 0 12px; border: 1px solid color-mix(in srgb, var(--brand) 24%, #fff); background: var(--brand-tint); border-radius: var(--radius); font-size: 11.5px; color: var(--ink-2); }
.sintese { margin: 12px 0 14px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.sintese-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.sinal-list { display: flex; flex-direction: column; gap: 10px; }
.sinal { padding: 9px 11px; background: #fff; border: 1px solid var(--line); border-radius: 6px; }
.sinal-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 5px; }
.sinal-trecho { margin: 0 0 4px; padding: 0 0 0 10px; border-left: 3px solid var(--brand); font-size: 12px; color: var(--ink-2); line-height: 1.55; }
.fonte-detalhe { margin-top: 6px; }
.fonte-detalhe summary { cursor: pointer; font-size: 11.5px; color: var(--brand); font-weight: 600; }
.texto-fonte { margin: 8px 0 0; padding: 10px 12px; max-height: 320px; overflow: auto; background: #0e1822; color: #dbe7f5; border-radius: 6px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.file-input { padding: 8px; height: auto; }
.file-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 6px 0 8px; }
.file-actions .chip { font-size: 10.5px; }
.badge .dot { width: 5px; height: 5px; }
@media (max-width: 640px) {
  .inv-head-main { flex-basis: 100%; }
  .prog-meta { line-height: 1.5; }
  .file-actions .btn { width: 100%; }
}

/* ---------- Sprint 4: contexto conduzido por conversa ---------- */
.jstep-link { text-decoration: none; color: inherit; }
.jstep-link:hover { background: var(--brand-tint); text-decoration: none; }
.jstep .j-open { margin-top: 4px; font-size: 10px; font-weight: 650; color: var(--brand); letter-spacing: .02em; }
.stage-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.doc-shell .doc-sec .origin { vertical-align: middle; }
.doc-shell .doc-sec li .t-sub { margin-top: 2px; }
.chat-log .bosia-empty { padding: 22px 12px; }
.chat-compose .select { height: 27px; font-size: 11px; border: 1px solid var(--line); border-radius: 6px; background: #fff; padding: 0 6px; }
.chat-compose .cp-tools label.tiny { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; }
.chat-compose .send { color: #fff; font-size: 16px; line-height: 1; }
.chat-compose select:focus-visible, .chat-compose textarea:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
@media (max-width: 1180px) {
  .workspace .chat { display: flex; }
}
@media (max-width: 640px) {
  .quick-actions .inline-form, .quick-actions .btn { width: 100%; }
  .quick-actions .inline-form .btn { width: 100%; }
  .doc-shell .doc-body { padding: 16px 14px 22px; }
}

/* ---------- Sprint 5: AS IS, diagnóstico e TO BE ---------- */
.origin.observed { color: var(--brand); background: var(--brand-tint); }
.item-meta { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 2px; }
.item-meta .badge, .item-meta .chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.diagrama-sec { margin-top: 24px; }
.diagrama-acoes { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 8px 0 12px; }
.diagrama-render {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 12px;
  overflow-x: auto;
}
.diagrama-render svg { min-width: 520px; }
.diagrama-mermaid { margin-top: 12px; }
.diagrama-mermaid summary { cursor: pointer; font-size: 11.5px; font-weight: 650; color: var(--brand); }
.diagrama-mermaid[open] summary { margin-bottom: 8px; }
.alt-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.alt-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.alt-card.selected { border-color: var(--ok); box-shadow: 0 0 0 2px color-mix(in srgb, var(--ok) 18%, transparent); }
.alt-card header { display: flex; align-items: flex-start; gap: 8px; justify-content: space-between; }
.alt-card h4 { font-size: 13px; font-weight: 650; margin: 0; }
.alt-secoes { margin: 0; padding-left: 16px; display: flex; flex-direction: column; gap: 4px; font-size: 11.8px; color: var(--ink-2); line-height: 1.5; }
.alt-card form { margin-top: auto; }
@media (max-width: 900px) {
  .alt-grid { grid-template-columns: 1fr; }
}

/* ---------- Sprint 6: oportunidades e PRDs ---------- */
.opo-sec { margin-top: 18px; }
.opo-grid-cards { display: grid; grid-template-columns: 1fr; gap: 14px; margin-top: 12px; }
.opo-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.opo-card.selected { border-color: var(--ok); box-shadow: 0 0 0 2px color-mix(in srgb, var(--ok) 16%, transparent); }
.opo-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.opo-head h3 { margin: 2px 0 0; font-size: 15px; line-height: 1.3; }
.opo-kicker { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.opo-badges { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.opo-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 18px; }
.opo-field p { margin: 3px 0 0; font-size: 12px; line-height: 1.5; color: var(--ink-2); }
.opo-label { font-size: 10px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; }
.opo-field .plain-list { margin: 3px 0 0; }
.opo-trace { border-top: 1px dashed var(--line); padding-top: 10px; }
.opo-trace p { margin: 3px 0 0; font-size: 11.5px; color: var(--ink-2); line-height: 1.5; }
.opo-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; border-top: 1px solid var(--line); padding-top: 12px; }
.opo-priority { display: flex; gap: 6px; align-items: center; }
.opo-priority .select { height: 30px; }
.opo-criteria { margin-bottom: 10px; }
.opo-criteria h4 { margin: 0 0 4px; font-size: 12.5px; }
.prd-sec-list { display: flex; flex-direction: column; gap: 16px; }
.prd-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.prd-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.prd-head h3 { margin: 2px 0 0; font-size: 15px; line-height: 1.3; }
.prd-metrics { display: flex; gap: 6px; flex-wrap: wrap; }
.prd-trace { border: 1px dashed var(--line); border-radius: 6px; padding: 10px 12px; background: var(--surface-2); }
.prd-trace-grid { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 6px; }
.prd-details summary { cursor: pointer; font-size: 12px; font-weight: 650; color: var(--brand); }
.prd-details[open] summary { margin-bottom: 10px; }
.prd-body { display: flex; flex-direction: column; gap: 12px; }
.prd-sec h4 { margin: 0 0 6px; font-size: 12.5px; color: var(--ink); }
.prd-sec ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 12px; line-height: 1.5; }
.prd-foot { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; }
.prd-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.cp-target { display: flex; flex-direction: column; gap: 3px; margin-bottom: 6px; }
.cp-target label { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.cp-target .select { height: 30px; font-size: 11.5px; }
@media (max-width: 900px) {
  .opo-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .opo-head, .prd-head { flex-direction: column; }
  .opo-badges { justify-content: flex-start; }
  .opo-actions .btn, .opo-actions .inline-form { width: 100%; }
  .opo-actions .inline-form .btn { width: 100%; }
  .opo-priority { width: 100%; }
  .opo-priority .select { flex: 1; }
  .prd-trace-grid { flex-direction: column; gap: 6px; }
}
.prd-versions summary { cursor: pointer; font-size: 11.5px; font-weight: 650; color: var(--muted); }
.prd-versions[open] summary { margin-bottom: 8px; }

.impact-card { margin-top: 16px; }
.impact-item { border: 1px solid var(--bosia-border); border-radius: var(--bosia-radius); padding: 12px 14px; margin-bottom: 10px; background: var(--bosia-bg); }
.impact-item:last-child { margin-bottom: 0; }
.impact-item header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.impact-item .quick-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
