:root {
  --ink: #13201b;
  --muted: #64706b;
  --green: #102820;
  --leaf: #2f6f5e;
  --gold: #d9a441;
  --red: #b64035;
  --cream: #f8f4ec;
  --paper: #fffdf8;
  --line: #ded7c8;
  --shadow: 0 22px 70px rgba(16, 40, 32, .14);
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  background:
    linear-gradient(90deg, rgba(16,40,32,.05) 1px, transparent 1px),
    linear-gradient(0deg, rgba(16,40,32,.04) 1px, transparent 1px),
    var(--cream);
  background-size: 42px 42px;
  color: var(--ink);
  letter-spacing: 0;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }

.app-shell {
  min-height: 100vh;
  display: grid;
  place-items: start center;
  padding: clamp(14px, 3vw, 34px);
}

.form-surface {
  position: relative;
  width: min(930px, 100%);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.form-surface::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 12% 16%, rgba(47, 111, 94, .08), transparent 26%),
    linear-gradient(135deg, rgba(217, 164, 65, .08), transparent 34%);
}

.form-header,
#draftBanner,
#formArea,
.success {
  position: relative;
  z-index: 2;
}

.sport-motion {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.sport-ball {
  position: absolute;
  border-radius: 50%;
  opacity: .18;
  filter: drop-shadow(0 12px 18px rgba(16, 40, 32, .16));
  transform: translateZ(0);
}

.basketball {
  width: 82px;
  height: 82px;
  top: 98px;
  inset-inline-end: clamp(20px, 6vw, 72px);
  background:
    radial-gradient(circle at 34% 28%, rgba(255,255,255,.4), transparent 18%),
    linear-gradient(135deg, #e68b31, #b95125);
  animation: ball-drift 9s ease-in-out infinite;
}

.basketball::before,
.basketball::after {
  content: "";
  position: absolute;
  inset: 10px;
  border: 2px solid rgba(75, 28, 12, .72);
  border-left-width: 0;
  border-right-width: 0;
  border-radius: 50%;
}

.basketball::after {
  inset: 0;
  border: 0;
  background:
    linear-gradient(90deg, transparent 47%, rgba(75, 28, 12, .72) 48%, rgba(75, 28, 12, .72) 52%, transparent 53%),
    linear-gradient(0deg, transparent 47%, rgba(75, 28, 12, .72) 48%, rgba(75, 28, 12, .72) 52%, transparent 53%);
}

.football {
  width: 64px;
  height: 64px;
  top: 250px;
  inset-inline-start: clamp(18px, 5vw, 56px);
  background:
    radial-gradient(circle at 50% 50%, rgba(20, 24, 31, .9) 0 13%, transparent 14%),
    radial-gradient(circle at 23% 30%, rgba(20, 24, 31, .8) 0 10%, transparent 11%),
    radial-gradient(circle at 76% 30%, rgba(20, 24, 31, .8) 0 10%, transparent 11%),
    radial-gradient(circle at 31% 78%, rgba(20, 24, 31, .8) 0 10%, transparent 11%),
    radial-gradient(circle at 70% 78%, rgba(20, 24, 31, .8) 0 10%, transparent 11%),
    linear-gradient(135deg, #fff, #dfe5e1);
  border: 1px solid rgba(19, 32, 27, .22);
  animation: ball-drift 11s ease-in-out 1.2s infinite reverse;
}

@keyframes ball-drift {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(0deg); }
  45% { transform: translate3d(10px, -13px, 0) rotate(10deg); }
  70% { transform: translate3d(-8px, 7px, 0) rotate(-7deg); }
}

.form-header,
.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px clamp(16px, 4vw, 34px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 248, .92);
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.brand-lockup img { flex: none; }
.brand-lockup strong {
  display: block;
  font-size: clamp(1rem, 2.6vw, 1.18rem);
  line-height: 1.2;
}
.brand-lockup span {
  display: block;
  color: var(--muted);
  font-size: .88rem;
  margin-top: 2px;
}

.lang-switch {
  display: grid;
  grid-template-columns: repeat(3, 42px);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  flex: none;
}
.lang-switch button {
  min-height: 38px;
  border: 0;
  border-inline-start: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-weight: 800;
}
.lang-switch button:first-child { border-inline-start: 0; }
.lang-switch button.active {
  background: var(--green);
  color: var(--cream);
}

#formArea,
.success {
  padding: clamp(18px, 4vw, 38px);
}

.progress {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 6px;
  margin-bottom: 26px;
}
.progress span {
  display: block;
  height: 7px;
  border-radius: 99px;
  background: #e7e0d2;
}
.progress span.done { background: var(--gold); }
.progress span.active { background: var(--leaf); }

.step-kicker {
  margin: 0 0 6px;
  color: var(--leaf);
  font-weight: 800;
  font-size: .83rem;
}

h1 {
  margin: 0 0 22px;
  font-size: clamp(1.55rem, 4vw, 2.35rem);
  line-height: 1.12;
  letter-spacing: 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.form-grid .full { grid-column: 1 / -1; }

.field {
  min-width: 0;
}
.field label,
.choice-field > span,
.consent label,
.admin-notes label,
.login-box label {
  display: block;
  color: var(--ink);
  font-size: .88rem;
  font-weight: 800;
  margin-bottom: 7px;
}
.req { color: var(--red); }
.hint {
  color: var(--muted);
  font-size: .8rem;
  font-weight: 600;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  min-height: 48px;
  padding: 11px 13px;
  outline: none;
}
textarea {
  min-height: 98px;
  resize: vertical;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--leaf);
  box-shadow: 0 0 0 4px rgba(47, 111, 94, .15);
}

.choice-field {
  margin: 0;
}
.choice-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}
.choice-row button {
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  padding: 10px 12px;
  text-align: center;
}
.choice-row button.active {
  border-color: var(--green);
  background: #edf5f1;
  color: var(--green);
  box-shadow: inset 0 0 0 1px var(--green);
}

.panel {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 18px;
}
.compact { max-width: 430px; }

.section-note {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: .94rem;
}
.section-title {
  margin: 18px 0 10px;
  color: var(--green);
  font-size: 1rem;
}

.sibling-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fbfaf6;
  margin-bottom: 12px;
}
.sibling-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.sibling-card h2 {
  margin: 0;
  font-size: 1rem;
}
.icon-button {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--red);
  font-weight: 900;
}
.add-row {
  width: 100%;
  min-height: 50px;
  border: 1px dashed var(--leaf);
  border-radius: 8px;
  background: #fff;
  color: var(--green);
  font-weight: 900;
}

.consent {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf6;
}
.consent input {
  width: 20px;
  height: 20px;
  min-height: auto;
  margin-top: 2px;
  flex: none;
}
.consent label {
  margin: 0;
  line-height: 1.55;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.summary-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 15px;
  background: #fff;
}
.summary-card h2 {
  margin: 0 0 10px;
  color: var(--green);
  font-size: 1rem;
}
.kv {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 0;
  border-top: 1px solid #eee8da;
}
.kv span {
  color: var(--muted);
  font-size: .82rem;
}
.kv b {
  text-align: end;
  font-size: .9rem;
  overflow-wrap: anywhere;
}

.form-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
}
.primary, .secondary, .filters button, .whatsapp {
  min-height: 46px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 10px 18px;
  font-weight: 900;
}
.primary {
  background: var(--green);
  color: var(--cream);
}
.primary:hover { background: #184031; }
.secondary {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}
.primary:disabled {
  opacity: .62;
  cursor: wait;
}

.field.error input,
.field.error textarea,
.field.error select,
.choice-field.error .choice-row button,
.consent.error {
  border-color: var(--red);
}
.error-text {
  display: none;
  margin-top: 5px;
  color: var(--red);
  font-size: .78rem;
  font-weight: 700;
}
.field.error .error-text,
.choice-field.error .error-text,
.consent.error .error-text { display: block; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; }

.draft-banner {
  margin: 18px clamp(16px, 4vw, 34px) 0;
  padding: 13px;
  border: 1px solid var(--gold);
  background: #fff9ea;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.draft-banner div { display: flex; gap: 8px; }
.draft-banner button {
  border: 0;
  border-radius: 8px;
  min-height: 38px;
  padding: 8px 12px;
  font-weight: 800;
  background: var(--gold);
  color: var(--ink);
}
.draft-banner button:last-child {
  background: #efe8da;
}

.success {
  text-align: center;
}
.success-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--leaf);
  color: #fff;
  font-size: 2rem;
  font-weight: 900;
}
.success h1 { margin-bottom: 10px; }
.success p {
  max-width: 660px;
  margin: 0 auto 18px;
  color: var(--muted);
}
.ref-box {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-weight: 900;
}

.admin-shell { background: #f3f0e8; }
.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 5;
}
.admin-topbar nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.admin-topbar nav a {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 9px 12px;
  font-weight: 800;
  color: var(--green);
}
.admin-layout {
  display: grid;
  grid-template-columns: minmax(310px, 390px) minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
}
.lead-sidebar,
.lead-detail {
  min-width: 0;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}
.stats-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}
.stats-grid b { display: block; font-size: 1.35rem; }
.stats-grid span { color: var(--muted); font-size: .78rem; font-weight: 800; }
.filters {
  display: grid;
  gap: 9px;
  margin-bottom: 12px;
}
.filters button {
  background: var(--green);
  color: #fff;
}
.lead-list {
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 245px);
  overflow: auto;
  padding-inline-end: 3px;
}
.lead-row {
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}
.lead-row.active {
  border-color: var(--leaf);
  box-shadow: inset 4px 0 0 var(--leaf);
}
[dir="rtl"] .lead-row.active { box-shadow: inset -4px 0 0 var(--leaf); }
.lead-row strong,
.lead-row span,
.lead-row em { display: block; }
.lead-row span { color: var(--muted); font-size: .86rem; margin-top: 3px; }
.lead-row em { color: var(--leaf); font-size: .76rem; font-style: normal; margin-top: 5px; font-weight: 800; }

.detail-head {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 18px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 14px;
}
.detail-head p,
.detail-head span {
  margin: 0;
  color: var(--muted);
  font-size: .86rem;
}
.detail-head h1 {
  margin: 4px 0;
  font-size: 1.7rem;
}
.whatsapp {
  background: #eaf7ef;
  color: #155c38;
}
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.detail-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 15px;
}
.detail-card h2 {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 1rem;
}
.admin-notes {
  margin-top: 14px;
}
.admin-notes label + label {
  margin-top: 12px;
}

.admin-login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
  background: var(--cream);
}
.login-box {
  width: min(430px, 100%);
}
.login-box .brand-lockup {
  margin-bottom: 14px;
}
.login-box h1 {
  font-size: 1.55rem;
  margin-bottom: 18px;
}
.login-box label + label {
  margin-top: 12px;
}
.login-box button {
  width: 100%;
  margin-top: 16px;
}
.notice.error {
  border: 1px solid #e4bbb6;
  background: #fff1ef;
  color: var(--red);
  border-radius: 8px;
  padding: 10px;
  font-weight: 800;
}
.empty,
.empty-state {
  color: var(--muted);
  text-align: center;
  padding: 30px 12px;
}

@media (max-width: 760px) {
  .app-shell { padding: 0; place-items: stretch; }
  .form-surface { min-height: 100vh; border: 0; border-radius: 0; }
  .form-header,
  .admin-topbar {
    align-items: flex-start;
    flex-direction: column;
  }
  .form-grid,
  .summary-grid,
  .detail-grid,
  .admin-layout {
    grid-template-columns: 1fr;
  }
  .admin-layout { padding: 12px; }
  .lead-list { max-height: none; }
  .form-actions {
    position: sticky;
    bottom: 0;
    background: rgba(255, 253, 248, .94);
    border-top: 1px solid var(--line);
    padding-top: 12px;
    margin-inline: -18px;
    padding-inline: 18px;
    padding-bottom: 12px;
  }
  .primary, .secondary { flex: 1; padding-inline: 10px; }
  .draft-banner {
    align-items: flex-start;
    flex-direction: column;
  }
  .sport-ball {
    opacity: .1;
  }
  .basketball {
    width: 58px;
    height: 58px;
    top: 130px;
  }
  .football {
    width: 46px;
    height: 46px;
    top: 315px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sport-ball {
    animation: none;
  }
}
