:root {
  --navy: #1E3A5F;
  --navy-light: #2C5282;
  --siena: #7C2D12;
  --siena-hover: #9A3A17;
  --cream: #FDFAF6;
  --cream-dark: #F5EFE6;
  --white: #FFFFFF;
  --text: #1F2937;
  --text-muted: #6B7280;
  --text-light: #9CA3AF;
  --border: #E5DDD5;
  --border-focus: #7C2D12;
  --success: #2D6A4F;
  --error: #DC2626;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 4px 6px rgba(0,0,0,0.05), 0 10px 30px rgba(0,0,0,0.10);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--cream);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ── */
.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 20px;
  width: 100%;
}

.container-wide {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 20px;
  width: 100%;
}

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

.site-header .inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.logo-img {
  height: 34px;
  width: auto;
}

.header-link {
  font-size: 14px;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s;
}

.header-link:hover { color: var(--siena); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  text-decoration: none;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

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

.btn-primary {
  background: var(--siena);
  color: var(--white);
  width: 100%;
  padding: 14px 24px;
  font-size: 16px;
}

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

.btn-secondary {
  background: transparent;
  color: var(--text-muted);
  border: 1.5px solid var(--border);
  padding: 12px 20px;
}

.btn-secondary:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  padding: 8px 12px;
  font-weight: 500;
}

.btn-ghost:hover { color: var(--siena); }

.btn-navy {
  background: var(--navy);
  color: var(--white);
  width: 100%;
  padding: 14px 24px;
  font-size: 16px;
}

.btn-navy:hover { background: var(--navy-light); }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ── Form elements ── */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}

.form-label .optional {
  color: var(--text-light);
  font-weight: 400;
  margin-left: 4px;
}

input[type="text"],
input[type="email"],
input[type="number"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: inherit;
  background: var(--white);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
  -webkit-appearance: none;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(124, 45, 18, 0.08);
}

input::placeholder,
textarea::placeholder { color: var(--text-light); }

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

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

/* ── Gender select ── */
.gender-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.gender-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 16px;
  background: var(--white);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  color: var(--text);
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.gender-card .emoji { font-size: 32px; }

.gender-card:hover {
  border-color: var(--siena);
  background: rgba(124, 45, 18, 0.03);
}

.gender-card.selected {
  border-color: var(--siena);
  background: rgba(124, 45, 18, 0.06);
  color: var(--siena);
}

.gender-card:active { transform: scale(0.97); }

/* ── Priority cards ── */
.priority-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.priority-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 14px;
  background: var(--white);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.priority-card .p-emoji { font-size: 22px; }

.priority-card .p-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.priority-card:hover {
  border-color: var(--siena);
  background: rgba(124, 45, 18, 0.03);
}

.priority-card.selected {
  border-color: var(--siena);
  background: rgba(124, 45, 18, 0.06);
}

.priority-card.selected .p-label { color: var(--siena); }

/* ── Radio / Checkbox group ── */
.radio-group,
.check-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.radio-option,
.check-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  background: var(--white);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.15s;
}

.radio-option:has(input:checked),
.check-option:has(input:checked) {
  border-color: var(--siena);
  background: rgba(124, 45, 18, 0.04);
}

.radio-option input,
.check-option input {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  accent-color: var(--siena);
  cursor: pointer;
}

.radio-option input,
.check-option input {
  width: auto;
  padding: 0;
  border: none;
  box-shadow: none;
}

.radio-option label,
.check-option label {
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  flex: 1;
}

/* ── Step indicator ── */
.step-header {
  padding: 24px 0 8px;
  text-align: center;
}

.step-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 20px;
}

.step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.2s, transform 0.2s;
}

.step-dot.active {
  background: var(--siena);
  transform: scale(1.2);
}

.step-dot.done { background: var(--text-muted); }

/* ── Step nav ── */
.step-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0 32px;
  gap: 12px;
}

.step-nav .skip-link {
  font-size: 14px;
  color: var(--text-light);
  text-decoration: none;
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
  padding: 4px;
}

.step-nav .skip-link:hover { color: var(--text-muted); }

/* ── Children list ── */
.child-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.child-row input[type="text"] { flex: 2; }
.child-row input[type="number"] { flex: 1; min-width: 0; }

.child-remove {
  padding: 12px 14px;
  background: none;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
  transition: border-color 0.15s, color 0.15s;
}

.child-remove:hover {
  border-color: var(--error);
  color: var(--error);
}

.add-child-btn {
  background: none;
  border: none;
  font-size: 14px;
  color: var(--siena);
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  padding: 4px 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.add-child-btn:hover { text-decoration: underline; }

/* ── Channel cards ── */
.channel-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.channel-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  background: var(--white);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  position: relative;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}

.channel-card:hover:not(.disabled) {
  border-color: var(--siena);
  background: rgba(124, 45, 18, 0.03);
}

.channel-card.selected {
  border-color: var(--siena);
  background: rgba(124, 45, 18, 0.06);
}

.channel-card.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.channel-icon {
  font-size: 28px;
  flex-shrink: 0;
}

.channel-info { flex: 1; text-align: left; }

.channel-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.channel-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
}

.channel-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--cream-dark);
  color: var(--text-muted);
}

.channel-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, background 0.15s;
}

.channel-card.selected .channel-check {
  background: var(--siena);
  border-color: var(--siena);
  color: white;
  font-size: 12px;
}

/* ── Custody grid ── */
.custody-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.custody-option {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  background: var(--white);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.custody-option:hover {
  border-color: var(--siena);
  background: rgba(124, 45, 18, 0.03);
}

.custody-option.selected {
  border-color: var(--siena);
  background: rgba(124, 45, 18, 0.06);
}

.custody-option-icon {
  font-size: 24px;
  flex-shrink: 0;
  width: 40px;
  text-align: center;
}

.custody-option-text { flex: 1; }

.custody-option-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.custody-option-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Days of week grid (for custom custody) ── */
.days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-top: 14px;
}

.day-btn {
  aspect-ratio: 1;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  background: var(--white);
  font-family: inherit;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  padding: 0;
}

.day-btn.papa {
  background: #EBF4FF;
  border-color: #378ADD;
  color: #1A5EA3;
}

.day-btn.mamma {
  background: #FEF0F4;
  border-color: #D4537E;
  color: #A0284F;
}

/* ── Alerts / banners ── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 16px;
}

.alert-info {
  background: #EFF6FF;
  color: #1E40AF;
  border: 1px solid #BFDBFE;
}

.alert-success {
  background: #F0FDF4;
  color: #166534;
  border: 1px solid #BBF7D0;
}

.alert-error {
  background: #FEF2F2;
  color: #991B1B;
  border: 1px solid #FECACA;
}

/* ── Spinner ── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

.spinner-dark {
  border-color: rgba(124, 45, 18, 0.2);
  border-top-color: var(--siena);
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 60px 20px;
  text-align: center;
}

/* ── Typography ── */
.page-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -0.3px;
  line-height: 1.3;
  margin-bottom: 8px;
}

.page-subtitle {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 28px;
}

.section-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

/* ── Footer ── */
.site-footer {
  margin-top: auto;
  padding: 24px 0;
  text-align: center;
  border-top: 1px solid var(--border);
}

.site-footer a {
  font-size: 13px;
  color: var(--text-light);
  text-decoration: none;
  margin: 0 10px;
}

.site-footer a:hover { color: var(--text-muted); }

/* ── Divider ── */
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--text-light);
  font-size: 13px;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Hidden ── */
.hidden { display: none !important; }

/* ── Grazie page ── */
.success-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(45, 106, 79, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin: 0 auto 20px;
}

/* ── Responsive ── */
@media (max-width: 360px) {
  .gender-grid { grid-template-columns: 1fr 1fr; }
  .priority-grid { grid-template-columns: 1fr 1fr; }
  .page-title { font-size: 21px; }
}
