:root {
  --bg-0: #04111f;
  --bg-1: #071a2f;
  --bg-2: #0b2642;
  --panel: rgba(8, 29, 54, 0.58);
  --panel-strong: rgba(8, 39, 74, 0.74);
  --panel-edge: rgba(132, 223, 255, 0.16);
  --text: #e9f8ff;
  --muted: rgba(174, 226, 247, 0.66);
  --line: rgba(112, 196, 255, 0.12);
  --cyan: #8be7ff;
  --blue: #53b6ff;
  --ice: #d8fbff;
  --teal: #79f0da;
  --warning: #f8c16d;
  --danger: #ff7e8a;
  --shadow: 0 28px 80px rgba(0, 42, 86, 0.34);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at 14% 14%, rgba(56, 146, 220, 0.24), transparent 24%),
    radial-gradient(circle at 82% 10%, rgba(85, 219, 255, 0.2), transparent 28%),
    radial-gradient(circle at 50% 120%, rgba(52, 166, 255, 0.18), transparent 36%),
    linear-gradient(160deg, #020914, var(--bg-0) 18%, var(--bg-1) 52%, var(--bg-2));
  color: var(--text);
  font-family: 'Rajdhani', sans-serif;
}

body {
  font-size: 15px;
  overflow-x: hidden;
  overflow-y: auto;
}

button,
input,
textarea {
  font: inherit;
}

.backdrop {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.glow,
.radar-ring {
  position: absolute;
  border-radius: 999px;
}

.glow-a {
  width: 34vw;
  height: 34vw;
  top: -10vw;
  left: -8vw;
  background: radial-gradient(circle, rgba(79, 184, 255, 0.34), transparent 64%);
  filter: blur(12px);
}

.glow-b {
  width: 40vw;
  height: 40vw;
  right: -12vw;
  bottom: -16vw;
  background: radial-gradient(circle, rgba(64, 211, 255, 0.2), transparent 66%);
  filter: blur(18px);
}

.grid-layer {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(128, 196, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(128, 196, 255, 0.06) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at center, black 36%, transparent 100%);
}

.scan-layer {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, rgba(255, 255, 255, 0.022), transparent 4px);
  background-size: 100% 4px;
  opacity: 0.18;
}

.radar-ring {
  border: 1px solid rgba(102, 208, 255, 0.12);
}

.radar-a {
  width: 26vw;
  height: 26vw;
  top: 22vh;
  left: 8vw;
}

.radar-b {
  width: 18vw;
  height: 18vw;
  right: 12vw;
  top: 12vh;
}

.shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr) 420px;
  gap: 22px;
  min-height: 100dvh;
  padding: 24px;
}

.glass {
  background:
    linear-gradient(180deg, rgba(18, 48, 84, 0.62), rgba(7, 21, 40, 0.76)),
    radial-gradient(circle at top right, rgba(113, 214, 255, 0.08), transparent 28%);
  border: 1px solid rgba(132, 223, 255, 0.22);
  border-radius: 28px;
  backdrop-filter: blur(28px) saturate(155%);
  box-shadow: 0 28px 96px rgba(0, 32, 76, 0.42), inset 0 1px 0 rgba(197, 241, 255, 0.04);
  position: relative;
}

.glass::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid rgba(214, 248, 255, 0.03);
  pointer-events: none;
}

.sidebar,
.main-column,
.right-column {
  min-height: 0;
}

.sidebar {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand-block {
  display: flex;
  gap: 14px;
  align-items: center;
}

.brand-emblem {
  width: 74px;
  height: 74px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--ice);
  background:
    linear-gradient(145deg, rgba(99, 192, 255, 0.32), rgba(26, 90, 162, 0.42));
  border: 1px solid rgba(146, 226, 255, 0.28);
  box-shadow: inset 0 0 30px rgba(113, 209, 255, 0.1), 0 0 32px rgba(83, 182, 255, 0.16);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-family: 'Orbitron', sans-serif;
  font-size: 36px;
  letter-spacing: 0.03em;
}

h2 {
  font-family: 'Orbitron', sans-serif;
  font-size: 42px;
  line-height: 1.06;
  letter-spacing: 0.04em;
}

.eyebrow {
  margin-bottom: 4px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 11px;
}

.subtle,
.muted,
.metric-label,
.resume-hint {
  color: var(--muted);
}

.subtle {
  font-size: 14px;
}

.control-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.action-btn,
.send-btn,
.icon-close {
  border: 1px solid rgba(132, 223, 255, 0.16);
  border-radius: 16px;
  background: rgba(92, 183, 255, 0.08);
  color: var(--text);
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

a.action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.action-btn,
.send-btn {
  padding: 14px 18px;
}

.action-btn:hover,
.send-btn:hover,
.icon-close:hover {
  transform: translateY(-1px);
  border-color: rgba(132, 223, 255, 0.32);
  background: rgba(92, 183, 255, 0.14);
}

.action-btn.primary,
.send-btn {
  background: linear-gradient(135deg, rgba(83, 182, 255, 0.22), rgba(121, 240, 218, 0.12));
}

.action-btn:disabled,
.send-btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  transform: none;
}

.intel-card,
.intel-panel,
.chat-panel,
.composer-panel,
.topbar,
.channel-banner {
  padding: 20px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 13px;
}

.directive-list {
  display: grid;
  gap: 10px;
}

.directive-item,
.stack-card,
.profile-item,
.decor-cell,
.banner-chip,
.tactical-node,
.threat-cell {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(132, 223, 255, 0.08);
}

.directive-item strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ice);
  letter-spacing: 0.06em;
}

.directive-item span {
  font-size: 14px;
  color: var(--muted);
}

.stack-metrics,
.profile-grid,
.decor-grid,
.tactical-grid,
.threat-grid {
  display: grid;
  gap: 10px;
}

.metric-stack strong,
.profile-item strong,
.decor-cell strong,
.banner-chip strong,
.top-card strong,
.tactical-node strong,
.threat-cell strong {
  display: block;
  margin-top: 6px;
  font-family: 'Orbitron', sans-serif;
  font-size: 26px;
  letter-spacing: 0.04em;
}

.tactical-grid {
  grid-template-columns: 1fr 1fr;
}

.tactical-node {
  position: relative;
  overflow: hidden;
}

.tactical-node strong,
.threat-cell strong {
  font-size: 20px;
}

.tactical-node::after {
  content: '';
  position: absolute;
  right: -8px;
  bottom: -28px;
  width: 92px;
  height: 92px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(139, 231, 255, 0.14), transparent 70%);
}

.bar-shell {
  position: relative;
  height: 10px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}

.bar-shell.compact {
  height: 8px;
}

.bar-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--teal));
  transition: width 260ms ease;
}

.bar-fill.cyan {
  background: linear-gradient(90deg, #59d1ff, #7cecff);
}

.bar-fill.blue {
  background: linear-gradient(90deg, #4b7dff, #53b6ff);
}

.decor-grid {
  grid-template-columns: 1fr 1fr;
}

.dummy-trace {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-top: 14px;
}

.dummy-trace span {
  height: 44px;
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(130, 220, 255, 0.22), rgba(130, 220, 255, 0.02));
  opacity: 0.5;
}

.main-column {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 22px;
  align-items: center;
}

.headline {
  max-width: 60%;
}

.headline-side {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 12px;
  min-width: 420px;
}

.top-card {
  min-height: 92px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(132, 223, 255, 0.08);
}

.channel-banner {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.chat-layout {
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 22px;
}

.chat-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.chat-stream,
.ops-feed,
.resume-results {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
}

.chat-stream {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-right: 6px;
}

.bubble {
  max-width: 84%;
  padding: 18px 20px;
  border-radius: 24px;
  line-height: 1.68;
  font-size: 15px;
  position: relative;
  animation: riseIn 240ms ease;
}

.bubble.user {
  align-self: flex-end;
  background: linear-gradient(140deg, rgba(83, 182, 255, 0.22), rgba(73, 122, 255, 0.18));
  border: 1px solid rgba(132, 223, 255, 0.16);
}

.bubble.assistant {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(132, 223, 255, 0.1);
}

.bubble-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.bubble-content p:first-child {
  margin-top: 0;
}

.bubble-content p:last-child {
  margin-bottom: 0;
}

.bubble-content pre,
.diff-shell,
.ops-output {
  font-family: 'IBM Plex Mono', monospace;
  background: rgba(4, 13, 27, 0.72);
  border-radius: 14px;
  border: 1px solid rgba(132, 223, 255, 0.08);
  padding: 14px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.bubble-content code,
.plan-body,
.ops-feed,
.resume-results,
.resume-controls input {
  font-family: 'IBM Plex Mono', monospace;
}

.composer-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 12px;
}

.composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: end;
}

#messageInput,
.resume-controls input {
  width: 100%;
  padding: 20px;
  border-radius: 20px;
  border: 1px solid rgba(132, 223, 255, 0.12);
  background: rgba(2, 18, 36, 0.58);
  color: var(--text);
  outline: none;
  box-shadow: inset 0 0 30px rgba(102, 208, 255, 0.03);
}

#messageInput {
  min-height: 126px;
  max-height: 320px;
  font-size: 16px;
  resize: vertical;
}

#messageInput::placeholder,
.resume-controls input::placeholder {
  color: rgba(174, 226, 247, 0.42);
}

.send-btn {
  min-width: 142px;
  min-height: 64px;
  display: inline-flex;
  justify-content: space-between;
  align-items: center;
  padding-inline: 18px;
}

.send-arrow {
  font-size: 20px;
}

.right-column {
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-height: 0;
}

.intel-panel.flex-panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.profile-grid {
  grid-template-columns: 1fr 1fr;
}

.threat-grid {
  grid-template-columns: 1fr 1fr;
}

.threat-strip {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
  margin-top: 14px;
}

.threat-strip span {
  min-height: 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(83, 182, 255, 0.18), rgba(139, 231, 255, 0.48), rgba(83, 182, 255, 0.18));
  box-shadow: 0 0 14px rgba(83, 182, 255, 0.12);
  animation: pulseBand 2.8s ease-in-out infinite;
}

.threat-strip span:nth-child(2) {
  animation-delay: 0.18s;
}

.threat-strip span:nth-child(3) {
  animation-delay: 0.36s;
}

.threat-strip span:nth-child(4) {
  animation-delay: 0.54s;
}

.threat-strip span:nth-child(5) {
  animation-delay: 0.72s;
}

.threat-strip span:nth-child(6) {
  animation-delay: 0.9s;
}

.threat-strip span:nth-child(7) {
  animation-delay: 1.08s;
}

.threat-strip span:nth-child(8) {
  animation-delay: 1.26s;
}

.plan-body {
  min-height: 100px;
  white-space: pre-wrap;
  line-height: 1.7;
  font-size: 13px;
}

.ops-feed {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ops-entry {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.032);
  border: 1px solid rgba(132, 223, 255, 0.08);
}

.ops-entry.command {
  border-left: 3px solid var(--cyan);
}

.ops-entry.commentary {
  border-left: 3px solid var(--teal);
}

.ops-entry.reasoning {
  border-left: 3px solid var(--warning);
}

.ops-entry.warning {
  border-left: 3px solid var(--danger);
}

.ops-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  margin-bottom: 8px;
}

.ops-output {
  margin-top: 10px;
  max-height: 220px;
}

.diff-shell {
  min-height: 148px;
  max-height: 240px;
}

.decorative-surface .surface-grid {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 16px;
  align-items: center;
}

.surface-radar {
  position: relative;
  width: 140px;
  height: 140px;
  border-radius: 999px;
  background:
    radial-gradient(circle, rgba(137, 233, 255, 0.16), transparent 54%),
    rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(132, 223, 255, 0.12);
  overflow: hidden;
}

.surface-radar::before,
.surface-radar::after {
  content: '';
  position: absolute;
  inset: 12px;
  border-radius: inherit;
  border: 1px solid rgba(132, 223, 255, 0.1);
}

.surface-radar::after {
  inset: 32px;
}

.radar-core {
  position: absolute;
  inset: 50%;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  margin-top: -5px;
  border-radius: 999px;
  background: var(--ice);
  box-shadow: 0 0 20px rgba(139, 231, 255, 0.6);
}

.radar-sweep {
  position: absolute;
  inset: -30%;
  background: conic-gradient(from 0deg, rgba(139, 231, 255, 0), rgba(139, 231, 255, 0.34), rgba(139, 231, 255, 0));
  animation: rotateSweep 6s linear infinite;
}

.surface-matrix {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.surface-matrix span {
  display: block;
  min-height: 46px;
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(139, 231, 255, 0.18), rgba(139, 231, 255, 0.03));
  border: 1px solid rgba(132, 223, 255, 0.08);
}

.resume-modal[hidden] {
  display: none;
}

.resume-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
}

.resume-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 10, 20, 0.62);
  backdrop-filter: blur(8px);
}

.resume-panel {
  position: relative;
  width: min(860px, calc(100vw - 28px));
  max-height: min(78vh, 820px);
  padding: 18px;
}

.icon-close {
  width: 38px;
  height: 38px;
  font-size: 22px;
  line-height: 1;
}

.resume-controls {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.resume-results {
  max-height: calc(78vh - 140px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 4px;
}

.resume-item {
  border: 1px solid rgba(132, 223, 255, 0.1);
  border-radius: 18px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.resume-item:hover {
  transform: translateX(2px);
  border-color: rgba(132, 223, 255, 0.26);
  background: rgba(96, 181, 255, 0.08);
}

.resume-item-title {
  font-size: 18px;
  margin-bottom: 6px;
}

.resume-item-preview,
.resume-item-meta {
  color: var(--muted);
  font-size: 13px;
}

.resume-item-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}

.empty-state {
  padding: 26px;
  border: 1px dashed rgba(132, 223, 255, 0.14);
  border-radius: 24px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.02);
}

.typing-indicator {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--cyan);
  animation: pulse 1.1s infinite;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.16s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.32s;
}

@keyframes pulse {
  0%, 80%, 100% {
    opacity: 0.34;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-4px);
  }
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes rotateSweep {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulseBand {
  0%, 100% {
    opacity: 0.38;
    transform: scaleX(0.92);
  }
  50% {
    opacity: 1;
    transform: scaleX(1);
  }
}

@media (max-width: 1420px) {
  .shell {
    grid-template-columns: 280px minmax(0, 1fr);
  }

  .right-column {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .headline,
  .headline-side {
    max-width: none;
    min-width: 0;
    width: 100%;
  }

  .headline-side,
  .channel-banner,
  .profile-grid,
  .decor-grid,
  .tactical-grid,
  .threat-grid {
    grid-template-columns: 1fr 1fr;
  }

  .right-column {
    grid-template-columns: 1fr;
  }

  .composer {
    grid-template-columns: 1fr;
  }

  .send-btn {
    width: 100%;
  }

  .bubble {
    max-width: 100%;
  }

  .decorative-surface .surface-grid {
    grid-template-columns: 1fr;
  }
}
