:root {
  --cyan: #55dfff;
  --cyan-hot: #7af6ff;
  --cyan-soft: rgba(85, 223, 255, .35);
  --green: #58ffb0;
  --orange: #ff9b32;
  --bg: #02070d;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  min-height: 100%;
  overflow: hidden;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--cyan);
  background:
    radial-gradient(circle at 50% 44%, rgba(0, 142, 202, .20), transparent 32%),
    radial-gradient(circle at 50% 45%, rgba(0, 73, 120, .22), transparent 53%),
    linear-gradient(180deg, #010206, var(--bg) 58%, #010207);
}

body::before, body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}
body::before {
  background: repeating-linear-gradient(0deg, rgba(255,255,255,.025) 0 1px, transparent 1px 4px);
  mix-blend-mode: screen;
}
body::after { box-shadow: inset 0 0 150px rgba(0,0,0,.95); }

.jarvis-shell {
  height: 100%;
  display: grid;
  grid-template-rows: 110px 1fr 210px 90px;
  align-items: center;
  justify-items: center;
  padding: 20px;
}

.top-status { width: min(1120px, 96vw); text-align: center; text-shadow: 0 0 14px var(--cyan-soft); }
.status-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; }
.online { justify-self: start; letter-spacing: .28em; font-weight: 800; font-size: 13px; }
.window-controls { justify-self: end; letter-spacing: .7em; opacity: .85; }
.top-status h1 { font-size: clamp(12px, 2vw, 18px); font-weight: 700; letter-spacing: .75em; margin: 18px 0 0; opacity: .92; }
.pill {
  display: inline-block;
  padding: 9px 30px;
  border: 1px solid rgba(255, 155, 50, .78);
  color: var(--orange);
  letter-spacing: .35em;
  border-radius: 6px;
  background: rgba(255, 115, 42, .08);
  box-shadow: 0 0 22px rgba(255, 105, 40, .22), inset 0 0 14px rgba(255, 105, 40, .09);
}

.sphere-wrap { position: relative; width: min(76vw, 720px); aspect-ratio: 1; }
.halo, .sphere {
  position: absolute;
  border-radius: 50%;
  inset: 2%;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 50%, rgba(19, 121, 215, .22), transparent 57%),
    radial-gradient(circle at 64% 28%, rgba(109, 227, 255, .16), transparent 30%),
    radial-gradient(circle at 36% 46%, rgba(0, 16, 42, .10), rgba(0, 3, 11, .93) 78%);
  box-shadow:
    inset -86px -42px 130px rgba(0, 0, 0, .86),
    inset 46px 20px 80px rgba(66, 190, 255, .13),
    inset 0 0 54px rgba(85, 223, 255, .42),
    0 0 44px rgba(68, 201, 255, .50),
    0 0 140px rgba(68, 201, 255, .20);
  transform-style: preserve-3d;
}
.halo { inset: -3%; background: radial-gradient(circle, rgba(67,225,255,.16), transparent 62%); filter: blur(12px); z-index: 1; }
.sphere { z-index: 2; }
.sphere::before {
  content:"";
  position:absolute; inset:0; border-radius:50%;
  background:
    radial-gradient(circle at 32% 25%, rgba(255,255,255,.16), transparent 11%, transparent 58%, rgba(80,232,255,.30) 88%, rgba(119,246,255,.92) 99%),
    linear-gradient(105deg, rgba(0,0,0,.28), transparent 42%, rgba(93,218,255,.10) 76%, rgba(126,246,255,.28));
  mix-blend-mode: screen;
  pointer-events: none;
}
.sphere::after {
  content:"";
  position:absolute; inset: 1.2%; border-radius:50%;
  border: 1px solid rgba(120,246,255,.54);
  box-shadow: inset 0 0 30px rgba(99,246,255,.23), 0 0 34px rgba(99,246,255,.24);
  pointer-events: none;
}
#sphereCanvas { position: absolute; inset: 0; width: 100%; height: 100%; filter: drop-shadow(0 0 8px rgba(67,225,255,.58)); }

.reticle {
  position: absolute;
  width: 82px; height: 82px;
  left: 62%; top: 25%;
  transform: translate(-50%, -50%);
  border: 2px solid rgba(143, 246, 255, .55);
  border-radius: 50%;
  opacity: 0;
  transition: left .62s cubic-bezier(.2,.8,.2,1), top .62s cubic-bezier(.2,.8,.2,1), opacity .25s;
  box-shadow: 0 0 20px rgba(99,246,255,.38), inset 0 0 22px rgba(99,246,255,.14);
  z-index: 5;
}
.speaking .reticle { opacity: 1; }
.reticle::before, .reticle::after { content:""; position:absolute; background:rgba(99,246,255,.55); box-shadow: 0 0 10px rgba(99,246,255,.5); }
.reticle::before { width:1px; height:132%; left:50%; top:-16%; }
.reticle::after { height:1px; width:132%; top:50%; left:-16%; }
.reticle .lock-dot { position: absolute; width: 9px; height: 9px; left: 50%; top: 50%; transform: translate(-50%, -50%); border-radius: 50%; background: white; box-shadow: 0 0 18px white, 0 0 34px var(--cyan-hot); }

.side-scale { position: absolute; top: 26%; bottom: 16%; width: 56px; opacity: .82; z-index: 4; pointer-events: none; }
.left-scale { left: -82px; }
.right-scale { right: -82px; }
.scale-label {
  position: absolute;
  top: 48%;
  left: -34px;
  transform: translateY(-50%) rotate(-90deg);
  transform-origin: center;
  white-space: nowrap;
  letter-spacing: .25em;
  font-size: 12px;
  color: rgba(143,246,255,.65);
}
.right-scale .scale-label { display: none; }
.scale-rail {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
}
.right-scale .scale-rail { align-items: flex-end; }
.scale-rail i {
  display: block;
  width: 21px;
  height: 2px;
  border-radius: 999px;
  background: rgba(99,246,255,.8);
  opacity: .45;
  transform: scaleX(var(--base));
  transform-origin: left center;
  transition: transform 80ms linear, opacity 80ms linear, box-shadow 80ms linear;
}
.right-scale .scale-rail i { transform-origin: right center; }
.listening .scale-rail i { background: rgba(122,246,255,.95); }

.voice-panel { text-align: center; margin-top: -42px; width: min(720px, 90vw); }
.state { color: var(--green); letter-spacing: .55em; font-weight: 800; text-shadow: 0 0 16px rgba(88,255,176,.42); }
.subtitle { min-height: 24px; color: rgba(220,255,255,.86); text-shadow: 0 0 12px var(--cyan-soft); letter-spacing: .16em; }
canvas#waveform { width: 100%; height: 92px; display: block; }
.controls { display: flex; justify-content: center; gap: 14px; }
button {
  cursor: pointer;
  color: var(--cyan);
  background: rgba(8, 40, 52, .72);
  border: 1px solid rgba(99,246,255,.38);
  border-radius: 8px;
  padding: 11px 22px;
  letter-spacing: .18em;
  text-transform: uppercase;
  box-shadow: 0 0 18px rgba(99,246,255,.15);
}
button:hover { background: rgba(35, 104, 124, .5); }

.metrics { width: min(760px, 95vw); display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; text-align: center; color: rgba(143, 246, 255, .78); }
.metrics div { border-left: 1px solid rgba(99,246,255,.24); }
.metrics b { display:block; font-size: 21px; text-shadow: 0 0 12px var(--cyan-soft); }
.metrics span { display:block; font-size: 10px; letter-spacing: .38em; color: rgba(255,255,255,.56); text-transform: uppercase; }

.listening .sphere { box-shadow: inset -68px -44px 110px rgba(0, 0, 0, .74), inset 36px 22px 80px rgba(107, 238, 255, .24), inset 0 0 50px rgba(85, 223, 255, .54), 0 0 65px rgba(68, 201, 255, .58), 0 0 135px rgba(68, 201, 255, .22); }
.speaking .sphere { box-shadow: inset -68px -44px 110px rgba(0, 0, 0, .72), inset 36px 22px 80px rgba(107, 238, 255, .24), inset 0 0 55px rgba(88,255,176,.22), 0 0 70px rgba(68, 201, 255, .58), 0 0 150px rgba(88,255,176,.16); }
.speaking .halo-one { box-shadow: 0 0 110px rgba(88,255,176,.30); }

@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 760px) {
  .jarvis-shell { grid-template-rows: 96px 1fr 190px 80px; }
  .top-status h1 { letter-spacing: .35em; }
  .pill { padding: 7px 12px; letter-spacing: .16em; }
  .online, .window-controls, .side-scale { display: none; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
}

.left-stack {
  position: absolute;
  left: 30px;
  top: 130px;
  bottom: 130px;
  width: 340px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  z-index: 10;
}
.left-stack::-webkit-scrollbar { width: 4px; }
.left-stack::-webkit-scrollbar-thumb { background: rgba(73, 223, 255, 0.3); border-radius: 4px; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 7, 13, 0.85);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}
.modal-content {
  width: min(1000px, 90vw);
  max-height: 85vh;
  background: linear-gradient(180deg, rgba(8, 25, 39, 0.95), rgba(3, 12, 20, 0.98));
  border: 1px solid var(--cyan-soft);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 50px rgba(0, 167, 255, 0.15), inset 0 0 30px rgba(73, 223, 255, 0.05);
}
.modal-header {
  padding: 20px 30px;
  border-bottom: 1px solid rgba(73, 223, 255, 0.2);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-header h2 {
  margin: 0;
  color: var(--cyan);
  font-size: 18px;
  letter-spacing: 2px;
  text-transform: uppercase;
}
.modal-controls {
  display: flex;
  gap: 12px;
}
.modal-body {
  padding: 30px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}
.modal-body::-webkit-scrollbar { width: 6px; }
.modal-body::-webkit-scrollbar-thumb { background: rgba(73, 223, 255, 0.3); border-radius: 4px; }

/* Status indicator in card */
.status-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}
.status-indicator.queued { background: var(--muted); box-shadow: 0 0 8px var(--muted); }
.status-indicator.building { background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.status-indicator.testing { background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.status-indicator.ready { background: var(--green); box-shadow: 0 0 8px var(--green); }
.status-indicator.failed { background: var(--red); box-shadow: 0 0 8px var(--red); }

/* Widget Styling */
.card {
  background: rgba(4, 18, 29, 0.6);
  border: 1px solid rgba(85, 223, 255, 0.15);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.card h2 {
  margin: 0 0 8px 0;
  font-size: 14px;
  color: var(--cyan-hot);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 12px;
}
.metric {
  display: flex;
  flex-direction: column;
}
.metric .label {
  font-size: 10px;
  color: rgba(255,255,255,0.6);
  text-transform: uppercase;
  margin-bottom: 4px;
}
.metric .value {
  font-size: 24px;
  color: var(--cyan);
  font-weight: bold;
}
.metric .delta {
  font-size: 11px;
  color: var(--green);
  margin-top: 2px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
th {
  text-align: left;
  padding: 8px 4px;
  border-bottom: 1px solid rgba(85, 223, 255, 0.2);
  color: rgba(255,255,255,0.6);
  font-weight: normal;
  text-transform: uppercase;
  font-size: 10px;
}
td {
  padding: 8px 4px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 10px;
  background: rgba(85, 223, 255, 0.1);
  color: var(--cyan);
  text-transform: uppercase;
}
.badge.yellow {
  background: rgba(255, 155, 50, 0.1);
  color: var(--orange);
}
.badge.red {
  background: rgba(255, 50, 50, 0.1);
  color: #ff5555;
}
.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* More Widget Styles */
.approval { display: flex; flex-direction: column; gap: 10px; }
.approval-item { border-left: 2px solid var(--orange); padding-left: 10px; }
.approval-title { display: flex; justify-content: space-between; align-items: center; color: white; font-size: 13px; }
.small { font-size: 11px; color: rgba(255,255,255,0.5); margin-top: 4px; }

.timeline { display: flex; flex-direction: column; gap: 12px; position: relative; padding-left: 14px; border-left: 1px solid rgba(85,223,255,0.3); margin-left: 6px; }
.event { position: relative; }
.event::before { content: ""; position: absolute; left: -19px; top: 4px; width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.event strong { color: var(--cyan-hot); font-size: 12px; }

.risk { text-align: center; }
.risk-score { font-size: 42px; font-weight: 900; color: #ff5555; text-shadow: 0 0 15px rgba(255,85,85,0.4); margin-bottom: 5px; }
.risk-label { font-size: 14px; letter-spacing: 2px; color: #ff5555; font-weight: bold; }

.buttons { display: flex; gap: 10px; margin-top: 10px; }
.buttons button { flex: 1; padding: 10px; border-radius: 6px; font-weight: bold; border: none; cursor: pointer; }
button.approve { background: rgba(88, 255, 176, 0.2); color: var(--green); border: 1px solid var(--green); }
button.reject { background: rgba(255, 85, 85, 0.2); color: #ff5555; border: 1px solid #ff5555; }
button.approve:hover { background: rgba(88, 255, 176, 0.3); }
button.reject:hover { background: rgba(255, 85, 85, 0.3); }

.chart-wrap { position: relative; width: 100%; height: 180px; display: flex; justify-content: center; align-items: center; margin-top: 10px; }
.donut { width: 120px; height: 120px; border-radius: 50%; background: conic-gradient(rgba(85,223,255,0.6) 0% 42%, rgba(255,155,50,0.6) 42% 73%, #ff5555 73% 92%, #a82323 92% 100%); position: relative; }
.donut::after { content: ""; position: absolute; inset: 20px; border-radius: 50%; background: #061118; }
.pie-wrap { justify-content: space-between; padding: 0 10px; }
.legend { display: flex; flex-direction: column; gap: 8px; font-size: 11px; color: rgba(255,255,255,0.7); }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 2px; }
.legend i.low { background: rgba(85,223,255,0.6); }
.legend i.mod { background: rgba(255,155,50,0.6); }
.legend i.high { background: #ff5555; }
.legend i.crit { background: #a82323; }

.svg-chart svg { width: 100%; height: 100%; }
.axis, .grid-line { stroke: rgba(85,223,255,0.2); stroke-width: 1; }
.trend-line { fill: none; stroke: var(--cyan); stroke-width: 2; filter: drop-shadow(0 0 6px var(--cyan)); }
.trend-fill { fill: rgba(85,223,255,0.1); stroke: none; }
.chart-dot { fill: var(--bg); stroke: var(--cyan-hot); stroke-width: 2; }
text { fill: rgba(255,255,255,0.5); font-size: 10px; font-family: monospace; }
.grid-poly { fill: none; stroke: rgba(85,223,255,0.1); stroke-width: 1; }
.radar-fill { fill: rgba(88,255,176,0.2); stroke: var(--green); stroke-width: 1.5; filter: drop-shadow(0 0 8px var(--green)); }

/* Conversation Widget */
.conversation-widget .conversation-text {
  padding: 1rem;
  background: rgba(10, 15, 25, 0.6);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  color: var(--text);
  font-size: 1.1rem;
  line-height: 1.5;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
}

/* Light Theme Overrides */
body.light-theme {
  --bg: #f8fafc;
  color: #0f172a;
  background: #f8fafc;
}

body.light-theme::before {
  mix-blend-mode: multiply;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,.025) 0 1px, transparent 1px 4px);
}

body.light-theme::after {
  box-shadow: inset 0 0 150px rgba(255,255,255,.95);
}

body.light-theme .top-status h1 {
  color: #0f172a;
  text-shadow: none;
}

body.light-theme .modal-overlay {
  background: rgba(255, 255, 255, 0.85);
}

body.light-theme .modal-content {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #0f172a;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.1);
}

body.light-theme .modal-header h2 {
  color: #0f172a;
}

body.light-theme button {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #0f172a;
  box-shadow: none;
}

body.light-theme .metrics b {
  text-shadow: none;
}

body.light-theme .subtitle {
  color: #475569;
  text-shadow: none;
}

