:root {
  --navy: #14208f;
  --navy-dark: #0c1566;
  --green: #2e7d32;
  --yellow: #ffe600;
  --bg: #f1f4fb;
  --card: #ffffff;
  --text: #1c2340;
  --muted: #6b7394;
  --line: #dde2f1;
  --danger: #d32f2f;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(20, 32, 143, 0.1);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Poppins', system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(circle at 0% 0%, rgba(255, 230, 0, 0.25), transparent 35%),
    radial-gradient(circle at 100% 100%, rgba(20, 32, 143, 0.12), transparent 40%);
  background-attachment: fixed;
  min-height: 100vh;
}

/* ---------- Header ---------- */
/* Full-width blue banner: white text, yellow lining */
.site-header {
  background: linear-gradient(160deg, var(--navy), var(--navy-dark)); color: #fff;
  border-top: 6px solid var(--yellow); border-bottom: 5px solid var(--yellow);
  box-shadow: 0 8px 24px rgba(20, 32, 143, 0.25);
}
.banner-inner { display: flex; align-items: center; gap: 22px; max-width: 1100px; margin: 0 auto; padding: 16px 20px; }
.logo { width: 96px; height: 96px; flex: none; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.35)); }
.org { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.org-short { font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 700; letter-spacing: 0.14em; line-height: 1; color: #fff; }
.org-name { font-size: clamp(0.85rem, 1.8vw, 1.1rem); font-weight: 500; color: #fff; opacity: 0.92; }
.tag { height: 56px; width: auto; max-width: 100%; flex: none; }
.page-intro { max-width: 1100px; margin: 0 auto; padding: 22px 20px 4px; }
.page-intro h1 { margin: 0 0 4px; font-size: clamp(1.3rem, 3vw, 1.9rem); color: var(--navy); line-height: 1.2; }
.page-intro p { margin: 0; color: var(--muted); font-size: 0.92rem; max-width: 640px; }

/* ---------- Layout ---------- */
.layout {
  display: grid; grid-template-columns: 290px 1fr; gap: 24px;
  max-width: 1100px; margin: 0 auto; padding: 12px 20px 40px;
  align-items: start;
}
.layout.single { grid-template-columns: minmax(0, 1fr); }

/* ---------- Sidebar ---------- */
.sidebar {
  position: sticky; top: 16px;
  background: linear-gradient(170deg, var(--navy), var(--navy-dark));
  color: #fff; border-radius: var(--radius); padding: 22px 18px; box-shadow: var(--shadow);
}
.progress-label { font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.8; margin-bottom: 8px; }
.progress { height: 6px; background: rgba(255, 255, 255, 0.2); border-radius: 99px; overflow: hidden; margin-bottom: 18px; }
.progress .bar { height: 100%; background: var(--yellow); border-radius: 99px; transition: width 0.4s ease; }
.sidebar ol { list-style: none; margin: 0; padding: 0; position: relative; }
.step { position: relative; }
.step:not(:last-child)::after {
  content: ''; position: absolute; left: 26px; top: 50px; bottom: -6px; width: 2px; background: rgba(255, 255, 255, 0.2);
}
.step.done:not(:last-child)::after { background: var(--yellow); }
.step button {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  background: none; border: 0; color: inherit; font: inherit; padding: 10px; border-radius: 12px; cursor: pointer;
}
.step button:disabled { cursor: not-allowed; opacity: 0.55; }
.step.current button { background: rgba(255, 255, 255, 0.14); }
.step button:not(:disabled):hover { background: rgba(255, 255, 255, 0.1); }
.badge {
  flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 600; font-size: 0.85rem; border: 2px solid rgba(255, 255, 255, 0.5);
}
.step.current .badge { background: var(--yellow); color: var(--navy-dark); border-color: var(--yellow); }
.step.done .badge { background: var(--green); border-color: var(--green); }
.meta { display: flex; flex-direction: column; }
.meta strong { font-size: 0.92rem; font-weight: 600; }
.meta small { font-size: 0.74rem; opacity: 0.75; }

/* ---------- Card ---------- */
.card { background: var(--card); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); border-top: 6px solid var(--yellow); }
.card-head { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.big-icon { font-size: 1.8rem; width: 56px; height: 56px; display: grid; place-items: center; background: #eef0ff; border-radius: 14px; }
.card-head h2 { margin: 0; font-size: 1.35rem; color: var(--navy); }
.card-head p { margin: 2px 0 0; color: var(--muted); font-size: 0.88rem; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 22px; }
.field.wide { grid-column: 1 / -1; }

/* ---------- Fields ---------- */
.field { margin-bottom: 8px; }
.field-label { display: block; font-size: 0.85rem; font-weight: 500; margin-bottom: 6px; }
.req { color: var(--danger); }
.input {
  width: 100%; padding: 12px 14px; font: inherit; color: inherit; background: #f8f9fe;
  border: 1.5px solid var(--line); border-radius: 10px; outline: none; transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.input:focus { border-color: var(--navy); background: #fff; box-shadow: 0 0 0 4px rgba(20, 32, 143, 0.12); }
select.input { appearance: none; cursor: pointer; padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%2314208f' stroke-width='2'%3E%3Cpath d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; }
.has-error .input { border-color: var(--danger); background: #fff6f6; }
.input-wrap { position: relative; }
.input-wrap .prefix { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.input-wrap .input { padding-left: 32px; }
.field-hint { margin: 6px 0 0; font-size: 0.78rem; color: var(--muted); }
.field-error { margin: 4px 0 0; min-height: 1.1em; font-size: 0.78rem; color: var(--danger); }

.options { display: flex; flex-wrap: wrap; gap: 10px; }
.option {
  position: relative; display: flex; align-items: center; gap: 10px; padding: 10px 16px; cursor: pointer;
  background: #f8f9fe; border: 1.5px solid var(--line); border-radius: 10px; font-size: 0.9rem; transition: all 0.15s;
}
.option:hover { border-color: var(--navy); }
.option input { position: absolute; opacity: 0; pointer-events: none; }
.option .mark { width: 18px; height: 18px; flex: none; border: 2px solid #aab0d0; border-radius: 50%; display: grid; place-items: center; }
.option input[type='checkbox'] + .mark { border-radius: 5px; }
.option.selected { background: #eef0ff; border-color: var(--navy); font-weight: 500; }
.option.selected .mark { border-color: var(--navy); background: var(--navy); }
.option.selected .mark::after { content: '✓'; color: #fff; font-size: 11px; line-height: 1; }
.option:has(input:focus-visible) { box-shadow: 0 0 0 4px rgba(20, 32, 143, 0.18); }
.has-error .option { border-color: var(--danger); }

/* ---------- Buttons ---------- */
.actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.btn { font: inherit; font-weight: 600; padding: 12px 26px; border-radius: 12px; border: 0; cursor: pointer; transition: transform 0.1s, box-shadow 0.2s; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.6; cursor: wait; }
.btn.primary { background: var(--navy); color: #fff; box-shadow: 0 6px 16px rgba(20, 32, 143, 0.3); }
.btn.primary:hover:not(:disabled) { background: var(--navy-dark); }
.btn.ghost { background: #eef0ff; color: var(--navy); }
.link { background: none; border: 0; color: var(--navy); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; }

/* ---------- Review ---------- */
.review-card { border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; margin-bottom: 14px; }
.review-head { display: flex; justify-content: space-between; align-items: center; }
.review-head h3 { margin: 0; font-size: 1rem; color: var(--navy); }
.review dl { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px 16px; margin: 10px 0 0; }
.review dt { font-size: 0.8rem; color: var(--muted); }
.review dd { margin: 0; font-weight: 500; font-size: 0.9rem; word-break: break-word; }
.banner.error { background: #fdecea; color: var(--danger); padding: 10px 14px; border-radius: 10px; margin: 12px 0 0; }

/* ---------- Done ---------- */
.done { text-align: center; padding: 48px 28px; }
.tick { width: 80px; height: 80px; margin: 0 auto 16px; border-radius: 50%; background: var(--green); color: #fff; font-size: 2.4rem; display: grid; place-items: center; animation: pop 0.4s ease; }
@keyframes pop { from { transform: scale(0); } to { transform: scale(1); } }

footer { text-align: center; color: var(--muted); font-size: 0.8rem; padding: 0 20px 28px; }

/* ---------- Responsive ---------- */
/* ---------- Responsive ---------- */
img { max-width: 100%; }
.input, .option, .btn { -webkit-tap-highlight-color: transparent; }

/* Large screens: a little more room */
@media (min-width: 1400px) {
  .banner-inner, .page-intro, .layout { max-width: 1240px; }
  .layout { grid-template-columns: 320px 1fr; }
}

/* Tablet & below: stepper becomes a compact bar pinned to the top */
@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 14px; padding: 0 14px 28px; }
  .layout > * { min-width: 0; }  /* let grid items shrink instead of widening the page */
  .banner-inner, .page-intro { padding-left: 16px; padding-right: 16px; }

  .sidebar {
    position: sticky; top: 0; z-index: 20; padding: 10px 14px 12px; margin: 0 -14px;
    border-radius: 0 0 var(--radius) var(--radius);
    padding-top: max(10px, env(safe-area-inset-top));
  }
  .progress-label { display: none; }
  .progress { margin-bottom: 8px; height: 4px; }
  .sidebar ol { display: flex; align-items: center; gap: 6px; overflow-x: auto; scrollbar-width: none; }
  .sidebar ol::-webkit-scrollbar { display: none; }
  .step { flex: none; }
  .step:not(:last-child)::after { display: none; }
  .step button { flex-direction: row; gap: 8px; padding: 4px; min-width: 0; border-radius: 99px; }
  .step.current button { padding-right: 14px; }
  .step:not(.current) .meta { display: none; }        /* only the active step shows its title */
  .meta small { display: none; }
  .meta strong { font-size: 0.82rem; white-space: nowrap; }
  .badge { width: 34px; height: 34px; }

  .card { padding: 22px 20px; }
  .actions { gap: 10px; }
}

/* Touch devices: comfortable targets and no iOS zoom-on-focus (inputs must be >= 16px) */
@media (max-width: 860px), (pointer: coarse) {
  .input { font-size: 16px; min-height: 48px; padding: 12px 14px; }
  .option { min-height: 48px; }
  .btn { min-height: 48px; }
  .link { padding: 8px; }
}

/* Phones */
@media (max-width: 600px) {
  .banner-inner { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 8px 14px; padding-top: 12px; padding-bottom: 12px; text-align: left; }
  .logo { width: 64px; height: 64px; }
  .org { min-width: 0; }
  .org-short { font-size: 1.6rem; }
  .org-name { font-size: 0.8rem; line-height: 1.3; }
  .tag { grid-column: 1 / -1; justify-self: center; height: 36px; width: auto; max-width: 100%; object-fit: contain; }
  .page-intro { text-align: left; padding-top: 16px; }
  .page-intro h1 { font-size: 1.3rem; }
  .page-intro p { margin: 0; font-size: 0.85rem; }

  .layout { padding: 0 12px 20px; }
  .sidebar { margin: 0 -12px; }
  .card { padding: 18px 16px 0; border-radius: 14px; }
  .card.done { padding-bottom: 28px; }
  .card-head { gap: 12px; margin-bottom: 16px; padding-bottom: 14px; }
  .big-icon { width: 46px; height: 46px; font-size: 1.5rem; border-radius: 12px; }
  .card-head h2 { font-size: 1.15rem; }

  .grid, .review dl { grid-template-columns: 1fr; }
  .review dl { gap: 2px 0; }
  .review dd { margin-bottom: 8px; }
  .options { flex-direction: column; gap: 8px; }
  .option { width: 100%; }

  /* Back / Continue stay reachable at the bottom while filling a long step */
  .actions {
    position: sticky; bottom: 0; z-index: 5; margin: 18px -16px 0; border-top: 1px solid var(--line);
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(6px); border-radius: 0 0 14px 14px; box-shadow: 0 -6px 16px rgba(20, 32, 143, 0.08);
  }
  .actions .btn { flex: 1; padding-left: 12px; padding-right: 12px; }
  footer { padding-bottom: calc(24px + env(safe-area-inset-bottom)); font-size: 0.75rem; }
}

/* Narrow phones: tighten the stepper so all six steps fit without scrolling */
@media (max-width: 420px) {
  .sidebar ol { gap: 2px; }
  .badge { width: 30px; height: 30px; font-size: 0.78rem; }
  .step.current button { padding-right: 10px; gap: 6px; }
  .meta strong { font-size: 0.78rem; }
}

/* Very small phones */
@media (max-width: 360px) {
  .org-short { font-size: 1.4rem; letter-spacing: 0.1em; }
  .badge { width: 30px; height: 30px; font-size: 0.78rem; }
  .meta strong { font-size: 0.76rem; }
}

/* Landscape phones: avoid a tall sticky stepper eating the screen */
@media (max-height: 480px) and (orientation: landscape) {
  .sidebar { position: static; }
  .actions { position: static; box-shadow: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- Year picker ---------- */
.yearpicker { position: relative; }
.yearpicker .input { padding-right: 46px; }
.yp-icon { position: absolute; right: 6px; top: 6px; width: 36px; height: 36px; border: 0; border-radius: 8px; background: transparent; cursor: pointer; font-size: 1.1rem; }
.yp-icon:hover { background: #eef0ff; }
.yp-panel { position: absolute; z-index: 30; left: 0; top: calc(100% + 6px); width: min(300px, 100%); min-width: 260px; background: #fff; border: 1.5px solid var(--line); border-radius: 14px; padding: 12px; box-shadow: 0 16px 40px rgba(20, 32, 143, 0.22); animation: yp-in 0.12s ease; }
.yp-panel[hidden] { display: none; }
.yp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; color: var(--navy); }
.yp-nav { width: 38px; height: 38px; border: 0; border-radius: 10px; background: #eef0ff; color: var(--navy); font-size: 1.1rem; font-weight: 700; cursor: pointer; }
.yp-nav:disabled { opacity: 0.35; cursor: not-allowed; }
.yp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.yp-year { min-height: 44px; border: 1.5px solid transparent; border-radius: 10px; background: #f8f9fe; font: inherit; font-size: 0.92rem; color: var(--text); cursor: pointer; }
.yp-year:hover:not(:disabled) { border-color: var(--navy); }
.yp-year.now { border-color: var(--yellow); background: #fffbd1; }
.yp-year.selected { background: var(--navy); border-color: var(--navy); color: #fff; font-weight: 600; }
.yp-year:disabled { opacity: 0.3; cursor: not-allowed; }
.has-error .yearpicker .input { border-color: var(--danger); background: #fff6f6; }
@keyframes yp-in { from { opacity: 0; transform: translateY(-4px); } }
