:root {
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  color: #101828;
  background: #fff;
  font-synthesis: none;
  --primary: #1d4ed8;
  --primary-dark: #173eae;
  --ink: #101828;
  --muted: #475467;
  --border: #dfe5ed;
  --soft: #f8fafc;
  --blue-soft: #eff5ff;
  --radius: 14px;
}

*, *::before, *::after { box-sizing: border-box; }
html { min-width: 0; }
body { min-height: 100vh; margin: 0; display: flex; flex-direction: column; }
main { flex: 1; }
[hidden] { display: none !important; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; }
button:disabled { cursor: not-allowed; opacity: .55; }
a { color: var(--primary); text-underline-offset: .2em; }
a:hover { color: var(--primary-dark); }
:focus-visible { outline: 3px solid #1d4ed8; outline-offset: 3px; }
h1, h2, h3 { color: var(--ink); font-weight: 720; line-height: 1.15; margin: 0; overflow-wrap: anywhere; }
h1 { font-size: clamp(2rem, 4vw, 3rem); letter-spacing: -.043em; }
h2 { font-size: clamp(1.3rem, 2.7vw, 1.9rem); letter-spacing: -.031em; }
h3 { font-size: 1.1rem; letter-spacing: -.014em; }
p, li, dt, dd { line-height: 1.6; }
p { margin: 0; }
p + p { margin-top: .75rem; }
ul, ol { padding-inline-start: 1.25rem; }
button, a, input, select { touch-action: manipulation; }

.page-width { width: min(1180px, calc(100% - 72px)); margin-inline: auto; }
.site-header { border-bottom: 1px solid var(--border); background: #fff; }
.header-inner { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; }
.wordmark { display: inline-flex; align-items: center; gap: .65rem; color: var(--ink); font-size: 1.42rem; font-weight: 790; letter-spacing: -.055em; text-decoration: none; }
.brand-mark { position: relative; width: 33px; height: 33px; border-radius: 9px; background: var(--primary); flex: 0 0 33px; }
.brand-mark::before { content: ""; position: absolute; top: 9px; left: 9px; width: 15px; height: 11px; border: 2px solid white; border-radius: 3px 3px 2px 2px; }
.brand-mark::after { content: ""; position: absolute; top: 23px; left: 12px; width: 9px; height: 2px; border-radius: 2px; background: white; }
.site-nav { display: flex; align-items: center; gap: .2rem; }
.site-nav a { color: #344054; font-size: .925rem; font-weight: 580; text-decoration: none; padding: .6rem .75rem; border-radius: 8px; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--primary); background: var(--blue-soft); }
.menu-button { display: none !important; }
.app-content { padding-block: 3rem 4rem; min-height: 55vh; }
.site-footer { border-top: 1px solid var(--border); }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1.5rem; padding-block: 1.5rem; }
.footer-inner .wordmark { font-size: 1.2rem; }
.footer-inner span, .footer-inner > a:last-child { font-size: .9rem; }
.footer-inner span { color: var(--muted); }
.skip-link { position: absolute; z-index: 4; padding: .75rem 1rem; background: white; transform: translateY(-130%); }
.skip-link:focus { transform: translateY(0); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.button { min-height: 43px; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .63rem .92rem; border: 1px solid #cbd5e1; border-radius: 9px; background: white; color: var(--ink); cursor: pointer; font-weight: 650; font-size: .925rem; line-height: 1.32; text-decoration: none; text-align: center; }
.button:hover { background: var(--soft); color: var(--primary-dark); border-color: #aab9ce; }
.button-primary, .button.primary { background: var(--primary); border-color: var(--primary); color: white; }
.button-primary:hover, .button.primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: white; }
.button-secondary, .button.secondary { color: var(--ink); }
.button[aria-pressed="true"] { color: var(--primary); border-color: #9db6f1; background: var(--blue-soft); }
.action-row, .card-actions, .form-actions, .result-controls { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem; }
.text-button { padding: 0; border: 0; background: transparent; color: var(--primary); cursor: pointer; text-decoration: underline; text-underline-offset: .2em; }

.hero { display: grid; grid-template-columns: 1.15fr 1fr; align-items: center; gap: clamp(2rem, 5vw, 5rem); padding-block: .7rem 2.15rem; }
.hero-label { display: flex; align-items: center; gap: .55rem; color: var(--primary-dark); font-size: .9rem; font-weight: 650; margin-bottom: 1.12rem; }
.hero-label span { width: .5rem; height: .5rem; border-radius: 50%; background: var(--primary); }
.hero h1 { font-size: clamp(2.8rem, 4.85vw, 4.5rem); line-height: 1.04; letter-spacing: -.064em; }
.hero h1 em { color: var(--primary); font-style: normal; }
.hero-intro { font-size: 1.1rem; color: var(--muted); margin-top: 1.35rem; max-width: 35rem; }
.hero-actions { margin-top: 1.65rem; }
.hero-actions .button { min-height: 49px; padding-inline: 1.03rem; }
.hero-visual { aspect-ratio: 4 / 3; border-radius: 19px; overflow: hidden; background: #edf3fa; border: 1px solid var(--border); }
.hero-visual img { width: 100%; height: 100%; object-fit: cover; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); margin: .7rem 0 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--soft); }
.stats-grid > div { min-width: 0; display: flex; flex-direction: column-reverse; gap: .23rem; padding: 1.13rem clamp(.8rem, 3.5vw, 2rem); }
.stats-grid > div + div { border-inline-start: 1px solid var(--border); }
.stats-grid dt { color: var(--muted); font-size: .91rem; }
.stats-grid dd { color: var(--ink); margin: 0; font-weight: 760; line-height: 1.2; font-size: clamp(1.65rem, 3vw, 2.05rem); letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.stats-note { margin-top: .45rem; color: var(--muted); font-size: .9rem; }
.home-guide { margin-top: 2.8rem; }
.home-guide h2 { margin-bottom: 1.1rem; }
.guide-grid, .about-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.guide-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; }
.guide-card h3 { margin: .82rem 0 .45rem; }
.guide-card p, .about-card p { color: var(--muted); }
.guide-icon { display: block; width: 34px; height: 34px; border-radius: 9px; background: var(--blue-soft); position: relative; color: var(--primary); }
.guide-icon::before, .guide-icon::after { content: ""; position: absolute; }
.icon-profile::before { width: 8px; height: 8px; top: 7px; left: 13px; border: 1.6px solid; border-radius: 50%; }
.icon-profile::after { width: 15px; height: 8px; top: 18px; left: 9.5px; border: 1.6px solid; border-radius: 6px 6px 2px 2px; }
.icon-match::before { width: 12px; height: 8px; top: 11px; left: 11px; border-left: 2px solid; border-bottom: 2px solid; transform: rotate(-45deg); }
.icon-match::after { width: 21px; height: 21px; top: 6.5px; left: 6.5px; border: 1.5px solid; border-radius: 50%; }
.icon-apply::before { width: 13px; height: 17px; top: 8px; left: 10.5px; border: 1.5px solid; border-radius: 2px; }
.icon-apply::after { width: 6px; height: 6px; top: 14px; left: 14px; border-top: 1.5px solid; border-bottom: 1.5px solid; }

.page-heading { margin-bottom: 1.65rem; }
.page-heading > :is(p,.action-row) { margin-top: .6rem; }
.page-heading p { max-width: 49rem; color: var(--muted); font-size: 1.04rem; }
.card, .notice, .filter-panel, .privacy-panel { border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; background: white; min-width: 0; }
.notice { background: var(--soft); }
.notice p, .empty-state p { margin-top: .5rem; color: var(--muted); }
.notice .button, .empty-state .action-row { margin-top: .9rem; }
.about-card p { margin-block: .7rem; }
.about-card h2 { font-size: 1.25rem; }
.app-feedback { position: fixed; z-index: 3; bottom: 1.15rem; right: 1.15rem; width: max-content; max-width: calc(100% - 2.3rem); box-shadow: 0 3px 12px #10182818; padding: .8rem 1rem; border: 1px solid #c5d3ee; border-radius: .7rem; background: white; }
.loading-state { display: flex; gap: .9rem; align-items: center; }
.loading-indicator { width: 20px; height: 20px; border: 3px solid #d6e1fd; border-top-color: var(--primary); border-radius: 50%; }
.error-state { border-color: #f4d0ce; background: #fff8f7; }

.profile-layout { display: grid; grid-template-columns: minmax(220px, .39fr) minmax(0, 1fr); gap: 1.35rem; align-items: start; }
.profile-form { border: 1px solid var(--border); border-radius: var(--radius); padding: clamp(1rem, 3vw, 1.75rem); min-width: 0; }
.profile-form p, .profile-sidebar p { color: var(--muted); }
.profile-layout fieldset { margin: 0; min-width: 0; }
.profile-sidebar { display: grid; gap: .9rem; }
.profile-sidebar .privacy-panel { background: var(--soft); }
.privacy-panel p { margin: .55rem 0 .8rem; }
.step-list { padding: 0; margin: 0; list-style: none; display: grid; gap: .4rem; }
.step-list .step-button { width: 100%; text-align: left; }
.step-button { min-height: 39px; padding: .36rem .65rem; border: 1px solid var(--border); background: white; border-radius: 7px; color: var(--muted); cursor: pointer; font-size: .875rem; }
.step-button[aria-current="step"] { color: var(--primary-dark); border-color: #a5bcf6; background: var(--blue-soft); font-weight: 680; }
.step-progress { font-size: .85rem; font-weight: 650; margin-bottom: .4rem; }
.profile-form h2 + p { margin-top: .45rem; }
.field-wide { grid-column: 1 / -1; }
.conditional-group { margin: 0; }
.exam-row { padding: .8rem; border: 1px solid var(--border); border-radius: .6rem; margin-bottom: .7rem !important; }
.checkbox-line, .check-field { display: flex; gap: .45rem; align-items: flex-start; color: var(--ink); line-height: 1.45; }
.checkbox-line input, .check-field input { flex: 0 0 auto; margin-top: .14rem; }
.field-help { font-size: .875rem; }
.muted { color: var(--muted); }
.form-grid, .filter-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.form-grid { margin-block: 1rem; }
.form-field, .filter-field { display: flex; flex-direction: column; gap: .3rem; min-width: 0; font-size: .935rem; }
.form-field label, .filter-field label { font-weight: 650; }
input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  display: block; width: 100%; min-width: 0; min-height: 42px; border: 1px solid #bfc9d7; border-radius: 7px; background-color: white; color: var(--ink); padding: .5rem .64rem;
}
select { padding-inline-end: 1rem; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); width: 1.05em; height: 1.05em; }
small, .field-hint { color: var(--muted); font-size: .875rem; line-height: 1.45; }
.form-actions { border-top: 1px solid var(--border); margin-top: 1.25rem; padding-top: 1rem; }
.form-error { color: #a2231b; font-size: .9rem; }
fieldset { border: 0; padding: 0; }
legend { color: var(--ink); font-weight: 660; }

.filter-panel { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .9rem 1rem; background: var(--soft); margin-bottom: 1.05rem; }
.filter-panel .field { min-width: 0; display: grid; gap: .28rem; align-content: start; font-size: .925rem; font-weight: 640; }
.filter-panel .search-field { grid-column: span 2; }
.filter-panel .filter-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: .65rem; }
.filter-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.catalog-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.catalog-grid > .empty-state { grid-column: 1 / -1; }
.result-count { color: var(--muted); margin: .75rem 0; }
.result-tabs, .badge-row, .track-tabs, .details-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; }
.scholarship-card { display: flex; flex-direction: column; gap: .72rem; }
.scholarship-card h2 { font-size: clamp(1.15rem, 2.2vw, 1.42rem); }
.scholarship-card p { color: var(--muted); margin: 0; }
.scholarship-card .card-actions { margin-top: auto; padding-top: .28rem; }
.card-kicker { font-size: .875rem; font-weight: 670; color: var(--primary-dark) !important; }
.card-meta, .details-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .45rem .75rem; margin: 0; }
.card-meta dt, .details-meta dt { color: var(--muted); font-size: .88rem; }
.card-meta dd, .details-meta dd { margin: 0; font-weight: 620; }
.badge { display: inline-flex; width: max-content; max-width: 100%; padding: .2rem .6rem; align-items: center; border-radius: 5px; border: 1px solid #d3dded; background: #f2f5fa; color: #344054; font-size: .8rem; font-weight: 665; line-height: 1.4; }
.badge-open, .badge-eligible, .badge.eligible, .badge.open { color: #135138; border-color: #b9e1cb; background: #eaf8f0; }
.badge-potentially_eligible, .badge-upcoming, .badge.potentially_eligible { color: #70440a; border-color: #efda9e; background: #fff8e6; }
.badge-not_eligible, .badge-cancelled, .badge.not_eligible, .badge.cancelled { color: #8a261f; border-color: #f1c5c1; background: #fff0ef; }
.details-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(230px, .49fr); gap: 1rem; align-items: start; }
.details-main, .details-sidebar { display: grid; gap: .9rem; }
.details-grid .detail-list { padding-inline-start: 1.2rem; }
.detail-list > li + li { margin-top: .48rem; }
.rule-group { margin-block: .6rem; padding-inline-start: .65rem; border-inline-start: 2px solid var(--border); }
.details-grid .detail-section > :is(.reason-block,.track-tabs) { margin-top: .7rem; }
.back-link { margin-bottom: .9rem; }
.details-grid article, .details-grid aside, .details-grid section { min-width: 0; }
.details-grid h2 + :is(p,dl,ul,ol,div) { margin-top: .65rem; }
.details-grid a { overflow-wrap: anywhere; }
details summary { cursor: pointer; color: var(--ink); font-weight: 650; }
details + details { margin-top: .55rem; }

@media (max-width: 960px) {
  .page-width { width: calc(100% - 48px); }
  .site-nav a { padding-inline: .55rem; }
  .hero { gap: 2rem; }
}
@media (max-width: 760px) {
  .page-width { width: calc(100% - 36px); }
  .header-inner { min-height: 64px; flex-wrap: wrap; gap: 0; }
  .menu-button { display: inline-flex !important; min-height: 39px; }
  .site-nav { display: none; flex: 1 0 100%; flex-wrap: wrap; padding-block: .4rem .75rem; }
  .menu-button[aria-expanded="true"] + .site-nav { display: flex; }
  .site-nav a { min-height: 42px; }
  .app-content { padding-block: 2rem 3rem; }
  .hero { grid-template-columns: minmax(0, 1fr); gap: 1.45rem; padding-block: 0 1.35rem; }
  .hero h1 { font-size: clamp(2.55rem, 8vw, 4rem); }
  .hero-intro { font-size: 1rem; margin-top: .9rem; }
  .hero-actions { margin-top: 1.13rem; }
  .hero-visual { aspect-ratio: 16 / 9; width: 100%; }
  .profile-layout, .details-grid { grid-template-columns: minmax(0, 1fr); }
  .profile-sidebar { display: contents; }
  .step-list { grid-row: 1; display: flex; flex-wrap: wrap; }
  .profile-form { grid-row: 2; }
  .privacy-panel { grid-row: 3; }
  .guide-grid, .about-grid, .filter-grid, .filter-panel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 500px) {
  .page-width { width: calc(100% - 32px); }
  .hero h1 { font-size: clamp(2.35rem, 8.6vw, 3.1rem); }
  .hero-break { display: none; }
  .hero-actions .button { flex: 1 1 auto; }
  .home-guide { margin-top: 1.9rem; }
  .stats-grid dt { font-size: .82rem; line-height: 1.35; }
  .stats-grid > div { padding-inline: .52rem; }
  .guide-grid, .about-grid, .form-grid, .catalog-grid { grid-template-columns: minmax(0, 1fr); }
  .filter-grid { gap: .65rem; }
  .filter-panel { padding: .85rem; }
  .footer-inner { align-items: flex-start; }
}
