/* hidden elements must stay hidden (display rules below would otherwise override) */
[hidden] { display: none !important; }

/* ============================================================
   Application flow — apply.html
   ============================================================ */

.apply-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: clamp(28px, 3vw, 42px) 0 clamp(26px, 3vw, 38px);
  background: var(--navy);
  color: #fff;
}
.apply-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(80% 90% at 88% 6%, rgba(21, 73, 154, 0.5) 0%, rgba(4, 16, 31, 0) 60%),
    linear-gradient(160deg, #04101f 0%, #061a38 55%, #0a2450 100%);
}
.apply-hero .crumbs { margin-bottom: 22px; }
.apply-hero__head { max-width: 720px; }
.apply-hero__title {
  font-size: clamp(30px, 3.4vw, 46px);
  line-height: 1.04;
  letter-spacing: -0.035em;
  font-weight: 600;
  margin: 10px 0 0;
}
.apply-hero__lead {
  margin-top: 12px;
  font-size: 16px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.72);
}

/* stepper */
.stepper {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: clamp(24px, 3vw, 34px) 0 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}
.stepper li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 14px;
  color: rgba(255, 255, 255, 0.62);
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.stepper li span {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex: none;
}
.stepper li.is-current {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.3);
  color: #fff;
}
.stepper li.is-current span { background: var(--accent); color: #20170a; }
.stepper li.is-done { color: rgba(255, 255, 255, 0.85); }
.stepper li.is-done span { background: rgba(126, 227, 154, 0.9); color: #06251a; }

/* layout */
.apply-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: clamp(24px, 3vw, 40px);
  align-items: start;
  padding: clamp(30px, 4vw, 52px) 0 clamp(50px, 6vw, 80px);
}

.apply-panel {
  background: #fff;
  border: 1px solid var(--n-150);
  border-radius: 24px;
  padding: clamp(22px, 2.6vw, 32px);
  box-shadow: 0 1px 2px rgba(7, 26, 61, 0.04);
}
.astep { display: none; }
.astep.is-active { display: block; }
.astep__head { display: grid; gap: 6px; margin-bottom: 22px; }
.astep__index {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--blue-600);
}
.astep__title {
  font-size: clamp(19px, 1.8vw, 23px);
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--ink);
  margin: 0;
}
.astep__sub { font-size: 14.5px; line-height: 1.55; color: var(--muted); margin: 0; }

/* fields */
.afields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.afield { display: grid; gap: 6px; }
.afield--wide { grid-column: 1 / -1; }
.afield label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--n-700);
  letter-spacing: -0.005em;
}
.afield .req { color: #c0392b; }
.afield input[type="text"],
.afield input[type="email"],
.afield input[type="tel"],
.afield input[type="date"],
.afield select {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--n-200);
  background: #fff;
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.afield select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%23555' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
.afield input:focus,
.afield select:focus {
  outline: 0;
  border-color: var(--blue-400);
  box-shadow: 0 0 0 3px rgba(21, 73, 154, 0.14);
}
.afield .hint { font-size: 12.5px; color: var(--n-400); line-height: 1.45; }
.afield .err {
  display: none;
  font-size: 12.5px;
  font-weight: 500;
  color: #b52a1c;
}
.afield.is-invalid input,
.afield.is-invalid select { border-color: #d6665a; box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.1); }
.afield.is-invalid .err { display: block; }

/* option cards (plan / term) */
.option-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.option {
  position: relative;
  display: grid;
  gap: 4px;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--n-200);
  background: #fff;
  cursor: pointer;
  transition: border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}
.option:hover { border-color: var(--blue-300); }
.option input { position: absolute; opacity: 0; pointer-events: none; }
.option__title { font-size: 15.5px; font-weight: 600; color: var(--ink); }
.option__meta { font-size: 13px; color: var(--muted); }
.option__price { font-size: 16px; font-weight: 600; color: var(--ink); margin-top: 2px; }
.option.is-selected {
  border-color: var(--blue-600);
  background: var(--blue-50);
  box-shadow: 0 0 0 1px var(--blue-600);
}
.option__badge {
  position: absolute;
  top: -9px;
  right: 12px;
  height: 18px;
  padding: 0 8px;
  border-radius: var(--r-full);
  background: var(--accent);
  color: #20170a;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
}

.term-row { display: flex; gap: 8px; flex-wrap: wrap; }
.term {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 18px;
  border-radius: var(--r-full);
  border: 1px solid var(--n-200);
  background: #fff;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--n-600);
  cursor: pointer;
  transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}
.term input { position: absolute; opacity: 0; pointer-events: none; }
.term:hover { border-color: var(--blue-300); color: var(--blue-800); }
.term.is-selected { background: var(--navy); border-color: var(--navy); color: #fff; }

.checkline {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--n-50);
  border: 1px solid var(--n-150);
  font-size: 13.8px;
  line-height: 1.5;
  color: var(--n-700);
}
.checkline input { width: 17px; height: 17px; margin-top: 1px; accent-color: var(--blue-600); flex: none; }
.checkline.is-invalid { border-color: #d6665a; background: #fdf1ef; }

.switchline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--n-150);
  background: #fff;
}
.switchline__text { display: grid; gap: 2px; }
.switchline__title { font-size: 14.5px; font-weight: 600; color: var(--ink); }
.switchline__meta { font-size: 12.5px; color: var(--muted); }
.switch {
  position: relative;
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: var(--n-200);
  border: 0;
  cursor: pointer;
  flex: none;
  transition: background-color 0.18s ease;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(7, 26, 61, 0.25);
  transition: transform 0.18s ease;
}
.switch[aria-checked="true"] { background: var(--blue-600); }
.switch[aria-checked="true"]::after { transform: translateX(18px); }
.switch:disabled { opacity: 0.5; cursor: not-allowed; }

/* uploads */
.uploads { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.upload {
  position: relative;
  display: grid;
  place-items: center;
  gap: 6px;
  padding: 18px 12px;
  min-height: 128px;
  border-radius: 16px;
  border: 1.5px dashed var(--n-300);
  background: var(--n-50);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.16s ease, background-color 0.16s ease;
  overflow: hidden;
}
.upload:hover { border-color: var(--blue-400); background: var(--blue-50); }
.upload input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload__icon { width: 22px; height: 22px; color: var(--blue-600); }
.upload__title { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.upload__meta { font-size: 11.5px; color: var(--n-400); }
.upload img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.upload.is-filled { border-style: solid; border-color: var(--blue-300); background: #fff; }
.upload.is-filled .upload__icon,
.upload.is-filled .upload__title,
.upload.is-filled .upload__meta { display: none; }
.upload__clear {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 0;
  background: rgba(7, 26, 61, 0.75);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  display: none;
  cursor: pointer;
  z-index: 2;
}
.upload.is-filled .upload__clear { display: block; }

/* actions */
.apply-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid var(--n-150);
}
.apply-actions .btn { min-width: 132px; }
.apply-actions .btn[hidden] { display: none !important; }
.apply-actions__note { font-size: 12.5px; color: var(--n-400); }

/* summary */
.apply-summary {
  position: sticky;
  top: 96px;
  display: grid;
  gap: 14px;
}
.summary-card {
  padding: 22px;
  border-radius: 22px;
  background: #fff;
  border: 1px solid var(--n-150);
  box-shadow: 0 1px 2px rgba(7, 26, 61, 0.04);
}
.summary-card__title {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--n-400);
}
.summary-rows { display: grid; gap: 10px; margin-top: 16px; }
.summary-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  font-size: 14px;
  color: var(--n-600);
}
.summary-row span:first-child { color: var(--muted); }
.summary-row strong { color: var(--ink); font-weight: 600; }
.summary-total {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--n-150);
}
.summary-total__label { font-size: 13px; color: var(--muted); }
.summary-total__value {
  font-size: 31px;
  font-weight: 600;
  letter-spacing: -0.035em;
  color: var(--ink);
  line-height: 1;
}
.summary-note { margin-top: 12px; font-size: 12px; line-height: 1.5; color: var(--n-400); }
.summary-list { display: grid; gap: 10px; margin-top: 14px; padding: 0; list-style: none; }
.summary-list li {
  display: grid;
  grid-template-columns: 16px 1fr;
  gap: 9px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--n-600);
}
.summary-list svg { width: 15px; height: 15px; color: var(--blue-600); margin-top: 1px; }

/* review */
.review { display: grid; gap: 0; margin: 0; }
.review__row {
  display: grid;
  grid-template-columns: minmax(140px, 0.6fr) minmax(0, 1.4fr);
  gap: 16px;
  padding: 13px 0;
  border-bottom: 1px solid var(--n-150);
  font-size: 14.5px;
}
.review__row dt { color: var(--muted); }
.review__row dd { margin: 0; color: var(--ink); font-weight: 500; }
.review__row dd a { color: var(--blue-700); text-decoration: underline; text-underline-offset: 2px; }

/* success */
.apply-success {
  display: none;
  padding: clamp(38px, 5vw, 64px) clamp(22px, 3vw, 40px);
  text-align: center;
}
.apply-success.is-visible { display: block; }
.apply-success__icon {
  width: 62px;
  height: 62px;
  margin: 0 auto 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(18, 128, 92, 0.12);
  color: #0d6b4c;
}
.apply-success__icon svg { width: 28px; height: 28px; }
.apply-success__title { font-size: clamp(24px, 2.6vw, 32px); letter-spacing: -0.03em; font-weight: 600; color: var(--ink); margin: 0; }
.apply-success__text { margin: 12px auto 0; max-width: 46ch; font-size: 15px; line-height: 1.6; color: var(--muted); }
.apply-success__ref {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 22px;
  padding: 12px 18px;
  border-radius: 14px;
  background: var(--blue-50);
  border: 1px solid var(--blue-100);
  font-size: 15px;
  color: var(--blue-900);
}
.apply-success__ref b { letter-spacing: 0.04em; }
.apply-success__actions { display: flex; justify-content: center; gap: 12px; margin-top: 26px; flex-wrap: wrap; }
.apply-success__next { margin: 28px auto 0; max-width: 520px; text-align: left; }

@media (max-width: 1000px) {
  .apply-layout { grid-template-columns: 1fr; }
  .apply-summary { position: static; order: -1; }
  .stepper { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .afields, .option-grid, .uploads { grid-template-columns: 1fr; }
  .stepper { grid-template-columns: 1fr; }
  .stepper li { padding: 10px 12px; font-size: 13px; }
  .apply-actions { flex-direction: column-reverse; align-items: stretch; }
  .apply-actions .btn { width: 100%; }
}

/* ---------- plan block (collapsible) ---------- */
.plan-block {
  padding: 18px;
  border-radius: 18px;
  background: var(--n-50);
  border: 1px solid var(--n-150);
  margin-bottom: 26px;
}
.plan-block__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.plan-block__label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--n-500);
}
.plan-edit {
  border: 0;
  background: transparent;
  padding: 0;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--blue-700);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.plan-edit:hover { color: var(--blue-800); }
.plan-block.is-collapsed { background: var(--blue-50); border-color: var(--blue-100); }
.plan-block.is-collapsed .plan-block__head { margin-bottom: 10px; }
.plan-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.plan-summary__main { display: grid; gap: 2px; }
.plan-summary__title { font-size: 15px; font-weight: 600; color: var(--ink); }
.plan-summary__meta { font-size: 13px; color: var(--n-500); }
.plan-summary__price {
  font-size: 23px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--ink);
}

/* ---------- sub-section headings ---------- */
.asub-title {
  margin: 24px 0 12px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--n-500);
}
.asub-hint { margin: 0 0 12px; font-size: 13.5px; line-height: 1.55; color: var(--muted); }

/* ---------- payment box ---------- */
.paybox {
  margin-top: 20px;
  padding: 16px 18px;
  border-radius: 16px;
  background: var(--blue-50);
  border: 1px solid var(--blue-100);
}
.paybox__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  font-size: 14.5px;
  color: var(--n-700);
}
.paybox__row strong {
  font-size: 25px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.paybox__note { margin: 6px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--n-500); }

/* ---------- save indicator ---------- */
.save-note {
  margin-left: auto;
  margin-right: 12px;
  font-size: 12.5px;
  font-weight: 600;
  color: #0d6b4c;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.save-note.is-on { opacity: 1; transform: none; }

@media (max-width: 640px) {
  .save-note { margin: 0 0 6px; text-align: center; }
}
