:root {
  --bg: #12110f;
  --bg-radial: rgba(177, 144, 104, 0.12);
  --surface: rgba(24, 22, 20, 0.92);
  --surface-strong: rgba(30, 28, 25, 0.96);
  --surface-soft: rgba(42, 38, 34, 0.72);
  --surface-muted: rgba(34, 31, 28, 0.76);
  --surface-user: rgba(57, 67, 78, 0.54);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #f7f3ed;
  --text-strong: #ffffff;
  --muted: rgba(231, 222, 211, 0.64);
  --muted-strong: rgba(244, 238, 231, 0.82);
  --accent: #f4efe6;
  --accent-ink: #191715;
  --accent-soft: rgba(244, 239, 230, 0.08);
  --success: #97d8b3;
  --warning: #f2c879;
  --shadow-xl: 0 32px 120px rgba(0, 0, 0, 0.38);
  --shadow-lg: 0 18px 56px rgba(0, 0, 0, 0.28);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.22);
  --radius-2xl: 32px;
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --font-body: "Avenir Next", "Segoe UI Variable", "SF Pro Display", "Helvetica Neue", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", "Menlo", monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top center, var(--bg-radial), transparent 34%),
    linear-gradient(180deg, #11100f 0%, #12110f 52%, #13110f 100%);
  color: var(--text);
  font-family: var(--font-body);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 18%),
    radial-gradient(circle at 50% -10%, rgba(255, 255, 255, 0.04), transparent 28%);
}

button,
input,
textarea {
  font: inherit;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

.shell {
  position: relative;
  width: min(1080px, calc(100% - 28px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 0 34px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.topbar__brand {
  display: grid;
  gap: 4px;
}

.topbar__eyebrow,
.hero__eyebrow,
.thread-panel__eyebrow,
.status-card__label,
.message__author,
.artifact-card__kind,
.fact dt,
.composer__lead-label,
.quick-actions-shell__label {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.topbar__project {
  margin: 0;
  color: var(--muted-strong);
  font-size: 0.95rem;
}

.topbar__controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  backdrop-filter: blur(16px);
}

.status-pill--muted {
  color: var(--muted-strong);
}

.experience {
  display: grid;
  gap: 20px;
}

.hero {
  display: grid;
  gap: 28px;
  justify-items: center;
}

.shell[data-stage="landing"] .hero {
  padding-top: min(14vh, 112px);
  gap: 30px;
}

.shell[data-stage="active"] .hero {
  padding-top: 8px;
  gap: 18px;
}

.hero__copy {
  display: grid;
  gap: 14px;
  max-width: 760px;
  text-align: center;
}

.hero h1,
.thread-panel h2,
.details-card h2,
.message h3,
.artifact-card h3 {
  margin: 0;
  letter-spacing: -0.045em;
}

.shell[data-stage="landing"] .hero h1 {
  font-size: clamp(3rem, 8vw, 5rem);
  line-height: 0.94;
}

.shell[data-stage="active"] .hero h1 {
  font-size: clamp(2.3rem, 5vw, 3.6rem);
  line-height: 0.98;
}

.hero__summary,
.access-banner__copy p,
.composer__tool-hint,
.composer__hint,
.message__body,
.artifact-card__body,
.status-note,
.fact dd {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.composer-card,
.thread-panel,
.meta-panel {
  width: min(920px, 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-2xl);
  background: var(--surface);
  box-shadow: var(--shadow-xl);
  backdrop-filter: blur(22px);
}

.shell[data-stage="landing"] .composer-card {
  width: min(760px, 100%);
}

.composer-card {
  padding: 18px;
}

.access-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface-muted);
}

.access-banner__copy {
  display: grid;
  gap: 4px;
}

.access-banner__copy strong {
  color: var(--text-strong);
}

.access-banner__controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.composer {
  display: grid;
  gap: 14px;
}

.composer__lead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 2px 2px 0;
}

.composer__lead strong {
  font-size: 0.96rem;
  color: var(--muted-strong);
}

.access-banner input,
.composer textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: rgba(17, 16, 15, 0.84);
  color: var(--text);
  transition: border-color 0.14s ease, background-color 0.14s ease, box-shadow 0.14s ease;
}

.access-banner input {
  min-width: 250px;
  min-height: 48px;
  padding: 0 14px;
}

.composer textarea {
  min-height: 172px;
  padding: 18px 20px;
  resize: vertical;
  line-height: 1.6;
}

.composer textarea::placeholder,
.access-banner input::placeholder {
  color: rgba(235, 226, 215, 0.38);
}

.composer textarea:focus,
.access-banner input:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(19, 18, 16, 0.92);
  box-shadow: 0 0 0 4px rgba(244, 239, 230, 0.05);
}

.attachment-list,
.message__attachments,
.message__actions,
.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.composer__footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.composer__tools {
  display: grid;
  gap: 8px;
}

.composer__hint {
  font-size: 0.92rem;
}

.quick-actions-shell {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.shell[data-stage="landing"] .quick-actions-shell {
  display: none;
}

.shell[data-stage="landing"][data-access="gated"] .meta-panel {
  width: min(760px, 100%);
}

.chip,
.button,
.attach-button,
.artifact-card__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted-strong);
  cursor: pointer;
  transition:
    background-color 0.14s ease,
    border-color 0.14s ease,
    color 0.14s ease,
    transform 0.14s ease;
}

.chip:hover,
.chip.is-active,
.button--ghost:hover,
.attach-button:hover,
.artifact-card__button:hover,
.attachment-pill__remove:hover {
  border-color: var(--border-strong);
  background: var(--accent-soft);
  color: var(--text-strong);
}

.button:hover,
.chip:hover,
.attach-button:hover,
.artifact-card__button:hover {
  transform: translateY(-1px);
}

.button--primary {
  min-width: 124px;
  border-color: transparent;
  background: var(--accent);
  color: var(--accent-ink);
}

.button--primary:hover {
  background: #ffffff;
  color: #151311;
}

.button--ghost {
  background: rgba(255, 255, 255, 0.02);
}

.button--compact {
  min-height: 38px;
  padding-inline: 12px;
}

.attach-button {
  min-height: 38px;
}

.attachment-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 8px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
}

.attachment-pill--session {
  border-style: dashed;
}

.attachment-pill__label {
  color: var(--text);
}

.attachment-pill__meta {
  color: var(--muted);
  font-size: 0.78rem;
}

.attachment-pill__remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted-strong);
  cursor: pointer;
}

.thread-panel {
  overflow: hidden;
}

.shell[data-stage="landing"] .thread-panel {
  display: none;
}

.thread-panel__header {
  padding: 18px 20px 0;
}

.thread-panel h2,
.details-card h2 {
  font-size: 1.12rem;
}

.chat-log {
  min-height: 420px;
  max-height: min(62vh, 760px);
  padding: 18px 20px 20px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.22) transparent;
}

.message {
  max-width: min(86%, 760px);
  margin-bottom: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--surface-strong);
}

.message--user {
  margin-left: auto;
  background: var(--surface-user);
}

.message--system,
.message--artifact {
  background: rgba(36, 32, 28, 0.92);
}

.message__meta,
.artifact-card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.message__kind,
.artifact-card__state {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.message__title,
.artifact-card__title {
  margin-bottom: 8px;
  font-size: 1rem;
}

.meta-panel {
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.meta-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  list-style: none;
  cursor: pointer;
  color: var(--muted-strong);
}

.meta-panel summary::-webkit-details-marker {
  display: none;
}

.meta-panel__summary-note {
  color: var(--muted);
  font-size: 0.9rem;
}

.meta-panel__content {
  display: grid;
  gap: 14px;
  padding: 0 18px 18px;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.status-card,
.details-card,
.artifact-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface-soft);
}

.status-card {
  padding: 14px 16px;
}

.status-card strong {
  display: block;
  color: var(--text-strong);
  line-height: 1.35;
}

.meta-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

.details-card {
  padding: 16px;
}

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

.fact dd {
  margin-top: 6px;
  color: var(--text-strong);
  overflow-wrap: anywhere;
}

.artifact-empty {
  color: var(--muted);
  line-height: 1.6;
}

.artifact-list {
  display: grid;
  gap: 12px;
}

.artifact-card {
  padding: 14px;
}

.artifact-card__button {
  margin-top: 12px;
}

[hidden] {
  display: none !important;
}

@media (max-width: 960px) {
  .shell {
    width: calc(100% - 20px);
  }

  .topbar,
  .topbar__controls,
  .composer__footer,
  .access-banner,
  .access-banner__controls {
    flex-direction: column;
    align-items: stretch;
  }

  .status-strip,
  .meta-grid,
  .fact-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .access-banner input {
    min-width: 0;
  }
}

@media (max-width: 720px) {
  .shell {
    width: calc(100% - 16px);
    padding-top: 12px;
  }

  .shell[data-stage="landing"] .hero {
    padding-top: 48px;
  }

  .composer-card,
  .thread-panel,
  .meta-panel {
    width: 100%;
  }

  .composer-card,
  .status-card,
  .details-card,
  .artifact-card {
    border-radius: var(--radius-lg);
  }

  .status-strip,
  .meta-grid,
  .fact-grid {
    grid-template-columns: 1fr;
  }

  .message {
    max-width: 100%;
  }

  .chat-log {
    min-height: 340px;
  }
}
