/* ============================================================
   OSI DISPATCH — style.css
   Mobile-first, ~390px target width
   ============================================================ */

/* --- Reset & base ------------------------------------------ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --color-primary:       #1A2744;   /* OSI navy — wordmark / headers    */
  --color-accent:        #1A6DB5;   /* OSI blue — map pin / CTA         */
  --color-accent-dark:   #155a96;   /* hover / active state             */
  --color-supporting:    #4A5568;   /* body / instructional text        */
  --color-surface:       #ffffff;
  --color-border:        #d1d5db;
  --color-text:          #1A2744;
  --color-muted:         #4A5568;
  --color-bg:            #ffffff;

  --radius-sm:   6px;
  --radius-md:  10px;
  --radius-lg:  16px;

  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

  --topbar-h: 56px;
  --progress-h: 4px;
}

html, body {
  height: 100%;
  font-family: var(--font-sans);
  background: var(--color-surface);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

/* --- Screen management ------------------------------------- */
.screen {
  display: none;
  min-height: 100dvh;
  flex-direction: column;
}

.screen--active {
  display: flex;
}

/* --- SCREEN 1 — Landing ------------------------------------ */
.landing-wrap {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: stretch;
  min-height: 100dvh;
  padding: 52px 28px 44px;
  background: var(--color-surface);
}

/* Logo */
.landing-logo {
  display: flex;
  justify-content: center;
}

.logo-img {
  width: 100%;
  max-width: 200px;
  height: auto;
  display: block;
  object-fit: contain;
}

/* Headline block */
.landing-head {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: center;
}

.landing-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-accent);
}

.landing-label-sub {
  font-size: 13px;
  font-style: italic;
  color: var(--color-supporting);
}

.landing-reassurance {
  font-size: 13px;
  font-style: italic;
  color: var(--color-supporting);
  text-align: center;
}

.landing-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1.25;
}

/* 3-step process flow — centered, compact */
.steps {
  list-style: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 0;
  margin: 0;
  width: 100%;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 100%;
  max-width: 300px;
}

.step-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.step-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 6px 0 0;
}

.step-num {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-accent);
}

.step-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1.25;
}

.step-desc {
  font-size: 13px;
  line-height: 1.55;
  color: var(--color-supporting);
}

/* --- Buttons ----------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  border: none;
  border-radius: var(--radius-md);
  padding: 16px 24px;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.1s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.btn:active {
  opacity: 0.85;
  transform: scale(0.98);
}

.btn--primary {
  background: var(--color-accent);
  color: #fff;
  transition: background 0.15s ease, opacity 0.15s ease, transform 0.1s ease;
}

.btn--primary:hover {
  background: var(--color-accent-dark);
}

.btn--primary:active {
  background: var(--color-accent-dark);
}

.btn--full {
  width: 100%;
}

/* --- Topbar (Screens 2 & 3) -------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  height: var(--topbar-h);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 0 16px;
  gap: 8px;
}

.back-btn {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--color-primary);
  cursor: pointer;
  padding: 8px;
  margin-left: -8px;
  border-radius: var(--radius-sm);
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
}

.topbar-title {
  flex: 1;
  font-size: 16px;
  font-weight: 700;
  color: var(--color-primary);
  text-align: center;
}

.topbar-logo {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

.topbar-logo-img {
  height: 26px;
  width: auto;
  display: block;
  object-fit: contain;
}

.topbar-step {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-muted);
  white-space: nowrap;
}

/* --- Progress bar ------------------------------------------ */
.progress-bar-wrap {
  height: var(--progress-h);
  background: var(--color-border);
  width: 100%;
  flex-shrink: 0;
}

.progress-bar {
  height: 100%;
  background: var(--color-accent);
  transition: width 0.35s ease;
}

/* --- Form body --------------------------------------------- */
.form-body {
  flex: 1;
  padding: 24px 20px 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  background: var(--color-bg);
}

/* --- Confirm body ------------------------------------------ */
.confirm-body {
  flex: 1;
  padding: 32px 24px 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  background: var(--color-bg);
}

/* Non-sticky topbar for Screen 3 */
#screen-confirm .topbar {
  position: relative;
}

.confirm-logo {
  display: flex;
  justify-content: center;
  width: 100%;
}

.confirm-icon {
  display: flex;
  justify-content: center;
  margin-top: -4px;
}

.confirm-headline {
  font-size: 24px;
  font-weight: 700;
  color: var(--color-primary);
  text-align: center;
  margin-top: -4px;
}

.confirm-thankyou {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: center;
  margin-top: -8px;
}

.confirm-thankyou p {
  font-size: 15px;
  color: var(--color-muted);
  line-height: 1.6;
  max-width: 320px;
}

.confirm-subtext {
  font-size: 14px;
  color: var(--color-muted);
  text-align: center;
  line-height: 1.5;
}

.confirm-card {
  width: 100%;
  background: #f5f9ff;
  border: 1px solid #d6e4f5;
  border-radius: var(--radius-md);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.confirm-detail {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
}

.confirm-detail-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}

.confirm-detail-value {
  font-size: 14px;
  color: var(--color-primary);
  font-weight: 700;
  text-align: right;
}

.btn--outline {
  background: var(--color-surface);
  color: var(--color-accent);
  border: 1.5px solid var(--color-accent);
  transition: background 0.15s ease, opacity 0.15s ease, transform 0.1s ease;
}

.btn--outline:hover {
  background: #f0f6ff;
}

.btn--outline:active {
  background: #e8f0fc;
}

.confirm-close-note {
  font-size: 13px;
  color: var(--color-muted);
  text-align: center;
}

/* Full-width children of confirm-body */
#screen-confirm .btn {
  width: 100%;
}

/* ============================================================
   SCREEN 2 — FORM
   ============================================================ */

/* Override form-body defaults for the actual form */
.form-body {
  background: #f8f9fa;
  padding: 16px 16px 48px;
  gap: 12px;
}

/* --- Section card ------------------------------------------ */
.form-section {
  background: var(--color-surface);
  border: 1px solid #e5e7eb;
  border-radius: var(--radius-md);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.section-header {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: 0.01em;
}

.section-note {
  font-size: 13px;
  color: var(--color-muted);
  margin-top: -6px;
  line-height: 1.5;
}

/* --- Field groups ------------------------------------------ */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.field-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  min-width: 0;
  overflow: hidden;
}

/* Proportional column widths */
.fg-city  { flex: 6; min-width: 0; }
.fg-state { flex: 2; min-width: 0; }
.fg-zip   { flex: 2; min-width: 0; }
.fg-half  { flex: 1; min-width: 0; }
.fg-tech  { flex: 3; min-width: 0; }
.fg-time  { flex: 2; min-width: 0; }

.field-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.req {
  color: var(--color-accent);
}

.field-input {
  width: 100%;
  min-height: 48px;
  padding: 12px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 16px;   /* 16px prevents iOS auto-zoom on focus */
  color: var(--color-text);
  background: var(--color-surface);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
}

/* iOS date/time containment — keep appearance: none from global rule */
input[type="date"].field-input,
input[type="time"].field-input {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.field-input::placeholder {
  color: #b0b7c3;
}

.field-input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(26, 109, 181, 0.12);
}

.field-input--error {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1) !important;
}

.field-input--upper {
  text-transform: uppercase;
}

.field-textarea {
  min-height: 100px;
  resize: none;
  line-height: 1.55;
  -webkit-appearance: none;
  appearance: none;
}

.field-error {
  display: none;
  font-size: 12px;
  font-weight: 500;
  color: #dc2626;
  padding-top: 2px;
}

/* --- Checklist --------------------------------------------- */
.checklist {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Group container */
.checklist-group {
  border: 1px solid #e5e7eb;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.checklist-group-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 16px;
  background: #f4f6f8;
  border-bottom: 1px solid #e5e7eb;
}

.checklist-group-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.checklist-group-note {
  font-size: 11px;
  color: var(--color-muted);
}

.checklist-items {
  display: flex;
  flex-direction: column;
}

/* Standard checkbox rows */
.checklist-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  min-height: 52px;
  background: var(--color-surface);
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s ease;
}

.checklist-item:last-child {
  border-bottom: none;
}

.checklist-item[data-state="checked"] {
  background: #f5f9ff;
}

/* Right-side status indicator */
.check-indicator {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 6px;
  border: 2px solid #d1d5db;
  background: var(--color-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  line-height: 1;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.checklist-item[data-state="checked"] .check-indicator {
  background: var(--color-accent);
  border-color: var(--color-accent);
}

.checklist-item[data-state="checked"] .check-indicator::after {
  content: '✓';
}

/* Item label */
.check-label {
  flex: 1;
  font-size: 15px;
  line-height: 1.4;
  color: var(--color-primary);
}

/* Tristate items — label above, pills below */
.checklist-item--tristate {
  flex-direction: column;
  align-items: flex-start;
  min-height: 72px;
  padding: 12px 16px;
  cursor: default;
}

.checklist-item--tristate .check-label {
  width: 100%;
}

.checklist-item--tristate[data-state="checked"] {
  background: #f5f9ff;
}

.checklist-item--tristate[data-state="na"] {
  background: #fafafa;
}

.checklist-item--tristate[data-state="issue"] {
  background: #fff8f8;
}

/* Pill row */
.pill-row {
  display: flex;
  gap: 6px;
  width: 100%;
  margin-top: 8px;
}

.pill {
  flex: 1;
  height: 36px;
  border: 1.5px solid transparent;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-sans);
  background: #f0f0f0;
  color: var(--color-muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.pill:active {
  opacity: 0.8;
}

/* Active pill states via parent data-state */
.checklist-item--tristate[data-state="checked"] .pill--confirm {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
  font-weight: 600;
}

.checklist-item--tristate[data-state="na"] .pill--na {
  background: #e8e8e8;
  border-color: #d0d0d0;
  color: var(--color-primary);
  font-weight: 600;
}

.checklist-item--tristate[data-state="issue"] .pill--issue {
  background: #fff3f3;
  border-color: #f5b8b8;
  color: #c0392b;
  font-weight: 600;
}

/* Error state — red left accent, no layout shift */
.checklist-item--error {
  box-shadow: inset 3px 0 0 0 #c0392b;
}

/* --- Signature blocks -------------------------------------- */
.sig-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sig-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sig-canvas {
  display: block;
  width: 100%;
  height: 120px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  cursor: crosshair;
  touch-action: none;
}

.sig-block + .sig-block {
  margin-top: 24px;
  border-top: 1px solid var(--color-border);
  padding-top: 20px;
}

.sig-canvas--error {
  border-color: #dc2626;
}

.sig-clear {
  background: none;
  border: none;
  color: var(--color-accent);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
  text-decoration: underline;
  text-underline-offset: 2px;
  align-self: flex-start;
  -webkit-tap-highlight-color: transparent;
}

/* --- Submit wrap ------------------------------------------- */
.form-submit-wrap {
  padding-top: 4px;
}

/* --- Dev placeholder --------------------------------------- */
.placeholder-note {
  margin: auto;
  padding: 32px 24px;
  background: var(--color-surface);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-muted);
  font-size: 14px;
  text-align: center;
  width: 100%;
}
