:root {
  --brand: #011264;
  --brand-deep: #000b42;
  --accent: #168cf5;
  --accent-hover: #0877dd;
  --panel: #ffffff;
  --surface: #ffffff;
  --text: #222733;
  --muted: #a4a9b2;
  --placeholder: #c7ccd5;
  --border: #e1e5eb;
  --error: #ef5a5a;
  --field-height: 64px;
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--panel); color: var(--text); }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.apply-layout {
  display: grid;
  grid-template-columns: minmax(420px, 39%) minmax(640px, 61%);
  height: 100dvh;
  min-height: 680px;
  overflow: hidden;
}

.brand-panel {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  overflow: hidden;
  background: var(--brand);
}

.brand-logo-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
  pointer-events: none;
  transform: translateY(clamp(74px, 9vh, 112px));
}

.brand-copy {
  position: absolute;
  top: clamp(58px, 8vh, 96px);
  right: clamp(38px, 5vw, 78px);
  left: clamp(38px, 5vw, 78px);
  z-index: 2;
  color: #fff;
}

.brand-copy h2 {
  margin: 0;
  font-size: clamp(36px, 3.2vw, 52px);
  line-height: 1.15;
  letter-spacing: -.035em;
}

.brand-copy p {
  max-width: 590px;
  margin: 28px 0 0;
  color: rgba(255, 255, 255, .78);
  font-size: clamp(15px, 1.12vw, 18px);
  line-height: 1.9;
}

.form-panel {
  min-width: 0;
  overflow-y: auto;
  background: var(--panel);
  scrollbar-color: rgba(140, 150, 165, .35) transparent;
}

.apply-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 84px;
  padding: 20px clamp(28px, 4vw, 62px);
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  backdrop-filter: blur(16px);
}

.topbar-actions { display: flex; gap: 8px; }

.icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #858b94;
  cursor: pointer;
  transition: color .2s ease, background .2s ease;
}
.icon-button:hover { color: var(--accent); background: rgba(22, 140, 245, .08); }
.icon-button svg { width: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon-button:first-child svg { fill: currentColor; stroke: none; }

.form-shell {
  width: min(100%, 790px);
  margin: 0 auto;
  padding: 28px 44px 76px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 23px;
  color: #9097a1;
  font-size: 13px;
  text-decoration: none;
}
.back-link:hover { color: var(--accent); }
.back-link svg { width: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.form-heading h1 { margin: 0; font-size: clamp(36px, 3.2vw, 46px); line-height: 1.15; letter-spacing: -.02em; }
.form-heading p { margin: 17px 0 40px; color: var(--muted); font-size: 17px; }

.partner-form { display: grid; gap: 26px; }
.form-group { min-width: 0; margin: 0; padding: 0; border: 0; }
.form-group > label,
.form-group > legend {
  display: block;
  margin: 0 0 9px;
  padding: 0;
  color: #505660;
  font-size: 16px;
  font-weight: 500;
}
.form-group > label span,
.form-group > legend span { color: var(--error); }

.form-group input,
.form-group select,
.name-inputs,
.phone-field {
  width: 100%;
  height: var(--field-height);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  background: var(--surface);
  color: var(--text);
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
.form-group > input,
.input-with-action > input { padding: 0 56px 0 19px; font-size: 16px; }
.form-group > input:not(.input-with-action input) { padding-right: 19px; }
.form-group input::placeholder { color: var(--placeholder); }
.form-group select { appearance: none; cursor: pointer; }
.form-group input:focus,
.form-group select:focus,
.name-inputs:focus-within,
.phone-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(22, 140, 245, .11); }

.name-inputs,
.phone-field { display: flex; align-items: center; }
.name-inputs label { flex: 1; min-width: 0; }
.name-inputs input,
.phone-field input,
.phone-field select {
  height: calc(var(--field-height) - 2px);
  border: 0;
  border-radius: 9px;
  box-shadow: none !important;
  background: transparent;
}
.name-inputs input { padding: 0 19px; font-size: 16px; }
.name-inputs label:last-of-type input { padding-right: 46px; }
.field-divider { flex: 0 0 1px; width: 1px; height: 28px; background: var(--border); }
.name-inputs { position: relative; }
.name-icon { position: absolute; right: 14px; width: 26px; fill: none; stroke: #c6cbd3; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.phone-field select { width: 112px; padding: 0 32px 0 19px; font-size: 16px; background-image: linear-gradient(45deg, transparent 50%, #89909a 50%), linear-gradient(135deg, #89909a 50%, transparent 50%); background-position: calc(100% - 18px) 29px, calc(100% - 13px) 29px; background-size: 5px 5px; background-repeat: no-repeat; }
.phone-field input { flex: 1; min-width: 0; padding: 0 19px; font-size: 16px; }

.input-with-action { position: relative; }
.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #b8bdc6;
  cursor: pointer;
}
.password-toggle:hover { color: var(--accent); background: rgba(22, 140, 245, .07); }
.password-toggle svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.password-toggle.is-visible svg { opacity: .55; }

.select-wrap { position: relative; }
.select-wrap select { padding: 0 48px 0 19px; font-size: 16px; }
.select-wrap svg { position: absolute; top: 50%; right: 16px; width: 19px; pointer-events: none; fill: none; stroke: #adb3bc; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; transform: translateY(-50%); }

.field-hint { display: block; margin: 7px 0 0; color: #afb4bd; font-size: 12px; }
.field-error,
.agreement-error { display: none; margin: 6px 0 0; color: var(--error); font-size: 12px; }
.form-group.has-error .field-error,
.agreement-error.is-visible { display: block; }
.form-group.has-error input,
.form-group.has-error select,
.form-group.has-error .name-inputs,
.form-group.has-error .phone-field { border-color: var(--error); }

.agreement { display: flex; align-items: flex-start; gap: 11px; color: #7f858e; font-size: 14px; line-height: 22px; cursor: pointer; }
.agreement input { position: absolute; opacity: 0; pointer-events: none; }
.custom-checkbox { flex: 0 0 20px; display: grid; place-items: center; width: 20px; height: 20px; margin-top: 1px; border: 1px solid #cfd4dc; border-radius: 4px; background: var(--surface); transition: background .2s ease, border-color .2s ease; }
.custom-checkbox svg { width: 15px; fill: none; stroke: #fff; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; opacity: 0; transform: scale(.7); transition: opacity .2s ease, transform .2s ease; }
.agreement input:checked + .custom-checkbox { border-color: var(--accent); background: var(--accent); }
.agreement input:checked + .custom-checkbox svg { opacity: 1; transform: scale(1); }
.agreement input:focus-visible + .custom-checkbox { box-shadow: 0 0 0 3px rgba(22, 140, 245, .16); }
.agreement a { color: #067df2; text-decoration: none; }
.agreement a:hover { text-decoration: underline; }

.submit-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 58px;
  margin-top: 2px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, #1598ff, #0877e7);
  box-shadow: 0 13px 26px rgba(15, 125, 235, .22);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
}
.submit-button:hover { transform: translateY(-1px); box-shadow: 0 16px 30px rgba(15, 125, 235, .28); filter: brightness(1.03); }
.submit-button:active { transform: translateY(0); }
.submit-button svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.form-note { margin: -5px 0 0; color: #b2b7c0; font-size: 11px; line-height: 1.6; text-align: center; }

.success-panel { padding: 90px 0; text-align: center; }
.success-icon { display: grid; place-items: center; width: 68px; height: 68px; margin: 0 auto 24px; border-radius: 50%; background: rgba(22, 140, 245, .11); color: var(--accent); }
.success-icon svg { width: 34px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.success-panel h2 { margin: 0; font-size: 30px; }
.success-panel p { max-width: 440px; margin: 16px auto 28px; color: var(--muted); line-height: 1.75; }
.success-panel a { display: inline-flex; padding: 12px 22px; border: 1px solid var(--border); border-radius: 9px; color: var(--text); text-decoration: none; }
.success-panel a:hover { border-color: var(--accent); color: var(--accent); }

.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }

body.dark {
  --panel: #0b1424;
  --surface: #101c2e;
  --text: #f0f4fa;
  --muted: #7e8da0;
  --placeholder: #667589;
  --border: #26354a;
  color-scheme: dark;
}
body.dark .form-group > label,
body.dark .form-group > legend { color: #c6d0de; }
@media (max-width: 1050px) {
  .apply-layout { grid-template-columns: 34% 66%; }
  .brand-copy { right: 34px; left: 34px; }
  .brand-copy h2 { font-size: 36px; }
  .brand-copy p { margin-top: 20px; font-size: 14px; line-height: 1.8; }
  .form-shell { padding-inline: 34px; }
}

@media (max-width: 760px) {
  .apply-layout { display: block; height: auto; min-height: 100dvh; overflow: visible; }
  .brand-panel { height: 340px; }
  .brand-logo-frame { position: absolute; inset: 0; transform: translateY(72px); }
  .brand-copy { top: 28px; right: 24px; left: 24px; text-align: center; }
  .brand-copy h2 { font-size: 29px; }
  .brand-copy p { max-width: 520px; margin: 12px auto 0; font-size: 13px; line-height: 1.65; }
  .form-panel { overflow: visible; }
  .apply-topbar { min-height: 78px; padding: 14px 20px; }
  .form-shell { padding: 30px 20px 54px; }
  .form-heading p { margin-bottom: 30px; }
}

@media (max-width: 420px) {
  :root { --field-height: 54px; }
  .brand-panel { height: 310px; }
  .brand-logo-frame { transform: translateY(70px); }
  .brand-copy { top: 24px; right: 18px; left: 18px; }
  .brand-copy h2 { font-size: 27px; }
  .brand-copy p { font-size: 12px; }
  .apply-topbar { min-height: 70px; }
  .icon-button { width: 38px; height: 38px; }
  .form-shell { padding-top: 24px; }
  .form-heading h1 { font-size: 30px; }
  .partner-form { gap: 21px; }
  .name-inputs input { padding-inline: 12px; }
  .phone-field select { width: 94px; padding-left: 13px; }
  .agreement { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
