:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --bg-light: #ffffff;
  --bg-accent: #eef2ff;
  --text: #1a1d23;
  --text-secondary: #5a6270;
  --text-muted: #8a929f;
  --border: #e2e5eb;
  --border-strong: #d1d5db;
  --primary: #4f46e5;
  --primary-light: #e0e7ff;
  --primary-dark: #3730a3;
  --safe: #10b981;
  --safe-bg: #d1fae5;
  --caution: #f59e0b;
  --caution-bg: #fef3c7;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.05);
  --shadow-hover: 0 4px 6px rgba(0,0,0,0.08), 0 10px 24px rgba(0,0,0,0.06);
  --max-width: 1100px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(224, 231, 255, 0.86), transparent 28rem),
    linear-gradient(180deg, #ffffff 0%, var(--bg) 34rem);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button { transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s, background 0.2s; }
button:hover { transform: translateY(-1px); }

[hidden] { display: none !important; }

.access-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.access-card {
  width: min(100%, 560px);
  background: rgba(255,255,255,0.94);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 8px);
  box-shadow: var(--shadow-hover);
  padding: 30px;
}

.access-card h1 {
  font-size: clamp(1.8rem, 5vw, 3rem);
  margin-bottom: 12px;
}

.access-card label {
  display: block;
  margin: 22px 0 8px;
  font-weight: 800;
  color: var(--text);
}

.access-card input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  outline: none;
}

.access-card input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.access-card button {
  width: 100%;
  margin-top: 14px;
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #ffffff;
  border-radius: var(--radius);
  padding: 13px 18px;
  font-weight: 800;
  cursor: pointer;
}

.gate-warning {
  margin-top: 14px;
  color: #92400e;
  background: var(--caution-bg);
  border: 1px solid rgba(245, 158, 11, 0.28);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.92rem;
}

.gate-error {
  min-height: 1.4em;
  margin-top: 10px;
  color: #b91c1c;
  font-weight: 700;
}

.shell {
  width: min(var(--max-width), calc(100vw - 32px));
  margin: 0 auto;
  padding: 48px 0 36px;
}

.hero {
  text-align: center;
  padding: 40px 0 32px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 1.25rem;
  margin-bottom: 18px;
}

.logo-icon { font-size: 1.4rem; }

.hero-badge, .section-label {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary);
  background: var(--primary-light);
  padding: 6px 14px;
  border-radius: 100px;
  margin: 0 0 14px;
}

.section-label.compact { margin-bottom: 8px; }

h1, h2, h3 {
  color: var(--text);
  line-height: 1.18;
  margin: 0;
}

h1 {
  font-size: clamp(2.25rem, 7vw, 4.5rem);
  letter-spacing: -0.04em;
  margin-bottom: 16px;
}

h2 { font-size: clamp(1.35rem, 3vw, 2.1rem); }

p { color: var(--text-secondary); margin: 0; }

.lead {
  max-width: 720px;
  margin: 0 auto 18px;
  font-size: 1.12rem;
}

.demo-notice {
  max-width: 860px;
  margin: 22px auto 0;
  padding: 14px 18px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.76);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  color: var(--text-secondary);
}

.section-card, .chat-panel {
  background: rgba(255,255,255,0.92);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 8px);
  box-shadow: var(--shadow);
}

.section-card { padding: 26px; }

.section-heading {
  text-align: center;
  max-width: 650px;
  margin: 0 auto 24px;
}

.section-heading h2 { margin-bottom: 10px; }

.agent-section { margin-bottom: 22px; }

.agent-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.agent-card {
  text-align: left;
  min-height: 184px;
  padding: 20px;
  border: 1px solid var(--border);
  background: var(--bg-light);
  color: var(--text);
  border-radius: var(--radius);
  cursor: pointer;
  box-shadow: none;
}

.agent-card:hover { box-shadow: var(--shadow-hover); border-color: var(--border-strong); }

.agent-card.selected {
  border-color: var(--primary);
  background: linear-gradient(180deg, #ffffff 0%, var(--bg-accent) 100%);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.14), var(--shadow-hover);
}

.agent-title {
  display: block;
  font-weight: 800;
  font-size: 1.25rem;
  margin-bottom: 12px;
}

.agent-card strong {
  display: block;
  color: var(--primary-dark);
  font-size: 0.98rem;
  margin-bottom: 8px;
}

.agent-card small {
  display: block;
  color: var(--text-secondary);
  line-height: 1.5;
}

.chat-panel {
  overflow: hidden;
  margin-bottom: 22px;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 26px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #ffffff 0%, #f9fafb 100%);
}

.chat-header h2 { margin-bottom: 8px; }
.chat-header p:not(.section-label) { max-width: 560px; }

.command-hints {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-content: flex-start;
  gap: 8px;
  min-width: 220px;
}

.command-hints span, .command-row button {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-accent);
  color: var(--primary-dark);
  font-weight: 700;
}

.command-hints span { padding: 7px 11px; font-size: 0.9rem; }

.helper-line {
  padding: 14px 26px;
  background: var(--safe-bg);
  color: #065f46;
  font-weight: 600;
  border-bottom: 1px solid rgba(16, 185, 129, 0.18);
}

.messages {
  height: 420px;
  overflow-y: auto;
  padding: 22px 26px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #fbfcfe;
}

.message {
  white-space: pre-wrap;
  line-height: 1.5;
  padding: 14px 16px;
  border-radius: var(--radius);
  max-width: min(82%, 720px);
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.message.user {
  background: var(--primary);
  color: #ffffff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.message.assistant {
  background: #ffffff;
  color: var(--text);
  align-self: flex-start;
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.composer {
  display: flex;
  gap: 10px;
  padding: 16px;
  border-top: 1px solid var(--border);
  background: #ffffff;
}

.composer input {
  flex: 1;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 1rem;
  outline: none;
}

.composer input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.composer button {
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #ffffff;
  border-radius: var(--radius);
  padding: 12px 20px;
  font-weight: 800;
  cursor: pointer;
}

.composer button:hover { background: var(--primary-dark); }

.command-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 0 16px 16px;
  background: #ffffff;
}

.command-row button {
  padding: 10px 14px;
  cursor: pointer;
}

.limits-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 18px;
  align-items: stretch;
}

.safety-note ul {
  margin: 14px 0 0;
  padding-left: 20px;
  color: var(--text-secondary);
}

.safety-note li + li { margin-top: 6px; }

.footer-note {
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: var(--bg-accent);
}

.footer-note strong {
  color: var(--primary-dark);
  font-size: 1.05rem;
  margin-bottom: 8px;
}

.sr-only {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

@media (max-width: 860px) {
  .agent-picker, .limits-grid { grid-template-columns: 1fr; }
  .chat-header { flex-direction: column; }
  .command-hints { justify-content: flex-start; min-width: 0; }
}

@media (max-width: 640px) {
  .shell { width: min(100vw - 20px, var(--max-width)); padding-top: 24px; }
  .hero { padding-top: 22px; }
  .section-card { padding: 20px; }
  .message { max-width: 96%; }
  .composer { flex-direction: column; }
  .composer button { width: 100%; }
}
