/* CompassAB — Design System (identidade Compass)
   Creme quente + verde-pinho + dourado, mesma paleta do CompassPPM.
   Temas claro/escuro via [data-theme] no <html>; tokens em custom properties. */

:root, html[data-theme="dark"] {
  --bg: #121c18;
  --surface: #1a2620;
  --surface-2: #223028;
  --surface-3: #2c3c32;
  --border: #384c40;
  --border-strong: #4c6353;
  --text: #f0eada;
  --text-strong: #fcfaf4;
  --muted: #a0a89c;
  --accent: #7d9b85;
  --accent-strong: #3d6049;
  --accent-soft: rgba(125, 155, 133, 0.14);
  --green: #4ade80;
  --green-soft: rgba(74, 222, 128, 0.12);
  --red: #f87171;
  --red-soft: rgba(248, 113, 113, 0.12);
  --yellow: #e0b85a;
  --yellow-soft: rgba(224, 184, 90, 0.14);
  --purple: #a78bda;
  --purple-soft: rgba(167, 139, 218, 0.14);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 6px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
  --grid-dot: #223028;
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #f7f4ea;
  --surface: #fcfaf4;
  --surface-2: #f4f0e2;
  --surface-3: #f0ebda;
  --border: #ded7c4;
  --border-strong: #c6bca0;
  --text: #263832;
  --text-strong: #1f3329;
  --muted: #5a6e61;
  --accent: #2f4e3a;
  --accent-strong: #243d2d;
  --accent-soft: rgba(47, 78, 58, 0.10);
  --green: #16853c;
  --green-soft: rgba(22, 133, 60, 0.12);
  --red: #dc2626;
  --red-soft: rgba(220, 38, 38, 0.09);
  --yellow: #b4892e;
  --yellow-soft: rgba(180, 137, 46, 0.14);
  --purple: #7c5cbf;
  --purple-soft: rgba(124, 92, 191, 0.12);
  --shadow-sm: 0 1px 0 rgba(34, 48, 40, 0.08);
  --shadow-md: 0 8px 24px -12px rgba(34, 48, 40, 0.22);
  --shadow-lg: 0 16px 48px rgba(34, 48, 40, 0.18);
  --grid-dot: #e5ddc9;
  color-scheme: light;
}

:root {
  --radius: 10px;
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --display: "Plus Jakarta Sans", "Inter", -apple-system, sans-serif;
  --studio-entry: #547b9f;
  --studio-intelligence: #745ca5;
  --studio-action: #b68232;
  --studio-output: #aa5b5b;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  transition: background 0.2s ease, color 0.2s ease;
  font-feature-settings: 'cv11', 'ss01', 'ss03';
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, .logo-name, .stat .num {
  font-family: var(--display);
  letter-spacing: -0.02em;
}
::selection { background: var(--accent-soft); }
#app { display: flex; height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: 224px; min-width: 224px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
}
.logo { display: flex; gap: 10px; align-items: center; padding: 18px 16px 14px; }
.logo-icon { font-size: 22px; }
.logo-name { font-weight: 700; font-size: 15px; letter-spacing: 0.2px; color: var(--text-strong); }
.logo-sub { font-size: 11px; color: var(--muted); }
.sidebar nav { flex: 1; padding: 4px 10px 12px; display: flex; flex-direction: column; gap: 1px; overflow-y: auto; }
.nav-section {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--muted); padding: 14px 10px 5px; user-select: none;
}
.sidebar nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px;
  color: var(--muted); text-decoration: none; font-weight: 500; font-size: 13.5px;
  transition: background 0.12s, color 0.12s;
  position: relative;
}
.sidebar nav a span:first-child { font-size: 15px; width: 18px; text-align: center; }
.sidebar nav a:hover { background: var(--surface-2); color: var(--text); }
.sidebar nav a.active { background: var(--accent-soft); color: var(--accent); }
.nav-badge {
  margin-left: auto; background: var(--red); color: #fff;
  font-size: 10.5px; font-weight: 700; min-width: 18px; height: 18px;
  border-radius: 999px; display: none; align-items: center; justify-content: center; padding: 0 5px;
}
.nav-badge.on { display: inline-flex; }
.sidebar-footer {
  padding: 12px 16px; font-size: 11.5px; color: var(--muted);
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.theme-toggle {
  margin-left: auto; background: none; border: 1px solid var(--border);
  border-radius: 8px; padding: 4px 8px; cursor: pointer; font-size: 13px; color: var(--muted);
}
.theme-toggle:hover { color: var(--text); border-color: var(--border-strong); }
.kbd {
  font-family: var(--mono); font-size: 10.5px; background: var(--surface-2);
  border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; padding: 1px 5px;
  color: var(--muted);
}

/* ---------- Main ---------- */
main { flex: 1; overflow-y: auto; padding: 28px 32px; }
.page-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; gap: 16px; }
.page-header h1 { font-size: 22px; font-weight: 700; color: var(--text-strong); letter-spacing: -0.2px; }
.page-header p { color: var(--muted); margin-top: 4px; max-width: 660px; }
.page-actions { display: flex; gap: 8px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }

/* ---------- Botões e inputs ---------- */
button, .btn {
  font: inherit; cursor: pointer;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 14px; font-weight: 500;
  transition: border-color 0.12s, background 0.12s, transform 0.06s;
  text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
}
button:hover, .btn:hover { border-color: var(--accent); }
button:active, .btn:active { transform: translateY(1px); }
button:focus-visible, .btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
.btn-primary { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { filter: brightness(1.1); border-color: var(--accent-strong); }
.btn-danger { color: var(--red); }
.btn-danger:hover { border-color: var(--red); background: var(--red-soft); }
.btn-sm { padding: 4px 10px; font-size: 12.5px; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
input, textarea, select {
  font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 12px; width: 100%;
  transition: border-color 0.12s;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.7; }
textarea { resize: vertical; min-height: 80px; }
label.field { display: block; margin-bottom: 14px; }
label.field > .label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.4px; }
label.field > .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.row { display: flex; gap: 14px; }
.row > * { flex: 1; }

/* ---------- Cards e grids ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
  box-shadow: var(--shadow-sm);
}
.card.clickable { cursor: pointer; transition: border-color 0.12s, transform 0.12s, box-shadow 0.12s; }
.card.clickable:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.card h3 { font-size: 15px; margin-bottom: 4px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--text-strong); }
.card .desc { color: var(--muted); font-size: 13px; margin-bottom: 12px; min-height: 20px; }
.card .meta { display: flex; gap: 6px; flex-wrap: wrap; }
.tag {
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--muted);
  white-space: nowrap;
}
.tag.blue { color: var(--accent); border-color: transparent; background: var(--accent-soft); }
.tag.green { color: var(--green); border-color: transparent; background: var(--green-soft); }
.tag.purple { color: var(--purple); border-color: transparent; background: var(--purple-soft); }
.tag.yellow { color: var(--yellow); border-color: transparent; background: var(--yellow-soft); }

/* ---------- Hero (Gênese) ---------- */
.hero {
  background: linear-gradient(135deg, var(--accent-soft), transparent 60%), var(--surface);
  border: 1px solid var(--border); border-radius: 14px;
  padding: 26px 28px; margin-bottom: 24px; box-shadow: var(--shadow-sm);
}
.hero h2 { font-size: 19px; color: var(--text-strong); margin-bottom: 4px; }
.hero p { color: var(--muted); margin-bottom: 14px; }
.hero-input { display: flex; gap: 10px; align-items: flex-start; }
.hero-input textarea {
  flex: 1; min-height: 52px; max-height: 130px; font-size: 14.5px;
  background: var(--bg); border-radius: 10px;
}
.hero-input .btn-primary { padding: 13px 20px; font-size: 14.5px; border-radius: 10px; white-space: nowrap; }
.hero-examples { margin-top: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  font-size: 12px; padding: 4px 11px; border-radius: 999px; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--muted);
  transition: border-color 0.12s, color 0.12s;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Onboarding checklist ---------- */
.onboarding { margin-bottom: 24px; }
.onboarding .bar { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin: 10px 0 14px; }
.onboarding .bar > div { height: 100%; background: var(--green); border-radius: 999px; transition: width 0.4s ease; }
.ob-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; }
.ob-step {
  display: flex; gap: 9px; align-items: center; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 9px; font-size: 12.5px;
  color: var(--muted); text-decoration: none; background: var(--bg);
  transition: border-color 0.12s;
}
.ob-step:hover { border-color: var(--accent); color: var(--text); }
.ob-step.done { color: var(--green); border-color: transparent; background: var(--green-soft); text-decoration: line-through; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 28px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm); }
.stat .num { font-size: 26px; font-weight: 700; color: var(--text-strong); }
.stat .lbl { color: var(--muted); font-size: 12px; margin-top: 2px; }

/* ---------- Tabelas (HTML) ---------- */
table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--muted); background: var(--surface-2); }
tr:last-child td { border-bottom: none; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: var(--surface-2); }

/* ---------- Seletores reutilizados no Studio e na administração ---------- */
.checklist { display: flex; flex-direction: column; gap: 8px; }
.checklist .check-item, .check-item {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px;
  cursor: pointer; transition: border-color 0.12s;
}
.checklist .check-item:hover { border-color: var(--accent); }
.checklist .check-item input, .check-item input[type="checkbox"] { width: auto; margin-top: 3px; }
.check-item .t { font-weight: 600; font-size: 13.5px; color: var(--text-strong); }
.check-item .d { font-size: 12.5px; color: var(--muted); }

/* ---------- Mensagens e trace compartilhados ---------- */
.msg { max-width: 92%; display: flex; gap: 9px; }
.msg.user { align-self: flex-end; flex-direction: row-reverse; }
.msg .bubble {
  padding: 10px 14px; border-radius: 12px; white-space: pre-wrap; word-wrap: break-word; font-size: 13.5px;
  position: relative;
}
.msg.user .bubble { background: var(--accent-strong); color: #fff; border-bottom-right-radius: 4px; }
.msg.assistant .bubble { background: var(--surface-2); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg .bubble code { font-family: var(--mono); font-size: 12px; background: rgba(127, 127, 127, 0.18); padding: 1px 5px; border-radius: 4px; }
.msg .bubble pre { background: rgba(0, 0, 0, 0.25); padding: 10px; border-radius: 8px; overflow-x: auto; margin: 6px 0; }
html[data-theme="light"] .msg .bubble pre { background: rgba(16, 24, 40, 0.06); }
.msg .bubble pre code { background: none; padding: 0; }

/* trace de raciocínio */
.trace { margin-top: 8px; font-size: 12px; }
.trace summary { cursor: pointer; color: var(--muted); font-weight: 600; user-select: none; }
.trace summary:hover { color: var(--accent); }
.trace .step { display: flex; gap: 8px; padding: 6px 0 6px 8px; border-left: 2px solid var(--border); margin-left: 4px; }
.trace .step .icon { flex-shrink: 0; }
.trace .step .detail { color: var(--muted); font-family: var(--mono); font-size: 11.5px; white-space: pre-wrap; word-break: break-word; }
.trace .step.delegate { border-left-color: var(--purple); }
.trace .step.tool_call, .trace .step.tool_result { border-left-color: var(--accent); }
.trace .step.knowledge_search { border-left-color: var(--green); }
.trace .step.error { border-left-color: var(--red); }

.typing { color: var(--muted); font-size: 12.5px; padding: 4px 8px; }
.typing::after { content: "…"; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0.3; } }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(4, 8, 16, 0.55);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px;
  backdrop-filter: blur(3px);
}
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  width: 100%; max-width: 640px; max-height: 90vh; overflow-y: auto; padding: 24px;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.16s ease;
}
@keyframes modalIn { from { transform: translateY(8px) scale(0.985); opacity: 0; } }
.modal h2 { font-size: 17px; margin-bottom: 18px; color: var(--text-strong); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* ---------- Command Palette (⌘K) ---------- */
#palette-overlay {
  position: fixed; inset: 0; background: rgba(4, 8, 16, 0.5); z-index: 300;
  display: flex; align-items: flex-start; justify-content: center; padding-top: 14vh;
  backdrop-filter: blur(3px);
}
#palette {
  width: 580px; max-width: calc(100vw - 40px);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 14px;
  box-shadow: var(--shadow-lg); overflow: hidden;
  animation: modalIn 0.14s ease;
}
#palette input {
  border: none; border-bottom: 1px solid var(--border); border-radius: 0;
  padding: 15px 18px; font-size: 15px; background: transparent;
}
#palette input:focus { border-color: var(--border); }
#palette-results { max-height: 46vh; overflow-y: auto; padding: 6px; }
.pal-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border-radius: 8px; cursor: pointer; font-size: 13.5px;
}
.pal-item .pi { width: 20px; text-align: center; }
.pal-item .ps { margin-left: auto; font-size: 11px; color: var(--muted); }
.pal-item.sel, .pal-item:hover { background: var(--accent-soft); color: var(--accent); }
.pal-empty { padding: 18px; color: var(--muted); font-size: 13px; text-align: center; }

/* ---------- Params editor ---------- */
.param-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.param-row input, .param-row select { padding: 6px 10px; font-size: 13px; }
.param-row .del { color: var(--red); background: none; border: none; font-size: 16px; padding: 4px 8px; }

/* ---------- Timeline (runs) ---------- */
.timeline { display: flex; flex-direction: column; }
.timeline .tl-step { display: flex; gap: 12px; padding: 10px 0; border-left: 2px solid var(--border); padding-left: 16px; margin-left: 8px; position: relative; }
.timeline .tl-step::before {
  content: ""; position: absolute; left: -6px; top: 16px;
  width: 10px; height: 10px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg);
}
.timeline .tl-step.delegate::before { background: var(--purple); }
.timeline .tl-step.knowledge_search::before { background: var(--green); }
.timeline .tl-step.error::before { background: var(--red); }
.timeline .tl-type { font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; min-width: 130px; color: var(--muted); }
.timeline .tl-detail { font-family: var(--mono); font-size: 12px; color: var(--text); white-space: pre-wrap; word-break: break-word; flex: 1; }

/* ---------- Toast ---------- */
#toast-root { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 400; }
.toast {
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--green);
  border-radius: 10px; padding: 12px 16px; min-width: 240px; max-width: 380px;
  animation: slideIn 0.2s ease; box-shadow: var(--shadow-md); color: var(--text);
}
.toast.error { border-left-color: var(--red); }
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } }

/* ---------- Diversos ---------- */
.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty .big { font-size: 42px; margin-bottom: 12px; }
.empty .cta { margin-top: 16px; }
.section-title { font-size: 15px; font-weight: 700; margin: 24px 0 12px; color: var(--text-strong); }
.mono { font-family: var(--mono); font-size: 12px; }
.muted { color: var(--muted); }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.status-dot.on { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.status-dot.off { background: var(--red); }
.back-link { color: var(--muted); text-decoration: none; font-size: 13px; display: inline-block; margin-bottom: 10px; }
.back-link:hover { color: var(--accent); }
code.inline { font-family: var(--mono); font-size: 12px; background: var(--surface-2); padding: 2px 6px; border-radius: 4px; border: 1px solid var(--border); }

/* ---------- Grid de dados (Tabelas de negócio) ---------- */
.datagrid td input { padding: 4px 8px; font-size: 13px; background: transparent; border-color: transparent; }
.datagrid td input:hover { border-color: var(--border); }
.datagrid td input:focus { background: var(--bg); border-color: var(--accent); }

/* ---------- Compass Studio ---------- */
.studio {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 56px);
  margin: -28px -32px;
  overflow: hidden;
  background: var(--bg);
}
.studio-toolbar {
  min-height: 62px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  z-index: 20;
}
.studio-back {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  font-size: 18px;
}
.studio-back:hover { color: var(--text-strong); border-color: var(--border-strong); }
.studio-identity { display: flex; flex-direction: column; line-height: 1.2; min-width: 126px; }
.studio-identity strong { font-family: var(--display); color: var(--text-strong); font-size: 13px; }
.studio-identity span { color: var(--muted); font-size: 11px; }
.studio-divider { width: 1px; height: 30px; background: var(--border); margin: 0 2px; }
#flow-name {
  width: min(270px, 22vw);
  padding: 7px 9px;
  font-family: var(--display);
  font-weight: 600;
  color: var(--text-strong);
  background: transparent;
  border-color: transparent;
}
#flow-name:hover, #flow-name:focus { background: var(--bg); border-color: var(--border); }
.studio-cockpit {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 264px minmax(480px, 1fr) 308px;
}
.studio-guide {
  min-width: 0;
  overflow-y: auto;
  background: var(--surface);
  border-right: 1px solid var(--border);
}
.studio-stage-list { padding: 12px 10px 8px; border-bottom: 1px solid var(--border); }
.studio-stage-list button {
  width: 100%;
  display: grid;
  grid-template-columns: 26px 1fr;
  grid-template-rows: auto auto;
  column-gap: 8px;
  padding: 8px;
  margin-bottom: 2px;
  text-align: left;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
}
.studio-stage-list button > span {
  grid-row: 1 / 3;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  align-self: center;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 50%;
  font-size: 10px;
  font-family: var(--mono);
}
.studio-stage-list button b { color: var(--text); font-size: 12.5px; line-height: 1.2; }
.studio-stage-list button small { font-size: 10.5px; line-height: 1.25; }
.studio-stage-list button:hover { background: var(--surface-2); color: var(--text); }
.studio-stage-list button.active { background: var(--accent-soft); border-color: var(--accent); }
.studio-stage-list button.active > span { color: var(--surface); background: var(--accent); border-color: var(--accent); }
.studio-stage-list button.active b { color: var(--text-strong); }
.capability-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  padding: 14px 12px 7px;
}
.capability-heading span { font-family: var(--display); color: var(--text-strong); font-size: 12px; font-weight: 700; }
.capability-heading strong { color: var(--muted); font-family: var(--mono); font-size: 8.5px; font-weight: 500; }
.capability-search { width: calc(100% - 24px); margin: 0 12px 10px; padding: 7px 9px; font-size: 11.5px; }
.studio-capabilities { padding: 0 10px 18px; }
.capability-group { margin-bottom: 12px; }
.capability-group-title {
  margin: 0 2px 5px;
  padding-left: 7px;
  color: var(--muted);
  border-left: 3px solid var(--border-strong);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.capability-group.group-entry .capability-group-title { border-color: var(--studio-entry); }
.capability-group.group-intelligence .capability-group-title { border-color: var(--studio-intelligence); }
.capability-group.group-action .capability-group-title { border-color: var(--studio-action); }
.capability-group.group-control .capability-group-title,
.capability-group.group-output .capability-group-title { border-color: var(--studio-output); }
.capability-card { margin-bottom: 5px; }
.capability-main {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  padding: 7px 9px;
  text-align: left;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
}
.capability-main:hover:not(:disabled) { color: var(--text-strong); border-color: var(--accent); background: var(--surface-2); }
.capability-name { font-size: 11.5px; font-weight: 650; }
.capability-technical { color: var(--muted); font-family: var(--mono); font-size: 8.5px; }
.capability-card.disabled { opacity: .48; }
.capability-main:disabled { cursor: not-allowed; }
.capability-variants { display: flex; flex-wrap: wrap; gap: 3px; padding: 4px 0 0 6px; }
.capability-variants button { padding: 3px 6px; color: var(--muted); background: transparent; border: 1px solid var(--border); font-size: 9px; }
.capability-variants button:hover { color: var(--text); border-color: var(--accent); }
.studio-empty-small { padding: 12px 4px; color: var(--muted); font-size: 11.5px; }
.studio-canvas-region { min-width: 0; min-height: 0; display: grid; grid-template-rows: auto minmax(260px, 1fr) auto; background: var(--bg); }
.studio-canvas-heading {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.studio-canvas-heading h2 { color: var(--text-strong); font-size: 17px; line-height: 1.2; }
.studio-canvas-heading p { margin-top: 2px; color: var(--muted); font-size: 11px; }
.studio-eyebrow { display: block; color: var(--accent); font-size: 8.5px; font-weight: 700; letter-spacing: .1em; }
.canvas-tools { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }
#canvas-wrap {
  min-height: 0;
  overflow: hidden;
  position: relative;
  background-color: var(--bg);
  background-image: radial-gradient(circle, var(--grid-dot) 1px, transparent 1px);
  background-size: 24px 24px;
  cursor: grab;
  isolation: isolate;
}
#canvas-wrap:active { cursor: grabbing; }
#world { position: absolute; transform-origin: 0 0; }
.canvas-sphere-band {
  position: absolute;
  left: 0;
  right: 0;
  height: 33.333%;
  border-bottom: 1px dashed color-mix(in srgb, currentColor 26%, transparent);
  pointer-events: none;
  z-index: 0;
}
.canvas-sphere-band span {
  position: sticky;
  left: 16px;
  top: 12px;
  display: inline-block;
  margin: 12px 0 0 14px;
  padding: 3px 7px;
  color: currentColor;
  background: var(--surface);
  border: 1px solid currentColor;
  border-radius: 5px;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  opacity: .82;
}
.band-entry { top: 0; color: var(--studio-entry); background: rgba(84, 123, 159, .055); }
.band-intelligence { top: 33.333%; color: var(--studio-intelligence); background: rgba(116, 92, 165, .05); }
.band-output { top: 66.666%; color: var(--studio-output); background: rgba(170, 91, 91, .045); }
#edges-svg { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
#edges-svg g { pointer-events: auto; }
#nodes-layer { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.fnode {
  position: absolute;
  pointer-events: auto;
  overflow: visible;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-strong);
  border-radius: 9px;
  box-shadow: var(--shadow-md);
  font-size: 12px;
  user-select: none;
}
.fnode.group-entry { border-left-color: var(--studio-entry); }
.fnode.group-intelligence { border-left-color: var(--studio-intelligence); }
.fnode.group-action { border-left-color: var(--studio-action); }
.fnode.group-control, .fnode.group-output { border-left-color: var(--studio-output); }
.fnode.selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow-md); }
.fnode.trigger { border-top-color: var(--studio-entry); }
.fnode.ran { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft), var(--shadow-md); transition: border-color .2s ease, box-shadow .2s ease; }
.fnode.warn { border-color: var(--yellow); box-shadow: 0 0 0 3px var(--yellow-soft), var(--shadow-md); }
.fnode.failed { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft), var(--shadow-md); }
.fnode-head {
  min-height: 46px;
  padding: 7px 8px;
  cursor: move;
  display: flex;
  gap: 7px;
  align-items: center;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  border-radius: 7px 8px 0 0;
  color: var(--text-strong);
}
.fnode-icon { font-size: 15px; }
.fnode-title-wrap { min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.fnode-title { overflow: hidden; color: var(--text-strong); font-size: 11.5px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.fnode-technical { overflow: hidden; color: var(--muted); font-family: var(--mono); font-size: 8.5px; font-weight: 400; text-overflow: ellipsis; white-space: nowrap; }
.fnode-id { margin-left: auto; color: var(--muted); font-family: var(--mono); font-size: 8.5px; font-weight: 400; }
.fnode-body { padding: 4px 0 6px; }
.port-row { position: relative; height: 22px; display: flex; align-items: center; }
.port-row.in { justify-content: flex-start; }
.port-row.out { justify-content: flex-end; padding-right: 12px; }
.port-label { margin-right: 6px; color: var(--muted); font-size: 10px; }
.port { width: 12px; height: 12px; position: absolute; cursor: crosshair; background: var(--bg); border: 2px solid var(--accent); border-radius: 50%; }
.port-in { left: -8px; }
.port-out { right: -7px; }
.port:hover { background: var(--accent); }
.fedge .line { fill: none; stroke: var(--border-strong); stroke-width: 2; }
.fedge .hit { fill: none; stroke: transparent; stroke-width: 14; cursor: pointer; }
.fedge:hover .line, .fedge.selected .line { stroke: var(--accent); stroke-width: 2.5; }
#temp-edge { fill: none; stroke: var(--accent); stroke-width: 2; stroke-dasharray: 6 4; }
.studio-side-panel {
  min-width: 0;
  overflow-y: auto;
  background: var(--surface);
  border-left: 1px solid var(--border);
}
.insp-head { padding: 14px 14px 7px; display: flex; gap: 8px; align-items: center; color: var(--text-strong); }
.insp-head > span:nth-child(2) { min-width: 0; display: flex; flex-direction: column; }
.insp-head strong { font-family: var(--display); font-size: 13px; }
.insp-head small { color: var(--muted); font-family: var(--mono); font-size: 9px; font-weight: 400; }
.stage-panel-empty { padding: 22px 18px; }
.stage-panel-empty h3 { margin: 5px 0 7px; color: var(--text-strong); font-size: 17px; }
.stage-panel-empty p { color: var(--muted); font-size: 12.5px; }
.stage-panel-kicker { color: var(--accent); font-size: 8.5px; font-weight: 700; letter-spacing: .1em; }
.stage-panel-note { margin-top: 16px; padding: 10px; color: var(--text); background: var(--surface-2); border-left: 3px solid var(--accent); border-radius: 0 6px 6px 0; font-size: 11px; }
.studio-panel-content { padding: 16px 14px; }
.studio-panel-heading { margin-bottom: 16px; }
.studio-panel-heading h3 { margin: 4px 0 3px; color: var(--text-strong); font-size: 16px; }
.studio-panel-heading p { color: var(--muted); font-size: 11.5px; }
.studio-panel-content .field { margin-bottom: 12px; }
.studio-panel-content .field .label { font-size: 10.5px; }
.studio-panel-content textarea, .studio-panel-content input, .studio-panel-content select { font-size: 11.5px; }
.studio-panel-section { margin-top: 16px; padding-top: 13px; border-top: 1px solid var(--border); }
.studio-panel-section-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.studio-panel-section-title > span { color: var(--text-strong); font-family: var(--display); font-size: 11.5px; font-weight: 700; }
.studio-panel-section-title a { color: var(--accent); font-size: 9.5px; text-decoration: none; }
.resource-card { padding: 8px; margin-bottom: 6px; background: var(--bg); border: 1px solid var(--border); border-radius: 7px; }
.resource-card > label { display: flex; gap: 7px; align-items: flex-start; cursor: pointer; }
.resource-card input, .tool-choice input { width: auto; margin-top: 3px; }
.resource-card label span, .resource-line div, .tool-choice span { min-width: 0; display: flex; flex-direction: column; }
.resource-card strong, .resource-line strong, .tool-choice strong { color: var(--text-strong); font-size: 10.5px; }
.resource-card small, .resource-line small, .tool-choice small { color: var(--muted); font-family: var(--mono); font-size: 8.5px; }
.resource-actions { display: flex; gap: 4px; padding: 6px 0 0 24px; }
.resource-actions button { padding: 2px 5px; color: var(--muted); background: transparent; border: 0; font-size: 9px; }
.resource-actions button:hover { color: var(--accent); }
.resource-line { display: flex; gap: 8px; align-items: center; padding: 7px 6px; border-bottom: 1px solid var(--border); }
.resource-line > span { width: 22px; color: var(--accent); font-size: 15px; text-align: center; }
.resource-line.spatial > span { color: var(--studio-action); }
.action-callout { display: flex; gap: 9px; padding: 9px; margin-bottom: 10px; background: rgba(182, 130, 50, .1); border-left: 3px solid var(--studio-action); border-radius: 0 6px 6px 0; }
.action-callout > span { color: var(--studio-action); font-size: 17px; }
.action-callout > div { display: flex; flex-direction: column; }
.action-callout strong { color: var(--text-strong); font-size: 10.5px; }
.action-callout small { color: var(--muted); font-size: 9.5px; }
.tool-choice-list { display: flex; flex-direction: column; gap: 5px; max-height: 380px; overflow-y: auto; margin-bottom: 9px; }
.tool-choice { display: flex; gap: 7px; padding: 8px; cursor: pointer; background: var(--bg); border: 1px solid var(--border); border-radius: 7px; }
.tool-choice:hover { border-color: var(--studio-action); }
.tool-choice em { overflow: hidden; margin-top: 2px; color: var(--muted); font-size: 9px; font-style: normal; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.btn-sm.full { width: 100%; }
.inline-editor { margin-top: 10px; padding: 10px; background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 8px; }
.inline-editor .hint { display: block; margin-bottom: 9px; font-size: 9px; }
.studio-copilot { margin: 4px 10px 14px; padding: 10px; background: var(--surface-2); border: 1px solid var(--border); border-top: 3px solid var(--studio-intelligence); border-radius: 8px; }
.copilot-title { display: flex; gap: 7px; align-items: center; margin-bottom: 8px; }
.copilot-title > span { color: var(--studio-intelligence); font-size: 18px; }
.copilot-title > div { display: flex; flex-direction: column; }
.copilot-title strong { color: var(--text-strong); font-family: var(--display); font-size: 11.5px; }
.copilot-title small { color: var(--muted); font-size: 9px; }
.copilot-compose { display: grid; grid-template-columns: 1fr auto; gap: 5px; align-items: end; }
.copilot-compose textarea { min-height: 48px; padding: 7px; font-size: 10.5px; resize: vertical; }
.copilot-compose button { height: 32px; padding: 0 8px; }
.copilot-proposal { margin-top: 9px; padding-top: 9px; border-top: 1px solid var(--border); }
.copilot-reply { margin-bottom: 7px; color: var(--text); font-size: 10px; }
.proposal-diff { display: flex; flex-direction: column; gap: 2px; padding: 6px; margin-bottom: 4px; background: var(--bg); border-left: 2px solid var(--studio-intelligence); }
.proposal-diff span { color: var(--muted); font-size: 8.5px; text-transform: uppercase; }
.proposal-diff code { overflow: hidden; color: var(--text); font-size: 8.5px; text-overflow: ellipsis; white-space: nowrap; }
.proposal-graph { display: flex; flex-direction: column; padding: 7px; background: rgba(116, 92, 165, .1); border: 1px solid var(--studio-intelligence); border-radius: 6px; }
.proposal-graph strong { color: var(--text-strong); font-size: 10px; }
.proposal-graph span { font-size: 9.5px; }
.proposal-graph small { color: var(--muted); font-family: var(--mono); font-size: 8.5px; }
.proposal-actions { display: flex; justify-content: flex-end; gap: 5px; margin-top: 7px; }
.proposal-actions button { padding: 4px 7px; font-size: 9px; }
.safety-control { padding: 10px 0; border-bottom: 1px solid var(--border); }
.safety-control-title { display: flex; gap: 8px; align-items: center; margin-bottom: 7px; }
.safety-control-title > span { width: 22px; height: 22px; display: grid; place-items: center; color: var(--studio-output); background: rgba(170, 91, 91, .1); border-radius: 50%; font-size: 10px; font-weight: 800; }
.safety-control-title > div { display: flex; flex-direction: column; }
.safety-control-title strong { color: var(--text-strong); font-size: 11px; }
.safety-control-title small { color: var(--muted); font-size: 9px; }
.safety-control textarea, .safety-control input[type="number"] { width: 100%; font-size: 10.5px; }
.toggle-line { display: flex; gap: 7px; align-items: center; color: var(--text); font-size: 10.5px; cursor: pointer; }
.toggle-line input { width: auto; }
.test-mode-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; margin-bottom: 12px; padding: 3px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; }
.test-mode-tabs button { padding: 6px 3px; color: var(--muted); background: transparent; border: 0; font-size: 8.5px; }
.test-mode-tabs button.active { color: var(--text-strong); background: var(--surface); box-shadow: var(--shadow-sm); }
.scenario-suggest { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
.scenario-choice { display: flex; gap: 7px; padding: 7px 4px; cursor: pointer; border-bottom: 1px solid var(--border); }
.scenario-choice input { width: auto; margin-top: 3px; }
.scenario-choice span { display: flex; flex-direction: column; }
.scenario-choice strong { color: var(--text-strong); font-size: 10px; }
.scenario-choice small { color: var(--muted); font-size: 8.5px; }
.inline-test-result { margin-top: 15px; padding-top: 12px; border-top: 1px solid var(--border); }
.test-reply { display: flex; gap: 8px; padding: 9px; margin-bottom: 8px; background: var(--green-soft); border-radius: 7px; }
.test-reply [data-status-icon] { color: var(--green); font-weight: 800; }
.test-reply strong { color: var(--text-strong); font-size: 10px; }
.test-reply p { color: var(--text); font-size: 10px; }
.trace-list { display: flex; flex-direction: column; gap: 4px; }
.trace-row { display: flex; gap: 7px; padding: 6px; background: var(--bg); border-left: 3px solid var(--green); }
.trace-row.warn { border-left-color: var(--yellow); }
.trace-row.failed { border-left-color: var(--red); }
.trace-row > [data-status-icon] { width: 15px; height: 15px; display: grid; place-items: center; color: var(--surface); background: var(--green); border-radius: 50%; font-size: 8px; font-weight: 800; }
.trace-row.warn > [data-status-icon] { color: var(--text-strong); background: var(--yellow); }
.trace-row.failed > [data-status-icon] { background: var(--red); }
.trace-row > div { min-width: 0; display: flex; flex-direction: column; }
.trace-row strong { color: var(--text-strong); font-size: 9px; }
.trace-row small { overflow: hidden; color: var(--muted); font-family: var(--mono); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.studio-test-dock .status-dot.ok { background: var(--green); }
.studio-test-dock .status-dot.warn { background: var(--yellow); }
.studio-test-dock .status-dot.failed { background: var(--red); }
.publish-mode-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin-bottom: 12px; }
.publish-mode-grid button { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 8px; color: var(--muted); text-align: left; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; }
.publish-mode-grid button:hover { border-color: var(--accent); }
.publish-mode-grid button.active { color: var(--text-strong); background: var(--accent-soft); border-color: var(--accent); }
.publish-mode-grid button > span { font-size: 17px; }
.publish-mode-grid button strong { color: inherit; font-size: 10px; }
.publish-mode-grid button small { font-family: var(--mono); font-size: 7.5px; line-height: 1.3; }
.publish-config { padding: 10px; margin-bottom: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; }
.publish-config .toggle-line { margin: 6px 0; }
.publish-config .studio-panel-section-title small { color: var(--muted); font-family: var(--mono); font-size: 8px; }
.config-label { display: block; margin: 8px 0 5px; color: var(--muted); font-size: 8.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.option-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.option-chips label { display: flex; gap: 4px; align-items: center; padding: 4px 6px; cursor: pointer; background: var(--bg); border: 1px solid var(--border); border-radius: 5px; font-size: 8.5px; }
.option-chips input { width: auto; }
.publish-review { margin: 14px 0 10px; }
.readiness-list { display: flex; flex-direction: column; gap: 4px; }
.readiness-row { display: flex; gap: 7px; padding: 7px; background: var(--bg); border-left: 3px solid var(--green); }
.readiness-row.warning { border-left-color: var(--yellow); }
.readiness-row.error { border-left-color: var(--red); }
.readiness-row > [data-status-icon] { width: 16px; height: 16px; display: grid; flex: 0 0 auto; place-items: center; color: var(--surface); background: var(--green); border-radius: 50%; font-size: 8px; font-weight: 800; }
.readiness-row.warning > [data-status-icon] { color: var(--text-strong); background: var(--yellow); }
.readiness-row.error > [data-status-icon] { background: var(--red); }
.readiness-row > div { min-width: 0; display: flex; flex-direction: column; }
.readiness-row strong { color: var(--text-strong); font-size: 9.5px; }
.readiness-row small { color: var(--muted); font-size: 8.5px; }
.publish-ai-summary { display: flex; gap: 7px; padding: 8px; margin-top: 7px; background: rgba(116, 92, 165, .1); border-left: 3px solid var(--studio-intelligence); }
.publish-ai-summary > span { color: var(--studio-intelligence); }
.publish-ai-summary p { color: var(--text); font-size: 9.5px; }
.acknowledge-line { display: flex; gap: 6px; align-items: flex-start; padding: 8px; margin-bottom: 8px; color: var(--text); background: var(--yellow-soft); border-radius: 6px; font-size: 9.5px; }
.acknowledge-line input { width: auto; margin-top: 2px; }
.publish-success { display: flex; flex-direction: column; padding: 9px; margin-top: 8px; background: var(--green-soft); border-left: 3px solid var(--green); }
.publish-success strong { color: var(--text-strong); font-size: 10.5px; }
.publish-success a { color: var(--accent); font-size: 9px; }
.published-versions { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
.version-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.version-row > div { min-width: 0; display: flex; flex-direction: column; }
.version-row strong { color: var(--text-strong); font-size: 10px; }
.version-row small { color: var(--muted); font-family: var(--mono); font-size: 8px; }
.version-row button { padding: 3px 5px; font-size: 8.5px; }
#minimap {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 160px;
  height: 96px;
  overflow: hidden;
  cursor: pointer;
  z-index: 5;
  opacity: .92;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.mm-node { position: absolute; background: var(--border-strong); border-radius: 1px; }
.mm-node.sel { background: var(--accent); }
#mm-view { position: absolute; pointer-events: none; background: var(--accent-soft); border: 1px solid var(--accent); }
#marquee { position: absolute; pointer-events: none; z-index: 10; background: var(--accent-soft); border: 1px dashed var(--accent); }
.studio-test-dock {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  color: var(--muted);
  background: var(--surface);
  border-top: 1px solid var(--border);
  font-size: 10.5px;
}
.studio-test-dock .status-dot { width: 7px; height: 7px; flex: 0 0 auto; background: var(--yellow); border-radius: 50%; }
.studio-test-dock button { margin-left: auto; }
.studio :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 1180px) {
  .studio-cockpit { grid-template-columns: 232px minmax(420px, 1fr) 270px; }
  .studio-toolbar { gap: 6px; }
  .studio-identity { min-width: auto; }
  .studio-identity span, .studio-divider { display: none; }
}
@media (max-width: 1140px) {
  .studio { height: auto; min-height: calc(100vh - 56px); overflow: visible; }
  .studio-toolbar { position: sticky; top: 0; flex-wrap: wrap; }
  .studio-cockpit { min-height: 900px; grid-template-columns: 210px minmax(520px, 1fr); overflow-x: auto; }
  .studio-side-panel { grid-column: 1 / -1; min-height: 220px; border-top: 1px solid var(--border); border-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .studio *, .studio *::before, .studio *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* ---------- Página de autenticação (login/cadastro) ---------- */
.auth-page {
  position: fixed; inset: 0; z-index: 500; display: flex;
  background: var(--bg);
}
.auth-brand {
  flex: 1.1; display: flex; align-items: center; justify-content: center; padding: 48px;
  background:
    radial-gradient(ellipse 80% 60% at 20% 0%, var(--accent-soft), transparent),
    radial-gradient(ellipse 60% 50% at 90% 100%, var(--purple-soft), transparent),
    var(--surface);
  border-right: 1px solid var(--border);
}
.auth-brand-inner { max-width: 460px; }
.auth-logo { font-size: 22px; margin-bottom: 28px; color: var(--text-strong); }
.auth-brand h1 { font-size: 34px; line-height: 1.2; color: var(--text-strong); letter-spacing: -0.5px; margin-bottom: 24px; }
.auth-feats { list-style: none; display: flex; flex-direction: column; gap: 12px; color: var(--muted); font-size: 14.5px; }
.auth-back { display: inline-block; margin-top: 32px; color: var(--muted); text-decoration: none; font-size: 13px; }
.auth-back:hover { color: var(--accent); }
.auth-form-side { flex: 1; display: flex; align-items: center; justify-content: center; padding: 32px; }
.auth-card { width: 380px; max-width: 100%; }
.auth-card h2 { font-size: 22px; color: var(--text-strong); margin-bottom: 6px; }
.auth-switch { margin-top: 18px; font-size: 13px; color: var(--muted); text-align: center; }
.auth-switch a { color: var(--accent); text-decoration: none; font-weight: 600; }
@media (max-width: 860px) { .auth-brand { display: none; } }

/* ---------- Administração de plataforma e empresa ---------- */
.nav-shell { display: contents; }
.nav-shell[hidden] { display: none !important; }
.eyebrow { display: block; margin-bottom: 5px; color: var(--accent); font-size: 10.5px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; }
.admin-header { margin-bottom: 14px; }
.admin-note {
  display: flex; gap: 9px; align-items: flex-start; max-width: 760px; margin: 0 0 16px;
  padding: 10px 12px; background: var(--yellow-soft); border: 1px solid color-mix(in srgb, var(--yellow) 35%, var(--border)); border-radius: 9px; color: var(--muted); font-size: 12.5px;
}
.admin-note > :first-child { color: var(--yellow); font-weight: 700; }
.admin-table-wrap { overflow-x: auto; border-radius: var(--radius); }
.admin-table-wrap table { min-width: 640px; }
.admin-table-wrap td > strong, .admin-table-wrap td > small { display: block; }
.admin-table-wrap td > small { margin-top: 1px; color: var(--muted); font-size: 11.5px; }
.admin-table-wrap tr.is-disabled { opacity: .58; }
.admin-table-wrap tr.is-disabled strong { text-decoration: line-through; }
.table-actions { text-align: right; white-space: nowrap; }
.table-actions .btn-sm + .btn-sm { margin-left: 5px; }
.empty-cell { color: var(--muted); padding: 24px 14px; text-align: center; }
.status-active { color: var(--green); background: var(--green-soft); border-color: transparent; }
.status-invited { color: var(--yellow); background: var(--yellow-soft); border-color: transparent; }
.status-disabled { color: var(--red); background: var(--red-soft); border-color: transparent; }
.obs-filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.obs-filters .field { min-width: 150px; flex: 0 1 auto; margin: 0; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-bottom: 8px; }
.kpi-card { display: flex; flex-direction: column; gap: 3px; padding: 13px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.kpi-label { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; }
.kpi-value { font-family: var(--display); font-size: 21px; line-height: 1.15; }
.kpi-card small { color: var(--muted); font-size: 11.5px; }
.obs-series { display: flex; align-items: flex-end; gap: 4px; height: 140px; padding: 10px; overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.obs-bar-wrap { display: flex; flex: 1 0 22px; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.obs-bar { position: relative; width: 100%; min-height: 2px; border-radius: 3px 3px 0 0; background: var(--accent); }
.obs-bar-degraded { position: absolute; bottom: 0; width: 100%; border-radius: 0 0 3px 3px; background: var(--yellow); }
.obs-bar-failed { position: absolute; bottom: 0; width: 100%; border-radius: 0 0 3px 3px; background: var(--red); }
.sev { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; font-size: 12.5px; }
.sev + .sev { margin-left: 6px; }
.sev-success { color: var(--green); }
.sev-warning { color: var(--yellow); }
.sev-error { color: var(--red); }
.obs-bar-wrap small { color: var(--muted); font-size: 10px; white-space: nowrap; }
.model-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.model-card { display: flex; flex-direction: column; gap: 10px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.model-card.is-disabled { opacity: .62; }
.model-card .table-actions { margin-top: auto; }
.model-card header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.model-card header small { display: block; margin-top: 2px; color: var(--muted); font-family: var(--mono); font-size: 11px; }
.model-chips, .model-meta { display: flex; flex-wrap: wrap; gap: 5px; }
.check-line { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 13px; }
.check-line input[type="checkbox"] { width: auto; }
.check-inline { display: inline-flex; align-items: center; gap: 5px; margin-left: auto; color: var(--muted); font-size: 12px; }
.auth-link { display: block; width: 100%; margin-top: 10px; padding: 6px; border: 0; background: transparent; color: var(--muted); font-size: 12.5px; text-align: center; cursor: pointer; }
.auth-link:hover { color: var(--text-strong); text-decoration: underline; }
.admin-panel { max-width: 720px; padding: 18px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.admin-panel .page-actions { margin-top: 16px; }
.role-label { display: inline-flex; flex-direction: column; color: var(--text); font-weight: 600; line-height: 1.2; }
.role-label small { margin-top: 2px; color: var(--muted); font-family: var(--mono); font-size: 10.5px; font-weight: 400; }
.form-divider { margin: 4px 0 12px; padding-top: 14px; border-top: 1px solid var(--border); color: var(--text-strong); font-family: var(--display); font-size: 13.5px; font-weight: 700; }
.form-note { margin: -3px 0 12px; color: var(--muted); font-size: 12px; }

@media (max-width: 700px) {
  #app { min-height: 100vh; height: auto; }
  .sidebar { width: 100%; min-width: 0; height: auto; border-right: 0; border-bottom: 1px solid var(--border); }
  .logo { padding: 12px 16px 8px; }
  .sidebar nav { flex: none; max-height: none; padding: 2px 10px 10px; flex-direction: row; flex-wrap: wrap; gap: 3px; }
  .sidebar nav a { padding: 6px 8px; font-size: 12px; }
  .sidebar nav .nav-section { width: 100%; padding: 8px 8px 2px; }
  .sidebar-footer { display: none; }
  main { padding: 20px 16px; overflow: visible; }
  .page-header { margin-bottom: 18px; }
  .page-header h1 { font-size: 20px; }
  .page-actions { width: 100%; justify-content: flex-start; }
  .page-actions .btn-primary { width: 100%; justify-content: center; }
  .row { flex-direction: column; gap: 0; }
  .admin-table-wrap { margin: 0 -16px; border-radius: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .admin-table-wrap, .admin-table-wrap *, .modal-overlay, .modal-overlay * {
    animation-duration: .01ms !important;
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}

/* ---------- Copiloto do builder + polimento ---------- */
.seg { display: flex; gap: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 2px; }
.seg button { border: 0; background: transparent; padding: 4px 10px; border-radius: 6px; font-size: 12px; cursor: pointer; color: var(--muted); }
.seg button.active { background: var(--surface); color: var(--text-strong); box-shadow: var(--shadow-sm); }
.tab-count { display: inline-block; min-width: 16px; padding: 0 5px; margin-left: 2px; border-radius: 999px; background: var(--surface-3); font-size: 10.5px; text-align: center; }
.patch-card { margin-top: 8px; border: 1px dashed var(--accent); border-radius: 10px; padding: 10px 12px; background: rgba(69, 137, 255, .06); max-width: 90%; }
.patch-field { margin-bottom: 6px; font-size: 12.5px; }

/* Cartões de anexo (artefatos gerados pelos fluxos) */
.attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.attachment-card {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--bg);
  text-decoration: none; color: var(--text); max-width: 280px;
}
.attachment-card:hover { border-color: var(--accent); }
.attachment-card .att-icon { font-size: 20px; }
.attachment-card .att-info { display: flex; flex-direction: column; min-width: 0; }
.attachment-card .att-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-card .att-meta { font-size: 11px; color: var(--muted); }
.attachment-card .att-dl { margin-left: auto; color: var(--accent); font-size: 16px; }

/* Mapa embutido no chat (artefato kind=map) */
.map-embed { width: 100%; max-width: 560px; }
.map-embed iframe { width: 100%; height: 340px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); }
.map-embed .map-open { display: inline-block; margin-top: 4px; font-size: 12px; color: var(--accent); text-decoration: none; }
.map-embed .map-open:hover { text-decoration: underline; }

/* Anexos pendentes no chat (multimodal) */
.chat-pending { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 0; }
.att-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px;
  padding: 3px 8px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg); }
.att-chip button { border: none; background: none; cursor: pointer; color: var(--muted); font-size: 11px; }
#chat-mic.recording { background: #c0392b; color: #fff; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: 0.6; } }
