/* ==========================================================================
   DZ23 AI Compare — folha única
   Ordem: tokens → base → layout → componentes → vistas → responsivo
   Nenhum estilo inline depende desta folha (CSP: style-src 'self').
   ========================================================================== */

:root {
  color-scheme: dark;

  --ink: #0b0c0e;
  --surface: #101216;
  --surface-2: #16191e;
  --surface-3: #1c2026;
  --line: rgba(242, 240, 234, 0.1);
  --line-strong: rgba(242, 240, 234, 0.2);
  --text: #f2f0ea;
  --text-soft: #d5d2c9;
  --muted: #969ca5;
  --accent: #c8f14e;
  --accent-ink: #12160a;
  --accent-soft: rgba(200, 241, 78, 0.14);
  --info: #93a4ff;
  --warn: #ffbe55;
  --danger: #ff6b76;
  --ok: #6fdcae;
  --white: #ffffff;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  --shadow-soft: 0 2px 12px rgba(0, 0, 0, 0.25);

  --font-display: 'Iowan Old Style', 'Palatino Linotype', 'Book Antiqua', Georgia, serif;
  --font-sans: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', 'Cascadia Mono', Menlo, Consolas, 'Liberation Mono', monospace;

  --rail: 224px;
  --topbar: 64px;
  --page: 1240px;
}

:root[data-theme='light'] {
  color-scheme: light;
  --ink: #f6f3ec;
  --surface: #fffdf8;
  --surface-2: #f2eee5;
  --surface-3: #e9e4d9;
  --line: rgba(21, 23, 27, 0.12);
  --line-strong: rgba(21, 23, 27, 0.24);
  --text: #15171b;
  --text-soft: #2c3036;
  --muted: #646a74;
  --accent: #4f7c05;
  --accent-ink: #ffffff;
  --accent-soft: rgba(79, 124, 5, 0.12);
  --info: #3f51d6;
  --warn: #9a6200;
  --danger: #c22a3a;
  --ok: #1c7c55;
  --white: #ffffff;
  --shadow: 0 24px 60px rgba(21, 23, 27, 0.16);
  --shadow-soft: 0 2px 10px rgba(21, 23, 27, 0.08);
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

html {
  -webkit-text-size-adjust: 100%;
  scrollbar-gutter: stable;
}

body {
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.has-overlay,
body.has-rail-open {
  overflow: hidden;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--text);
}

h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 3.4vw, 2.9rem);
  line-height: 1.05;
  letter-spacing: -0.025em;
}

h2 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: -0.015em;
}

h3 {
  font-size: 1rem;
  font-weight: 600;
}

p {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  color: var(--accent);
}

button {
  font: inherit;
  color: inherit;
}

input,
textarea,
select {
  font: inherit;
  color: inherit;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

pre {
  margin: 0;
  font-family: var(--font-mono);
}

svg.icon {
  flex: none;
  display: block;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection {
  background: var(--accent);
  color: var(--accent-ink);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: -60px;
  left: 16px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  font-weight: 600;
  transform: translateY(-200%);
  transition: transform 0.15s ease;
}

.skip-link:focus-visible {
  transform: none;
}

/* Fallback de cópia para navegadores sem Clipboard API. */
.clipboard-helper {
  position: fixed;
  top: -1000px;
  left: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.82rem;
}

.eyebrow {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.fatal {
  max-width: 520px;
  margin: 18vh auto;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.fatal h1 {
  font-size: 1.6rem;
  margin-bottom: 12px;
}

.fatal-detail {
  margin: 12px 0 20px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.fatal button {
  padding: 10px 18px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  cursor: pointer;
}

.noscript {
  padding: 40px;
  text-align: center;
}

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */

.shell {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  min-height: 100vh;
}

.rail {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 22px;
  height: 100vh;
  padding: 22px 16px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, var(--surface) 0%, var(--ink) 100%);
  z-index: 30;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px;
}

.brand-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
}

.brand-dot {
  position: absolute;
  right: 6px;
  bottom: 7px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent-ink);
}

.brand-text {
  display: flex;
  flex-direction: column;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  line-height: 1.2;
}

.brand-text em {
  font-style: normal;
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  color: var(--muted);
}

.rail-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rail-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 0.9rem;
  text-align: left;
  background: none;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.rail-link span {
  white-space: nowrap;
}

.rail-link:hover {
  color: var(--text);
  background: var(--surface-2);
}

.rail-link.is-active {
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--line);
}

.rail-link.is-active svg {
  color: var(--accent);
}

.rail-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.rail-workspaces {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  overflow: auto;
  padding-top: 4px;
}

.rail-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px 0 10px;
}

.rail-section-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.rail-add {
  width: 24px;
  height: 24px;
}

.spaces {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.space-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--muted);
  font-size: 0.84rem;
  text-align: left;
  cursor: pointer;
}

.space-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.space-btn.is-active {
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--line);
}

.space-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
  opacity: 0.6;
}

.space-btn.is-active .space-dot {
  background: var(--accent);
  opacity: 1;
}

.space-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.space-count {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--muted);
}

@media (max-width: 1080px) {
  .rail-workspaces {
    display: none;
  }
}

@media (max-width: 860px) {
  .rail-workspaces {
    display: flex;
  }
}

.frame {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  height: var(--topbar);
  padding: 0 clamp(16px, 3vw, 40px);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--ink) 88%, transparent);
  backdrop-filter: blur(14px);
}

.topbar-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.topbar-crumb {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.topbar-title strong {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.rail-toggle {
  display: none;
}

.main {
  flex: 1;
  width: 100%;
  max-width: var(--page);
  margin: 0 auto;
  padding: clamp(22px, 3vw, 40px) clamp(16px, 3vw, 40px) 96px;
}

.view {
  display: flex;
  flex-direction: column;
  gap: clamp(24px, 3vw, 36px);
  animation: rise 0.24s ease both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.page-head > div:first-child {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 68ch;
}

.page-head h1 {
  margin-top: 2px;
}

.page-head p {
  color: var(--muted);
  font-size: 0.95rem;
}

.page-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.section-head > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.section-head p {
  color: var(--muted);
  font-size: 0.9rem;
}

/* --------------------------------------------------------------------------
   Botões, badges, chips
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 15px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.12s ease, border-color 0.12s ease, opacity 0.12s ease;
  white-space: nowrap;
}

.btn:hover:not(:disabled) {
  background: var(--surface-3);
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 650;
}

.btn-primary:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent) 86%, #ffffff);
}

.btn-ghost {
  background: transparent;
  border-color: var(--line-strong);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-2);
}

.btn-quiet {
  background: transparent;
  color: var(--muted);
}

.btn-quiet:hover:not(:disabled) {
  color: var(--text);
  background: var(--surface-2);
}

.btn-danger {
  background: var(--danger);
  color: #1a0305;
  font-weight: 650;
}

.btn-danger-ghost {
  background: transparent;
  border-color: color-mix(in srgb, var(--danger) 40%, transparent);
  color: var(--danger);
}

.btn-danger-ghost:hover:not(:disabled) {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
}

.btn-sm {
  padding: 6px 11px;
  font-size: 0.8rem;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.icon-btn-sm {
  width: 26px;
  height: 26px;
}

.icon-btn-danger:hover {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 12%, transparent);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.63rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.badge-ok {
  color: var(--ok);
  border-color: color-mix(in srgb, var(--ok) 36%, transparent);
  background: color-mix(in srgb, var(--ok) 10%, transparent);
}

.badge-warn {
  color: var(--warn);
  border-color: color-mix(in srgb, var(--warn) 36%, transparent);
}

.badge-info {
  color: var(--info);
  border-color: color-mix(in srgb, var(--info) 36%, transparent);
}

.badge-neutral {
  color: var(--muted);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  cursor: pointer;
}

.chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.chip.is-on {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   Avatar com cor de marca (sem estilo inline)
   -------------------------------------------------------------------------- */

.avatar {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: var(--brand, #5e7469);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0;
  flex: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}

/* Logomarca branca (SVG) sobre a cor da marca. */
.avatar-img {
  display: block;
  width: 60%;
  height: 60%;
  object-fit: contain;
}

/* Favicon colorido pede fundo neutro para não brigar com a cor da marca. */
.avatar[data-logo='color'] {
  background: #f4f2ec;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.avatar[data-logo='color'] .avatar-img {
  width: 68%;
  height: 68%;
}

.avatar-initial {
  display: none;
}

.avatar[data-logo='none'] .avatar-initial {
  display: inline;
}

.avatar-sm {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  font-size: 0.78rem;
}

.avatar-lg {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  font-size: 1.15rem;
}

[data-brand='chatgpt'] { --brand: #0d8a6c; }
[data-brand='claude'] { --brand: #c2633f; }
[data-brand='gemini'] { --brand: #3b74d9; }
[data-brand='grok'] { --brand: #2b303a; }
[data-brand='deepseek'] { --brand: #3f58cf; }
[data-brand='qwen'] { --brand: #5a55d6; }
[data-brand='kimi'] { --brand: #1f3a93; }
[data-brand='mistral'] { --brand: #d95f00; }
[data-brand='copilot'] { --brand: #0a6bb8; }
[data-brand='poe'] { --brand: #5452c9; }
[data-brand='huggingchat'] { --brand: #b47f00; }
[data-brand='zai'] { --brand: #1a63cc; }
[data-brand='minimax'] { --brand: #c22f2f; }
[data-brand='perplexity'] { --brand: #0e8c99; }
[data-brand='notebooklm'] { --brand: #2a63ba; }
[data-brand='lmarena'] { --brand: #6d2fd1; }
[data-brand='consensus'] { --brand: #0d665f; }
[data-brand='elicit'] { --brand: #443ccb; }
[data-brand='aistudio'] { --brand: #2a8a45; }
[data-brand='openrouter'] { --brand: #5558d6; }
[data-brand='groq'] { --brand: #d84228; }
[data-brand='cerebras'] { --brand: #cf4b1c; }
[data-brand='ollama'] { --brand: #3a3f47; }
[data-brand='v0'] { --brand: #1a1d22; }
[data-brand='lovable'] { --brand: #d64d76; }
[data-brand='bolt'] { --brand: #0a6bc4; }
[data-brand='replit'] { --brand: #cf4f00; }
[data-brand='cursor'] { --brand: #2a2d34; }
[data-brand='manus'] { --brand: #2b2f3a; }
[data-brand='genspark'] { --brand: #0b7f75; }
[data-brand='dola'] { --brand: #7c3aed; }
[data-brand='duckai'] { --brand: #de5833; }
[data-brand='deepai'] { --brand: #2563eb; }
[data-brand='mimo'] { --brand: #ff6900; }
[data-brand='custom'] { --brand: #5e7469; }

/* --------------------------------------------------------------------------
   Estatísticas
   -------------------------------------------------------------------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 18px 20px;
  background: var(--surface);
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 500;
  line-height: 1.1;
}

.stat-hint {
  font-size: 0.78rem;
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   Painéis do workspace
   -------------------------------------------------------------------------- */

.panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
  gap: 12px;
}

.panel-grid.is-sparse {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 0.14s ease, transform 0.14s ease;
}

.panel:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.panel-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-index {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted);
  letter-spacing: 0.1em;
}

.panel-top .icon-btn {
  margin-left: auto;
}

.panel-id {
  display: flex;
  align-items: center;
  gap: 11px;
}

.panel-id h3 {
  font-size: 1rem;
}

.panel-id span {
  font-size: 0.78rem;
  color: var(--muted);
}

.panel-note {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.45;
}

.panel-foot {
  display: flex;
  gap: 6px;
  margin-top: auto;
}

.panel-foot .btn:first-child {
  flex: 1;
}

.panel-add {
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 200px;
  border-style: dashed;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-align: center;
}

.panel-add:hover {
  color: var(--text);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.panel-add-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
}

.panel-add strong {
  font-size: 0.92rem;
}

.panel-add span {
  font-size: 0.78rem;
}

/* --------------------------------------------------------------------------
   Compositor
   -------------------------------------------------------------------------- */

.composer {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-soft);
}

.composer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.composer-title {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--accent);
}

.composer-title h2 {
  font-size: 1rem;
  font-family: var(--font-sans);
  font-weight: 600;
  color: var(--text);
}

.composer-tools {
  display: flex;
  gap: 4px;
}

.composer-input {
  width: 100%;
  resize: vertical;
  min-height: 110px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.6;
}

.composer-input::placeholder {
  color: color-mix(in srgb, var(--muted) 80%, transparent);
}

.composer-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.composer-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.composer-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--muted);
}

.composer-count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
}

.last-prompt {
  margin: 0;
  padding: 16px 18px;
  border-left: 2px solid var(--accent);
  background: var(--surface);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-soft);
  font-size: 0.92rem;
}

/* --------------------------------------------------------------------------
   Comparador
   -------------------------------------------------------------------------- */

.prompt-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.prompt-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 12px;
}

.prompt-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 0.95rem;
  color: var(--text-soft);
  max-height: 260px;
  overflow: auto;
}

.gateway-bar,
.gateway-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
}

.gateway-status {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
}

.gateway-status div {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.gateway-status strong {
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
}

.gateway-status span {
  font-size: 0.8rem;
}

.gateway-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.gateway-panel.is-ready {
  border-style: solid;
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
  background: var(--accent-soft);
}

.gateway-panel.is-ready .gateway-status {
  color: var(--text-soft);
}

.assist-note {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  padding: 11px 14px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.84rem;
}

.assist-note svg {
  color: var(--info);
}

.assist-note a {
  margin-left: auto;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.assist-note code,
.settings-note code {
  font-family: var(--font-mono);
  font-size: 0.78em;
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--surface-3);
  color: var(--text-soft);
}

.progress {
  appearance: none;
  width: 100%;
  height: 4px;
  border: 0;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}

.progress::-webkit-progress-bar {
  background: var(--surface-3);
}

.progress::-webkit-progress-value {
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.2s ease;
}

.progress::-moz-progress-bar {
  background: var(--accent);
  border-radius: 999px;
}

.answer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
}

.answer {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.answer.has-answer {
  border-color: color-mix(in srgb, var(--ok) 26%, var(--line));
}

.answer-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
}

.answer-id {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  min-width: 0;
}

.answer-id strong {
  font-size: 0.92rem;
}

.answer-id span {
  font-size: 0.75rem;
  color: var(--muted);
}

.answer-head .badge {
  margin-left: auto;
}

.answer-body {
  padding: 15px;
  flex: 1;
  max-height: 420px;
  overflow: auto;
}

.answer-body p {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 0.9rem;
  line-height: 1.6;
}

.answer-body.is-empty {
  display: flex;
  flex-direction: column;
  gap: 6px;
  justify-content: center;
  min-height: 130px;
  text-align: left;
}

.answer-error {
  margin: 0 15px 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger);
  font-size: 0.8rem;
  display: flex;
  gap: 6px;
  align-items: center;
}

.answer-foot {
  display: flex;
  gap: 4px;
  padding: 8px 10px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}

.export-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 4px;
}

/* --------------------------------------------------------------------------
   Consensus
   -------------------------------------------------------------------------- */

.mission {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.mission-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.mission-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 14px 16px;
  background: var(--surface);
}

.mission-cell strong {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 500;
}

.mission-goal {
  padding: 16px 18px;
  border-left: 2px solid var(--accent);
  background: var(--surface);
  border-radius: 0 var(--radius) var(--radius) 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--text-soft);
}

.mission-participants {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 12px;
}

.participant {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.participant-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.participant-id {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  min-width: 0;
}

.participant-id span {
  font-size: 0.76rem;
  color: var(--muted);
}

.participant-head .badge {
  margin-left: auto;
}

.participant-tools {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  align-items: center;
}

.participant-input {
  width: 100%;
  resize: vertical;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: var(--text);
  font-size: 0.86rem;
  line-height: 1.55;
  font-family: var(--font-mono);
}

.participant-input:focus {
  outline: none;
  border-color: var(--accent);
}

.participant-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.mission-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.records {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 14px 16px;
}

.records > summary {
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-soft);
}

.records-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.record {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  background: var(--ink);
}

.record > summary {
  cursor: pointer;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: var(--muted);
}

.record-stage {
  color: var(--text-soft);
}

.record-body {
  margin-top: 10px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 0.8rem;
  line-height: 1.55;
  max-height: 320px;
  overflow: auto;
  color: var(--text-soft);
}

.notice {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  padding: 13px 15px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 0.88rem;
}

.notice-ok {
  border-color: color-mix(in srgb, var(--ok) 34%, transparent);
  background: color-mix(in srgb, var(--ok) 9%, transparent);
  color: var(--ok);
}

.notice-warn {
  border-color: color-mix(in srgb, var(--warn) 34%, transparent);
  background: color-mix(in srgb, var(--warn) 9%, transparent);
  color: var(--warn);
}

.team-field {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 0;
}

.team-field legend {
  padding: 0 6px;
  font-size: 0.82rem;
  color: var(--muted);
}

.team-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.team-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(170px, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--ink);
}

.team-row.is-checked {
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
}

.team-toggle {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  font-size: 0.88rem;
}

.team-model {
  font-size: 0.74rem;
  color: var(--muted);
  font-family: var(--font-mono);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-btn {
  border: 0;
  background: none;
  color: var(--accent);
  cursor: pointer;
  padding: 0;
  font-size: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Formulários
   -------------------------------------------------------------------------- */

.form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field > label,
.field > span.field-label {
  font-size: 0.82rem;
  color: var(--text-soft);
  font-weight: 500;
}

.field-hint {
  font-size: 0.76rem;
  color: var(--muted);
}

.input,
.select,
textarea.input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: var(--text);
  font-size: 0.9rem;
}

.input:focus,
.select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

textarea.input {
  resize: vertical;
  line-height: 1.55;
}

.select {
  appearance: none;
  padding-right: 32px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}

.select-sm {
  padding: 6px 28px 6px 9px;
  font-size: 0.8rem;
}

.select-wrap {
  display: inline-flex;
}

.input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.input-row .input {
  flex: 1;
}

.checkbox-line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--muted);
}

.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.switch-track {
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--line-strong);
  position: relative;
  transition: background 0.15s ease;
}

.switch-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.15s ease, background 0.15s ease;
}

.switch input:checked + .switch-track {
  background: color-mix(in srgb, var(--accent) 30%, transparent);
  border-color: var(--accent);
}

.switch input:checked + .switch-track::after {
  transform: translateX(18px);
  background: var(--accent);
}

.search-field {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 1;
  min-width: 220px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
}

.search-field input {
  flex: 1;
  border: 0;
  background: none;
  color: var(--text);
  font-size: 0.9rem;
  padding: 2px 0;
}

.search-field input:focus {
  outline: none;
}

.search-field:focus-within {
  border-color: var(--accent);
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.form-actions .muted {
  font-size: 0.76rem;
}

/* --------------------------------------------------------------------------
   Listas e diretório
   -------------------------------------------------------------------------- */

.list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.list-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  transition: background 0.1s ease;
}

.list-row:last-child {
  border-bottom: 0;
}

.list-row:hover {
  background: var(--surface-2);
}

.list-row[hidden] {
  display: none;
}

.list-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--line);
  color: var(--muted);
  flex: none;
}

.list-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}

.list-meta {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.list-main h3 {
  font-size: 0.94rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-sub {
  font-size: 0.78rem;
  color: var(--muted);
}

.list-actions {
  display: flex;
  gap: 2px;
}

.directory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.directory-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 0.12s ease, transform 0.12s ease;
}

.directory-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.directory-card[hidden] {
  display: none;
}

.directory-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.directory-head div {
  min-width: 0;
  flex: 1;
}

.directory-head h3 {
  font-size: 0.95rem;
}

.directory-head span {
  font-size: 0.76rem;
  color: var(--muted);
}

.directory-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  row-gap: 8px;
  min-width: 0;
}

.directory-foot .btn {
  margin-left: auto;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.prompt-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.prompt-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
}

.prompt-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.prompt-main h3 {
  font-size: 0.95rem;
}

.prompt-main p {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.5;
}

.prompt-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.empty,
.empty-inline {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  padding: 44px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  color: var(--muted);
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--accent);
  margin-bottom: 4px;
}

.empty h2 {
  font-size: 1.2rem;
  color: var(--text);
  font-family: var(--font-display);
}

.empty p {
  font-size: 0.9rem;
  max-width: 46ch;
}

.empty .btn {
  margin-top: 8px;
}

.empty-inline {
  padding: 28px;
  grid-column: 1 / -1;
  width: 100%;
}

.empty-inline[hidden] {
  display: none;
}

.empty-inline p {
  font-size: 0.86rem;
}

/* --------------------------------------------------------------------------
   Configurações
   -------------------------------------------------------------------------- */

.settings-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.settings-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.settings-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--accent);
  flex: none;
}

.settings-head h2 {
  font-size: 1.05rem;
  font-family: var(--font-sans);
  font-weight: 600;
}

.settings-head p {
  font-size: 0.82rem;
  color: var(--muted);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}

.settings-row > div:first-child {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 58ch;
}

.settings-row strong {
  font-size: 0.9rem;
  font-weight: 600;
}

.settings-row span {
  font-size: 0.8rem;
  color: var(--muted);
}

.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.settings-note {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 0.78rem;
  color: var(--muted);
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}

.segmented {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
}

.segmented-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--muted);
  font-size: 0.8rem;
  cursor: pointer;
}

.segmented-btn.is-on {
  background: var(--surface-3);
  color: var(--text);
}

.shortcuts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 8px;
}

.shortcut {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.84rem;
  color: var(--muted);
}

.check-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 0.84rem;
  color: var(--text-soft);
}

.check-list li {
  display: flex;
  gap: 8px;
  align-items: center;
}

.check-list svg {
  color: var(--ok);
}

.about-line {
  font-size: 0.76rem;
  color: var(--muted);
  text-align: center;
}

.about-line a {
  color: var(--text-soft);
  text-decoration: underline;
  text-underline-offset: 2px;
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  padding: 2px 5px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   Modal
   -------------------------------------------------------------------------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(4, 5, 7, 0.68);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.16s ease;
}

.overlay.is-in {
  opacity: 1;
}

.overlay-top {
  align-items: flex-start;
  padding-top: 12vh;
}

.modal {
  width: min(100%, 560px);
  max-height: min(86vh, 760px);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
  transform: translateY(6px) scale(0.995);
  transition: transform 0.16s ease;
}

.overlay.is-in .modal {
  transform: none;
}

.modal-sm {
  width: min(100%, 420px);
}

.modal-lg {
  width: min(100%, 760px);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.modal-head h2 {
  font-size: 1.05rem;
  font-family: var(--font-sans);
  font-weight: 600;
}

.modal-body {
  padding: 18px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
}

.modal-text {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.55;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.modal-actions [data-delete] {
  margin-right: auto;
}

.provider-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 6px;
  max-height: 52vh;
  overflow: auto;
}

.provider-option {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.1s ease, background 0.1s ease;
}

.provider-option:hover {
  border-color: var(--line-strong);
}

.provider-option.is-on {
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
  background: var(--accent-soft);
}

.provider-option-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  min-width: 0;
  flex: 1;
}

.provider-option-text strong {
  font-size: 0.86rem;
  font-weight: 500;
}

.provider-option-text small {
  font-size: 0.72rem;
  color: var(--muted);
}

.provider-option-mark {
  color: var(--muted);
}

.provider-option.is-on .provider-option-mark {
  color: var(--accent);
}

.gateway-models {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

.gateway-models h3 {
  font-size: 0.9rem;
}

.assign-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.assign-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.assign-name {
  flex: 1;
  font-size: 0.86rem;
}

.assign-row .select {
  max-width: 300px;
}

/* --------------------------------------------------------------------------
   Paleta de comandos
   -------------------------------------------------------------------------- */

.palette {
  width: min(100%, 620px);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.palette-input {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

.palette-input input {
  flex: 1;
  border: 0;
  background: none;
  color: var(--text);
  font-size: 0.98rem;
}

.palette-input input:focus {
  outline: none;
}

.palette-list {
  max-height: 52vh;
  overflow: auto;
  padding: 6px;
}

.palette-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.9rem;
}

.palette-list li.is-active {
  background: var(--surface-3);
}

.palette-icon {
  color: var(--muted);
}

.palette-label {
  flex: 1;
}

.palette-hint {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* --------------------------------------------------------------------------
   Toasts
   -------------------------------------------------------------------------- */

.toasts {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(380px, calc(100vw - 36px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.86rem;
  box-shadow: var(--shadow-soft);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: auto;
  cursor: pointer;
}

.toast.is-in {
  opacity: 1;
  transform: none;
}

.toast-ok svg {
  color: var(--ok);
}

.toast-error {
  border-color: color-mix(in srgb, var(--danger) 45%, transparent);
}

.toast-error svg {
  color: var(--danger);
}

.toast-info svg {
  color: var(--info);
}

/* --------------------------------------------------------------------------
   Responsivo
   -------------------------------------------------------------------------- */

@media (max-width: 1080px) {
  :root {
    --rail: 76px;
  }

  .brand-text,
  .rail-link span {
    display: none;
  }

  .rail {
    align-items: center;
    padding: 18px 10px;
  }

  .rail-link {
    justify-content: center;
    width: 48px;
    height: 44px;
    padding: 0;
  }

  .brand {
    padding: 0;
  }
}

@media (max-width: 860px) {
  :root {
    --rail: 0px;
  }

  .shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .rail {
    position: fixed;
    left: 0;
    top: 0;
    width: 250px;
    height: 100vh;
    transform: translateX(-102%);
    transition: transform 0.2s ease;
    align-items: stretch;
    background: var(--surface);
    box-shadow: var(--shadow);
  }

  .rail.is-open {
    transform: none;
  }

  .rail.is-open .brand-text,
  .rail.is-open .rail-link span {
    display: block;
  }

  .rail.is-open .rail-link {
    width: auto;
    height: auto;
    justify-content: flex-start;
    padding: 10px 12px;
  }

  .rail-toggle {
    display: inline-grid;
  }

  .topbar {
    padding: 0 14px;
  }

  .topbar-title strong {
    display: none;
  }

  .main {
    padding: 20px 14px 80px;
  }

  .stats,
  .mission-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .answer-grid,
  .mission-participants {
    grid-template-columns: minmax(0, 1fr);
  }

  .team-row {
    grid-template-columns: 1fr;
  }

  .page-head {
    align-items: flex-start;
  }

  .page-actions {
    width: 100%;
  }

  .composer-count {
    order: 5;
    margin-left: 0;
    width: 100%;
  }

  .toasts {
    left: 14px;
    right: 14px;
    bottom: 14px;
    max-width: none;
  }
}

@media (max-width: 520px) {
  .stats,
  .mission-summary {
    grid-template-columns: minmax(0, 1fr);
  }

  .segmented {
    width: 100%;
  }

  .segmented-btn {
    flex: 1;
    justify-content: center;
  }

  .input-row {
    flex-wrap: wrap;
  }

  .export-row {
    gap: 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

:root[data-motion='reduced'] *,
:root[data-motion='reduced'] *::before,
:root[data-motion='reduced'] *::after {
  animation-duration: 0.001ms !important;
  transition-duration: 0.001ms !important;
}

@media print {
  .rail,
  .topbar,
  .composer,
  .toasts,
  .page-actions,
  .gateway-bar {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
  }
}

/* ------------------------------------------------------------------ *
 * Workspace multi-IA: layouts, cabeçalho 36px, expandir e veredito
 * ------------------------------------------------------------------ */

.layout-picker {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.layout-btn {
  min-width: 26px;
  height: 24px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: 600 0.72rem/1 ui-monospace, monospace;
  cursor: pointer;
}

.layout-btn:hover {
  color: var(--text);
}

.layout-btn.is-active {
  background: var(--accent);
  color: var(--accent-ink);
}

.section-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.panel-grid.layout-1 { grid-template-columns: minmax(0, 1fr); }
.panel-grid.layout-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel-grid.layout-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.panel-grid.layout-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.panel-grid.layout-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.panel-grid.layout-9 { grid-template-columns: repeat(9, minmax(0, 1fr)); }

@media (max-width: 1919px) {
  .panel-grid.layout-6,
  .panel-grid.layout-9 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1280px) {
  .panel-grid.layout-3,
  .panel-grid.layout-4,
  .panel-grid.layout-6,
  .panel-grid.layout-9 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .panel-grid[class*='layout-'] {
    grid-template-columns: minmax(0, 1fr);
  }
}

.panel-frame .panel-top {
  min-height: 36px;
  cursor: grab;
}

.panel-frame .panel-top:active {
  cursor: grabbing;
}

.panel-frame.is-dragging {
  opacity: 0.55;
}

.panel-frame.drop-target {
  outline: 2px dashed var(--accent);
  outline-offset: -2px;
}

.panel-frame.is-refused .frame-status {
  color: var(--danger);
}

.panel-frame.is-expanded {
  position: fixed;
  inset: 12px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: 14px;
  box-shadow: 0 24px 80px rgb(0 0 0 / 60%);
}

.panel-frame.is-expanded .panel-frame {
  flex: 1;
  min-height: 0;
}

body.has-expanded {
  overflow: hidden;
}

.verdict {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  padding: 8px 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.verdict-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--accent);
  font: 600 0.66rem/1 ui-monospace, monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.verdict p {
  flex: 1;
  margin: 0;
  font-size: 0.8rem;
  color: var(--text);
}

.composer-floating {
  position: sticky;
  bottom: 12px;
  z-index: 20;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  box-shadow: 0 18px 60px rgb(0 0 0 / 45%);
}

.debate-mode {
  height: 30px;
  max-width: 190px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  font: 600 0.72rem/1 ui-sans-serif, system-ui, sans-serif;
}

.debate-panel .section-head {
  align-items: flex-start;
}

.debate-objections {
  margin: 6px 0 0;
  padding-left: 18px;
  display: grid;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--danger);
}

.debate-objections:empty {
  display: none;
}

.debate-trail {
  margin-top: 10px;
  font-size: 0.8rem;
  color: var(--muted);
}

.debate-trail pre {
  margin: 8px 0 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--ink);
  color: var(--text);
  white-space: pre-wrap;
  max-height: 260px;
  overflow: auto;
}

.resume-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  padding: 8px 12px;
  border: 1px solid color-mix(in srgb, var(--info) 40%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--info) 10%, transparent);
  font-size: 0.8rem;
}

.resume-banner span {
  flex: 1;
}

.conflict-dialog {
  width: min(560px, 92vw);
  max-height: 80vh;
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
}

.conflict-dialog::backdrop {
  background: rgb(0 0 0 / 60%);
}

.conflict-dialog h2 {
  margin: 0 0 6px;
  font-family: var(--font-display, Georgia, serif);
}

.conflict-dialog p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.82rem;
}

.conflict-list {
  display: grid;
  gap: 10px;
  margin-bottom: 10px;
}

.conflict-row {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.conflict-row textarea {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--ink);
  color: var(--text);
  font: inherit;
  resize: vertical;
}

.conflict-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 100;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  text-decoration: none;
  transition: top 120ms ease;
}

.skip-link:focus {
  top: 12px;
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .skip-link {
    transition: none;
  }
}

.orchestrator-chat {
  display: grid;
  gap: 10px;
  padding: 16px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.orchestrator-chat textarea {
  width: 100%;
  resize: vertical;
}

.orchestrator-chat-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.orchestrator-chat-foot span {
  color: var(--muted);
  font-size: 0.82rem;
  max-width: 60ch;
}

.orchestrator-attach {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.orchestrator-attachments {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.orchestrator-attachments li {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.78rem;
  color: var(--muted);
}

[data-brand='lumo'] { --brand: #6d4aff; }
[data-brand='braveleo'] { --brand: #fb542b; }
[data-brand='ecogpt'] { --brand: #16a34a; }

.debate-chat {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: grid;
  gap: 10px;
  max-height: 420px;
  overflow-y: auto;
}

.debate-msg {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--surface);
}

.debate-msg-head {
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--accent);
  margin-bottom: 4px;
}

.debate-msg-body {
  margin: 0;
  white-space: pre-wrap;
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.pix-support {
  display: grid;
  gap: 8px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  max-width: 100%;
}

.pix-support-head strong { display: block; font-size: 0.85rem; }
.pix-support-head span { display: block; color: var(--muted); font-size: 0.74rem; line-height: 1.35; }

.pix-qr-btn {
  justify-self: start;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  cursor: zoom-in;
}

.pix-qr { display: block; width: 132px; height: 132px; max-width: 100%; background: #fff; }

.pix-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.pix-note { margin: 0; color: var(--muted); font-size: 0.72rem; line-height: 1.35; }

.pix-meta { margin: 0; font-size: 0.72rem; color: var(--muted); }
.pix-meta dt { font-weight: 600; }
.pix-meta dd { margin: 0 0 4px; }

.pix-dialog {
  border: none;
  border-radius: 16px;
  padding: 0;
  max-width: min(420px, 92vw);
  background: var(--surface);
  color: var(--text);
}

.pix-dialog::backdrop { background: rgb(0 0 0 / 60%); }

.pix-dialog-body {
  display: grid;
  gap: 12px;
  justify-items: center;
  padding: 20px;
  text-align: center;
}
