:root {
  color-scheme: light;
  --ink: #142033;
  --muted: #64748b;
  --brand: #183153;
  --accent: #ffbf69;
  --surface: #ffffff;
  --background: #f5f7fb;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--background);
}

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

.app-shell {
  width: min(100%, 44rem);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(1rem, env(safe-area-inset-top)) 1rem max(2rem, env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin: 0.75rem 0 1.5rem;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(2rem, 10vw, 3rem); line-height: 1; }
h2 { margin-bottom: 0.5rem; }

.eyebrow {
  margin-bottom: 0.35rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.muted, .hint { color: var(--muted); }
.hint { margin: 0.5rem 0 0; font-size: 0.8rem; }

.card {
  margin-bottom: 1rem;
  padding: 1.25rem;
  border: 1px solid #e3e8f0;
  border-radius: 1.25rem;
  background: var(--surface);
  box-shadow: 0 0.75rem 2rem rgba(24, 49, 83, 0.07);
}

.capture-card { padding: 2rem 1.25rem; text-align: center; }
.capture-icon, .brand-mark {
  display: grid;
  width: 4rem;
  height: 4rem;
  margin: 0 auto 1rem;
  place-items: center;
  border-radius: 1.25rem;
  color: white;
  background: var(--brand);
  font-size: 2rem;
  font-weight: 800;
}

.profile-switcher {
  display: flex;
  padding: 0.25rem;
  border-radius: 0.75rem;
  background: #e9edf4;
}

.profile-switcher a {
  padding: 0.5rem 0.7rem;
  border-radius: 0.55rem;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
}

.profile-switcher a[aria-current="page"] {
  color: var(--ink);
  background: white;
  box-shadow: 0 0.15rem 0.5rem rgba(20, 32, 51, 0.12);
}

.stack { display: grid; gap: 0.75rem; }
label { font-weight: 700; }
.field-label { font-weight: 700; }
.upload-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
}
.upload-option {
  display: grid;
  min-height: 3rem;
  padding: 0.65rem 0.25rem;
  place-items: center;
  border-radius: 0.7rem;
  color: white;
  background: var(--brand);
  font-size: 0.85rem;
  text-align: center;
  cursor: pointer;
}
.upload-source { display: none; }
input, select, textarea {
  width: 100%;
  min-height: 3rem;
  padding: 0.75rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.7rem;
  background: white;
  color: var(--ink);
}
textarea { resize: vertical; }

button {
  min-height: 3rem;
  padding: 0.75rem 1rem;
  border: 0;
  border-radius: 0.7rem;
  color: white;
  background: var(--brand);
  font-weight: 800;
}

button:disabled { opacity: 0.55; }
.back-link { color: var(--brand); font-weight: 800; }
.divider { display: flex; align-items: center; gap: 0.75rem; color: var(--muted); margin: 0; }
.divider::before, .divider::after { content: ""; height: 1px; flex: 1; background: #e3e8f0; }
.job-list { margin: 0; padding: 0; list-style: none; }
.job-list li + li { border-top: 1px solid #e3e8f0; }
.job-list a, .status-row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.job-list a { padding: 0.85rem 0; color: var(--ink); text-decoration: none; }
.status { padding: 0.3rem 0.55rem; border-radius: 999px; background: #e9edf4; font-size: 0.75rem; font-weight: 800; }
.status-ready, .status-imported { color: #14532d; background: #dcfce7; }
.status-needs_details { color: #854d0e; background: #fef3c7; }
.status-failed { color: #8b1e1e; background: #fee2e2; }
.draft { padding: 1rem 0; border-top: 1px solid #e3e8f0; }
.draft:first-child { border-top: 0; }
.draft p { margin-bottom: 0.75rem; }
.confirmation-draft { display: grid; gap: 0.75rem; }
.confirmation-draft h3 { margin: 0; }
.confirmation-grid { display: grid; grid-template-columns: 1fr; gap: 0.75rem; }
.confirmation-grid > div { min-width: 0; }
dl { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0.65rem; }
dl div { min-width: 0; }
dt { color: var(--muted); font-size: 0.75rem; font-weight: 700; }
dd { margin: 0.15rem 0 0; overflow-wrap: anywhere; }
.chat { display: grid; gap: 0.6rem; margin-bottom: 1rem; }
.chat p { max-width: 90%; margin: 0; padding: 0.7rem; border-radius: 0.8rem; background: #e9edf4; }
.chat .chat-user { justify-self: end; background: #dbeafe; }
.errorlist { color: #8b1e1e; }
.pair-card { margin-top: 8vh; }
.error, .notice, .warning { padding: 0.8rem; border-radius: 0.7rem; }
.error { color: #8b1e1e; background: #fee2e2; }
.notice { color: #14532d; background: #dcfce7; }
.warning { color: #854d0e; background: #fef3c7; }
.processing-message { display: flex; align-items: center; gap: 0.55rem; }
.spinner {
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
  border: 2px solid #cbd5e1;
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; }
}

@media (min-width: 40rem) {
  .app-shell { padding-inline: 1.5rem; }
  .card { padding: 1.75rem; }
  .confirmation-grid { grid-template-columns: 1fr 1fr; }
}
