:root {
  --bg: #070a10;
  --panel: #0e1420;
  --panel-2: #111a29;
  --card: #141f30;
  --card-soft: rgba(255,255,255,.055);
  --line: rgba(255,255,255,.12);
  --text: #eff5ff;
  --muted: #9aa8ba;
  --muted-2: #6f7f91;
  --accent: #f1b35b;
  --accent-2: #ffdc8a;
  --danger: #ff6b6b;
  --success: #79d6a6;
  --shadow: 0 20px 60px rgba(0,0,0,.35);
  --radius: 24px;
  --radius-sm: 14px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(circle at 15% 10%, rgba(241,179,91,.16), transparent 30%),
    radial-gradient(circle at 80% 0%, rgba(83,136,255,.14), transparent 35%),
    linear-gradient(135deg, #070a10 0%, #0a1020 50%, #05070c 100%);
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.view { min-height: calc(100vh - 72px); }

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px clamp(18px, 4vw, 48px);
  backdrop-filter: blur(18px);
  background: rgba(7,10,16,.78);
  border-bottom: 1px solid var(--line);
}
.brand, .sidebar-brand, .brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
}
.brand {
  background: transparent;
  border: 0;
  text-align: left;
  padding: 0;
}
.brand strong, .sidebar-brand strong, .brand-lockup strong { letter-spacing: .12em; font-size: .9rem; }
.brand small, .sidebar-brand small, .brand-lockup small { display: block; color: var(--muted); font-size: .73rem; margin-top: 2px; }
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 15px;
  display: inline-grid;
  place-items: center;
  font-weight: 900;
  letter-spacing: -.04em;
  color: #0a0d12;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 30px rgba(241,179,91,.18);
}
.top-nav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.nav-link, .side-link {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 10px 12px;
  border-radius: 999px;
}
.nav-link:hover, .side-link:hover, .side-link.active { color: var(--text); background: var(--card-soft); }

.btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 16px;
  color: var(--text);
  background: rgba(255,255,255,.06);
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
}
.btn:hover { transform: translateY(-1px); border-color: rgba(255,255,255,.22); }
.btn-primary {
  color: #0b0e14;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  font-weight: 800;
}
.btn-secondary { background: rgba(255,255,255,.08); }
.btn-ghost { background: transparent; }
.btn-large { padding: 14px 22px; min-height: 50px; }
.full { width: 100%; }
.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(255,255,255,.07);
  font-size: 1.45rem;
}

.hero-shell {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(330px, .92fr);
  gap: 36px;
  align-items: center;
  padding: clamp(54px, 9vw, 112px) 0 54px;
}
.eyebrow {
  color: var(--accent-2);
  letter-spacing: .16em;
  text-transform: uppercase;
  font-size: .72rem;
  font-weight: 900;
}
h1, h2, h3, p { margin-top: 0; }
h1 {
  margin: 16px 0 8px;
  font-size: clamp(3.4rem, 9vw, 8rem);
  line-height: .84;
  letter-spacing: -.08em;
}
.hero-tagline {
  font-size: clamp(1.45rem, 3vw, 2.35rem);
  font-weight: 800;
  color: var(--accent-2);
  margin-bottom: 18px;
}
.hero-description {
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  line-height: 1.55;
  max-width: 720px;
  color: #dce6f3;
}
.hero-actions { display: flex; gap: 12px; margin-top: 28px; flex-wrap: wrap; }
.hero-trust { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 26px; }
.hero-trust span {
  color: var(--muted);
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.04);
}
.hero-card { perspective: 900px; }
.case-window {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.035));
  box-shadow: var(--shadow);
  overflow: hidden;
  transform: rotateY(-4deg) rotateX(4deg);
}
.case-window-head { display: flex; gap: 8px; padding: 18px; border-bottom: 1px solid var(--line); background: rgba(0,0,0,.22); }
.case-window-head span { width: 12px; height: 12px; border-radius: 50%; background: rgba(255,255,255,.25); }
.case-window-body { padding: 26px; }
.case-label { color: var(--accent-2); text-transform: uppercase; letter-spacing: .16em; font-size: .72rem; font-weight: 900; }
.case-window h2 { font-size: 1.7rem; margin: 8px 0 22px; }
.signal-row { display: flex; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.signal-row span { color: var(--muted); text-align: right; }
.story-frame-preview { margin-top: 20px; padding: 18px; border-radius: 18px; background: rgba(241,179,91,.11); border: 1px solid rgba(241,179,91,.22); }
.story-frame-preview small { color: var(--accent-2); text-transform: uppercase; letter-spacing: .13em; font-weight: 900; }
.story-frame-preview p { margin: 8px 0 0; color: #f8edd7; }

.content-band {
  width: min(1120px, calc(100% - 36px));
  margin: 34px auto;
  padding: clamp(28px, 5vw, 54px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,.045);
  box-shadow: 0 18px 50px rgba(0,0,0,.22);
}
.section-heading { max-width: 780px; }
.section-heading h2, .split-band h2 { font-size: clamp(2rem, 5vw, 4rem); line-height: .95; letter-spacing: -.05em; margin: 12px 0; }
.section-heading p, .split-band p { color: var(--muted); line-height: 1.65; font-size: 1.05rem; }
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 26px; }
.feature-card, .card-block, .stat-card, .identity-card, .auth-card, .modal-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,.055);
}
.feature-card { padding: 22px; }
.feature-card p { color: var(--muted); line-height: 1.55; margin-bottom: 0; }
.split-band { display: grid; grid-template-columns: .8fr 1.2fr; gap: 28px; align-items: start; }
.workflow-list { list-style: none; display: grid; gap: 12px; margin: 0; padding: 0; }
.workflow-list li {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 14px;
  padding: 18px;
  border-radius: 16px;
  background: rgba(255,255,255,.055);
  border: 1px solid var(--line);
}
.workflow-list span { color: var(--muted); }
.guardrail-band { margin-bottom: 80px; }

.auth-view { display: grid; place-items: center; padding: 36px 18px; }
.auth-card { width: min(480px, 100%); padding: 26px; box-shadow: var(--shadow); background: rgba(14,20,32,.92); }
.auth-copy h2 { margin: 26px 0 8px; font-size: 2rem; letter-spacing: -.04em; }
.auth-copy p { color: var(--muted); }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 5px; border-radius: 999px; background: rgba(255,255,255,.06); margin: 22px 0; }
.auth-tab { border: 0; border-radius: 999px; padding: 10px; color: var(--muted); background: transparent; }
.auth-tab.active { color: #0a0e14; background: var(--accent-2); font-weight: 800; }
.auth-form { display: grid; gap: 14px; }
label { display: grid; gap: 8px; color: var(--muted); font-weight: 700; font-size: .9rem; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--text);
  background: rgba(3,6,10,.55);
  padding: 12px 14px;
  outline: none;
}
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: rgba(241,179,91,.65); box-shadow: 0 0 0 4px rgba(241,179,91,.08); }
.form-note, .muted { color: var(--muted); line-height: 1.5; font-size: .9rem; }

.app-view { display: grid; grid-template-columns: 280px 1fr; min-height: calc(100vh - 72px); }
.sidebar {
  border-right: 1px solid var(--line);
  background: rgba(5,8,13,.45);
  padding: 22px;
  position: sticky;
  top: 72px;
  height: calc(100vh - 72px);
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.sidebar-section { display: grid; gap: 8px; }
.sidebar-label { color: var(--muted-2); text-transform: uppercase; letter-spacing: .14em; font-size: .72rem; font-weight: 900; margin: 0 0 5px; }
.side-link { width: 100%; text-align: left; border-radius: 14px; }
.identity-card { padding: 18px; margin-top: auto; }
.identity-card span { display: block; color: var(--accent-2); margin-top: 4px; }
.workspace { min-width: 0; padding: clamp(18px, 3vw, 34px); }
.panel { display: none; }
.panel.active-panel { display: block; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 24px; }
.panel-head h2 { font-size: clamp(2rem, 4vw, 3.2rem); letter-spacing: -.05em; margin: 8px 0; }
.panel-head p { color: var(--muted); margin: 0; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
.stat-card { padding: 20px; background: rgba(255,255,255,.05); }
.stat-card span { display: block; color: var(--muted); font-size: .85rem; }
.stat-card strong { display: block; font-size: 2rem; margin-top: 8px; }
.toolbar { display: grid; grid-template-columns: 1fr 200px auto; gap: 12px; margin: 18px 0; }
.trace-list { display: grid; gap: 12px; }
.trace-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.045);
}
.trace-card h3 { margin: 0 0 8px; }
.trace-card p { margin: 0; color: var(--muted); line-height: 1.55; }
.badges { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.badge { border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px; color: var(--muted); font-size: .8rem; }
.badge.status { color: #0b0e14; background: var(--accent-2); border-color: transparent; font-weight: 800; }
.empty-state { min-height: 420px; display: grid; place-items: center; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); padding: 28px; }
.empty-state p { color: var(--muted); }
.case-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.case-actions select { width: auto; min-width: 150px; }
.tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 10px; margin-bottom: 18px; }
.tab { white-space: nowrap; border: 1px solid var(--line); border-radius: 999px; padding: 10px 14px; background: rgba(255,255,255,.05); color: var(--muted); }
.tab.active { background: var(--accent-2); color: #0b0e14; font-weight: 800; }
.tab-panel { display: none; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; background: rgba(255,255,255,.04); }
.tab-panel.active-tab-panel { display: block; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .span-2 { grid-column: span 2; }
.two-column { display: grid; grid-template-columns: .9fr 1.1fr; gap: 16px; margin-bottom: 16px; }
.card-block { padding: 18px; }
.card-block h3 { margin-bottom: 14px; }
.card-block label + label { margin-top: 12px; }
.output-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; margin-bottom: 14px; }
.output-box {
  white-space: pre-wrap;
  overflow: auto;
  min-height: 340px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: #e9f1ff;
  background: rgba(2,4,8,.55);
  line-height: 1.6;
}
.mini-list { display: grid; gap: 10px; }
.mini-item {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: rgba(255,255,255,.04);
}
.mini-item p { color: #dce6f3; margin: 0 0 8px; white-space: pre-wrap; }
.mini-item a { color: var(--accent-2); word-break: break-word; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0,0,0,.72);
  backdrop-filter: blur(10px);
}
.modal-card { width: min(720px, 100%); max-height: calc(100vh - 36px); overflow: auto; background: #0d1420; box-shadow: var(--shadow); padding: 24px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.modal-head h2 { margin: 8px 0 0; font-size: 2rem; letter-spacing: -.04em; }
.modal-form { display: grid; gap: 14px; }
.compact-grid { grid-template-columns: 1fr 1fr; }

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 200;
  max-width: 420px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(14,20,32,.96);
  border: 1px solid var(--line);
  color: var(--text);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { border-color: rgba(121,214,166,.45); }
.toast.error { border-color: rgba(255,107,107,.55); }

@media (max-width: 960px) {
  .hero-shell, .split-band, .app-view, .two-column { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .feature-grid, .stat-grid { grid-template-columns: 1fr; }
  .toolbar { grid-template-columns: 1fr; }
  .panel-head, .case-head { flex-direction: column; }
  .case-actions { justify-content: flex-start; }
  .hero-card { display: none; }
}
@media (max-width: 680px) {
  .site-header { height: auto; align-items: flex-start; flex-direction: column; }
  .top-nav { justify-content: flex-start; }
  .public-only.nav-link { display: none; }
  .view { min-height: calc(100vh - 118px); }
  .form-grid, .compact-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: span 1; }
  .trace-card { grid-template-columns: 1fr; }
  h1 { font-size: clamp(3rem, 16vw, 5rem); }
}
