:root {
  --page-bg: #f4f7f2;
  --page-tint: #eef6ef;
  --surface: #ffffff;
  --surface-soft: #f8fbf8;
  --surface-strong: #eff7f1;
  --surface-accent: #f4fbf6;
  --text: #152317;
  --muted: #66756a;
  --line: #d7e2d9;
  --line-strong: #c4d4c8;
  --accent: #148746;
  --accent-strong: #0f6c39;
  --accent-soft: rgba(20, 135, 70, 0.1);
  --accent-softer: rgba(20, 135, 70, 0.06);
  --danger: #b3261e;
  --danger-soft: rgba(179, 38, 30, 0.08);
  --success-soft: #edf8f0;
  --shadow: 0 16px 40px rgba(37, 62, 43, 0.08);
  --shadow-soft: 0 8px 24px rgba(37, 62, 43, 0.06);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(20, 135, 70, 0.08), transparent 24%),
    radial-gradient(circle at right 12%, rgba(95, 163, 111, 0.08), transparent 22%),
    linear-gradient(180deg, #fbfdfb 0%, var(--page-bg) 100%);
  color: var(--text);
  font-family: Aptos, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  line-height: 1.45;
}

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

.page-shell {
  width: min(1420px, calc(100% - 28px));
  margin: 20px auto;
  padding: 20px;
  border: 1px solid rgba(196, 212, 200, 0.9);
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(250, 253, 250, 0.98));
  box-shadow: var(--shadow);
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 24px;
  padding: 16px 4px 8px;
}

.hero-copy {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border-radius: 24px;
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.75), transparent 35%),
    linear-gradient(180deg, #1c9650 0%, #138043 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 12px 24px rgba(20, 135, 70, 0.2);
}

.brand-mark-inner {
  width: 34px;
  height: 42px;
  border: 3px solid #fff;
  border-radius: 8px;
  position: relative;
}

.brand-mark-inner::before,
.brand-mark-inner::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  border-radius: 999px;
}

.brand-mark-inner::before {
  top: -9px;
  width: 18px;
  height: 9px;
}

.brand-mark-inner::after {
  top: 12px;
  width: 16px;
  height: 16px;
  clip-path: polygon(18% 54%, 37% 73%, 80% 28%, 88% 36%, 38% 86%, 10% 58%);
}

.eyebrow {
  margin: 4px 0 8px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 8px;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.02;
  letter-spacing: -0.03em;
}

.intro {
  max-width: 700px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1rem;
}

.status-card {
  min-width: 320px;
  padding: 18px 18px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfefb 100%);
  box-shadow: var(--shadow-soft);
}

.status-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.auth-card strong {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  font-size: 1rem;
}

.auth-card strong::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 0 4px rgba(20, 135, 70, 0.12);
}

.auth-summary {
  margin: 10px 0 14px;
  color: var(--muted);
  font-size: 0.94rem;
}

.workspace-shell {
  display: grid;
  grid-template-columns: 106px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.progress-rail {
  position: sticky;
  top: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px 10px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(180deg, #fdfefd 0%, #f5faf5 100%);
}

.progress-rail::before {
  content: "";
  position: absolute;
  top: 58px;
  bottom: 58px;
  left: 36px;
  width: 1px;
  background: linear-gradient(180deg, rgba(20, 135, 70, 0.25), rgba(20, 135, 70, 0.08));
}

.progress-step {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--muted);
  text-align: center;
}

.progress-step-number {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid var(--line-strong);
  color: var(--accent);
  font-weight: 800;
  box-shadow: 0 6px 18px rgba(20, 135, 70, 0.12);
}

.progress-step-label {
  font-size: 0.78rem;
  line-height: 1.25;
  font-weight: 700;
}

.progress-step.is-active .progress-step-number,
.progress-step:hover .progress-step-number {
  background: linear-gradient(180deg, #22a35c 0%, #148746 100%);
  border-color: transparent;
  color: #fff;
}

.progress-step.is-active {
  color: var(--text);
}

.request-form {
  display: grid;
  gap: 18px;
}

.form-section {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.section-heading {
  padding: 18px 22px 14px;
  border-bottom: 1px solid rgba(215, 226, 217, 0.65);
  background: linear-gradient(180deg, var(--surface-soft) 0%, #fff 100%);
}

.section-heading h2,
.nested-heading h3 {
  margin-bottom: 4px;
  color: var(--accent);
  font-size: 1.08rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.01em;
}

.section-heading p,
.field small,
.section-kicker,
.nested-heading p {
  color: var(--muted);
}

.nested-heading {
  padding-top: 10px;
  border-top: 1px solid rgba(215, 226, 217, 0.65);
  border-bottom: 0;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  padding: 18px 22px 22px;
}

.notes-grid {
  align-items: stretch;
}

.field {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
}

.field.wide {
  grid-column: span 2;
}

.notes-grid .field.wide {
  grid-column: span 2;
}

.field > span {
  font-size: 0.84rem;
  font-weight: 700;
  color: #314536;
}

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  padding: 11px 13px;
  transition: border-color 120ms ease, box-shadow 120ms ease, background-color 120ms ease;
}

textarea {
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: #98a59b;
}

input[readonly] {
  background: var(--surface-accent);
  color: #4a5d4f;
}

input:focus,
select:focus,
textarea:focus,
button:focus {
  outline: none;
  border-color: rgba(20, 135, 70, 0.7);
  box-shadow: 0 0 0 4px rgba(20, 135, 70, 0.12);
}

.upload-field input[type="file"] {
  min-height: 140px;
  padding: 22px;
  border-style: dashed;
  border-width: 2px;
  background: linear-gradient(180deg, #fbfefb 0%, #f4faf5 100%);
}

.line-items-shell {
  display: grid;
  gap: 16px;
  padding: 18px 22px 22px;
}

.line-items-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.section-kicker {
  margin: 0;
  font-size: 0.94rem;
}

.line-items {
  display: grid;
  gap: 12px;
}

.line-item {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfefb 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.line-item-grid {
  display: grid;
  grid-template-columns: 84px 110px 110px minmax(220px, 2fr) 130px 150px 130px auto;
  gap: 12px;
  align-items: start;
  padding: 14px;
}

.line-item-grid .field {
  margin: 0;
}

.line-item-grid .field.wide {
  grid-column: 4 / 5;
}

.line-item-grid .field.wide textarea {
  min-height: 96px;
}

.line-item-actions {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  min-height: 100%;
}

.totals-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, var(--surface-soft) 0%, #fff 100%);
}

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

.notice {
  padding: 14px 16px;
  border: 1px solid rgba(20, 135, 70, 0.16);
  border-radius: 14px;
  background: linear-gradient(180deg, #f4fbf5 0%, #eef8f0 100%);
}

.notice strong {
  color: var(--accent-strong);
}

.notice p {
  margin-bottom: 0;
  color: #536857;
}

.compact-notice {
  padding: 14px 16px;
}

.form-message {
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.form-message.error {
  color: var(--danger);
  border-color: rgba(179, 38, 30, 0.22);
  background: #fff5f4;
}

.form-message.success {
  color: var(--accent-strong);
  border-color: rgba(20, 135, 70, 0.22);
  background: var(--success-soft);
}

.form-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  padding: 14px 6px 2px;
  background: linear-gradient(to top, rgba(244, 247, 242, 0.96) 72%, rgba(244, 247, 242, 0));
  backdrop-filter: blur(8px);
}

button {
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 18px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, background-color 120ms ease, border-color 120ms ease;
}

button:hover {
  transform: translateY(-1px);
}

.primary-button {
  background: linear-gradient(180deg, #1f9a55 0%, #148746 100%);
  color: #fff;
  box-shadow: 0 10px 20px rgba(20, 135, 70, 0.22);
}

.primary-button:hover {
  background: linear-gradient(180deg, #1b8d4e 0%, #12753e 100%);
}

.secondary-button,
.text-button {
  border-color: var(--line-strong);
  background: #fff;
  color: var(--text);
}

.secondary-button:hover,
.text-button:hover {
  background: var(--surface-soft);
}

.auth-button {
  width: 100%;
  border-color: rgba(20, 135, 70, 0.2);
  background: linear-gradient(180deg, #1f9a55 0%, #148746 100%);
  color: #fff;
}

.auth-button:hover {
  background: linear-gradient(180deg, #1b8d4e 0%, #12753e 100%);
}

.add-line-item-button {
  white-space: nowrap;
}

.remove-line-item-button {
  color: #5f6d61;
}

.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: center;
  min-height: 46px;
  padding: 2px 0;
}

.choice-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: #405144;
}

.choice-option input[type="radio"] {
  width: 18px;
  height: 18px;
  min-height: 0;
  margin: 0;
  accent-color: var(--accent);
}

.draft-status {
  margin-right: auto;
  color: var(--muted);
  font-size: 0.92rem;
}

.field.field-invalid > span,
.field.field-invalid small {
  color: var(--danger);
}

.field.field-invalid input,
.field.field-invalid select,
.field.field-invalid textarea,
.field.field-invalid .notice {
  border-color: rgba(179, 38, 30, 0.6);
  box-shadow: 0 0 0 4px rgba(179, 38, 30, 0.12);
  background: #fff7f6;
}

.honeypot,
[hidden] {
  display: none !important;
}

label.field:has([data-required="true"]) > span::after,
label.field:has([data-required-line-item="true"]) > span::after {
  content: " *";
  color: #d32626;
}

@media (max-width: 1220px) {
  .field-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .field.wide,
  .notes-grid .field.wide {
    grid-column: 1 / -1;
  }

  .totals-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .line-item-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .line-item-grid .field.wide {
    grid-column: 1 / -1;
  }

  .line-item-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }
}

@media (max-width: 960px) {
  .page-shell {
    width: min(100% - 16px, 1420px);
    margin: 8px auto 16px;
    padding: 14px;
    border-radius: 24px;
  }

  .app-header,
  .workspace-shell {
    grid-template-columns: 1fr;
    display: grid;
  }

  .hero-copy {
    flex-direction: row;
  }

  .status-card {
    min-width: 0;
  }

  .progress-rail {
    position: static;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    padding: 12px;
  }

  .progress-rail::before {
    display: none;
  }

  .line-items-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .field-grid,
  .totals-grid {
    grid-template-columns: 1fr;
  }

  .form-actions {
    flex-wrap: wrap;
    justify-content: stretch;
  }

  .form-actions button {
    flex: 1 1 180px;
  }
}

@media print {
  body {
    background: #fff;
  }

  .page-shell {
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
    background: #fff;
  }

  .progress-rail,
  .auth-card,
  .form-actions,
  .text-button,
  .add-line-item-button,
  #formMessage {
    display: none !important;
  }

  .workspace-shell {
    display: block;
  }

  .form-section,
  .line-item,
  .totals-panel {
    box-shadow: none;
    break-inside: avoid;
  }
}
