/* Royal Pure Dairy — registration portal
   Tokens mirror the internal apps (dairy-primary #176B4D family). */

:root {
  --primary: #176b4d;
  --primary-dark: #10533c;
  --primary-soft: #e8f3ee;
  --primary-very-soft: #f3f8f5;
  --bg: #f7f7f5;
  --white: #ffffff;
  --text: #171717;
  --text-2: #525252;
  --muted: #737373;
  --border: #e5e5e0;
  --border-strong: #d4d4ce;
  --error: #dc2626;
  --error-bg: #fef2f2;
  --success: #16a34a;
  --success-bg: #f0fdf4;
  --warning: #d97706;
  --warning-bg: #fffbeb;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(23, 107, 77, 0.06);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.wrap {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ── Header ─────────────────────────────────────────── */
.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 500;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}

.brand-mark {
  font-size: 26px;
  background: var(--primary-soft);
  border-radius: 12px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
}

.brand-text {
  font-weight: 800;
  font-size: 15px;
  line-height: 1.15;
  display: flex;
  flex-direction: column;
}

.brand-text small {
  font-weight: 500;
  font-size: 11px;
  color: var(--muted);
}

.link-btn {
  border: 0;
  background: none;
  color: var(--primary);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  padding: 8px 4px;
}

.link-btn:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

/* ── Hero ───────────────────────────────────────────── */
.hero {
  text-align: center;
  padding: 30px 4px 20px;
}

.hero h1 {
  font-size: clamp(22px, 5.4vw, 30px);
  line-height: 1.25;
  margin: 0 0 10px;
  letter-spacing: -0.02em;
}

.hero h1 br {
  display: none;
}

.hero p {
  margin: 0 auto;
  max-width: 460px;
  color: var(--text-2);
  font-size: 14px;
}

/* ── Cards ──────────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 16px;
  margin-bottom: 24px;
}

.card h2 {
  margin: 0 0 6px;
  font-size: 18px;
}

/* ── Steps ──────────────────────────────────────────── */
.steps {
  list-style: none;
  display: flex;
  margin: 0 0 22px;
  padding: 0;
  gap: 4px;
}

.steps li {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted);
  position: relative;
}

.steps .dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--bg);
  border: 2px solid var(--border);
  font-size: 13px;
  color: var(--muted);
  transition: all 0.2s;
  z-index: 1;
}

.steps li:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 14px;
  left: calc(50% + 16px);
  right: calc(-50% + 16px);
  height: 2px;
  background: var(--border);
}

.steps li.done .dot,
.steps li.active .dot {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.steps li.done::after {
  background: var(--primary);
}

.steps li.active .lbl,
.steps li.done .lbl {
  color: var(--primary-dark);
}

/* ── Panels / fields ────────────────────────────────── */
.panel {
  display: none;
}

.panel.active {
  display: block;
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.field {
  display: block;
  margin-bottom: 14px;
}

.field > span {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text);
}

.field b {
  color: var(--error);
}

input,
textarea,
select {
  width: 100%;
  font: inherit;
  font-size: 16px;
  padding: 12px 14px;
  border: 1.5px solid var(--border-strong);
  border-radius: 12px;
  background: var(--white);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}

input::placeholder,
textarea::placeholder {
  color: #a3a3a3;
  font-size: 14px;
}

input:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(23, 107, 77, 0.12);
}

input.invalid,
textarea.invalid {
  border-color: var(--error);
  background: var(--error-bg);
}

textarea {
  resize: vertical;
  min-height: 52px;
}

.row2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.phone {
  display: flex;
  align-items: stretch;
  border: 1.5px solid var(--border-strong);
  border-radius: 12px;
  overflow: hidden;
  background: var(--white);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.phone:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(23, 107, 77, 0.12);
}

.phone input {
  border: 0;
  box-shadow: none !important;
  border-radius: 0;
}

.phone input.invalid {
  background: transparent;
}

.phone .prefix {
  display: grid;
  place-items: center;
  padding: 0 12px;
  background: var(--primary-very-soft);
  color: var(--primary-dark);
  font-weight: 700;
  font-size: 15px;
  border-right: 1.5px solid var(--border);
}

.hint {
  font-size: 12.5px;
  color: var(--muted);
  margin: 4px 0 0;
}

.form-error {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid #fecaca;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
  margin: 4px 0 12px;
}

/* ── Map ────────────────────────────────────────────── */
.map-box {
  margin-top: 6px;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  background: var(--primary-very-soft);
}

.map-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.map-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--primary-dark);
}

#map {
  height: 240px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #e2e8e4;
  z-index: 1;
}

.coords {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  margin: 8px 0 0;
  font-variant-numeric: tabular-nums;
}

/* ── Choice grids (milk type / shift) ──────────────── */
.choice-grid {
  border: 0;
  padding: 0;
  margin: 0 0 16px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.choice-grid legend {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
  padding: 0;
}

.choice-grid legend b {
  color: var(--error);
}

.choice-grid label {
  cursor: pointer;
}

.choice-grid input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice-grid span {
  display: block;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  padding: 12px 6px;
  border: 1.5px solid var(--border-strong);
  border-radius: 12px;
  background: var(--white);
  color: var(--text-2);
  transition: all 0.15s;
  min-height: 48px;
}

.choice-grid input:checked + span {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-dark);
  box-shadow: 0 0 0 2px rgba(23, 107, 77, 0.15);
}

.choice-grid input:focus-visible + span {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ── Review list ───────────────────────────────────── */
.review {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.review li {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 14px;
  font-size: 13.5px;
  border-bottom: 1px solid var(--border);
}

.review li:last-child {
  border-bottom: 0;
}

.review .k {
  color: var(--muted);
  font-weight: 600;
  flex-shrink: 0;
}

.review .v {
  font-weight: 700;
  text-align: right;
  word-break: break-word;
}

/* ── Buttons ───────────────────────────────────────── */
.wizard-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.primary-btn {
  appearance: none;
  border: 0;
  background: var(--primary);
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 800;
  padding: 13px 22px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}

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

.primary-btn:active {
  transform: scale(0.99);
}

.primary-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.ghost-btn {
  appearance: none;
  background: var(--white);
  border: 1.5px solid var(--border-strong);
  color: var(--text-2);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  padding: 11px 18px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s;
}

.ghost-btn:hover {
  background: var(--bg);
}

.grow {
  flex: 1;
}

.full {
  width: 100%;
}

/* ── Success ───────────────────────────────────────── */
.success {
  text-align: center;
}

.success-icon {
  width: 64px;
  height: 64px;
  margin: 4px auto 12px;
  border-radius: 50%;
  background: var(--success-bg);
  border: 2px solid var(--success);
  color: var(--success);
  font-size: 34px;
  font-weight: 900;
  display: grid;
  place-items: center;
}

.success p {
  color: var(--text-2);
  font-size: 14.5px;
  margin: 6px auto 14px;
  max-width: 420px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 800;
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 18px;
}

.status-chip.pending {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid #fde68a;
}

.status-chip.verified {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid #bbf7d0;
}

.status-chip.rejected {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid #fecaca;
}

.status-chip.not_found {
  background: var(--bg);
  color: var(--muted);
  border: 1px solid var(--border);
}

.success-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ── Track status ──────────────────────────────────── */
.status-box {
  margin-top: 14px;
  border-radius: 12px;
  padding: 14px;
  font-size: 14px;
  border: 1px solid var(--border);
  background: var(--bg);
}

.status-box .status-chip {
  margin-bottom: 8px;
}

.status-box p {
  margin: 0;
  color: var(--text-2);
}

.status-box.error {
  background: var(--error-bg);
  border-color: #fecaca;
  color: var(--error);
  font-weight: 600;
}

/* ── Footer ───────────────────────────────────────── */
.site-footer {
  margin-top: auto;
  background: var(--primary-dark);
  color: #d6ebe2;
  padding: 22px 0;
  text-align: center;
  font-size: 13px;
}

.site-footer p {
  margin: 0 0 6px;
}

.site-footer .muted {
  color: #86b8a5;
  font-size: 12px;
}

/* ── Small screens ────────────────────────────────── */
@media (max-width: 480px) {
  .row2 {
    grid-template-columns: 1fr;
  }

  .choice-grid {
    grid-template-columns: 1fr;
  }

  .hero h1 br {
    display: block;
  }

  .success-actions {
    flex-direction: column;
  }
}

[hidden] {
  display: none !important;
}
