/* BONDA OS — superfície de trabalho (M-0042).
   Fundo neutro, um acento (verde BONDA), quatro cores funcionais dessaturadas.
   Estado nunca só por cor: sempre texto + marca. Texto base 17px; Noria 18px. */
:root {
  --bg: #f5f4ef;
  --surface: #ffffff;
  --surface-2: #f0eee7;
  --line: #dcd8cd;
  --line-strong: #c3beb0;
  --ink: #1d2320;
  --ink-2: #3f4742;
  --muted: #646b66;
  --brand: #1e4a2c;
  --brand-2: #2c6a3d;
  --brand-soft: #e6efe5;
  --on-brand: #ffffff;
  --bad: #9c3426;
  --bad-bg: #f8e6e2;
  --warn: #7a5200;
  --warn-bg: #faefd4;
  --ok: #2c6a3d;
  --ok-bg: #e4f0e3;
  --info: #2b5876;
  --info-bg: #e4eef5;
  --focus: #1f6fb2;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(29, 35, 32, 0.06), 0 2px 8px rgba(29, 35, 32, 0.05);
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --base: 17px;
  color-scheme: light;
}

body.ops { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: var(--base); line-height: 1.5; }
body.ops > main { display: none; }
body.ops.ops-large { --base: 18px; }
.ops *, .ops *::before, .ops *::after { box-sizing: border-box; }
.ops :focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.ops button, .ops input, .ops textarea, .ops select { font: inherit; }
.ops h1, .ops h2, .ops h3, .ops p { margin: 0; }
.ops .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Cabeçalho com a marca ---------- */
.w-top { background: var(--brand); color: var(--on-brand); display: flex; align-items: center; gap: 16px; padding: 8px 24px; min-height: 72px; }
.w-logo { height: 58px; width: auto; display: block; }
.w-top-who { margin-left: auto; text-align: right; line-height: 1.25; }
.w-top-who strong { display: block; font-size: 1rem; }
.w-top-who small { opacity: 0.85; font-size: 0.82rem; }
.w-top-btn { background: transparent; color: var(--on-brand); border: 1px solid rgba(255, 255, 255, 0.45); border-radius: 8px; padding: 6px 12px; cursor: pointer; }
.w-top-btn:hover { background: rgba(255, 255, 255, 0.12); }

/* ---------- Estrutura ---------- */
.w-shell { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: calc(100vh - 72px); }
.w-nav { background: var(--surface); border-right: 1px solid var(--line); padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; }
.w-nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-weight: 500; }
.w-nav a:hover { background: var(--surface-2); }
.w-nav a[aria-current="page"] { background: var(--brand-soft); color: var(--brand); font-weight: 650; }
.w-nav .w-nav-count { margin-left: auto; font-size: 0.8rem; background: var(--surface-2); border-radius: 999px; padding: 1px 8px; color: var(--ink-2); }
.w-nav a[aria-current="page"] .w-nav-count { background: var(--surface); }
.w-nav-sep { height: 1px; background: var(--line); margin: 10px 4px; }
.w-nav-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); padding: 6px 12px 2px; }
.w-main { padding: 28px 32px 120px; max-width: 1080px; width: 100%; }

.w-page-head { margin-bottom: 22px; }
.w-page-head h1 { font-size: 1.65rem; line-height: 1.2; font-weight: 700; letter-spacing: -0.01em; }
.w-page-head p { color: var(--ink-2); margin-top: 6px; max-width: 70ch; }
.w-banner { background: var(--info-bg); color: var(--info); border: 1px solid #c7d9e7; border-radius: var(--radius); padding: 10px 14px; margin-bottom: 18px; font-weight: 550; }
.w-feedback { border-radius: var(--radius); padding: 10px 14px; margin-bottom: 16px; font-weight: 550; }
.w-feedback-ok { background: var(--ok-bg); color: var(--ok); }
.w-feedback-bad { background: var(--bad-bg); color: var(--bad); }

/* ---------- Resumo de estados (contadores com significado) ---------- */
.w-states { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 4px 0 26px; }
.w-state { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; text-decoration: none; color: inherit; display: block; }
.w-state strong { display: block; font-size: 1.6rem; line-height: 1.1; }
.w-state span { color: var(--ink-2); font-size: 0.92rem; }
.w-state.is-bad { border-color: #e2b8b0; background: var(--bad-bg); }
.w-state.is-bad strong { color: var(--bad); }

/* ---------- Seções e listas ---------- */
.w-section { margin-bottom: 30px; }
.w-section-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.w-section-head h2 { font-size: 1.15rem; font-weight: 700; }
.w-section-head small { color: var(--muted); }
.w-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.w-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 16px; border-top: 1px solid var(--line); }
.w-row:first-child { border-top: 0; }
.w-row-main { min-width: 0; cursor: pointer; background: none; border: 0; text-align: left; padding: 0; color: inherit; }
.w-row-title { display: block; font-weight: 650; overflow-wrap: anywhere; }
.w-row-why { display: block; color: var(--ink-2); font-size: 0.93rem; margin-top: 2px; }
.w-row-meta { display: block; color: var(--muted); font-size: 0.84rem; margin-top: 3px; }
.w-row-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.w-row.is-readonly { grid-template-columns: auto minmax(0, 1fr); }
.w-row > .w-chip { min-width: 9.5em; justify-content: center; }
.w-empty { padding: 16px; color: var(--ink-2); background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.w-empty.is-nodata { background: var(--surface-2); }
.w-more { margin-top: 8px; }
.w-note { color: var(--muted); font-size: 0.86rem; margin-top: 8px; }

/* ---------- Marcas de estado: texto + símbolo, cor só reforça ---------- */
.w-chip { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 3px 10px; font-size: 0.82rem; font-weight: 650; white-space: nowrap; background: var(--surface-2); color: var(--ink-2); border: 1px solid transparent; }
.w-chip.t-bad { background: var(--bad-bg); color: var(--bad); }
.w-chip.t-warn { background: var(--warn-bg); color: var(--warn); }
.w-chip.t-ok { background: var(--ok-bg); color: var(--ok); }
.w-chip.t-info { background: var(--info-bg); color: var(--info); }
.w-chip.t-muted { background: var(--surface-2); color: var(--muted); border-color: var(--line); }
.w-chip.t-inference { background: var(--surface); color: var(--info); border: 1px dashed var(--info); }

/* ---------- Botões ---------- */
.w-btn { border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); padding: 8px 14px; cursor: pointer; font-weight: 600; min-height: 40px; }
a.w-btn { text-decoration: none; display: inline-flex; align-items: center; }
.w-btn:hover { background: var(--surface-2); }
.w-btn:disabled { opacity: 0.55; cursor: progress; }
.w-btn-primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.w-btn-primary:hover { background: var(--brand-2); }
.w-btn-problem { color: var(--bad); border-color: #dcb2aa; }
.w-btn-problem:hover { background: var(--bad-bg); }
.w-btn-link { border: 0; background: none; color: var(--brand); text-decoration: underline; padding: 4px 0; min-height: auto; }

/* ---------- Cartões da equipe e de mudanças ---------- */
.w-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.w-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; }
.w-card h3 { font-size: 1.1rem; }
.w-card .w-card-area { color: var(--muted); font-size: 0.86rem; margin-top: -6px; }
.w-card dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; }
.w-card dt { color: var(--ink-2); }
.w-card dd { margin: 0; font-weight: 700; text-align: right; }
.w-card dd.is-bad { color: var(--bad); }
.w-card .w-btn { align-self: flex-start; margin-top: auto; }
.w-change { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.w-change + .w-change { margin-top: 10px; }
.w-change h3 { font-size: 1rem; }
.w-change dl { display: grid; grid-template-columns: 9.5em 1fr; gap: 3px 12px; margin: 8px 0 0; font-size: 0.94rem; }
.w-change dt { color: var(--muted); }
.w-change dd { margin: 0; }

/* ---------- Gaveta de detalhe (divulgação progressiva) ---------- */
.w-drawer { border: 0; padding: 0; margin: 0 0 0 auto; height: 100vh; max-height: 100vh; width: min(560px, 100vw); background: var(--surface); box-shadow: -8px 0 30px rgba(0, 0, 0, 0.15); }
.w-drawer::backdrop { background: rgba(29, 35, 32, 0.35); }
.w-drawer-inner { display: flex; flex-direction: column; height: 100%; }
.w-drawer-head { padding: 18px 20px 12px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.w-drawer-head h2 { font-size: 1.25rem; }
.w-drawer-body { padding: 16px 20px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 18px; }
.w-drawer-foot { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; flex-wrap: wrap; }
.w-block h3 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-bottom: 6px; }
.w-block ul { margin: 0; padding-left: 1.1em; }
.w-facts { display: grid; grid-template-columns: 11em 1fr; gap: 4px 12px; margin: 0; }
.w-facts dt { color: var(--muted); }
.w-facts dd { margin: 0; }
.w-source { color: var(--muted); font-size: 0.85rem; }
.w-form { display: flex; flex-direction: column; gap: 10px; }
.w-form label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; }
.w-form textarea, .w-form input[type="text"], .w-form select { border: 1px solid var(--line-strong); border-radius: 8px; padding: 9px 10px; background: var(--surface); color: var(--ink); }
.w-form .w-check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }

/* ---------- Vondinia (IA) ---------- */
.w-ask-fab { position: fixed; right: 24px; bottom: 24px; z-index: 20; background: var(--brand); color: var(--on-brand); border: 0; border-radius: 999px; padding: 14px 20px; font-weight: 700; box-shadow: 0 6px 18px rgba(30, 74, 44, 0.35); cursor: pointer; }
.w-ask { position: fixed; right: 0; top: 72px; bottom: 0; width: min(440px, 100vw); background: var(--surface); border-left: 1px solid var(--line); box-shadow: -6px 0 24px rgba(0, 0, 0, 0.08); z-index: 30; display: flex; flex-direction: column; }
.w-ask[hidden] { display: none; }
.w-ask-head { padding: 14px 16px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; gap: 4px; }
.w-ask-head strong { font-size: 1.05rem; }
.w-ask-head small { color: var(--muted); grid-column: 1 / -1; }
.w-ask-log { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 14px; }
.w-ask-q { align-self: flex-end; background: var(--brand-soft); color: var(--brand); border-radius: 12px 12px 2px 12px; padding: 8px 12px; max-width: 90%; font-weight: 550; }
.w-ask-a { background: var(--surface-2); border-radius: 12px 12px 12px 2px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.w-ask-a ul { margin: 0; padding-left: 1.1em; }
.w-ask-a .w-ask-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; color: var(--muted); }
.w-ask-a .w-ask-inference { color: var(--info); }
.w-draft { background: var(--surface); border: 1px dashed var(--line-strong); border-radius: 8px; padding: 10px; white-space: pre-wrap; }
.w-ask-sugs { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 10px; }
.w-sug { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 999px; padding: 6px 12px; cursor: pointer; font-size: 0.9rem; color: var(--ink-2); }
.w-sug:hover { background: var(--surface-2); }
.w-ask-form { display: flex; gap: 8px; padding: 12px 16px 16px; border-top: 1px solid var(--line); }
.w-ask-form textarea { flex: 1; border: 1px solid var(--line-strong); border-radius: 8px; padding: 9px 10px; resize: none; min-height: 46px; }

/* ---------- Fontes (rodapé discreto) ---------- */
.w-sources { margin-top: 36px; color: var(--muted); font-size: 0.85rem; display: flex; flex-wrap: wrap; gap: 6px 16px; border-top: 1px solid var(--line); padding-top: 12px; }

/* ---------- Responsivo: navegação embaixo, conteúdo em coluna ---------- */
@media (max-width: 820px) {
  .w-shell { grid-template-columns: 1fr; }
  .w-nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 25; flex-direction: row; overflow-x: auto; padding: 6px; border-right: 0; border-top: 1px solid var(--line); gap: 2px; }
  .w-nav a { flex-direction: column; gap: 2px; font-size: 0.78rem; padding: 6px 10px; white-space: nowrap; }
  .w-nav-sep, .w-nav-label { display: none; }
  .w-nav .w-nav-count { margin: 0; }
  .w-main { padding: 18px 16px 150px; }
  .w-top { padding: 8px 16px; }
  .w-logo { height: 46px; }
  .w-states { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .w-row, .w-row.is-readonly { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .w-top { gap: 10px; }
  .w-top-who small { display: none; }
  .w-top-btn { padding: 4px 8px; font-size: 0.85rem; }
  .w-row-actions { justify-content: flex-start; }
  .w-row > .w-chip { justify-self: start; min-width: 0; }
  .w-ask-fab { bottom: 84px; right: 16px; }
  .w-ask { top: 0; width: 100vw; }
  .w-change dl, .w-facts { grid-template-columns: 1fr; }
}
