:root {
  color-scheme: dark;
  --bg: #020202;
  --panel: #090909;
  --panel-soft: #101010;
  --line: #272727;
  --line-strong: #434343;
  --text: #f5f5f2;
  --muted: #aaa8a0;
  --dim: #74726c;
  --focus: #e9e4d8;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px clamp(18px, 4vw, 56px);
  border-bottom: 1px solid var(--line);
  background: rgba(2, 2, 2, 0.94);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--text);
  border-radius: 50%;
  font-size: 11px;
  letter-spacing: 0;
}

.brand-text {
  font-size: 14px;
  letter-spacing: 0;
}

.top-nav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-link,
.quiet-button,
.contact-button,
.composer button,
.single-form button,
.item-form button {
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  padding: 8px 13px;
}

.nav-link {
  color: var(--muted);
  border-color: transparent;
}

.nav-link:hover,
.nav-link.is-active,
.quiet-button:hover,
.contact-button:hover,
.composer button:hover,
.single-form button:hover,
.item-form button:hover {
  border-color: var(--text);
  color: var(--text);
}

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

.landing {
  min-height: min(70vh, 720px);
  display: flex;
  align-items: center;
  padding: clamp(64px, 10vw, 128px) clamp(18px, 4vw, 56px) clamp(36px, 7vw, 80px);
  border-bottom: 1px solid var(--line);
}

.landing-copy {
  max-width: 860px;
}

.source-kicker,
.view-label,
.source-footer {
  margin: 0;
  color: var(--dim);
  font-size: 12px;
  line-height: 1.5;
}

h1,
h2 {
  margin: 0;
  font-weight: 500;
  letter-spacing: 0;
}

h1 {
  margin-top: 18px;
  font-size: clamp(52px, 11vw, 132px);
  line-height: 0.95;
}

.landing-line {
  max-width: 620px;
  margin: 22px 0 26px;
  color: var(--muted);
  font-size: clamp(18px, 2.2vw, 24px);
  line-height: 1.45;
}

.preview-note {
  max-width: 520px;
  margin: -12px 0 24px;
  color: var(--dim);
  font-size: 13px;
  line-height: 1.5;
}

.boot-line {
  min-height: 22px;
  margin-bottom: 16px;
  color: var(--dim);
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-line;
}

.landing-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.contact-button.secondary {
  color: var(--muted);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
  gap: clamp(20px, 3vw, 44px);
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: clamp(28px, 5vw, 64px) 0;
}

.memory-panel {
  align-self: start;
  position: sticky;
  top: 88px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 16px;
}

.panel-heading,
.view-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  margin-bottom: 18px;
}

.panel-heading h2,
.view-heading h2 {
  font-size: 26px;
}

.quiet-button {
  min-height: 32px;
  padding: 5px 9px;
  color: var(--muted);
}

.field-label {
  display: block;
  margin: 14px 0 7px;
  color: var(--muted);
  font-size: 12px;
}

.text-input,
.text-area,
.select-input,
.composer textarea,
.single-form textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #050505;
  color: var(--text);
  padding: 11px 12px;
  outline: none;
}

.text-input:focus,
.text-area:focus,
.select-input:focus,
.composer textarea:focus,
.single-form textarea:focus {
  border-color: var(--focus);
}

.text-area,
.composer textarea,
.single-form textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.5;
}

.text-area.short {
  min-height: 80px;
}

.memory-counts {
  display: grid;
  gap: 7px;
  margin-top: 18px;
  color: var(--dim);
  font-size: 12px;
}

.view {
  display: none;
  min-width: 0;
}

.view.is-visible {
  display: block;
}

.chat-window {
  min-height: 420px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 16px;
  overflow: auto;
}

.message {
  max-width: 78%;
  margin-bottom: 14px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  line-height: 1.55;
}

.message strong {
  font-weight: 650;
}

.message em {
  color: var(--muted);
  font-style: italic;
}

.message.ai {
  background: var(--panel-soft);
}

.message.user {
  margin-left: auto;
  border-color: var(--line-strong);
  background: #050505;
}

.message-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.tiny-button {
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 4px 8px;
  font-size: 12px;
}

.tiny-button:hover {
  color: var(--text);
  border-color: var(--text);
}

.composer,
.single-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 12px;
}

.composer textarea {
  min-height: 76px;
}

.item-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 10px;
  margin-bottom: 18px;
}

.saved-list {
  display: grid;
  gap: 10px;
}

.empty-state {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--dim);
  background: var(--panel);
  padding: 13px;
  line-height: 1.5;
}

.saved-item {
  display: grid;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 13px;
}

.saved-item strong {
  font-weight: 500;
}

.saved-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.saved-meta {
  color: var(--dim);
  font-size: 12px;
}

.saved-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.plan-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.plan-card {
  display: grid;
  gap: 12px;
  align-content: start;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 16px;
}

.plan-card.is-featured {
  border-color: var(--line-strong);
  background: var(--panel-soft);
}

.plan-card h3 {
  margin: 0;
  color: var(--text);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: 0;
}

.plan-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.plan-kicker {
  color: var(--dim) !important;
  font-size: 12px;
}

.source-footer {
  margin-top: auto;
  padding: 20px clamp(18px, 4vw, 56px);
  border-top: 1px solid var(--line);
}

@media (max-width: 860px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-nav {
    justify-content: flex-start;
  }

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

  .memory-panel {
    position: static;
  }

  .composer,
  .single-form,
  .item-form {
    grid-template-columns: 1fr;
  }

  .message {
    max-width: 100%;
  }

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