:root {
  --bg: #ecf2f8;
  --bg-deep: #d5e2ef;
  --paper: #ffffff;
  --ink: #0f1d2f;
  --muted: #4d5f78;
  --accent: #0f8bff;
  --accent-strong: #065bc2;
  --accent-soft: #d6e9ff;
  --warn: #b04444;
  --ok: #0b7a58;
  --border: #d3dfec;
  --shadow: 0 16px 40px rgba(7, 20, 42, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 80% -20%, #9ed6ff 0%, transparent 43%),
    radial-gradient(circle at -10% 20%, #ffe6ae 0%, transparent 36%),
    linear-gradient(160deg, var(--bg) 0%, var(--bg-deep) 100%),
    var(--bg);
  font-family: "DM Sans", "Segoe UI", sans-serif;
}

.app-shell {
  max-width: 840px;
  margin: 0 auto;
  padding: 1.2rem 1rem 4rem;
}

.hero {
  padding: 1.3rem 0.35rem 1rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--accent-strong);
  margin: 0;
  font-size: 0.72rem;
}

h1,
h2 {
  font-family: "Sora", "Segoe UI", sans-serif;
}

h1 {
  margin: 0.35rem 0;
  font-size: clamp(1.55rem, 5vw, 2.2rem);
  letter-spacing: -0.02em;
}

.intro {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.admin-link {
  display: inline-block;
  margin-top: 0.85rem;
  color: var(--accent-strong);
  font-weight: 700;
  text-decoration: none;
}

.admin-link:hover {
  text-decoration: underline;
}

.flow-tracker {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.4rem;
  margin: 0.6rem 0 0.3rem;
}

.flow-item {
  font-size: 0.75rem;
  text-align: center;
  font-weight: 700;
  color: #4d607a;
  background: #e9f1fb;
  border: 1px solid #c9dcf2;
  border-radius: 10px;
  padding: 0.45rem 0.3rem;
}

.flow-item.is-active {
  color: #fff;
  background: #0f8bff;
  border-color: #0a75d8;
}

.flow-item.is-done {
  color: #0b6c4f;
  background: #dff7ed;
  border-color: #b3e8d2;
}

.card {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 1.05rem;
  margin-top: 1rem;
}

.card.accent {
  border-color: #a8cfff;
  background: linear-gradient(180deg, #eef6ff 0%, var(--paper) 70%);
}

.step.step-active {
  border-color: #7db7ff;
  box-shadow: 0 18px 42px rgba(17, 85, 170, 0.19);
}

.gated {
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.locked .gated {
  display: none;
  opacity: 0.32;
  pointer-events: none;
  transform: translateY(6px);
}

h2 {
  margin: 0;
  font-size: 1.16rem;
}

.section-title-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.subtle {
  color: var(--muted);
  margin: 0.45rem 0 0.8rem;
  font-size: 0.92rem;
}

.hint {
  margin: 0.2rem 0 0.8rem;
  color: #3b516f;
  font-size: 0.86rem;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.7rem;
}

label {
  display: grid;
  gap: 0.32rem;
  font-weight: 700;
  font-size: 0.92rem;
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid #c8d9ec;
  border-radius: 10px;
  padding: 0.62rem 0.72rem;
  background: #fbfdff;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid #90c2ff;
  outline-offset: 1px;
}

textarea {
  resize: vertical;
}

.lines,
.checklist {
  display: grid;
  gap: 0.72rem;
}

.line-item,
.check-item {
  border: 1px solid #d3e2f1;
  background: #fff;
  border-radius: 12px;
  padding: 0.72rem;
}

.line-grid,
.check-row {
  display: grid;
  gap: 0.6rem;
}

button {
  border: 0;
  border-radius: 12px;
  padding: 0.6rem 0.85rem;
  cursor: pointer;
  font-weight: 700;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

button.primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #fff;
}

button.ghost {
  background: var(--accent-soft);
  color: #0f5bbf;
}

button.danger {
  background: #fce7e7;
  color: var(--warn);
  margin-top: 0.55rem;
}

.actions {
  margin-top: 0.9rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.6rem;
}

.actions.inline-actions {
  grid-template-columns: 1fr;
  margin-top: 0.8rem;
}

.lookup-context {
  margin-top: 0.8rem;
  border: 1px dashed #8eb9e9;
  background: #f1f8ff;
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
}

.lookup-context p {
  margin: 0.2rem 0;
  font-size: 0.9rem;
}

.result {
  margin-top: 0.8rem;
  background: #111f35;
  color: #e5efff;
  padding: 0.7rem;
  border-radius: 10px;
  min-height: 2.8rem;
  white-space: pre-wrap;
  font-size: 0.82rem;
}

.readiness {
  margin: 0.6rem 0 0;
  font-size: 0.86rem;
  font-weight: 600;
  color: #4e6078;
}

.readiness.is-warning {
  color: #8b4f00;
}

.readiness.is-ready {
  color: #0f6b4f;
}

.check-group {
  margin-bottom: 1rem;
}

.check-group > h3 {
  margin: 0.2rem 0 0.55rem;
  font-size: 1rem;
}

.check-item-title {
  margin: 0 0 0.45rem;
  font-size: 0.95rem;
}

.question-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.required-pill {
  background: #ffe7c4;
  color: #7f4e00;
  border-radius: 999px;
  padding: 0.15rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
}

.question-help {
  margin: 0 0 0.55rem;
  color: var(--muted);
  font-size: 0.86rem;
}

.question-input {
  display: grid;
  gap: 0.45rem;
}

.media-upload {
  margin-top: 0.5rem;
  border-top: 1px dashed #cdddf0;
  padding-top: 0.5rem;
  display: grid;
  gap: 0.35rem;
}

.media-upload label {
  font-weight: 700;
  font-size: 0.85rem;
}

.media-help {
  margin: 0;
  color: #5f6f86;
  font-size: 0.78rem;
}

.media-selected {
  font-size: 0.8rem;
  color: #20446d;
}

.question-choice {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 500;
}

.question-choice input {
  width: auto;
}

.condition-note {
  margin: 0.5rem 0 0;
  color: #5f6a78;
  font-size: 0.76rem;
}

.check-group {
  padding: 0.7rem;
  border-radius: 14px;
  border: 1px solid #cfe0f1;
  background: #f8fbff;
}

.form-pager {
  margin-top: 0.8rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.55rem;
}

.form-pager .subtle {
  margin: 0;
  text-align: center;
}

@media (min-width: 700px) {
  .field-grid {
    grid-template-columns: 1fr 1fr;
  }

  .line-grid,
  .check-row {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .actions {
    grid-template-columns: auto auto;
    justify-content: end;
  }

  .actions.inline-actions {
    grid-template-columns: auto;
    justify-content: start;
  }

  .form-pager {
    grid-template-columns: auto 1fr auto;
    align-items: center;
  }
}
