/* ═══════════════════════════════════════════════════════════════════════════
   VEREDICTO — sobre o nimbleUI (nimble/tokens.css: zinco, 6px nos controlos, 12px nos painéis).
   Acento próprio: âmbar (data-accent="amber").

   Regra do tema: claro/escuro só trocam tokens de COR. Tamanhos, espaçamentos, raios e
   geometria das sombras estão definidos uma vez, em :root.
   ═══════════════════════════════════════════════════════════════════════════ */

/* Tokens: neutrals, accent (data-accent="amber"), radii, shadows and fonts come from nimbleUI (nimble/tokens.css, loaded first).
   Only what is specific to this app stays here: layout widths and the status colours of hypotheses/decisions
   (kept as their own, more contrasted, values) + one neutral tuned for contrast on the dark theme. Colours only. */
:root {
  --wrap: 960px;
  --gutter: 16px;
}

[data-theme="light"] {
  --ok: #059669; --ok-soft: rgba(5, 150, 105, .12);
  --bad: #dc2626; --bad-soft: rgba(220, 38, 38, .10);
  --warn: #b45309; --warn-soft: rgba(217, 119, 6, .14);
  --open: #475569; --open-soft: rgba(71, 85, 105, .12);
}

[data-theme="dark"] {
  --subtle: #8b8b94;
  --ok: #34d399; --ok-soft: rgba(52, 211, 153, .14);
  --bad: #dc2626; --bad-soft: rgba(220, 38, 38, .14);
  --warn: #fbbf24; --warn-soft: rgba(251, 191, 36, .14);
  --open: #94a3b8; --open-soft: rgba(148, 163, 184, .14);
}

* { box-sizing: border-box; margin: 0; }
[hidden] { display: none !important; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; background: var(--bg); color: var(--text); font: 400 15px/1.5 var(--font); }
button, input, select, textarea { font: inherit; color: inherit; }
.ico { width: 18px; height: 18px; flex: none; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.grow { flex: 1; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 13px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: none; box-shadow: 0 0 0 var(--ring) var(--primary-soft); border-color: var(--primary); }

/* ── barra de topo ─────────────────────────────────────────────────────── */
.topbar { position: sticky; top: 0; z-index: 10; background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar__in { display: flex; align-items: center; gap: 8px; height: 56px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; color: var(--text); text-decoration: none; }
.brand__mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: var(--r-md); background: var(--primary); color: var(--primary-ink); }

/* ── botões ────────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 0 14px; border: 1px solid transparent; border-radius: var(--r-sm); background: var(--surface-2); color: var(--text); font-weight: 600; font-size: 14px; cursor: pointer; transition: background var(--fast), border-color var(--fast); white-space: nowrap; }
.btn:hover { border-color: var(--border-strong); }
.btn--primary { background: var(--primary); color: var(--primary-ink); }
.btn--primary:hover { background: var(--primary-h); border-color: transparent; }
.btn--text { background: transparent; }
.btn--text:hover { background: var(--surface-2); border-color: transparent; }
.btn--danger { background: transparent; color: var(--bad); }
.btn--danger:hover { background: var(--bad-soft); border-color: transparent; }
.btn--icon { width: 36px; padding: 0; }
.btn--sm { min-height: 30px; padding: 0 10px; font-size: 13px; }

/* ── menu ──────────────────────────────────────────────────────────────── */
.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 50; min-width: 240px; padding: 6px; display: grid; gap: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-lg); }
.menu[hidden] { display: none; }
.menu__item { display: flex; align-items: center; width: 100%; min-height: 36px; padding: 0 12px; border: 0; border-radius: var(--r-md); background: none; color: var(--text); font: inherit; font-weight: 500; text-align: left; cursor: pointer; }
.menu__item .install-ico { display: inline-flex; margin-right: 10px; }
.menu__item[hidden] { display: none; }
.menu__item:hover, .menu__item:focus-visible { background: var(--surface-2); }

/* ── separadores ───────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 4px; margin: 20px 0 16px; border-bottom: 1px solid var(--border); }
.tab { padding: 10px 14px; margin-bottom: -1px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); font-weight: 600; cursor: pointer; }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--primary); }

/* ── barra de ferramentas ──────────────────────────────────────────────── */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.filter { min-height: 30px; padding: 0 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; }
.filter[aria-pressed="true"] { background: var(--primary-soft); border-color: var(--primary); color: var(--text); }
.select, .input, .textarea { width: 100%; min-height: 36px; padding: 7px 10px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--surface); }
.toolbar .select { width: auto; max-width: 100%; }
.textarea { min-height: 72px; resize: vertical; }
.summary { margin-bottom: 16px; color: var(--muted); font-size: 13px; }

/* ── etiquetas ─────────────────────────────────────────────────────────── */
.tag { display: inline-flex; align-items: center; min-height: 22px; padding: 0 8px; border-radius: var(--r-sm); font-size: 12px; font-weight: 600; white-space: nowrap; }
.tag--aberta { background: var(--open-soft); color: var(--open); }
.tag--sustentada, .tag--perseverar { background: var(--ok-soft); color: var(--ok); }
.tag--refutada, .tag--matar { background: var(--bad-soft); color: var(--bad); }
.tag--insuficiente, .tag--ajustar, .tag--ainda-nao { background: var(--warn-soft); color: var(--warn); }
.tag--neutra { background: var(--surface-2); color: var(--muted); }
.tag--critica { background: var(--primary-soft); color: var(--primary-fg); }

/* ── cartões ───────────────────────────────────────────────────────────── */
.list { display: grid; gap: 12px; }
.card { padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-sm); min-width: 0; }
.card__tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.card__title { font-size: 16px; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.card__meta { display: grid; gap: 2px; margin-top: 8px; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.card__meta b { color: var(--text); font-weight: 600; }
.card__warn { color: var(--warn); }
.card__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.card__actions .select { width: auto; min-height: 30px; padding: 3px 8px; font-size: 13px; }

.sessions { display: grid; gap: 8px; margin-top: 12px; padding: 0; list-style: none; }
.session { padding: 10px 12px; border-radius: var(--r-md); background: var(--surface-2); font-size: 14px; overflow-wrap: anywhere; }
.session__head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 4px; color: var(--muted); font-size: 13px; }
.session__foot { margin-top: 4px; color: var(--muted); font-size: 13px; }

.empty { padding: 32px 16px; text-align: center; color: var(--muted); border: 1px dashed var(--border-strong); border-radius: var(--r-lg); }

/* ── decisões ──────────────────────────────────────────────────────────── */
.suggest { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; font-size: 14px; color: var(--muted); }
.hyps { display: grid; gap: 4px; margin: 10px 0 0; padding: 0; list-style: none; font-size: 14px; }
.hyps li { display: flex; gap: 8px; align-items: baseline; }
.choices { display: flex; flex-wrap: wrap; gap: 6px; border: 0; padding: 0; margin: 12px 0 8px; }
.choice { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 999px; font-size: 14px; font-weight: 600; cursor: pointer; }
.choice input { margin: 0; accent-color: var(--primary); }
.history { display: grid; gap: 6px; margin-top: 12px; padding: 0; list-style: none; font-size: 14px; }
.history li { padding: 8px 10px; border-left: 3px solid var(--border-strong); background: var(--surface-2); border-radius: 0 var(--r-sm) var(--r-sm) 0; overflow-wrap: anywhere; }

/* ── formulários em diálogo ────────────────────────────────────────────── */
.dialog { width: min(560px, calc(100vw - 2 * var(--gutter))); max-height: calc(100vh - 32px); padding: 0; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); color: var(--text); box-shadow: var(--sh-lg); }
.dialog::backdrop { background: var(--overlay); }
.form { display: grid; gap: 12px; padding: 20px; }
.form h2 { font-size: 18px; }
.form__hint { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.field { display: grid; gap: 4px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 600; }
.field small { color: var(--subtle); font-size: 12px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; }
.check input { margin-top: 4px; accent-color: var(--primary); }
.group { display: grid; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: var(--r-md); }
.group > legend { padding: 0 6px; font-size: 13px; font-weight: 600; }
.form__err { color: var(--bad); font-size: 14px; min-height: 1.5em; }
.form__actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ajuda ("?") */
.help-btn { font-weight: 600; font-size: 15px; }
.help__section { display: grid; gap: 12px; }
.help__row { display: flex; align-items: flex-start; gap: 12px; font-size: 13px; line-height: 1.5; color: var(--muted); }
.help__row > div { min-width: 0; overflow-wrap: anywhere; }
.help__row strong { color: var(--text); font-weight: 600; }
.help__icon { flex: none; width: 20px; text-align: center; color: var(--primary); font-size: 15px; line-height: 1.4; }
.help__divider { height: 1px; background: var(--border); }

/* avisos: NimbleUI.toast (nimble/behaviors.js) */
.toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; max-width: calc(100vw - 2 * var(--gutter)); }
.toast { max-width: calc(100vw - 2 * var(--gutter)); padding: 10px 16px; border-radius: var(--r-md); background: var(--text); color: var(--bg); font-size: 14px; box-shadow: var(--sh-lg); }
.toast__icon { display: none; }

.foot { margin: 40px 0 24px; color: var(--subtle); font-size: 13px; }

/* ── modo monco: barra do projecto, avisos, entrar ─────────────────────── */
.projbar { border-top: 1px solid var(--border); }
.projbar__in { display: flex; align-items: center; gap: 10px; min-height: 40px; min-width: 0; }
.crumb { flex: none; color: var(--primary-fg); font-size: 13px; font-weight: 600; text-decoration: none; }
.crumb:hover { text-decoration: underline; }
.projbar__nome { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 600; }
.state { flex: none; color: var(--subtle); font-size: 12px; white-space: nowrap; }
.state--warn { color: var(--warn); }
.banner { display: grid; gap: 8px; margin-top: 16px; padding: 12px 14px; border: 1px solid var(--warn); border-radius: var(--r-md); background: var(--warn-soft); font-size: 14px; overflow-wrap: anywhere; }
.banner__actions { display: flex; flex-wrap: wrap; gap: 6px; }
.tag--perdida { background: var(--warn-soft); color: var(--warn); }
.porta { padding-top: 48px; padding-bottom: 48px; }
.porta__card { display: grid; gap: 12px; max-width: 440px; margin: 0 auto; padding: 20px; }
.porta__titulo { font-size: 18px; font-weight: 600; }
.porta__form { display: flex; gap: 8px; }
.porta__form .input { flex: 1; min-width: 0; }
.porta__a-abrir { text-align: center; color: var(--muted); }
.link { color: var(--primary-fg); }

@media (max-width: 600px) {
  .row { grid-template-columns: 1fr; }
  .toolbar .select { flex: 1; }
  .btn-label { display: none; }
}
