:root {
  color-scheme: dark;
  --ink: #f7f5ee;
  --muted: #969b9f;
  --dim: #676d72;
  --panel: rgba(17, 19, 22, .88);
  --panel-2: rgba(25, 28, 31, .82);
  --line: rgba(255, 255, 255, .09);
  --lime: #c9f171;
  --cyan: #7ce4df;
  --orange: #ffab67;
  --danger: #ff7c72;
  --bg: #090a0b;
  --radius: 22px;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 76% -20%, rgba(82, 124, 111, .24), transparent 42%),
    linear-gradient(135deg, #0d0f10, #08090a 54%, #0b0d0e);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

button, input, textarea { font: inherit; }
button { color: inherit; }
.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}
.ambient {
  position: fixed;
  pointer-events: none;
  border-radius: 999px;
  filter: blur(100px);
  opacity: .14;
}
.ambient-one { width: 380px; height: 380px; background: var(--lime); right: 8%; top: 9%; }
.ambient-two { width: 300px; height: 300px; background: var(--cyan); left: 20%; bottom: -12%; }

.access-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.access-card {
  width: min(520px, 100%);
  padding: 48px;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: rgba(16, 18, 20, .88);
  box-shadow: 0 36px 100px rgba(0, 0, 0, .45);
  backdrop-filter: blur(18px);
}
.brand-mark {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  margin-bottom: 28px;
  border-radius: 20px;
  color: #10130c;
  background: var(--lime);
  font-weight: 900;
  letter-spacing: -.04em;
}
.brand-mark.small { width: 42px; height: 42px; margin: 0; border-radius: 13px; font-size: .82rem; }
.access-card h1 { margin: 8px 0 12px; font-size: clamp(2.4rem, 7vw, 4.7rem); letter-spacing: -.065em; line-height: .95; }
.access-copy { color: var(--muted); line-height: 1.65; }
.access-help { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); color: var(--muted); }
.access-help code {
  display: block;
  margin: 12px 0;
  padding: 14px 16px;
  border-radius: 12px;
  background: #080909;
  color: var(--cyan);
  font-family: var(--mono);
}
.fine-print { color: var(--dim); font-size: .82rem; line-height: 1.55; }
.progress-line { height: 2px; margin-top: 28px; overflow: hidden; background: var(--line); }
.progress-line span { display: block; width: 45%; height: 100%; background: var(--lime); animation: scan 1.2s ease-in-out infinite; }
@keyframes scan { from { transform: translateX(-120%); } to { transform: translateX(330%); } }

.app { min-height: 100vh; display: grid; grid-template-columns: 270px minmax(0, 1fr); }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 10;
  width: 270px;
  display: flex;
  flex-direction: column;
  padding: 28px 20px 22px;
  border-right: 1px solid var(--line);
  background: rgba(9, 10, 11, .85);
  backdrop-filter: blur(22px);
}
.brand { display: flex; gap: 13px; align-items: center; padding: 0 8px; }
.brand strong, .brand span { display: block; }
.brand strong { letter-spacing: -.02em; }
.brand span { margin-top: 3px; color: var(--dim); font-size: .76rem; }
.scope-card { margin: 28px 6px 18px; padding: 15px; border: 1px solid var(--line); border-radius: 15px; background: var(--panel); }
.scope-card span, .scope-card strong { display: block; }
.scope-card span { color: var(--dim); font-size: .66rem; text-transform: uppercase; letter-spacing: .14em; }
.scope-card strong { margin-top: 5px; color: var(--cyan); font-family: var(--mono); font-size: .77rem; }
nav { display: grid; gap: 4px; }
.nav-item {
  width: 100%;
  padding: 12px 13px;
  display: flex;
  align-items: center;
  gap: 13px;
  border: 0;
  border-radius: 12px;
  color: var(--muted);
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.nav-item span { color: var(--dim); font: .64rem var(--mono); }
.nav-item:hover { color: var(--ink); background: rgba(255, 255, 255, .035); }
.nav-item.active { color: var(--ink); background: rgba(201, 241, 113, .09); }
.nav-item.active span { color: var(--lime); }
.sidebar-foot { margin-top: auto; padding: 18px 8px 0; border-top: 1px solid var(--line); }
.status-dot { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: .77rem; }
.status-dot i { width: 7px; height: 7px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 14px var(--lime); }
.text-button { margin-top: 14px; padding: 0; border: 0; background: none; color: var(--dim); cursor: pointer; font-size: .76rem; }
.text-button:hover { color: var(--ink); }

main { grid-column: 2; min-width: 0; padding: 0 48px 60px; }
.topbar {
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.topbar h2 { margin: 5px 0 0; font-size: 1.45rem; letter-spacing: -.035em; }
.topbar-meta { display: flex; gap: 18px; align-items: center; color: var(--dim); font-size: .72rem; }
.topbar-meta strong { color: var(--muted); font-family: var(--mono); font-weight: 500; }
.eyebrow { margin: 0; color: var(--lime); font-size: .64rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.menu-button { display: none; border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 9px 12px; }
.notice { margin: 18px 0 -4px; padding: 13px 16px; border: 1px solid rgba(255, 171, 103, .22); border-radius: 12px; color: #ffd2ad; background: rgba(255, 171, 103, .08); font-size: .85rem; }
.view { display: none; padding-top: 34px; }
.view.active { display: block; animation: enter .28s ease-out; }
@keyframes enter { from { opacity: 0; transform: translateY(5px); } }

.hero {
  min-height: 260px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 40px;
  padding: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(110deg, rgba(201, 241, 113, .09), transparent 48%),
    var(--panel);
}
.hero h3 { max-width: 760px; margin: 12px 0; font-size: clamp(2rem, 4vw, 4.2rem); line-height: 1; letter-spacing: -.06em; }
.hero p:not(.eyebrow) { max-width: 680px; margin: 0; color: var(--muted); line-height: 1.6; }
.primary-button, .quiet-button {
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.primary-button { padding: 13px 18px; color: #11140c; background: var(--lime); font-weight: 800; }
.primary-button:hover { filter: brightness(1.06); transform: translateY(-1px); }
.primary-button:disabled { opacity: .45; cursor: wait; transform: none; }
.quiet-button { padding: 9px 12px; border: 1px solid var(--line); background: rgba(255,255,255,.025); color: var(--muted); font-size: .76rem; }
.quiet-button:hover { color: var(--ink); border-color: rgba(255,255,255,.18); }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 14px 0; }
.stat-card { min-height: 118px; padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); }
.stat-card span { display: block; color: var(--dim); font-size: .7rem; text-transform: uppercase; letter-spacing: .09em; }
.stat-card strong { display: block; margin-top: 12px; font-size: 2rem; letter-spacing: -.05em; }
.two-column { display: grid; grid-template-columns: 1.2fr .8fr; gap: 14px; }
.panel { padding: 26px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.panel-head, .section-tools { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.panel h3, .section-tools h3 { margin: 6px 0 0; letter-spacing: -.03em; }
.record-list { display: grid; gap: 10px; margin-top: 22px; }
.record {
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255,255,255,.018);
}
.record-top { display: flex; justify-content: space-between; gap: 20px; align-items: start; }
.record strong { display: block; font-size: .9rem; }
.record p { margin: 7px 0 0; color: var(--muted); line-height: 1.5; font-size: .79rem; }
.record-meta { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; color: var(--dim); font: .66rem var(--mono); }
.pill { display: inline-flex; align-items: center; padding: 5px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font: .64rem var(--mono); }
.pill.good { color: var(--lime); border-color: rgba(201,241,113,.18); }
.pill.warn { color: var(--orange); border-color: rgba(255,171,103,.2); }
.empty { padding: 28px; border: 1px dashed var(--line); border-radius: 14px; color: var(--dim); text-align: center; font-size: .82rem; }
.guardrail { display: flex; align-items: center; gap: 20px; margin-top: 14px; padding: 20px 24px; border: 1px solid rgba(124,228,223,.17); border-radius: 16px; background: rgba(124,228,223,.045); }
.guardrail strong { color: var(--cyan); white-space: nowrap; }
.guardrail p { margin: 0; color: var(--muted); line-height: 1.5; font-size: .8rem; }

.chat-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 14px; }
.chat-panel { min-height: calc(100vh - 190px); display: flex; flex-direction: column; }
.worker-state { padding: 6px 9px; border-radius: 999px; background: rgba(201,241,113,.08); color: var(--lime); font: .65rem var(--mono); }
.conversation { flex: 1; display: flex; flex-direction: column; gap: 15px; padding: 30px 2px; }
.bubble { max-width: 86%; padding: 17px 19px; border-radius: 17px; color: var(--muted); background: var(--panel-2); line-height: 1.6; font-size: .88rem; }
.bubble.user { align-self: flex-end; color: #11140c; background: var(--lime); border-bottom-right-radius: 5px; }
.bubble.brain { align-self: flex-start; border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.bubble strong { display: block; margin-bottom: 7px; color: var(--ink); }
.bubble.user strong { color: #11140c; }
.answer-section { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.answer-section ul { margin: 8px 0 0; padding-left: 18px; }
.answer-section li + li { margin-top: 8px; }
.composer { padding-top: 20px; border-top: 1px solid var(--line); }
.composer label { display: block; margin-bottom: 8px; color: var(--dim); font-size: .72rem; }
textarea, input[type="search"] {
  width: 100%;
  border: 1px solid var(--line);
  outline: none;
  color: var(--ink);
  background: #0d0f10;
}
textarea { resize: vertical; min-height: 94px; padding: 15px; border-radius: 14px; line-height: 1.5; }
textarea:focus, input[type="search"]:focus { border-color: rgba(201,241,113,.38); box-shadow: 0 0 0 3px rgba(201,241,113,.06); }
.composer-foot { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 11px; }
.composer-foot p { margin: 0; color: var(--dim); font-size: .7rem; }
.explainer { align-self: start; }
.explainer ol { margin: 24px 0; padding-left: 22px; color: var(--muted); font-size: .82rem; line-height: 1.55; }
.explainer li + li { margin-top: 16px; }

.section-tools { margin-bottom: 22px; }
.section-intro { margin: -8px 0 22px; color: var(--muted); font-size: .84rem; }
.search-form { width: min(410px, 100%); display: flex; gap: 8px; }
.search-form input { padding: 10px 13px; border-radius: 11px; }
.cards-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.memory-card { padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); }
.memory-card h4 { margin: 12px 0 8px; font-size: 1.05rem; letter-spacing: -.025em; }
.memory-card p { margin: 0; color: var(--muted); line-height: 1.62; font-size: .83rem; }
.memory-card footer { margin-top: 16px; display: flex; gap: 7px; flex-wrap: wrap; }
.wide-list { gap: 9px; }
.mono-list .record strong, .mono-list .record p { font-family: var(--mono); font-size: .72rem; }
.skeleton-list:empty::before { content: "Loading…"; color: var(--dim); font-size: .8rem; }

@media (max-width: 1050px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .two-column, .chat-layout { grid-template-columns: 1fr; }
  .explainer { order: -1; }
}
@media (max-width: 760px) {
  .app { display: block; }
  .sidebar { width: min(290px, 86vw); transform: translateX(-105%); transition: transform .2s ease; box-shadow: 20px 0 60px #000; }
  .sidebar.open { transform: translateX(0); }
  main { padding: 0 18px 40px; }
  .topbar { min-height: 94px; }
  .menu-button { display: block; }
  .topbar-meta span { display: none; }
  .hero { min-height: 330px; display: block; padding: 28px; }
  .hero .primary-button { margin-top: 24px; }
  .stats-grid, .cards-grid { grid-template-columns: 1fr; }
  .two-column { grid-template-columns: 1fr; }
  .guardrail, .section-tools { align-items: flex-start; flex-direction: column; }
  .search-form { width: 100%; }
  .chat-panel { min-height: calc(100vh - 130px); padding: 20px; }
  .bubble { max-width: 95%; }
  .access-card { padding: 32px 24px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
