:root {
  color-scheme: dark;
  --bg: #07080d;
  --panel: rgba(17, 18, 28, 0.78);
  --panel-strong: rgba(22, 23, 35, 0.94);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #f5f3ff;
  --muted: #a8a6b5;
  --violet: #a882ff;
  --violet-strong: #8156f2;
  --gold: #d8b979;
  --green: #76d7aa;
  --red: #ff7c8d;
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at 18% 20%, rgba(126, 87, 226, 0.18), transparent 30%),
    radial-gradient(circle at 84% 78%, rgba(216, 185, 121, 0.09), transparent 28%),
    linear-gradient(135deg, #080910 0%, #090a12 45%, #05060a 100%);
  color: var(--text);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

body {
  overflow: hidden;
}

button,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

.ambient {
  position: fixed;
  border-radius: 999px;
  filter: blur(90px);
  pointer-events: none;
}

.ambient-one {
  width: 420px;
  height: 420px;
  background: rgba(121, 79, 235, 0.16);
  left: -120px;
  top: 80px;
}

.ambient-two {
  width: 360px;
  height: 360px;
  background: rgba(218, 174, 95, 0.08);
  right: -80px;
  bottom: -80px;
}

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 220px minmax(520px, 1fr) 280px;
  gap: 14px;
  height: 100vh;
  padding: 14px;
}

.glass {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(26px);
}

.sidebar,
.workspace,
.insight-rail {
  border-radius: 24px;
  overflow: hidden;
}

.sidebar {
  display: flex;
  flex-direction: column;
  padding: 22px 16px 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 26px;
}

.oracle-mark {
  position: relative;
  width: 46px;
  height: 46px;
}

.oracle-ring {
  position: absolute;
  inset: 2px;
  border: 1px solid rgba(168, 130, 255, 0.58);
  border-radius: 50%;
  box-shadow: inset 0 0 18px rgba(168, 130, 255, 0.12), 0 0 18px rgba(168, 130, 255, 0.13);
}

.oracle-p,
.oracle-r {
  position: absolute;
  font-family: Georgia, serif;
  font-weight: 700;
  font-size: 24px;
  color: #efe8ff;
  line-height: 1;
}

.oracle-p {
  left: 10px;
  top: 10px;
}

.oracle-r {
  right: 8px;
  bottom: 8px;
  transform: rotate(180deg);
  opacity: 0.72;
}

.brand-name {
  letter-spacing: 0.18em;
  font-size: 15px;
  font-weight: 700;
}

.brand-subtitle {
  margin-top: 3px;
  letter-spacing: 0.34em;
  font-size: 8px;
  color: var(--muted);
}

.nav {
  display: grid;
  gap: 7px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
  transition: 160ms ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.nav-item.active {
  color: var(--text);
  background: linear-gradient(135deg, rgba(136, 87, 241, 0.22), rgba(136, 87, 241, 0.08));
  border-color: rgba(168, 130, 255, 0.25);
}

.nav-icon {
  width: 20px;
  text-align: center;
  color: var(--violet);
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.device-mini {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.device-mini div {
  min-width: 0;
}

.device-mini strong,
.device-mini small {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.device-mini strong {
  font-size: 12px;
}

.device-mini small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #767685;
  box-shadow: 0 0 0 4px rgba(118, 118, 133, 0.1);
}

.status-dot.online {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(118, 215, 170, 0.12), 0 0 18px rgba(118, 215, 170, 0.42);
}

.status-dot.offline {
  background: var(--red);
  box-shadow: 0 0 0 4px rgba(255, 124, 141, 0.11);
}

.icon-button,
.profile-button,
.voice-button {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
}

.icon-button {
  width: 34px;
  height: 34px;
  border-radius: 11px;
}

.workspace {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: rgba(12, 13, 21, 0.88);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px 18px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--violet);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.22em;
}

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

h1 {
  margin-bottom: 0;
  font-size: 25px;
  font-weight: 650;
}

h2 {
  margin-bottom: 10px;
  font-size: 30px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.network-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  background: rgba(255, 255, 255, 0.035);
}

.profile-button {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: #efe8ff;
  background: linear-gradient(145deg, rgba(168, 130, 255, 0.28), rgba(168, 130, 255, 0.08));
}

.view {
  display: none;
  min-height: 0;
  flex: 1;
}

.view.active {
  display: flex;
}

.oracle-view {
  flex-direction: column;
  padding: 18px 28px 24px;
}

.mode-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 14px;
}

.mode-chip,
.segmented-control button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  cursor: pointer;
  transition: 160ms ease;
}

.mode-chip {
  padding: 8px 12px;
  font-size: 11px;
}

.mode-chip:hover,
.mode-chip.active,
.segmented-control button:hover,
.segmented-control button.active {
  color: var(--text);
  border-color: rgba(168, 130, 255, 0.28);
  background: rgba(132, 88, 238, 0.16);
}

.model-badge {
  margin-left: auto;
  color: var(--muted);
  font-size: 10px;
}

.conversation {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 4px 22px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}

.message {
  display: flex;
  gap: 13px;
  max-width: 82%;
  margin-bottom: 20px;
}

.user-message {
  margin-left: auto;
  flex-direction: row-reverse;
}

.message-avatar {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  border: 1px solid rgba(168, 130, 255, 0.22);
  background: rgba(132, 88, 238, 0.14);
  color: #efe8ff;
  font-family: Georgia, serif;
}

.user-message .message-avatar {
  border-color: rgba(216, 185, 121, 0.18);
  background: rgba(216, 185, 121, 0.08);
  color: var(--gold);
}

.message-content {
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 8px 18px 18px 18px;
  background: rgba(255, 255, 255, 0.035);
  line-height: 1.58;
}

.user-message .message-content {
  border-radius: 18px 8px 18px 18px;
  background: rgba(132, 88, 238, 0.1);
}

.message-content p {
  margin: 0 0 0.7em;
  white-space: pre-wrap;
}

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

.message-body ul {
  margin: 0.35em 0 0.7em 1.25em;
  padding: 0;
}

.message-body code {
  border-radius: 5px;
  padding: 0.1em 0.35em;
  background: rgba(255, 255, 255, 0.07);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.message-body pre {
  overflow-x: auto;
  margin: 0.55em 0;
  padding: 0.75em;
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.25);
}

.message-body pre code {
  padding: 0;
  background: transparent;
  white-space: pre;
}

.message-body a {
  color: #bca2ff;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.message-meta {
  margin-bottom: 6px;
  color: var(--violet);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.user-message .message-meta {
  color: var(--gold);
  text-align: right;
}

.message.error .message-content {
  border-color: rgba(255, 124, 141, 0.22);
  background: rgba(255, 124, 141, 0.07);
}

.composer {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.035);
}

.composer textarea {
  flex: 1;
  min-height: 42px;
  max-height: 150px;
  resize: none;
  border: 0;
  outline: 0;
  padding: 10px 8px;
  color: var(--text);
  background: transparent;
  line-height: 1.45;
}

.composer textarea::placeholder {
  color: #777686;
}

.voice-button {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  color: var(--muted);
}

.send-button,
.pause-button {
  border: 0;
  border-radius: 13px;
  background: linear-gradient(135deg, #a87cff, #7852e5);
  box-shadow: 0 10px 30px rgba(120, 82, 229, 0.22);
  color: white;
  cursor: pointer;
  font-weight: 700;
}

.send-button {
  height: 40px;
  padding: 0 18px;
}

.send-button:disabled,
.pause-button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.dashboard-view {
  flex-direction: column;
  overflow-y: auto;
  padding: 30px;
}

.section-copy {
  max-width: 620px;
  margin-bottom: 26px;
}

.section-copy p:last-child {
  color: var(--muted);
  line-height: 1.6;
}

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

.metric-card,
.control-panel,
.empty-state {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
}

.metric-card {
  min-height: 132px;
  padding: 18px;
  border-radius: 18px;
}

.highlight-card {
  background: linear-gradient(145deg, rgba(132, 88, 238, 0.2), rgba(132, 88, 238, 0.055));
  border-color: rgba(168, 130, 255, 0.22);
}

.metric-label,
.control-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.metric-card strong {
  display: block;
  margin: 14px 0 8px;
  font-size: 25px;
}

.metric-card small {
  color: var(--muted);
}

.control-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 16px;
  padding: 20px;
  border-radius: 18px;
}

.segmented-control {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.segmented-control button {
  padding: 9px 13px;
  font-size: 11px;
}

.pause-button {
  min-width: 110px;
  height: 42px;
  padding: 0 18px;
}

.pause-button.paused {
  background: linear-gradient(135deg, #d8b979, #b48d45);
  color: #17120a;
}

.network-map {
  position: relative;
  display: grid;
  place-items: center;
  height: 280px;
  margin: 4px 0 20px;
  overflow: hidden;
}

.network-core {
  position: relative;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 86px;
  height: 86px;
  border-radius: 50%;
  border: 1px solid rgba(168, 130, 255, 0.4);
  background: radial-gradient(circle at 35% 30%, #bca1ff, #7350d4 55%, #241646 100%);
  box-shadow: 0 0 70px rgba(132, 88, 238, 0.34);
  font-family: Georgia, serif;
  font-size: 34px;
}

.network-orbit {
  position: absolute;
  border: 1px solid rgba(168, 130, 255, 0.15);
  border-radius: 50%;
}

.orbit-one {
  width: 190px;
  height: 190px;
}

.orbit-two {
  width: 290px;
  height: 290px;
}

.node-dot {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 18px rgba(118, 215, 170, 0.54);
}

.node-a { transform: translate(92px, -54px); }
.node-b { transform: translate(-118px, 70px); }
.node-c { transform: translate(130px, 86px); }
.node-d { transform: translate(-62px, -126px); }

.empty-state {
  display: grid;
  place-items: center;
  min-height: 300px;
  padding: 38px;
  border-radius: 20px;
  text-align: center;
}

.empty-symbol {
  margin-bottom: 14px;
  color: var(--violet);
  font-size: 48px;
}

.empty-state p {
  max-width: 460px;
  color: var(--muted);
  line-height: 1.6;
}

.insight-rail {
  display: flex;
  flex-direction: column;
  padding: 20px;
}

.rail-section {
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.rail-section:first-child {
  padding-top: 4px;
}

.rail-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.live-label {
  color: var(--green);
}

.resource-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0;
  color: var(--muted);
  font-size: 12px;
}

.resource-row strong {
  color: var(--text);
}

.resource-row.stacked {
  display: block;
  margin-top: 18px;
}

.resource-row.stacked span,
.resource-row.stacked small {
  display: block;
}

.resource-row.stacked span {
  color: var(--text);
  line-height: 1.35;
}

.resource-row.stacked small {
  margin-top: 5px;
  color: var(--muted);
}

.resource-bar {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}

.resource-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #8053e9, #b596ff);
  transition: width 350ms ease;
}

.drachma-card {
  margin-top: 8px;
}

.drachma-value {
  margin: 14px 0 12px;
  font-size: 31px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.drachma-status {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.intelligence-card {
  margin-top: auto;
  border-bottom: 0;
}

.intelligence-card strong,
.intelligence-card small {
  display: block;
}

.intelligence-card strong {
  margin-top: 12px;
  font-size: 15px;
}

.intelligence-card small {
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.4;
}

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

  .insight-rail {
    display: none;
  }
}

@media (max-width: 760px) {
  body {
    overflow: auto;
  }

  .app-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
    padding: 8px;
  }

  .sidebar {
    min-height: auto;
  }

  .nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .nav-item {
    justify-content: center;
    padding: 10px 8px;
    font-size: 0;
  }

  .nav-icon {
    font-size: 16px;
  }

  .sidebar-footer {
    display: none;
  }

  .workspace {
    min-height: 720px;
  }

  .topbar,
  .oracle-view,
  .dashboard-view {
    padding-left: 18px;
    padding-right: 18px;
  }

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

  .control-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .pause-button {
    width: 100%;
  }

  .message {
    max-width: 94%;
  }
}
