:root {
  color-scheme: light;
  --bg: #f6f8f6;
  --surface: #ffffff;
  --surface-muted: #edf3f1;
  --ink: #18211c;
  --muted: #5a665f;
  --line: #d9ded7;
  --accent: #19675d;
  --accent-strong: #124b44;
  --accent-soft: #dcefed;
  --focus: #a8d8d2;
  --shadow: 0 16px 44px rgba(24, 33, 28, 0.1);
}

* {
  box-sizing: border-box;
}

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

a {
  color: inherit;
}

button,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.brand-lockup {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-width: 0;
  text-decoration: none;
}

.brand-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  padding: 5px;
  border-radius: 6px;
  background: var(--accent);
}

.eyebrow,
.section-label {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 1.35rem;
  line-height: 1.1;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 14px;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 1rem;
  line-height: 1.25;
  letter-spacing: 0;
}

.nav-actions,
.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.primary-link,
.secondary-link {
  min-height: 42px;
  border-radius: 6px;
  font-weight: 700;
  padding: 0 16px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.primary-link {
  border: 0;
  background: var(--accent);
  color: #ffffff;
}

.primary-link:hover {
  background: var(--accent-strong);
}

.secondary-link {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--accent);
}

.secondary-link:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.intro-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 430px);
  gap: 36px;
  align-items: start;
  padding: 44px 0 0;
}

.intro-copy p:not(.section-label) {
  max-width: 620px;
  color: var(--muted);
  font-size: 1.08rem;
}

.project-panel {
  border-left: 1px solid var(--line);
  padding-left: 28px;
}

.panel-heading h2 {
  font-size: 1.25rem;
  line-height: 1.2;
}

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

.project-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 16px;
}

.muted {
  color: var(--muted);
}

.text-link {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.text-link:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

.chat-shell {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: min(420px, calc(100vw - 32px));
  max-height: min(680px, calc(100vh - 48px));
  display: grid;
  grid-template-rows: auto minmax(180px, 1fr) auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.chat-header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.chat-header h2 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.2;
}

.chat-log {
  min-height: 0;
  overflow: auto;
  padding: 16px;
  display: grid;
  align-content: start;
  gap: 10px;
  background: var(--surface-muted);
}

.chat-message {
  max-width: 92%;
  border-radius: 8px;
  padding: 10px 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.chat-message-assistant {
  justify-self: start;
  background: var(--surface);
  border: 1px solid var(--line);
}

.chat-message-user {
  justify-self: end;
  background: var(--accent);
  color: #ffffff;
}

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid var(--line);
}

.chat-form textarea {
  min-width: 0;
  min-height: 44px;
  max-height: 120px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--ink);
}

.chat-form textarea:focus {
  outline: 3px solid var(--focus);
  border-color: var(--accent);
}

.chat-form button {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
  padding: 0 18px;
}

.chat-form button:hover {
  background: var(--accent-strong);
}

.error-state {
  color: #8a2f20;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 860px) {
  .topbar,
  .intro-grid {
    display: grid;
    grid-template-columns: 1fr;
  }

  .project-panel {
    border-left: 0;
    padding-left: 0;
  }

  .chat-shell {
    position: static;
    width: min(1160px, calc(100% - 32px));
    margin: 0 auto 24px;
  }
}

@media (max-width: 520px) {
  .nav-actions,
  .action-row,
  .chat-form {
    display: grid;
    grid-template-columns: 1fr;
  }
}
