/* ============================================================
   HASSE AI — HUD futurista
   Paleta: grafite profundo + azul ciano. Sem dependências.
   ============================================================ */

:root {
  --bg-0: #04070d;
  --bg-1: #070c16;
  --bg-2: #0b1322;
  --bg-3: #101a2c;
  --line: rgba(96, 165, 250, 0.14);
  --line-strong: rgba(96, 165, 250, 0.32);
  --txt: #e7eefb;
  --txt-dim: #8fa3bf;
  --txt-faint: #5b6c85;
  --cyan: #22d3ee;
  --blue: #3b82f6;
  --violet: #8b5cf6;
  --ok: #34d399;
  --warn: #fbbf24;
  --err: #f87171;
  --glow: 0 0 0 1px rgba(34, 211, 238, 0.25), 0 0 32px rgba(34, 211, 238, 0.12);
  --radius: 14px;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg-0);
  color: var(--txt);
  font-family: var(--sans);
  overscroll-behavior: none;
}

body {
  background-image:
    radial-gradient(1100px 700px at 12% -10%, rgba(59, 130, 246, 0.16), transparent 60%),
    radial-gradient(900px 600px at 88% 110%, rgba(139, 92, 246, 0.13), transparent 62%),
    linear-gradient(180deg, #04070d 0%, #050910 55%, #04070d 100%);
  min-height: 100dvh;
  overflow: hidden;
}

/* grade técnica de fundo */
body::before {
  content: "";
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    linear-gradient(rgba(96, 165, 250, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(96, 165, 250, 0.045) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(circle at 50% 40%, #000 0%, transparent 78%);
  -webkit-mask-image: radial-gradient(circle at 50% 40%, #000 0%, transparent 78%);
}

button, input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
::selection { background: rgba(34, 211, 238, 0.28); }

/* scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(96, 165, 250, 0.22); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(96, 165, 250, 0.4); }

/* ============================================================ LAYOUT */
.shell {
  position: relative; z-index: 1;
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  height: 100dvh;
  padding-bottom: env(safe-area-inset-bottom);
}

/* ---------- rail ---------- */
.rail {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 16px 0 14px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(8, 13, 24, 0.9), rgba(5, 9, 16, 0.6));
  backdrop-filter: blur(14px);
  z-index: 20;
}
.rail-logo {
  width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center;
  background: radial-gradient(circle at 30% 25%, rgba(34, 211, 238, 0.35), rgba(59, 130, 246, 0.1) 60%, transparent);
  border: 1px solid var(--line-strong);
  box-shadow: var(--glow);
  margin-bottom: 14px;
  font-weight: 700; font-size: 15px; letter-spacing: -0.5px;
  color: #bff4ff; flex-shrink: 0;
}
.rail-btn {
  width: 46px; height: 44px; border-radius: 11px;
  display: grid; place-items: center; gap: 3px;
  color: var(--txt-faint);
  transition: color .18s, background .18s, transform .18s;
  position: relative;
  font-size: 10px;
}
.rail-btn svg { width: 19px; height: 19px; }
.rail-btn span { font-family: var(--mono); font-size: 8px; letter-spacing: .06em; text-transform: uppercase; }
.rail-btn:hover { color: var(--txt); background: rgba(96, 165, 250, 0.07); }
.rail-btn.active { color: var(--cyan); background: rgba(34, 211, 238, 0.09); }
.rail-btn.active::before {
  content: ""; position: absolute; left: -1px; top: 9px; bottom: 9px;
  width: 2px; border-radius: 2px; background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
}
.rail-spacer { flex: 1; }
.rail-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--txt-faint); transition: background .2s, box-shadow .2s;
}
.rail-dot.online { background: var(--ok); box-shadow: 0 0 12px rgba(52, 211, 153, 0.8); }
.rail-dot.busy { background: var(--cyan); box-shadow: 0 0 12px rgba(34, 211, 238, 0.9); animation: pulse 1.4s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* ---------- stage ---------- */
.stage {
  display: grid;
  grid-template-columns: minmax(300px, 42%) minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
}

/* ---------- topbar ---------- */
.topbar {
  position: absolute; top: 0; left: 76px; right: 0; height: 52px;
  display: flex; align-items: center; gap: 14px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(6, 10, 19, 0.94), rgba(6, 10, 19, 0.55));
  backdrop-filter: blur(16px);
  z-index: 15;
}
.brand { display: flex; align-items: baseline; gap: 9px; }
.brand strong { font-size: 14px; letter-spacing: .22em; font-weight: 600; }
.brand em {
  font-style: normal; font-family: var(--mono); font-size: 9px;
  color: var(--cyan); letter-spacing: .18em;
  border: 1px solid rgba(34, 211, 238, 0.3); border-radius: 4px; padding: 2px 5px;
}
.topbar-info {
  display: flex; align-items: center; gap: 16px; margin-left: auto;
  font-family: var(--mono); font-size: 10px; color: var(--txt-faint);
  letter-spacing: .08em; text-transform: uppercase;
}
.topbar-info b { color: var(--txt-dim); font-weight: 500; }
.stat { display: flex; align-items: center; gap: 6px; }
.stat i { width: 5px; height: 5px; border-radius: 50%; background: var(--txt-faint); display: block; }
.stat i.on { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.stat i.off { background: var(--err); }

/* ============================================================ NÚCLEO (esquerda) */
.core-panel {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 68px 20px 20px;
  border-right: 1px solid var(--line);
  overflow: hidden;
  min-height: 0;
}

.core-wrap {
  position: relative;
  width: min(300px, 62vw); aspect-ratio: 1;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 1px solid rgba(96, 165, 250, 0.16);
  pointer-events: none;
}
.ring.r1 { inset: 0; animation: spin 34s linear infinite; border-style: solid; border-color: rgba(34,211,238,.28); border-width: 1px; }
.ring.r1::after, .ring.r2::after, .ring.r3::after {
  content: ""; position: absolute; width: 6px; height: 6px; border-radius: 50%;
  background: var(--cyan); box-shadow: 0 0 12px var(--cyan);
  top: -3px; left: 50%; transform: translateX(-50%);
}
.ring.r2 { inset: 11%; animation: spin 22s linear infinite reverse; border-color: rgba(139, 92, 246, 0.22); }
.ring.r2::after { background: var(--violet); box-shadow: 0 0 12px var(--violet); }
.ring.r3 { inset: 22%; animation: spin 16s linear infinite; border-color: rgba(96, 165, 250, 0.2); }
.ring.r3::after { background: var(--blue); box-shadow: 0 0 12px var(--blue); }
@keyframes spin { to { transform: rotate(360deg); } }

.core-ticks {
  position: absolute; inset: -13px; border-radius: 50%;
  background-image: repeating-conic-gradient(from 0deg, rgba(96,165,250,.5) 0deg .6deg, transparent .6deg 3deg);
  mask-image: radial-gradient(circle, transparent 63%, #000 64%, #000 66%, transparent 67%);
  -webkit-mask-image: radial-gradient(circle, transparent 63%, #000 64%, #000 66%, transparent 67%);
  opacity: .5; animation: spin 90s linear infinite;
}

/* avatar */
.core-avatar {
  position: relative;
  width: 58%; aspect-ratio: 1; border-radius: 50%;
  overflow: hidden;
  border: 1px solid rgba(34, 211, 238, 0.4);
  box-shadow: 0 0 0 8px rgba(34, 211, 238, 0.04), 0 0 60px rgba(34, 211, 238, 0.22), inset 0 0 40px rgba(4, 7, 13, 0.9);
  background: radial-gradient(circle at 50% 35%, #16324d, #060b14 72%);
  display: grid; place-items: center;
  transition: box-shadow .3s, transform .3s;
}
.core-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.core-avatar .avatar-fallback {
  font-family: var(--sans); font-weight: 700; font-size: clamp(28px, 7vw, 44px);
  letter-spacing: -1px;
  background: linear-gradient(180deg, #d9f6ff, #6fb6dd);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.core-avatar .avatar-scan {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 0%, rgba(34, 211, 238, 0.16) 48%, transparent 52%);
  animation: scan 4.5s ease-in-out infinite;
  mix-blend-mode: screen; pointer-events: none;
}
@keyframes scan { 0%,100% { transform: translateY(-46%); opacity: 0; } 50% { transform: translateY(46%); opacity: 1; } }

.core-avatar.speaking { box-shadow: 0 0 0 8px rgba(34,211,238,.09), 0 0 90px rgba(34,211,238,.5); transform: scale(1.015); }
.core-avatar.thinking { border-color: rgba(139,92,246,.55); box-shadow: 0 0 0 8px rgba(139,92,246,.08), 0 0 80px rgba(139,92,246,.35); }

/* status + nome */
.core-label { margin-top: 26px; text-align: center; }
.core-name { font-size: 17px; font-weight: 600; letter-spacing: .02em; }
.core-role {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .22em;
  text-transform: uppercase; color: var(--cyan); margin-top: 7px;
}
.core-state {
  margin-top: 16px;
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 10px; letter-spacing: .1em;
  color: var(--txt-dim); text-transform: uppercase;
  border: 1px solid var(--line); border-radius: 99px; padding: 6px 13px;
  background: rgba(8, 14, 26, 0.7);
}
.core-state i { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 10px var(--ok); }

/* waveform */
.wave {
  display: flex; align-items: center; justify-content: center; gap: 2.5px;
  height: 26px; margin-top: 18px; opacity: .9;
}
.wave span {
  width: 2px; border-radius: 2px; height: 4px;
  background: linear-gradient(180deg, var(--cyan), rgba(59,130,246,.35));
  transition: height .12s ease;
}
.wave.live span { animation: bounce 1s ease-in-out infinite; }
.wave span:nth-child(2n) { animation-delay: .1s; }
.wave span:nth-child(3n) { animation-delay: .2s; }
.wave span:nth-child(4n) { animation-delay: .3s; }
.wave span:nth-child(5n) { animation-delay: .15s; }
@keyframes bounce { 0%,100% { height: 4px; } 50% { height: 22px; } }

/* métricas */
.core-metrics {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  width: 100%; max-width: 330px; margin-top: 26px;
}
.metric {
  border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 10px; background: rgba(8, 14, 26, 0.55);
}
.metric b { display: block; font-size: 16px; font-weight: 600; letter-spacing: -.02em; }
.metric small {
  display: block; font-family: var(--mono); font-size: 8.5px; color: var(--txt-faint);
  letter-spacing: .1em; text-transform: uppercase; margin-top: 3px;
}

/* ============================================================ CONVERSA (direita) */
.convo { display: flex; flex-direction: column; min-height: 0; padding-top: 52px; position: relative; }

.convo-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 22px; border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.convo-title {
  font-size: 12.5px; font-weight: 500; color: var(--txt-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40%;
}
.mode-switch {
  display: flex; gap: 2px; padding: 2px; border-radius: 9px;
  border: 1px solid var(--line); background: rgba(6, 11, 20, 0.7); margin-left: auto;
}
.mode-switch button {
  padding: 5px 11px; border-radius: 7px; font-family: var(--mono);
  font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--txt-faint);
  transition: .16s;
}
.mode-switch button.on { background: rgba(34, 211, 238, 0.12); color: var(--cyan); }
.mode-switch button:hover:not(.on) { color: var(--txt-dim); }

.thread {
  flex: 1; overflow-y: auto; padding: 22px 22px 8px;
  display: flex; flex-direction: column; gap: 16px;
  scroll-behavior: smooth; min-height: 0;
}

.msg { display: flex; gap: 11px; max-width: 100%; animation: rise .28s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
.msg .who {
  width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0;
  display: grid; place-items: center; font-family: var(--mono); font-size: 9px;
  border: 1px solid var(--line-strong); color: var(--cyan);
  background: rgba(34, 211, 238, 0.07); margin-top: 2px;
}
.msg.user { flex-direction: row-reverse; }
.msg.user .who {
  color: var(--txt-dim); border-color: rgba(143,163,191,.28);
  background: rgba(143, 163, 191, 0.08);
}
.bubble {
  border: 1px solid var(--line); border-radius: 4px 13px 13px 13px;
  padding: 11px 15px; font-size: 14px; line-height: 1.62;
  background: linear-gradient(160deg, rgba(15, 23, 38, 0.92), rgba(9, 14, 24, 0.86));
  max-width: min(660px, 82%); word-wrap: break-word; overflow-wrap: anywhere;
  box-shadow: 0 8px 24px rgba(0,0,0,.22);
}
.msg.user .bubble {
  border-radius: 13px 4px 13px 13px;
  background: linear-gradient(160deg, rgba(26, 47, 74, 0.95), rgba(14, 26, 42, 0.9));
  border-color: rgba(59, 130, 246, 0.28);
}
.bubble p { margin: 0 0 .68em; }
.bubble p:last-child { margin-bottom: 0; }
.bubble ul, .bubble ol { margin: .35em 0 .7em; padding-left: 1.25em; }
.bubble li { margin: .22em 0; }
.bubble code {
  font-family: var(--mono); font-size: 12.4px;
  background: rgba(34, 211, 238, 0.1); border: 1px solid rgba(34,211,238,.14);
  border-radius: 4px; padding: 1px 5px;
}
.bubble pre {
  background: rgba(3, 7, 14, 0.9); border: 1px solid var(--line);
  border-radius: 8px; padding: 11px 13px; overflow-x: auto; margin: .6em 0;
}
.bubble pre code { background: none; border: 0; padding: 0; font-size: 12px; line-height: 1.55; }
.bubble strong { color: #fff; font-weight: 600; }
.bubble a { color: var(--cyan); text-decoration: underline; text-underline-offset: 2px; }

.msg-meta {
  display: flex; align-items: center; gap: 8px; margin-top: 7px;
  font-family: var(--mono); font-size: 8.5px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--txt-faint);
}
.msg-meta button { font-family: var(--mono); font-size: 8.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--txt-faint); padding: 2px 0; }
.msg-meta button:hover { color: var(--cyan); }
.msg-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--txt-faint); }

/* cartões do conselho */
.council { display: grid; gap: 8px; margin-top: 10px; width: min(660px, 100%); }
.council-card {
  border: 1px solid var(--line); border-radius: 9px;
  padding: 9px 12px; background: rgba(7, 12, 21, 0.75);
  font-size: 12.4px; line-height: 1.55; color: var(--txt-dim);
  max-height: 92px; overflow: hidden; position: relative;
}
.council-card b {
  display: block; font-family: var(--mono); font-size: 8.5px;
  letter-spacing: .12em; text-transform: uppercase; color: var(--cyan); margin-bottom: 5px;
}
.council-card.fail { border-color: rgba(248,113,113,.28); }
.council-card.fail b { color: var(--err); }
.council-card::after {
  content: ""; position: absolute; inset: auto 0 0 0; height: 26px;
  background: linear-gradient(transparent, rgba(7,12,21,.96)); pointer-events: none;
}

/* estado de digitação */
.typing { display: flex; align-items: center; gap: 9px; color: var(--txt-dim); font-size: 12.5px; font-family: var(--mono); letter-spacing: .06em; }
.typing .dots { display: flex; gap: 4px; }
.typing .dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--cyan); animation: blink 1.2s infinite; }
.typing .dots i:nth-child(2) { animation-delay: .18s; }
.typing .dots i:nth-child(3) { animation-delay: .36s; }
@keyframes blink { 0%,100% { opacity: .2; transform: scale(.85); } 50% { opacity: 1; transform: scale(1); } }

/* vazio */
.empty {
  margin: auto; text-align: center; max-width: 430px; padding: 18px;
}
.empty h2 { font-size: 19px; font-weight: 600; margin: 0 0 9px; letter-spacing: -.01em; }
.empty p { color: var(--txt-dim); font-size: 13.2px; line-height: 1.6; margin: 0 0 22px; }
.suggest { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; }
.suggest button {
  border: 1px solid var(--line); border-radius: 99px; padding: 7px 13px;
  font-size: 11.6px; color: var(--txt-dim); background: rgba(9, 15, 26, .6);
  transition: .16s;
}
.suggest button:hover { border-color: var(--line-strong); color: var(--txt); background: rgba(34,211,238,.07); }

/* ============================================================ COMPOSER */
.composer { padding: 12px 22px 18px; flex-shrink: 0; border-top: 1px solid var(--line); background: linear-gradient(180deg, rgba(4,7,13,0), rgba(4,7,13,.72) 40%); }
.composer-box {
  border: 1px solid var(--line-strong); border-radius: 15px;
  background: linear-gradient(160deg, rgba(11, 19, 34, 0.95), rgba(7, 11, 20, 0.94));
  padding: 9px 11px 9px 14px;
  display: flex; align-items: flex-end; gap: 9px;
  transition: border-color .18s, box-shadow .18s;
}
.composer-box:focus-within { border-color: rgba(34, 211, 238, 0.5); box-shadow: 0 0 0 3px rgba(34,211,238,.07), 0 0 34px rgba(34,211,238,.1); }
.composer textarea {
  flex: 1; resize: none; border: 0; background: none; outline: none;
  font-size: 14px; line-height: 1.55; max-height: 148px; min-height: 24px;
  padding: 5px 0; color: var(--txt);
}
.composer textarea::placeholder { color: var(--txt-faint); }

.icon-btn {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  display: grid; place-items: center; color: var(--txt-dim);
  border: 1px solid transparent; transition: .16s;
}
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:hover { color: var(--txt); background: rgba(96, 165, 250, 0.09); }
.icon-btn.mic { border-color: var(--line); }
.icon-btn.mic.rec { color: #fff; background: rgba(248, 113, 113, 0.16); border-color: rgba(248,113,113,.5); animation: pulse 1.2s infinite; }
.send-btn {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  display: grid; place-items: center;
  background: linear-gradient(150deg, #22d3ee, #3b82f6);
  color: #03121a; transition: .16s;
  box-shadow: 0 4px 18px rgba(34, 211, 238, 0.24);
}
.send-btn svg { width: 17px; height: 17px; }
.send-btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
.send-btn:disabled { opacity: .38; filter: grayscale(.5); transform: none; cursor: not-allowed; }

.composer-foot {
  display: flex; align-items: center; gap: 8px; margin-top: 9px;
  font-family: var(--mono); font-size: 9px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--txt-faint); flex-wrap: wrap;
}
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid var(--line); border-radius: 99px; padding: 3.5px 9px;
  color: var(--txt-faint); font-family: var(--mono); font-size: 9px;
  letter-spacing: .08em; transition: .16s; background: rgba(8,13,24,.5);
}
.chip i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.chip.on { color: var(--cyan); border-color: rgba(34,211,238,.35); }
.chip.off { color: var(--txt-faint); opacity: .55; }
.chip:hover { border-color: var(--line-strong); }
.chip select { background: none; border: 0; outline: none; color: inherit; font: inherit; cursor: pointer; }
.chip select option { background: #0b1322; color: var(--txt); }
.composer-foot .grow { flex: 1; }
.kbd { border: 1px solid var(--line); border-radius: 4px; padding: 1px 4px; font-size: 8.5px; }

/* ============================================================ DRAWERS */
.drawer {
  position: fixed; inset: 0; z-index: 60;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 470px);
  pointer-events: none;
}
.drawer[hidden] { display: none; }
.drawer .scrim {
  background: rgba(2, 5, 10, 0.62); backdrop-filter: blur(3px);
  opacity: 0; transition: opacity .22s; pointer-events: auto;
}
.drawer.open .scrim { opacity: 1; }
.panel {
  background: linear-gradient(175deg, #0a1220, #060b14 70%);
  border-left: 1px solid var(--line-strong);
  transform: translateX(102%); transition: transform .26s cubic-bezier(.4, 0, .2, 1);
  pointer-events: auto;
  display: flex; flex-direction: column; min-height: 0;
  box-shadow: -30px 0 80px rgba(0, 0, 0, .5);
}
.drawer.open .panel { transform: none; }

.panel-head {
  display: flex; align-items: center; gap: 12px;
  padding: 17px 20px; border-bottom: 1px solid var(--line); flex-shrink: 0;
}
.panel-head h3 {
  margin: 0; font-size: 12px; font-weight: 600;
  letter-spacing: .18em; text-transform: uppercase; color: var(--txt);
}
.panel-head .sub { font-family: var(--mono); font-size: 8.5px; color: var(--txt-faint); letter-spacing: .1em; }
.panel-head .close { margin-left: auto; }
.panel-body { padding: 18px 20px 30px; overflow-y: auto; flex: 1; min-height: 0; }

.section { margin-bottom: 26px; }
.section > h4 {
  margin: 0 0 11px; font-family: var(--mono); font-size: 9px;
  letter-spacing: .16em; text-transform: uppercase; color: var(--cyan);
  display: flex; align-items: center; gap: 8px;
}
.section > h4::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.hint { font-size: 11.5px; color: var(--txt-faint); line-height: 1.55; margin: -4px 0 11px; }

.field { margin-bottom: 11px; }
.field label {
  display: block; font-family: var(--mono); font-size: 8.5px;
  letter-spacing: .1em; text-transform: uppercase; color: var(--txt-faint); margin-bottom: 5px;
}
.field input, .field textarea, .input {
  width: 100%; border: 1px solid var(--line); border-radius: 9px;
  background: rgba(4, 8, 15, 0.75); padding: 9px 11px;
  font-size: 12.8px; outline: none; transition: .16s;
}
.field textarea { resize: vertical; min-height: 68px; line-height: 1.55; }
.field input:focus, .field textarea:focus, .input:focus {
  border-color: rgba(34, 211, 238, 0.45); box-shadow: 0 0 0 3px rgba(34, 211, 238, .06);
}
.field input::placeholder, .field textarea::placeholder { color: var(--txt-faint); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--line-strong); border-radius: 9px;
  padding: 9px 14px; font-size: 11.5px; font-weight: 500;
  color: var(--txt); background: rgba(59, 130, 246, 0.1);
  transition: .16s; letter-spacing: .02em;
}
.btn:hover { background: rgba(59, 130, 246, 0.18); border-color: rgba(96,165,250,.5); }
.btn.primary {
  background: linear-gradient(150deg, #22d3ee, #3b82f6); color: #03121a;
  border-color: transparent; font-weight: 600;
}
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--txt-dim); }
.btn.ghost:hover { color: var(--txt); background: rgba(96,165,250,.07); }
.btn.danger { color: var(--err); border-color: rgba(248,113,113,.3); background: rgba(248,113,113,.07); }
.btn.sm { padding: 5.5px 10px; font-size: 10.5px; border-radius: 7px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }

.prov-card {
  border: 1px solid var(--line); border-radius: 11px;
  padding: 12px; margin-bottom: 9px; background: rgba(7, 12, 21, 0.6);
}
.prov-top { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.prov-top b { font-size: 12.5px; font-weight: 600; }
.prov-top .badge {
  font-family: var(--mono); font-size: 8px; letter-spacing: .1em;
  text-transform: uppercase; padding: 2.5px 6px; border-radius: 4px;
  border: 1px solid var(--line); color: var(--txt-faint);
}
.badge.ok { color: var(--ok); border-color: rgba(52,211,153,.35); background: rgba(52,211,153,.07); }
.badge.warn { color: var(--warn); border-color: rgba(251,191,36,.3); background: rgba(251,191,36,.07); }
.badge.off { color: var(--txt-faint); }
.prov-top .toggle { margin-left: auto; }
.switch { width: 34px; height: 19px; border-radius: 99px; background: rgba(96,165,250,.16); position: relative; transition: .18s; flex-shrink: 0; }
.switch::after { content: ""; position: absolute; top: 2.5px; left: 2.5px; width: 14px; height: 14px; border-radius: 50%; background: var(--txt-faint); transition: .18s; }
.switch.on { background: rgba(34, 211, 238, 0.3); }
.switch.on::after { left: 17.5px; background: var(--cyan); box-shadow: 0 0 10px var(--cyan); }
.prov-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.check-out {
  font-family: var(--mono); font-size: 9.5px; line-height: 1.5;
  margin-top: 8px; padding: 7px 9px; border-radius: 6px;
  background: rgba(4, 8, 15, .7); border: 1px solid var(--line);
  color: var(--txt-dim); word-break: break-word; white-space: pre-wrap;
}
.check-out.ok { border-color: rgba(52,211,153,.3); color: var(--ok); }
.check-out.err { border-color: rgba(248,113,113,.3); color: var(--err); }

/* memória */
.mem-list { display: flex; flex-direction: column; gap: 7px; }
.mem-item {
  border: 1px solid var(--line); border-left: 2px solid var(--cyan);
  border-radius: 8px; padding: 9px 11px; background: rgba(7, 12, 21, 0.6);
  display: flex; gap: 9px; align-items: flex-start;
}
.mem-item .kind {
  font-family: var(--mono); font-size: 7.5px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--cyan); flex-shrink: 0; margin-top: 3px;
  min-width: 52px;
}
.mem-item p { margin: 0; font-size: 12.2px; line-height: 1.5; flex: 1; }
.mem-item button { color: var(--txt-faint); font-size: 15px; line-height: 1; padding: 0 2px; }
.mem-item button:hover { color: var(--err); }
.empty-mini { font-size: 11.5px; color: var(--txt-faint); padding: 12px 0; }

/* pareamento */
.pair-code {
  font-family: var(--mono); font-size: 26px; letter-spacing: .3em;
  text-align: center; padding: 15px; border-radius: 11px;
  border: 1px dashed rgba(34, 211, 238, 0.4);
  background: rgba(34, 211, 238, 0.05); color: var(--cyan);
  margin-bottom: 11px; font-weight: 500;
}
.device { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid rgba(96,165,250,.08); font-size: 11.5px; }
.device:last-child { border: 0; }
.device .plat { font-family: var(--mono); font-size: 8px; text-transform: uppercase; color: var(--txt-faint); letter-spacing: .08em; }
.device .when { margin-left: auto; font-family: var(--mono); font-size: 8.5px; color: var(--txt-faint); }

/* avatar na config */
.avatar-row { display: flex; gap: 13px; align-items: center; margin-bottom: 12px; }
.avatar-prev {
  width: 62px; height: 62px; border-radius: 50%; overflow: hidden; flex-shrink: 0;
  border: 1px solid var(--line-strong); background: #0d1726;
  display: grid; place-items: center; font-weight: 700; color: var(--cyan); font-size: 18px;
}
.avatar-prev img { width: 100%; height: 100%; object-fit: cover; }

/* ============================================================ TOASTS */
.toasts {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none; padding: 0 14px; width: max-content; max-width: 100%;
}
.toast {
  border: 1px solid var(--line-strong); border-radius: 10px;
  padding: 9px 15px; font-size: 12px;
  background: rgba(10, 18, 32, 0.97); color: var(--txt);
  box-shadow: 0 12px 40px rgba(0,0,0,.55);
  animation: toastIn .22s ease both; backdrop-filter: blur(10px);
  max-width: min(420px, 92vw); text-align: center;
}
.toast.err { border-color: rgba(248,113,113,.45); color: #ffd9d9; }
.toast.ok { border-color: rgba(52,211,153,.45); color: #ccffe9; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ============================================================ RESPONSIVO */
@media (max-width: 1080px) {
  .stage { grid-template-columns: minmax(240px, 36%) minmax(0, 1fr); }
  .core-wrap { width: min(230px, 52vw); }
  .core-metrics { display: none; }
}

@media (max-width: 880px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) 58px; }
  .rail {
    order: 2; flex-direction: row; justify-content: space-around; align-items: center;
    padding: 0 8px; border-right: 0; border-top: 1px solid var(--line);
    height: 58px; padding-bottom: env(safe-area-inset-bottom);
  }
  .rail-logo, .rail-spacer { display: none; }
  .rail-btn { width: auto; flex: 1; height: 46px; }
  .rail-btn.active::before { left: 22%; right: 22%; top: auto; bottom: 0; width: auto; height: 2px; }
  .rail-dot { position: absolute; top: 10px; right: 14px; }
  .topbar { left: 0; height: 46px; padding: 0 14px; }
  .stage { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .core-panel {
    flex-direction: row; gap: 14px; padding: 58px 14px 10px;
    border-right: 0; border-bottom: 1px solid var(--line);
    justify-content: flex-start;
  }
  .core-wrap { width: 74px; }
  .ring.r3, .core-ticks { display: none; }
  .core-label { margin-top: 0; text-align: left; }
  .core-name { font-size: 14px; }
  .core-role { font-size: 8px; margin-top: 3px; }
  .core-state { margin-top: 6px; padding: 3px 8px; font-size: 8.5px; }
  .wave { display: none; }
  .convo { padding-top: 0; }
  .convo-head { padding: 8px 14px; }
  .thread { padding: 14px 14px 4px; gap: 13px; }
  .bubble { font-size: 13.6px; max-width: 92%; }
  .composer { padding: 9px 12px 12px; }
  .composer-foot { font-size: 8px; }
  .kbd, .composer-foot .desktop-only { display: none; }
  .drawer { grid-template-columns: 1fr; }
  .panel { border-left: 0; }
}

@media (max-width: 420px) {
  .brand em { display: none; }
  .topbar-info { gap: 9px; font-size: 8.5px; }
  .core-name { font-size: 13px; }
  .suggest button { font-size: 10.8px; padding: 6px 10px; }
}

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