:root {
  color-scheme: only light;
  --blue: #0038b8; --blue-dark: #002a8a; --ink: #10203f; --muted: #5b6885;
  --line: #d5dcec; --bg: #f3f6fc; --red: #b3261e; --green: #17663a;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
a { color: var(--blue); }
h1 { font-size: 1.7rem; line-height: 1.2; margin: 0 0 .6em; }
h2 { font-size: 1.25rem; margin: 1.4em 0 .5em; }
h3 { font-size: 1.1rem; margin: 0 0 .2em; }
:focus-visible { outline: 3px solid #ffbf47; outline-offset: 2px; }

.top { background: var(--blue); color: #fff; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem 1.25rem; }
.brand img { display: block; height: auto; max-width: 100%; }
.account { display: flex; align-items: center; gap: 1.1rem; }
.account a { color: #fff; font-weight: 600; }
.account a.btn-light { color: var(--blue); }
.account form { margin: 0; }

main { max-width: 680px; margin: 0 auto; padding: 2rem 1.25rem 4rem; }
main.wide { max-width: 1100px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 1.75rem; margin-bottom: 1.5rem; box-shadow: 0 1px 2px rgba(16, 32, 63, .05); }
.card.narrow { max-width: 460px; margin-left: auto; margin-right: auto; }
.lede, .small, .hint { color: var(--muted); }
.small { font-size: .9rem; }

label { display: block; font-weight: 600; margin: 1.1rem 0 .35rem; }
.hint { display: block; font-weight: 400; font-size: .88rem; }
input:not([type=checkbox]), textarea { width: 100%; font: inherit; color: inherit; padding: .65rem .75rem; border: 1.5px solid #9aa7c2; border-radius: 8px; background: #fff; }
textarea { resize: vertical; }
input:focus, textarea:focus { border-color: var(--blue); outline: 3px solid rgba(0, 56, 184, .2); }
[aria-invalid=true] { border-color: var(--red) !important; }
.field-error { display: block; color: var(--red); font-size: .9rem; margin-top: .25rem; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.check { display: flex; gap: .65rem; align-items: flex-start; font-weight: 400; margin: 1.25rem 0; }
.check input { width: 1.2rem; height: 1.2rem; margin-top: .2rem; flex: none; accent-color: var(--blue); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.cf-turnstile { margin: 1.25rem 0; min-height: 65px; }
.code { font: 600 1.5rem/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .12em; text-align: center; }

.btn { display: inline-block; font: inherit; font-weight: 700; color: #fff; background: var(--blue); border: 2px solid var(--blue); border-radius: 8px; padding: .65rem 1.3rem; text-decoration: none; cursor: pointer; margin-top: .5rem; }
.btn:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.btn-light { background: #fff; color: var(--blue); border-color: #fff; margin: 0; }
.btn-light:hover { background: #e6edff; border-color: #e6edff; }
.btn-secondary { background: #fff; color: var(--blue); }
.btn-secondary:hover { background: #e6edff; }
.btn-danger { background: #fff; color: var(--red); border-color: var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; border-color: var(--red); }
.btn-small { padding: .25rem .65rem; font-size: .88rem; margin: 0; }
.link { background: none; border: 0; padding: 0; font: inherit; font-weight: 600; color: #fff; text-decoration: underline; cursor: pointer; }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; margin: 0; }

.notice { border-radius: 8px; padding: .75rem 1rem; margin: 0 0 1rem; border: 1px solid; }
.notice.error { color: var(--red); background: #fdf0ee; border-color: #f0c4c0; }
.notice.info { color: var(--green); background: #edf7f0; border-color: #bfe0cb; }

.event { border-top: 1px solid var(--line); padding: 1.1rem 0; }
.when { font-weight: 600; color: var(--blue); margin: 0; }
.where { margin: 0; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }

.shell { display: grid; grid-template-columns: 230px minmax(0, 1fr); }
.shell main { margin: 0; max-width: 1100px; width: 100%; }
.adminnav { background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: .2rem; padding: 1.5rem .9rem; }
.adminnav a { text-decoration: none; font-weight: 600; padding: .6rem .9rem; border-radius: 8px; border-left: 4px solid transparent; }
.adminnav a:hover { background: var(--bg); }
.adminnav a[aria-current] { color: var(--blue); background: #e6edff; border-left-color: var(--blue); }
.tabs a { text-decoration: none; font-weight: 600; padding-bottom: .15rem; }
.tabs a[aria-current] { color: var(--ink); border-bottom: 3px solid var(--blue); }
.tabs { display: flex; gap: 1.4rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1rem; }
.stats a { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 1.25rem; text-decoration: none; color: var(--ink); }
.stats strong { display: block; font-size: 2.2rem; color: var(--blue); line-height: 1.1; }
.app h2 { margin-top: 0; }
dl { display: grid; grid-template-columns: 9.5rem 1fr; gap: .4rem 1rem; margin: 0 0 1.2rem; }
dt { color: var(--muted); }
dd { margin: 0; }
.tablewrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
table { border-collapse: collapse; width: 100%; font-size: .93rem; }
th, td { text-align: left; vertical-align: top; padding: .7rem .9rem; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
tr:last-child td { border-bottom: 0; }
.tag { display: inline-block; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: .1rem .5rem; border-radius: 99px; background: #e6edff; color: var(--blue); }
.tag.approved { background: #edf7f0; color: var(--green); }
.tag.rejected { background: #fdf0ee; color: var(--red); }

.qr { display: block; width: 220px; height: 220px; margin: 1rem auto; }
.secret { text-align: center; }
.secret code, .recovery code { font: 600 1rem ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.recovery { list-style: none; padding: 1rem; display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; background: var(--bg); border-radius: 8px; }

@media (max-width: 800px) {
  .shell { display: block; }
  .adminnav { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: .6rem .75rem; }
  .adminnav a { white-space: nowrap; border-left: 0; border-bottom: 3px solid transparent; border-radius: 6px 6px 0 0; padding: .45rem .7rem; }
  .adminnav a[aria-current] { border-bottom-color: var(--blue); }
}
@media (max-width: 560px) {
  .row, dl, .recovery { grid-template-columns: 1fr; }
  .card { padding: 1.25rem; }
}

/* --- Application form ---------------------------------------------------- */
.form-card { padding: 0; overflow: hidden; border: 0; box-shadow: 0 18px 50px rgba(0, 30, 110, .14), 0 2px 6px rgba(16, 32, 63, .06); }
.form-banner { position: relative; overflow: hidden; color: #fff; padding: 2.25rem 2rem 2rem;
  background: radial-gradient(ellipse 80% 120% at 85% 0%, rgba(77, 136, 255, .6), transparent 70%), linear-gradient(135deg, #002a8a, var(--blue)); border-bottom: 6px solid #fff; box-shadow: 0 6px 0 var(--blue); }
.form-banner img { position: absolute; right: -18px; top: -22px; width: 170px; height: 170px; opacity: .16; }
.form-banner h1 { position: relative; font-size: 2rem; margin: 0 0 .35rem; }
.form-banner p { position: relative; margin: 0; max-width: 30rem; color: rgba(255, 255, 255, .88); }
.form-body { padding: 2.25rem 2rem 2rem; }
.form-body fieldset { border: 0; padding: 0; margin: 0 0 2rem; min-width: 0; }
.form-body legend { display: flex; align-items: center; gap: .7rem; width: 100%; padding: 0 0 .7rem; margin-bottom: .2rem; font-size: 1.15rem; font-weight: 700; border-bottom: 1px solid var(--line); }
.step { display: grid; place-items: center; width: 1.9rem; height: 1.9rem; border-radius: 50%; background: var(--blue); color: #fff; font-size: .95rem; flex: none; }
.form-body input:not([type=checkbox]), .form-body textarea { padding: .8rem .9rem; border: 1.5px solid #cfd8ea; border-radius: 10px; background: #f7f9fd; transition: border-color .15s, background .15s, box-shadow .15s; }
.form-body input:not([type=checkbox]):hover, .form-body textarea:hover { border-color: #9aa7c2; }
.form-body input:not([type=checkbox]):focus, .form-body textarea:focus { background: #fff; border-color: var(--blue); outline: 0; box-shadow: 0 0 0 4px rgba(0, 56, 184, .16); }
.optional { display: inline-block; margin-left: .4rem; padding: .05rem .5rem; border-radius: 99px; background: #e6edff; color: var(--blue); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; vertical-align: middle; }
.consent { background: #f0f4ff; border: 1px solid #d5e0ff; border-radius: 12px; padding: 1rem 1.1rem; margin: 0 0 .5rem; font-size: .95rem; }
.btn-submit { display: block; width: 100%; padding: 1rem; font-size: 1.1rem; border-radius: 999px; box-shadow: 0 10px 24px rgba(0, 56, 184, .28); transition: transform .15s, box-shadow .15s; }
.btn-submit:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(0, 56, 184, .36); }
.center { text-align: center; margin: 1rem 0 0; }
@media (max-width: 560px) {
  .form-banner { padding: 1.75rem 1.25rem 1.5rem; }
  .form-banner h1 { font-size: 1.6rem; }
  .form-banner img { width: 130px; height: 130px; }
  .form-card .form-body { padding: 1.75rem 1.25rem 1.5rem; }
}

body { min-height: 100vh; display: flex; flex-direction: column; }
body > div, body > main { flex: 1; }
.foot { text-align: center; background: #00123f; color: rgba(255, 255, 255, .82); font-size: .88rem; padding: 1rem 1.25rem; }
.foot a { color: #fff; }
.foot p { margin: 0; }
.prose h2 { font-size: 1.15rem; }
.prose li { margin-bottom: .35rem; }

/* --- Home page ----------------------------------------------------------- */
.home { background: #001a5c; }
.hero { position: relative; isolation: isolate; overflow: hidden; max-width: none; flex: 1; margin: 0; padding: 12vh 1.5rem;
  display: grid; place-items: center; color: #fff;
  background:
    radial-gradient(ellipse 70% 55% at 50% 42%, rgba(77, 136, 255, .55), transparent 70%),
    linear-gradient(180deg, #002a8a 0%, var(--blue) 45%, #001f6b 100%); }
/* The flag's two stripes, top and bottom. */
.hero::before, .hero::after { content: ""; position: absolute; left: 0; right: 0; height: clamp(14px, 3.2vh, 30px); background: #fff; box-shadow: 0 0 40px rgba(255, 255, 255, .35); z-index: 1; }
.hero::before { top: clamp(22px, 5vh, 48px); }
.hero::after { bottom: clamp(22px, 5vh, 48px); }
.hero-star { position: absolute; z-index: -1; top: 50%; left: 50%; width: min(135vh, 150vw); aspect-ratio: 1; margin: calc(min(135vh, 150vw) / -2) 0 0 calc(min(135vh, 150vw) / -2);
  background: url(/img/star.svg) center / contain no-repeat; opacity: .09; animation: turn 240s linear infinite; }
.hero-inner { width: min(760px, 100%); text-align: center; animation: rise 1.1s cubic-bezier(.2, .7, .2, 1) both; }
.hero h1 { margin: 0; }
.hero h1 img { display: block; width: 100%; height: auto; filter: drop-shadow(0 10px 34px rgba(0, 12, 60, .55)); }
.hero-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 1rem 1.25rem; margin-top: clamp(2rem, 6vh, 3.5rem); animation: rise 1.1s .25s cubic-bezier(.2, .7, .2, 1) both; }
.btn-hero { margin: 0; min-width: 15rem; padding: 1rem 2rem; font-size: 1.15rem; letter-spacing: .02em; border-radius: 999px; background: #fff; color: var(--blue); border-color: #fff;
  box-shadow: 0 12px 34px rgba(0, 12, 60, .45); transition: transform .18s ease, box-shadow .18s ease, background .18s ease; }
.btn-hero:hover { background: #fff; border-color: #fff; transform: translateY(-3px); box-shadow: 0 18px 44px rgba(0, 12, 60, .6); }
.btn-ghost { background: transparent; color: #fff; }
.btn-ghost:hover { background: rgba(255, 255, 255, .14); }
@keyframes rise { from { opacity: 0; transform: translateY(26px); } }
@keyframes turn { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .hero-star, .hero-inner, .hero-actions { animation: none; } .btn-hero { transition: none; } }
.home { min-height: 100vh; min-height: 100svh; }
@media (max-width: 560px) {
  .foot span, .foot a { display: block; }
  .foot .dot { display: none; }
  .foot a { margin-top: .2rem; }
  .hero { padding: 14vh 1.25rem; }
  .hero-actions { flex-direction: column; align-items: stretch; gap: .9rem; }
  .btn-hero { min-width: 0; width: 100%; }
}
