:root {
  --bg: #05080f;
  --bg2: #070d18;
  --cyan: #36d3ff;
  --cyan-soft: rgba(54, 211, 255, .14);
  --teal: #2af5d0;
  --line: rgba(54, 211, 255, .18);
  --glass: rgba(12, 22, 38, .55);
  --glass-strong: rgba(10, 19, 33, .82);
  --text: #dbeaff;
  --muted: #7d92ad;
  --danger: #ff5c6c;
  --up: #2af5a0;
  --down: #ff6b7a;
  --radius: 16px;
  --glow: 0 0 24px rgba(54, 211, 255, .35);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 700px at 80% -10%, #0c1c30 0%, transparent 60%),
              radial-gradient(900px 600px at 0% 100%, #0a1626 0%, transparent 55%),
              var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Grade futurista de fundo */
.bg-grid {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .5;
  background-image:
    linear-gradient(rgba(54,211,255,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(54,211,255,.05) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(circle at 50% 30%, #000 0%, transparent 80%);
}

.hidden { display: none !important; }
.sub { color: var(--muted); font-size: .8rem; }
.muted { color: var(--muted); font-size: .85rem; }
.section-title { font-size: .82rem; letter-spacing: .12em; text-transform: uppercase; color: var(--cyan); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }

.card {
  position: relative; z-index: 1;
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 10px 40px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.03);
}

/* Botões */
button { font: inherit; cursor: pointer; border-radius: 11px; border: 1px solid var(--line); transition: .18s; }
button.compact { padding: 8px 13px; font-size: .85rem; }
.primary { background: linear-gradient(180deg, var(--cyan), #1aa6d8); color: #022; border: none; font-weight: 700; box-shadow: var(--glow); }
.primary:hover { filter: brightness(1.08); }
.secondary { background: rgba(54,211,255,.08); color: var(--text); }
.secondary:hover { background: rgba(54,211,255,.16); border-color: var(--cyan); }
.danger { background: rgba(255,92,108,.14); color: var(--danger); border-color: rgba(255,92,108,.4); font-weight: 700; }
.danger:hover { background: rgba(255,92,108,.24); }

/* Login */
.overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(3,6,12,.85); backdrop-filter: blur(6px); }
.login-card { width: min(360px, 90vw); text-align: center; }
.login-card h1 { margin: 6px 0 2px; letter-spacing: .3em; }
.login-card p { color: var(--muted); margin: 0 0 18px; }
.login-card input { width: 100%; padding: 12px 14px; margin-bottom: 12px; border-radius: 11px; border: 1px solid var(--line); background: #050b14; color: var(--text); }
.login-card .primary { width: 100%; padding: 12px; }
.omega-mark { font-size: 3.4rem; color: var(--cyan); text-shadow: var(--glow); animation: pulse 3s ease-in-out infinite; }
.error { color: var(--danger); font-size: .85rem; margin-top: 8px; min-height: 1em; }

/* Topbar */
.app { position: relative; z-index: 1; max-width: 1320px; margin: 0 auto; padding: 16px clamp(12px, 3vw, 28px) 40px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 18px; margin-bottom: 18px; border-radius: var(--radius); background: var(--glass-strong); border: 1px solid var(--line); backdrop-filter: blur(14px); }
.brand { display: flex; align-items: center; gap: 14px; }
.omega-logo { font-size: 2.2rem; line-height: 1; color: var(--cyan); text-shadow: var(--glow); animation: pulse 3.5s ease-in-out infinite; }
.brand-name { font-size: 1.25rem; font-weight: 800; letter-spacing: .28em; }
.topbar-info { display: flex; align-items: center; gap: 18px; }
.clock { text-align: right; line-height: 1.1; }
.clock #clockTime { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.weather { font-size: .9rem; color: var(--text); display: flex; align-items: center; gap: 7px; white-space: nowrap; }

/* Layout principal + lateral */
.layout { display: grid; grid-template-columns: 1fr 340px; gap: 18px; align-items: start; }
.col-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.col-side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 16px; }

/* Hero / microfone */
.hero { text-align: center; overflow: hidden; }
.hero-ring { position: absolute; top: -40%; left: 50%; width: 360px; height: 360px; transform: translateX(-50%); border-radius: 50%; border: 1px solid rgba(54,211,255,.2); box-shadow: 0 0 80px rgba(54,211,255,.12) inset; pointer-events: none; animation: spin 22s linear infinite; }
.mic { width: 96px; height: 96px; border-radius: 50%; font-size: 2.2rem; background: radial-gradient(circle at 50% 35%, #0e2438, #061320); border: 1px solid var(--cyan); color: var(--cyan); box-shadow: var(--glow); margin: 6px auto 12px; display: grid; place-items: center; }
.mic.speaking { animation: micPulse 1.1s ease-in-out infinite; }
.voice-state { font-weight: 600; }
.audio-level { height: 5px; border-radius: 4px; background: rgba(54,211,255,.12); overflow: hidden; margin: 12px auto; max-width: 320px; }
.audio-level span { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, var(--teal), var(--cyan)); transition: width .12s; }
.transcript { color: var(--text); margin-top: 8px; min-height: 1.2em; }
.live-narration { color: var(--muted); font-size: .85rem; margin-top: 6px; font-style: italic; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; margin-top: 14px; }
.chips span { font-size: .72rem; padding: 4px 10px; border-radius: 999px; background: var(--cyan-soft); border: 1px solid var(--line); color: var(--muted); }

/* Resposta */
.response-card #response { font-size: 1.05rem; line-height: 1.5; }
.task-state { color: var(--muted); font-size: .82rem; margin-top: 8px; }

/* Linha de comando */
.command-row { display: flex; gap: 10px; }
.command-row input { flex: 1; padding: 13px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--glass-strong); color: var(--text); }
.command-row input:focus { outline: none; border-color: var(--cyan); box-shadow: var(--glow); }

/* Painel lateral: mercado */
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--up); box-shadow: 0 0 10px var(--up); animation: pulse 1.6s ease-in-out infinite; }
.market-list { display: flex; flex-direction: column; gap: 2px; }
.market-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 4px; border-bottom: 1px solid rgba(54,211,255,.07); }
.market-row:last-child { border-bottom: none; }
.market-row .asset { font-weight: 600; text-transform: capitalize; }
.market-row .price { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .85rem; }
.market-row .pct { font-variant-numeric: tabular-nums; font-weight: 700; font-size: .85rem; padding: 2px 8px; border-radius: 999px; }
.pct.up { color: var(--up); background: rgba(42,245,160,.12); }
.pct.down { color: var(--down); background: rgba(255,107,122,.12); }

/* Painel lateral: notícias */
.news-panel { max-height: 46vh; overflow: hidden; }
.news-list { display: flex; flex-direction: column; gap: 0; max-height: 40vh; overflow-y: auto; }
.news-item { padding: 9px 2px; border-bottom: 1px solid rgba(54,211,255,.07); font-size: .86rem; line-height: 1.35; color: var(--text); text-decoration: none; display: block; }
.news-item:hover { color: var(--cyan); }
.news-list::-webkit-scrollbar { width: 5px; }
.news-list::-webkit-scrollbar-thumb { background: rgba(54,211,255,.25); border-radius: 3px; }

/* Tela do PC */
.screen-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.screen-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.screen-wrap { border-radius: 14px; overflow: hidden; position: relative; background: #02060c; min-height: 180px; border: 1px solid var(--line); }
.screen-wrap img { width: 100%; height: auto; display: block; cursor: zoom-in; }
.screen-status { position: absolute; left: 10px; bottom: 10px; background: rgba(0,0,0,.72); padding: 5px 9px; border-radius: 8px; font-size: .72rem; color: var(--cyan); }
.screen-wrap:fullscreen { background: #000; display: grid; place-items: center; }
.screen-wrap:fullscreen img { max-width: 100vw; max-height: 100vh; width: auto; object-fit: contain; }

/* Diagnóstico */
.diagnostics summary { cursor: pointer; color: var(--muted); font-size: .85rem; }
.diagnostics pre { white-space: pre-wrap; word-break: break-word; font-size: .75rem; color: var(--muted); margin: 10px 0 0; }

/* ===== Modo "OMEGA precisa de você": tela do PC em FOCO/tela cheia ===== */
.needs-action-banner { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; padding: 11px 14px; border-radius: 12px; background: linear-gradient(90deg, rgba(255,170,40,.2), rgba(255,170,40,.05)); border: 1px solid rgba(255,170,40,.55); color: #ffd9a0; font-weight: 600; }
.needs-action-buttons { display: flex; gap: 8px; flex-shrink: 0; }
.screen-section.needs-action { outline: 2px solid rgba(255,170,40,.7); animation: needsPulse 1.8s ease-in-out infinite; }
@keyframes needsPulse { 0%,100% { box-shadow: 0 0 0 4px rgba(255,170,40,.10); } 50% { box-shadow: 0 0 0 8px rgba(255,170,40,.22); } }
/* Foco TOTAL: a tela do PC vira overlay de tela cheia mostrando o que acontece */
body.action-focus .screen-section {
  position: fixed; inset: 0; z-index: 60; margin: 0; border-radius: 0;
  display: flex; flex-direction: column; background: rgba(3,6,12,.96); padding: 14px clamp(12px,4vw,40px);
}
body.action-focus .screen-section .screen-wrap { flex: 1; min-height: 0; display: grid; place-items: center; }
body.action-focus .screen-section .screen-wrap img { max-height: calc(100vh - 140px); width: auto; max-width: 100%; }
body.action-focus .screen-section .needs-action-banner { font-size: 1.05rem; }

/* Animações */
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .45; } }
@keyframes spin { to { transform: translateX(-50%) rotate(360deg); } }
@keyframes micPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(54,211,255,.5); } 50% { box-shadow: 0 0 0 16px rgba(54,211,255,0); } }

/* Responsivo: lateral desce pra baixo no celular */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .col-side { position: static; flex-direction: column; }
  .news-panel, .news-list { max-height: none; }
}
@media (max-width: 560px) {
  .topbar { flex-wrap: wrap; }
  .topbar-info { gap: 12px; }
  .clock #clockTime { font-size: 1.2rem; }
  .screen-actions { justify-content: flex-start; }
  .brand-name { font-size: 1.05rem; }
}
