:root {
  color-scheme: dark;
  --bg: #04070a;
  --lift: rgba(13, 20, 28, 0.82);
  --lift-strong: rgba(22, 30, 39, 0.9);
  --text: #edeff5;
  --muted: #9ea3b0;
  --border: rgba(255, 255, 255, 0.15);
  --border-strong: rgba(255, 255, 255, 0.28);
  --cora: #ff6e52;
  --vera: #298aff;
  --petra: #42dbd1;
  --nova: #9457ff;
  --ready: #40d18c;
  --warning: #f3c84d;
  --down: #ff6157;
  --shadow: rgba(0, 0, 0, 0.42);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 25% 10%, rgba(41, 138, 255, 0.18), transparent 34rem),
    radial-gradient(circle at 82% 68%, rgba(148, 87, 255, 0.13), transparent 30rem),
    var(--bg);
  color: var(--text);
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

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

.ambient-one {
  width: 18rem;
  height: 18rem;
  left: -7rem;
  bottom: 12vh;
  background: var(--vera);
}

.ambient-two {
  width: 15rem;
  height: 15rem;
  right: -5rem;
  top: 22vh;
  background: var(--nova);
}

.portal-shell {
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

.access-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.25rem;
}

.access-card {
  width: min(100%, 35rem);
  padding: clamp(1.2rem, 4vw, 2.4rem);
  border: 1px solid var(--border);
  border-radius: 2rem;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.025)),
    var(--lift);
  box-shadow: 0 1.5rem 4rem var(--shadow);
  backdrop-filter: blur(22px);
}

.brand-lockup,
.stage-header,
.hero-field {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.lumela-logo {
  width: 4.25rem;
  height: 4.25rem;
  object-fit: contain;
}

.eyebrow {
  margin: 0 0 0.24rem;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(2.35rem, 8vw, 4rem);
  line-height: 0.94;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1;
}

h3 {
  margin-bottom: 0.6rem;
  font-size: clamp(1.45rem, 3vw, 2.3rem);
}

h4 {
  margin-bottom: 0.45rem;
  font-size: 1.05rem;
}

.lead {
  margin: 1.3rem 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.55;
}

.service-strip,
.service-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 2.5rem;
  color: var(--muted);
}

.service-strip {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
}

.service-pill {
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  white-space: nowrap;
}

.status-light,
.dot {
  display: inline-block;
  width: 0.72rem;
  height: 0.72rem;
  border-radius: 999px;
  background: var(--warning);
  box-shadow: 0 0 1rem currentColor;
}

[data-service-tone="ready"] .status-light {
  background: var(--ready);
}

[data-service-tone="working"] .status-light,
[data-service-tone="checking"] .status-light {
  background: var(--vera);
}

[data-service-tone="warning"] .status-light {
  background: var(--warning);
}

[data-service-tone="offline"] .status-light {
  background: var(--down);
}

.access-form {
  margin-top: 1rem;
  display: grid;
  gap: 0.85rem;
}

label {
  display: grid;
  gap: 0.42rem;
  color: var(--muted);
  font-size: 0.82rem;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 1.2rem;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  outline: none;
}

input,
select {
  min-height: 3rem;
  padding: 0 0.9rem;
}

textarea {
  min-height: 3rem;
  max-height: 9.25rem;
  padding: 0.86rem 1rem;
  resize: none;
  line-height: 1.35;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--vera);
  box-shadow: 0 0 0 0.2rem rgba(41, 138, 255, 0.16);
}

.access-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.primary-action,
.secondary-action,
.send-button {
  border: 1px solid transparent;
  border-radius: 999px;
  min-height: 3rem;
  padding: 0 1rem;
  color: var(--text);
}

.primary-action,
.send-button {
  background:
    radial-gradient(circle at 18% 10%, rgba(66, 219, 209, 0.55), transparent 2.5rem),
    radial-gradient(circle at 92% 82%, rgba(255, 110, 82, 0.55), transparent 2.5rem),
    linear-gradient(135deg, rgba(41, 138, 255, 0.7), rgba(148, 87, 255, 0.72));
}

.secondary-action {
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.045);
}

.microcopy {
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.portal-app {
  height: 100vh;
  display: grid;
  grid-template-columns: 15rem minmax(0, 1fr);
}

.portal-nav {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  padding: 1.1rem;
  border-right: 1px solid var(--border);
  background: rgba(4, 7, 10, 0.52);
  backdrop-filter: blur(24px);
}

.home-mark {
  width: 4rem;
  height: 4rem;
  padding: 0.55rem;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.045);
}

.home-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.portal-nav nav {
  display: grid;
  gap: 0.45rem;
}

.nav-item {
  min-height: 3rem;
  border: 1px solid transparent;
  border-radius: 1rem;
  background: transparent;
  color: var(--muted);
  text-align: left;
  padding: 0 0.9rem;
}

.nav-item.is-active {
  color: var(--text);
  border-color: rgba(41, 138, 255, 0.5);
  background: rgba(41, 138, 255, 0.11);
}

.portal-stage {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: clamp(1rem, 2vw, 1.6rem);
}

.stage-header {
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1rem;
}

.stage-panel {
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 1.75rem;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.065), rgba(255, 255, 255, 0.018)),
    rgba(8, 12, 18, 0.72);
  box-shadow: 0 1.25rem 3rem rgba(0, 0, 0, 0.25);
}

.stage-panel:not(.chat-panel) {
  padding: clamp(1rem, 3vw, 2rem);
}

.hero-field {
  min-height: 18rem;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.hero-logo {
  width: clamp(5rem, 14vw, 9rem);
  object-fit: contain;
}

.hero-field p,
.placeholder-surface p,
.portal-grid p {
  color: var(--muted);
  line-height: 1.5;
}

.portal-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
  margin-top: 1rem;
}

.portal-grid.two-column {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.portal-grid.compact-grid {
  margin-top: 0;
}

.portal-grid article,
.placeholder-surface,
.status-board article,
.usage-card,
.vault-entry,
.signal-ribbon article {
  border: 1px solid var(--border);
  border-radius: 1.25rem;
  background: rgba(255, 255, 255, 0.04);
  padding: 1.1rem;
}

.status-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
  margin-top: 1rem;
}

.status-board article {
  display: grid;
  gap: 0.32rem;
}

.status-board span,
.usage-card span {
  color: var(--muted);
  font-size: 0.82rem;
}

.status-board strong,
.usage-card strong {
  overflow-wrap: anywhere;
}

.surface-intro {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.surface-intro p {
  color: var(--muted);
  line-height: 1.5;
}

.signal-ribbon,
.account-stack {
  display: grid;
  gap: 0.9rem;
  margin-top: 1rem;
}

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

.signal-ribbon article {
  display: grid;
  gap: 0.35rem;
}

.signal-ribbon span,
.usage-card p,
.vault-entry p {
  color: var(--muted);
  line-height: 1.45;
}

.cora {
  color: var(--cora);
}

.vera {
  color: var(--vera);
}

.petra {
  color: var(--petra);
}

.nova {
  color: var(--nova);
}

.dot.cora,
.support-lane.cora {
  background: var(--cora);
}

.dot.vera,
.support-lane.vera {
  background: var(--vera);
}

.dot.petra,
.support-lane.petra {
  background: var(--petra);
}

.dot.nova,
.support-lane.nova {
  background: var(--nova);
}

.chat-panel {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
}

.chat-log {
  min-height: 0;
  overflow: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.empty-chat {
  min-height: 100%;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 0.8rem;
  color: var(--muted);
  text-align: center;
}

.empty-chat img {
  width: 6rem;
}

.message-bubble {
  position: relative;
  width: min(100%, 45rem);
  border: 1px solid var(--border);
  border-radius: 1.35rem;
  padding: 1rem;
  line-height: 1.5;
}

.message-bubble.is-important {
  border-color: rgba(237, 239, 245, 0.52);
  box-shadow: 0 0 0 0.12rem rgba(237, 239, 245, 0.08);
}

.important-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin-top: 0.7rem;
  padding: 0.28rem 0.55rem;
  border: 1px solid rgba(237, 239, 245, 0.28);
  border-radius: 999px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.74rem;
}

.important-popover {
  position: fixed;
  z-index: 20;
  transform: translate(-50%, -100%);
  padding: 0.35rem;
  border: 1px solid rgba(237, 239, 245, 0.24);
  border-radius: 999px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.06)),
    rgba(8, 12, 18, 0.96);
  box-shadow: 0 0.9rem 2rem rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(18px);
}

.important-popover button {
  min-height: 2.25rem;
  border: 0;
  border-radius: 999px;
  padding: 0 0.85rem;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 20%, rgba(66, 219, 209, 0.2), transparent 2.5rem),
    rgba(255, 255, 255, 0.06);
}

.message-bubble.user {
  align-self: flex-end;
  width: fit-content;
  max-width: min(85%, 42rem);
  border-color: rgba(41, 138, 255, 0.45);
  background: rgba(255, 255, 255, 0.07);
}

.message-bubble.core-four {
  align-self: flex-start;
  background:
    radial-gradient(circle at 90% 70%, rgba(41, 138, 255, 0.16), transparent 16rem),
    rgba(255, 255, 255, 0.045);
}

.message-bubble.core-four.cora {
  border-color: rgba(255, 110, 82, 0.4);
}

.message-bubble.core-four.vera {
  border-color: rgba(41, 138, 255, 0.45);
}

.message-bubble.core-four.petra {
  border-color: rgba(66, 219, 209, 0.38);
}

.message-bubble.core-four.nova {
  border-color: rgba(148, 87, 255, 0.42);
}

.message-bubble.failure {
  border-color: rgba(255, 97, 87, 0.42);
  color: #ffd8d5;
  background: rgba(255, 97, 87, 0.08);
}

.response-heading {
  color: var(--muted);
}

.response-heading strong {
  color: currentColor;
}

.response-summary {
  white-space: pre-wrap;
}

.model-line {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.memory-line {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.support-lanes {
  margin-top: 0.9rem;
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
}

.support-lanes summary {
  width: fit-content;
  color: var(--muted);
  cursor: pointer;
}

.support-lane {
  margin-top: 0.65rem;
  padding: 0.75rem;
  border-radius: 0.9rem;
  background: rgba(255, 255, 255, 0.05) !important;
  border-left: 0.18rem solid currentColor;
  color: var(--muted);
}

.composer {
  padding: 1rem;
  border-top: 1px solid var(--border);
  background: rgba(4, 7, 10, 0.42);
}

.composer-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 0.75rem;
}

.memory-strip {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.75rem;
}

.toggle-chip {
  display: inline-flex;
  align-items: center;
  grid-template-columns: none;
  gap: 0.35rem;
  padding: 0.52rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  white-space: nowrap;
}

.toggle-chip input {
  width: auto;
  min-height: auto;
  accent-color: var(--vera);
}

.memory-strip p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.usage-card {
  display: grid;
  gap: 0.8rem;
}

.usage-card > div:first-child,
.vault-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.usage-meter {
  height: 0.55rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.usage-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--ready);
}

.usage-meter span[data-usage-tone="watch"] {
  background: var(--warning);
}

.usage-meter span[data-usage-tone="low"] {
  background: var(--down);
}

.composer-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 0.75rem;
}

.send-button {
  width: 4.7rem;
  height: 3rem;
}

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

@media (max-width: 900px) {
  body {
    overflow: hidden;
  }

  .portal-app {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
  }

  .portal-nav {
    order: 2;
    flex-direction: row;
    align-items: center;
    border-right: 0;
    border-top: 1px solid var(--border);
    padding: 0.65rem;
  }

  .home-mark {
    width: 3.1rem;
    height: 3.1rem;
    flex: 0 0 auto;
  }

  .portal-nav nav {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    width: 100%;
    gap: 0.28rem;
  }

  .nav-item {
    min-height: 2.7rem;
    padding: 0 0.35rem;
    text-align: center;
    font-size: 0.78rem;
  }

  .portal-stage {
    order: 1;
    padding: 0.8rem;
  }

  .stage-header {
    align-items: flex-start;
  }

  .service-pill {
    font-size: 0.78rem;
  }

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

  .portal-grid.two-column,
  .status-board,
  .signal-ribbon {
    grid-template-columns: 1fr 1fr;
  }

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

  .memory-strip {
    flex-wrap: wrap;
  }
}

@media (max-width: 620px) {
  .access-actions,
  .composer-controls {
    grid-template-columns: 1fr;
  }

  .stage-header {
    display: grid;
  }

  .service-pill {
    width: 100%;
  }

  .hero-field {
    display: grid;
    text-align: center;
  }

  .hero-logo {
    margin: 0 auto;
  }

  .portal-nav {
    overflow-x: auto;
  }

  .portal-nav nav {
    min-width: 31rem;
  }

  .portal-grid.two-column,
  .status-board,
  .signal-ribbon {
    grid-template-columns: 1fr;
  }

  .vault-entry,
  .usage-card > div:first-child {
    align-items: flex-start;
    flex-direction: column;
  }
}
