:root {
  --bg: #07100e;
  --bg-raised: rgba(12, 24, 20, 0.86);
  --panel: rgba(10, 20, 17, 0.78);
  --panel-strong: rgba(14, 28, 23, 0.96);
  --line: rgba(151, 192, 171, 0.16);
  --line-strong: rgba(151, 192, 171, 0.28);
  --text: #edf5f0;
  --muted: #8ea79b;
  --faint: #5f756c;
  --accent: #9be3bd;
  --accent-strong: #c8f7d8;
  --warning: #e7cf86;
  --danger: #e8a09a;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.38);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--bg); }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 12%, rgba(72, 136, 104, 0.13), transparent 28rem),
    radial-gradient(circle at 90% 70%, rgba(43, 96, 77, 0.14), transparent 34rem),
    linear-gradient(145deg, #07100e 0%, #081310 46%, #050b09 100%);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.18;
  background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.028) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, black, transparent 82%);
}

.ambient {
  position: fixed;
  width: 32rem;
  height: 32rem;
  border: 1px solid rgba(134, 209, 169, 0.08);
  border-radius: 50%;
  filter: blur(.1px);
  pointer-events: none;
}

.ambient::after {
  content: "";
  position: absolute;
  inset: 22%;
  border: 1px solid rgba(134, 209, 169, 0.06);
  border-radius: 50%;
}

.ambient-a { top: -20rem; right: -12rem; }
.ambient-b { bottom: -24rem; left: -15rem; }

.shell {
  width: min(1180px, calc(100% - 40px));
  min-height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  gap: 14px;
  align-items: center;
  color: inherit;
  text-decoration: none;
  letter-spacing: .08em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line-strong);
  background: rgba(140, 225, 179, 0.05);
  color: var(--accent-strong);
  font-family: Georgia, serif;
  font-size: 22px;
  box-shadow: inset 0 0 24px rgba(133, 222, 174, .04);
}

.brand strong { display: block; font-size: 13px; font-weight: 680; }
.brand small { display: block; margin-top: 4px; color: var(--faint); font: 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace; }

.session-chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 99px;
  color: var(--muted);
  font: 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.signal {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--faint);
  box-shadow: 0 0 0 4px rgba(95, 117, 108, .08);
}

.session-chip[data-state="signed-in"] .signal { background: var(--accent); box-shadow: 0 0 0 4px rgba(155, 227, 189, .08), 0 0 16px rgba(155, 227, 189, .4); }

main { flex: 1; padding: 76px 0 54px; }

.hero { max-width: 770px; margin-bottom: 58px; }
.eyebrow, .kicker { color: var(--accent); font: 10px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .15em; }
.hero h1 { margin: 15px 0 22px; font-size: clamp(40px, 6.2vw, 74px); line-height: .98; letter-spacing: -.045em; font-weight: 560; }
.hero h1 span { color: var(--muted); font-weight: 420; }
.hero-copy { max-width: 650px; color: var(--muted); font-size: 16px; line-height: 1.72; }

.grid { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 22px; }
.panel {
  position: relative;
  min-height: 470px;
  padding: 30px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(15, 29, 24, .82), rgba(8, 17, 14, .9));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
.panel::before { content: ""; position: absolute; inset: 0; pointer-events: none; border-top: 1px solid rgba(255,255,255,.035); }
.panel-heading { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; margin-bottom: 34px; }
.panel h2 { margin: 7px 0 0; font-size: 25px; font-weight: 560; letter-spacing: -.025em; }
.step { color: var(--faint); font: 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace; }

.login-form { display: grid; gap: 17px; }
label { display: grid; gap: 8px; color: var(--muted); font-size: 12px; }
input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  outline: none;
  background: rgba(3, 9, 7, .48);
  color: var(--text);
  font: inherit;
  transition: border-color .16s ease, box-shadow .16s ease;
}
input:focus { border-color: rgba(155, 227, 189, .58); box-shadow: 0 0 0 3px rgba(155, 227, 189, .07); }
textarea {
  width: 100%;
  min-height: 150px;
  padding: 14px;
  resize: vertical;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  outline: none;
  background: rgba(3, 9, 7, .48);
  color: var(--text);
  font: inherit;
  line-height: 1.6;
  transition: border-color .16s ease, box-shadow .16s ease;
}
textarea:focus { border-color: rgba(155, 227, 189, .58); box-shadow: 0 0 0 3px rgba(155, 227, 189, .07); }

button { font: inherit; }
.primary {
  min-height: 51px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid rgba(174, 237, 202, .6);
  border-radius: 0;
  background: var(--accent-strong);
  color: #07100d;
  font-weight: 680;
  cursor: pointer;
  transition: transform .14s ease, background .14s ease, opacity .14s ease;
}
.primary:hover:not(:disabled) { transform: translateY(-1px); background: #dcffe7; }
.primary:disabled { opacity: .45; cursor: progress; }
.status-action { width: 100%; margin-top: 28px; }

.intake-panel { grid-column: 1 / -1; min-height: auto; }
.intake-note { margin: 10px 0 18px; color: var(--faint); font-size: 11px; line-height: 1.55; }
.intake-action { width: 100%; justify-content: center; }
.intake-action:disabled { cursor: not-allowed; }
.intake-preview { margin-top: 24px; padding: 20px; border: 1px solid var(--line); background: rgba(3, 8, 6, .35); }
.intake-preview dl { margin: 12px 0 0; border-top: 1px solid var(--line); }
.intake-preview dl div { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 18px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.intake-preview dt { color: var(--faint); font: 9px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; text-transform: uppercase; }
.intake-preview dd { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.intake-disclaimer { margin: 16px 0 0; color: var(--warning); font-size: 12px; line-height: 1.55; }

.form-note { margin: 20px 0 0; color: var(--faint); font-size: 11px; line-height: 1.55; }
.form-note[data-kind="error"] { color: var(--danger); }

.identity-card { display: grid; gap: 0; border-top: 1px solid var(--line); }
.identity-row { min-height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); }
.identity-row span { color: var(--muted); font-size: 12px; }
.identity-row strong { color: var(--accent-strong); font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; text-align: right; }
.identity-row.subtle strong { color: var(--muted); }
.text-button { margin-top: 20px; padding: 0; border: 0; background: transparent; color: var(--muted); text-align: left; cursor: pointer; font-size: 12px; text-decoration: underline; text-underline-offset: 4px; }

.status-empty { min-height: 310px; display: grid; place-items: center; align-content: center; gap: 25px; color: var(--faint); text-align: center; }
.status-empty p { max-width: 330px; margin: 0; line-height: 1.65; font-size: 13px; }
.orbit { position: relative; width: 82px; height: 82px; border: 1px solid var(--line-strong); border-radius: 50%; }
.orbit::before, .orbit::after { content: ""; position: absolute; inset: 17px; border: 1px solid var(--line); border-radius: 50%; }
.orbit::after { inset: 35px; background: var(--accent); border: 0; box-shadow: 0 0 20px rgba(155, 227, 189, .34); }
.orbit span { position: absolute; width: 8px; height: 8px; top: -4px; left: calc(50% - 4px); border-radius: 50%; background: var(--muted); transform-origin: 4px 45px; animation: orbit 5s linear infinite; }
@keyframes orbit { to { transform: rotate(360deg); } }

.status-summary { display: flex; align-items: flex-start; justify-content: space-between; gap: 22px; }
.status-summary h3 { margin: 8px 0 8px; font-size: 26px; letter-spacing: -.025em; }
.status-summary p { margin: 0; max-width: 460px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.status-badge { flex: 0 0 auto; padding: 8px 10px; border: 1px solid var(--line-strong); color: var(--muted); font: 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .09em; }
.status-badge[data-status="healthy"] { color: var(--accent); border-color: rgba(155,227,189,.35); }
.status-badge[data-status="degraded"] { color: var(--warning); border-color: rgba(231,207,134,.35); }
.status-badge[data-status="blocked"], .status-badge[data-status="unavailable"] { color: var(--danger); border-color: rgba(232,160,154,.35); }
.status-badge[data-status="checking"] { color: var(--text); animation: pulse 1.2s ease-in-out infinite alternate; }
@keyframes pulse { from { opacity: .48; } to { opacity: 1; } }

.providers { margin-top: 26px; display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); }
.provider { min-height: 72px; display: flex; align-items: center; gap: 12px; padding: 14px; border-right: 1px solid var(--line); }
.provider:last-child { border-right: 0; }
.provider-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.provider[data-state="healthy"] .provider-dot { background: var(--accent); box-shadow: 0 0 12px rgba(155,227,189,.28); }
.provider[data-state="blocked"] .provider-dot, .provider[data-state="unavailable"] .provider-dot { background: var(--danger); }
.provider small { display: block; color: var(--faint); font: 9px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .08em; }
.provider strong { display: block; margin-top: 6px; color: var(--muted); font-size: 11px; font-weight: 540; text-transform: uppercase; }

.metadata { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 18px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.metadata div { padding: 13px 12px; border-right: 1px solid var(--line); }
.metadata div:last-child { border-right: 0; }
.metadata span { display: block; color: var(--faint); font: 9px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; text-transform: uppercase; }
.metadata strong { display: block; margin-top: 5px; color: var(--muted); font: 10px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; }

.technical { margin-top: 18px; border: 1px solid var(--line); background: rgba(3,8,6,.35); }
.technical summary { padding: 13px 14px; cursor: pointer; color: var(--muted); font-size: 11px; }
.technical pre { max-height: 340px; overflow: auto; margin: 0; padding: 15px; border-top: 1px solid var(--line); color: #a7c5b6; font: 10px/1.58 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; word-break: break-word; }

footer { min-height: 70px; display: flex; align-items: center; gap: 22px; border-top: 1px solid var(--line); color: var(--faint); font: 9px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .08em; text-transform: uppercase; }
footer span:last-child { margin-left: auto; }

.toast { position: fixed; right: 24px; bottom: 24px; max-width: 380px; padding: 14px 16px; border: 1px solid var(--line-strong); background: var(--panel-strong); box-shadow: var(--shadow); color: var(--text); font-size: 12px; line-height: 1.5; }
.hidden { display: none !important; }

@media (max-width: 840px) {
  .shell { width: min(100% - 26px, 680px); }
  .topbar { min-height: 76px; }
  main { padding-top: 48px; }
  .hero { margin-bottom: 38px; }
  .grid { grid-template-columns: 1fr; }
  .panel { min-height: auto; padding: 24px; }
  .providers, .metadata { grid-template-columns: 1fr; }
  .provider, .metadata div { border-right: 0; border-bottom: 1px solid var(--line); }
  .provider:last-child, .metadata div:last-child { border-bottom: 0; }
  .status-summary { flex-direction: column; }
}

@media (max-width: 520px) {
  .brand small { display: none; }
  .session-chip { max-width: 150px; overflow: hidden; }
  .hero h1 { font-size: 42px; }
  .hero-copy { font-size: 14px; }
  footer { gap: 10px; flex-wrap: wrap; padding: 18px 0; }
  footer span:last-child { width: 100%; margin-left: 0; }
}
