/* Brand tokens lifted from apps/os2/src/app/globals.css (:root / .dark) in
   gw-os2-frontend-ui, so this standalone form matches the rest of the
   product — light AND dark — without pulling in Tailwind/the shared
   package. Icons below are Hugeicons' free "Stroke Rounded" set
   (@hugeicons/core-free-icons, MIT), matching what the React version uses
   via @hugeicons/react — inlined as raw SVG since there's no bundler here. */
:root {
  --font-sans: 'Google Sans', -apple-system, 'Segoe UI', sans-serif;
  --surface: #fcfefd;
  --card: #fcfefd;
  --accent: #03b155;
  --accent-dark: #029a49;
  --accent-light: #e6f2ec;
  --accent-line: rgba(3, 177, 85, 0.25);
  --accent-hover: rgba(3, 177, 85, 0.15);
  --text-primary: #0f1f18;
  --text-secondary: #4a6358;
  --border: #dfe7e3;
  --neutral: #f1f3f3;
  --red: #d94f3d;
  --red-light: #fdecea;
  --radius: 0.625rem;
  --card-shadow: 0 1px 2px rgba(15, 31, 24, 0.05);
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234a6358' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

/* Theming has three states, driven by a `data-theme` attribute on <html>
   that js/theme.js sets:

     - data-theme="dark"   -> dark, whatever the OS says
     - data-theme="light"  -> light, whatever the OS says
     - attribute absent    -> follow prefers-color-scheme (the default)

   "System" is the *absence* of the attribute, not data-theme="system", which
   is what lets the OS preference resolve in pure CSS below — so a visitor who
   never touches the toggle gets the right theme with JavaScript disabled and
   with no flash of the wrong one. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --surface: #121a16;
    --card: #121a16;
    --accent: #1ec46b;
    --accent-dark: #16a34a;
    --accent-light: #16281f;
    --accent-line: rgba(30, 196, 107, 0.3);
    --accent-hover: rgba(30, 196, 107, 0.18);
    --text-primary: #e8f0ec;
    --text-secondary: #9db3a8;
    --border: #243029;
    --neutral: #1a231e;
    --red: #f0715e;
    --red-light: #2a1512;
    --card-shadow: none;
    --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239db3a8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  }
}

/* The same dark tokens again, for an explicit data-theme="dark" — i.e. the
   visitor chose dark while their OS is in light mode.

   This duplicates the block above because CSS cannot share one declaration
   block between a media query and a plain selector, and the two cases are
   genuinely different: above is "no choice made, OS says dark", this is
   "choice made". KEEP THE VALUES IN SYNC — a token added to one must be added
   to the other. (The reverse case needs nothing: an explicit
   data-theme="light" is excluded by the :not() above, so :root's own light
   values already win.) */
:root[data-theme="dark"] {
    --surface: #121a16;
    --card: #121a16;
    --accent: #1ec46b;
    --accent-dark: #16a34a;
    --accent-light: #16281f;
    --accent-line: rgba(30, 196, 107, 0.3);
    --accent-hover: rgba(30, 196, 107, 0.18);
    --text-primary: #e8f0ec;
    --text-secondary: #9db3a8;
    --border: #243029;
    --neutral: #1a231e;
    --red: #f0715e;
    --red-light: #2a1512;
    --card-shadow: none;
    --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239db3a8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-family: var(--font-sans);
  font-optical-sizing: auto;
  font-variation-settings: "GRAD" 0;
}

body {
  background: var(--surface);
  color: var(--text-primary);
  min-height: 100vh;
}

.hidden { display: none !important; }

.layout {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
}

@media (min-width: 1024px) {
  .layout {
    grid-template-columns: 340px 1fr;
    grid-template-rows: 1fr;
  }
}

.brand-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 1.5rem;
  height: 6rem;
  background: var(--accent);
  padding: 0.5rem 1.5rem;
  overflow: hidden;
}

@media (min-width: 1024px) {
  .brand-panel {
    height: auto;
    align-items: flex-start;
    padding: 4rem 3.25rem;
  }
}

/* Sits in the brand panel, which is brand green in both themes — so the
   control is styled against that green (translucent white) rather than
   against the themed surface tokens. */
.theme-toggle {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.125rem;
  padding: 0.1875rem;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
}

@media (min-width: 1024px) {
  .theme-toggle {
    top: 1.25rem;
    right: 1.25rem;
  }
}

.theme-toggle__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, 0.75);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.theme-toggle__btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.theme-toggle__btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 1px;
}

/* aria-pressed is the source of truth for which theme is active, so the
   active styling keys off it rather than a separate class. */
.theme-toggle__btn[aria-pressed="true"] {
  background: #fff;
  color: var(--accent-dark);
}

.theme-toggle__btn svg {
  width: 0.9375rem;
  height: 0.9375rem;
}

.brand-logo {
  height: 4.25rem;
  width: auto;
  max-width: 100%;
  position: relative;
  z-index: 1;
}

@media (min-width: 1024px) {
  .brand-logo { height: auto; width: 20rem; }
}

.brand-rider {
  display: none;
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  width: 100%;
  height: 49%;
  object-fit: cover;
  object-position: bottom;
}

@media (min-width: 1024px) {
  .brand-rider { display: block; }
}

.form-area {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 2rem 1rem;
}

@media (min-width: 1024px) {
  .form-area { align-items: center; padding: 3rem 2rem; }
}

.form-shell {
  width: 100%;
  max-width: 28rem;
}

@media (min-width: 1024px) {
  .form-shell { max-width: 32rem; }
}

.capture-card {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: calc(var(--radius) * 1.8);
  padding: 1.5rem;
  box-shadow: var(--card-shadow);
}

@media (min-width: 1024px) {
  .capture-card { padding: 2rem; }
}

.capture-card__header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  text-align: center;
}

.step-icon {
  width: 2rem;
  height: 2rem;
  color: var(--accent);
  flex-shrink: 0;
}

.capture-card__header h1 { font-size: 1.125rem; font-weight: 700; }

.subtitle { font-size: 0.875rem; color: var(--text-secondary); }

.capture-card__body {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.field { display: flex; flex-direction: column; gap: 0.375rem; }

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

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

label { font-size: 0.875rem; font-weight: 500; }

.required { color: var(--red); margin-left: 0.125rem; }

input, select {
  height: 2.25rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 0.8);
  padding: 0 0.75rem;
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--surface);
  color-scheme: light dark;
}

select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2rem;
  background-image: var(--chevron);
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  background-size: 1.1rem;
}

input::placeholder { color: var(--text-secondary); opacity: 0.8; }

input:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

input[aria-invalid="true"], select[aria-invalid="true"], input.invalid, select.invalid {
  border-color: var(--red);
}

.phone-row { display: flex; }

.phone-row input:first-child,
.phone-row select:first-child {
  width: 6rem;
  flex-shrink: 0;
  border-right: none;
  border-radius: calc(var(--radius) * 0.8) 0 0 calc(var(--radius) * 0.8);
  background-color: var(--neutral);
  color: var(--text-secondary);
  text-align: center;
}

.phone-row input:last-child,
.phone-row select:last-child {
  border-radius: 0 calc(var(--radius) * 0.8) calc(var(--radius) * 0.8) 0;
  flex: 1;
}

.field-error {
  font-size: 0.8125rem;
  color: var(--red);
  min-height: 0;
}

.field-error:empty { display: none; }

.form-error {
  font-size: 0.875rem;
  color: var(--red);
}

/* .field's default flex-direction: column already stacks the label row
   above the error text correctly — this used to force the whole block into
   a row, which shoved the error text beside the checkbox instead of below
   it. checkbox-field needs no override; only .checkbox-label itself (the
   checkbox + its text) should lay out as a row. */

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--text-secondary);
  cursor: pointer;
}

.checkbox-label input {
  width: 1rem;
  height: 1rem;
  margin-top: 0.125rem;
  flex-shrink: 0;
  accent-color: var(--accent);
}

.checkbox-label input[aria-invalid="true"] {
  outline: 2px solid var(--red);
  outline-offset: 1px;
  border-radius: 2px;
}

.checkbox-label a { color: var(--accent); text-decoration: underline; white-space: nowrap; }

.radio-field { border: none; }

.radio-field legend {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.radio-options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.5rem;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 400;
  cursor: pointer;
  white-space: nowrap;
}

.radio-label input { accent-color: var(--accent); width: 1rem; height: 1rem; }

.fast-track-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border: 1px solid var(--accent-line);
  background: var(--accent-light);
  border-radius: calc(var(--radius) * 1.4);
  padding: 1rem;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  color: var(--text-primary);
}

.fast-track-banner:hover { background: var(--accent-hover); }

.fast-track-banner__icon {
  width: 1.25rem;
  height: 1.25rem;
  color: var(--accent);
  flex-shrink: 0;
}

.fast-track-banner__chevron {
  width: 1rem;
  height: 1rem;
  color: var(--accent);
  flex-shrink: 0;
}

.fast-track-banner__text { display: flex; flex-direction: column; flex: 1; }

.fast-track-banner__text strong { font-size: 0.875rem; font-weight: 600; }

.fast-track-banner__text small { font-size: 0.75rem; color: var(--text-secondary); }

.btn {
  height: 2.5rem;
  width: 100%;
  border-radius: calc(var(--radius) * 0.8);
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-dark); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text-primary);
}
.btn-outline:hover:not(:disabled) { background: var(--neutral); }
