:root {
  --navy: #102a43;
  --navy-soft: #243b53;
  --blue: #1677ff;
  --blue-dark: #0967d2;
  --ink: #172b4d;
  --muted: #6b7c93;
  --line: #e6ebf2;
  --surface: #ffffff;
  --background: #f4f7fb;
  --gold: #f3b51b;
  --silver: #a8b2bf;
  --bronze: #bd7542;
  --shadow: 0 12px 35px rgba(21, 44, 77, .08);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: var(--background); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.app-shell { min-height: 100vh; }
.access-gate { position: fixed; z-index: 100; inset: 0; padding: 24px; display: grid; place-items: center; background: rgba(244,247,251,.96); backdrop-filter: blur(8px); }
.access-gate[hidden] { display: none; }
.access-card { width: min(430px, 100%); padding: 34px; border: 1px solid var(--line); border-radius: 20px; text-align: center; background: white; box-shadow: var(--shadow); }
.access-mark { margin: 0 auto 18px; color: #f9c74f; background: var(--navy); }
.access-card h2 { margin: 9px 0 8px; font-size: 27px; letter-spacing: -.04em; }
.access-card p { color: var(--muted); font-size: 12px; line-height: 1.65; }
.access-actions { margin-top: 22px; display: grid; gap: 9px; }
.access-actions .button { display: block; text-decoration: none; }
.access-actions [hidden] { display: none; }
.auth-form { margin-top: 20px; display: grid; gap: 12px; text-align: left; }
.auth-form[hidden] { display: none; }
.auth-form .button { margin-top: 3px; }
.access-note { margin: 18px 0 0; font-size: 10px !important; }
.topbar { height: 82px; padding: 0 max(24px, calc((100vw - 1440px) / 2)); display: flex; align-items: center; justify-content: space-between; background: var(--navy); color: white; }
.brand { display: flex; align-items: center; gap: 13px; }
.brand-link { color: inherit; text-decoration: none; }
.brand-mark { width: 45px; height: 45px; border-radius: 13px; display: grid; place-items: center; color: #f9c74f; background: rgba(255,255,255,.1); }
.brand-mark svg { width: 29px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.brand h1 { margin: 1px 0 0; font-size: 20px; letter-spacing: -.02em; }
.eyebrow, .hero-label { margin: 0; color: #8496aa; text-transform: uppercase; font-size: 10px; font-weight: 800; letter-spacing: .13em; }
.brand .eyebrow { color: #9fb3c8; }
.top-actions { display: flex; gap: 10px; }
.top-actions a { text-decoration: none; }
.button { border: 0; border-radius: 9px; padding: 11px 16px; font-weight: 750; transition: transform .15s, background .15s, box-shadow .15s; }
.button:hover { transform: translateY(-1px); }
.button-primary { color: white; background: var(--blue); box-shadow: 0 7px 16px rgba(22,119,255,.24); }
.button-primary:hover { background: var(--blue-dark); }
.button-ghost { color: var(--navy-soft); background: #edf2f7; }
.topbar .button-ghost { color: white; background: rgba(255,255,255,.1); }
main { width: min(1440px, calc(100% - 48px)); margin: 0 auto; padding: 28px 0 55px; }
.source-panel { margin-bottom: 20px; padding: 20px 24px; display: grid; grid-template-columns: 270px 1fr; gap: 28px; align-items: end; overflow: visible; }
.source-intro h2 { margin: 5px 0 5px; font-size: 20px; letter-spacing: -.03em; }
.source-intro p:last-child { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.source-controls { display: grid; grid-template-columns: 1fr 1.45fr 1fr .75fr auto; gap: 10px; align-items: end; }
.source-controls .field input, .source-controls .field select { height: 40px; padding: 8px 10px; background: #fafbfd; font-size: 12px; }
.source-load { height: 40px; white-space: nowrap; }
.button:disabled { cursor: not-allowed; opacity: .55; transform: none; box-shadow: none; }
.load-status { grid-column: 1 / -1; padding: 11px 14px; display: grid; gap: 9px; border-radius: 8px; color: var(--blue-dark); background: #e8f2ff; font-size: 11px; font-weight: 750; }
.load-status[hidden] { display: none; }
.load-status-content { display: flex; align-items: center; gap: 9px; }
#loadProgressPercent { margin-left: auto; color: var(--navy); font-size: 11px; }
.load-progress { height: 6px; overflow: hidden; border-radius: 99px; background: #cfe3ff; }
.load-progress span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #1677ff, #63b3ff); transition: width .25s ease; }
.spinner { width: 14px; height: 14px; border: 2px solid #a7cdfd; border-top-color: var(--blue); border-radius: 50%; animation: spin .75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.hero { position: relative; overflow: hidden; min-height: 155px; padding: 31px 36px; border-radius: 18px; display: flex; justify-content: space-between; align-items: center; color: white; background: linear-gradient(118deg, #0d3157, #174d82); box-shadow: var(--shadow); }
.hero::after { content: ""; position: absolute; width: 390px; height: 390px; right: -120px; top: -210px; border: 48px solid rgba(255,255,255,.045); border-radius: 50%; }
.hero-label { color: #9fb3c8; }
.hero h2 { margin: 8px 0 7px; font-size: clamp(25px, 3vw, 36px); letter-spacing: -.045em; }
.hero-meta { margin: 0; display: flex; align-items: center; gap: 10px; color: #c8d7e6; font-size: 14px; }
.dot { width: 4px; height: 4px; border-radius: 50%; background: #8ba6c1; }
.hero-stat { position: relative; z-index: 1; min-width: 145px; text-align: center; padding: 19px 22px; border: 1px solid rgba(255,255,255,.14); border-radius: 14px; background: rgba(255,255,255,.08); backdrop-filter: blur(8px); }
.hero-stat-value { display: block; font-size: 42px; font-weight: 850; line-height: 1; }
.hero-stat-label { display: block; margin-top: 7px; color: #c8d7e6; font-size: 12px; font-weight: 650; }
.stats-grid { margin: 20px 0; display: grid; grid-template-columns: repeat(7, 1fr); gap: 15px; }
.stat-card { min-height: 106px; padding: 20px; display: flex; align-items: center; gap: 15px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 5px 20px rgba(21,44,77,.045); }
.medal-icon, .empty-medal { width: 52px; height: 52px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; font-size: 20px; font-weight: 900; border: 5px solid; }
.gold .medal-icon, .empty-medal { color: #7c5700; border-color: #ffd66b; background: #f3b51b; }
.silver .medal-icon { color: #4f5965; border-color: #d8dee5; background: #a8b2bf; }
.bronze .medal-icon { color: #64391f; border-color: #dfa078; background: #bd7542; }
.people-icon { width: 52px; height: 52px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 14px; color: var(--blue); background: #e8f2ff; }
.pr-icon, .qualifying-icon, .record-icon { width: 52px; height: 52px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 14px; color: #087f5b; background: #dff7ee; font-size: 16px; font-weight: 900; }
.qualifying-icon { color: #7c5700; background: #fff3bf; }
.record-icon { color: #6b3d00; background: #ffe8cc; }
.people-icon svg { width: 27px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.stat-number { display: block; font-size: 28px; line-height: 1; font-weight: 850; letter-spacing: -.04em; }
.stat-label { display: block; margin-top: 7px; color: var(--muted); font-size: 12px; font-weight: 700; }
.stat-percent { margin-left: auto; align-self: flex-start; padding: 4px 7px; border-radius: 20px; color: var(--muted); background: #f1f4f8; font-size: 10px; font-weight: 800; }
.content-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 20px; align-items: start; }
.side-column { display: grid; gap: 20px; }
.panel { overflow: hidden; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); box-shadow: 0 5px 20px rgba(21,44,77,.045); }
.panel-header { min-height: 76px; padding: 18px 20px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); }
.panel-header h3 { margin: 4px 0 0; font-size: 18px; letter-spacing: -.025em; }
.panel-tools { display: flex; gap: 8px; }
.search-field { min-width: 235px; padding: 0 11px; display: flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 8px; background: #fafbfd; }
.search-field svg { width: 16px; fill: none; stroke: #8496aa; stroke-width: 2; stroke-linecap: round; }
.search-field input { width: 100%; padding: 9px 0; border: 0; outline: 0; background: transparent; font-size: 12px; }
select { padding: 9px 28px 9px 10px; border: 1px solid var(--line); border-radius: 8px; outline: none; color: var(--ink); background: #fafbfd; font-size: 12px; font-weight: 650; }
.table-wrap { min-height: 370px; position: relative; }
table { width: 100%; border-collapse: collapse; }
th { padding: 11px 18px; text-align: left; color: #8496aa; background: #fafbfd; text-transform: uppercase; font-size: 9px; font-weight: 850; letter-spacing: .09em; }
td { padding: 13px 18px; border-top: 1px solid #eef2f6; font-size: 12px; }
.athlete-name { font-weight: 800; }
.entry-type-badge { margin-left: 8px; padding: 3px 6px; border-radius: 999px; color: #0d3157; background: #e8f2ff; font-size: 9px; font-weight: 850; text-transform: uppercase; letter-spacing: .04em; }
.secondary-text { color: var(--muted); }
.medal-pill { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 50%; color: white; font-size: 11px; font-weight: 900; }
.medal-pill.gold { background: var(--gold); }
.medal-pill.silver { background: var(--silver); }
.medal-pill.bronze { background: var(--bronze); }
.empty-state { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; text-align: center; padding: 30px; }
.empty-state[hidden] { display: none; }
.empty-medal { width: 58px; height: 58px; margin-bottom: 12px; }
.empty-state h4 { margin: 0; font-size: 17px; }
.empty-state p { margin: 7px 0 16px; color: var(--muted); font-size: 12px; }
.panel-footer { min-height: 52px; padding: 12px 18px; display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; font-weight: 650; }
.text-button { border: 0; padding: 5px 7px; color: var(--blue); background: none; font-size: 11px; font-weight: 800; }
.ranking-list, .discipline-chart { padding: 8px 20px 18px; }
.pr-ranking { padding: 12px; display: grid; gap: 7px; background: #f7f9fc; }
.pr-item { padding: 11px 12px 10px; border: 1px solid #e7edf3; border-radius: 10px; background: white; box-shadow: 0 2px 8px rgba(21,44,77,.035); }
.pr-item-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.pr-item-name { min-width: 0; overflow: hidden; color: var(--ink); text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-weight: 850; }
.pr-percent-badge { min-width: 42px; padding: 4px 7px; border-radius: 20px; color: #087f5b; background: #dff7ee; text-align: center; font-size: 10px; font-weight: 900; }
.pr-progress { height: 4px; overflow: hidden; margin-top: 9px; border-radius: 8px; background: #edf2f7; }
.pr-progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #12b886, #63e6be); }
.pr-item-meta { margin-top: 7px; display: flex; gap: 4px; color: var(--muted); font-size: 9px; font-weight: 650; }
.pr-item-meta strong { color: #087f5b; font-weight: 850; }
.qualifying-ranking, .club-record-ranking { padding: 12px; display: grid; gap: 7px; background: #fffdf7; }
.club-record-ranking { background: #fff8f0; }
.qualifying-item, .record-item { padding: 11px 12px; border: 1px solid #f1e5bc; border-radius: 10px; background: white; box-shadow: 0 2px 8px rgba(21,44,77,.035); }
.record-item { border-color: #f3d3ad; }
.qualifying-item-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.qualifying-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-weight: 850; }
.qualifying-year { padding: 3px 6px; border-radius: 20px; color: #7c5700; background: #fff3bf; font-size: 9px; font-weight: 850; }
.qualifying-meet { margin-top: 4px; color: #9a6b00; font-size: 9px; font-weight: 800; }
.qualifying-detail { margin-top: 8px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 8px; color: var(--muted); font-size: 9px; }
.qualifying-detail strong { color: var(--ink); font-size: 11px; }
.qualifying-standard { grid-column: 1 / -1; }
.ranking-item { padding: 12px 0; display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 10px; border-bottom: 1px solid #eef2f6; }
.ranking-item:last-child { border-bottom: 0; }
.rank-number { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 7px; color: var(--muted); background: #f1f4f8; font-size: 10px; font-weight: 850; }
.ranking-name { font-size: 12px; font-weight: 800; }
.ranking-medals { color: var(--muted); font-size: 10px; font-weight: 750; }
.ranking-dots { display: flex; gap: 3px; justify-content: flex-end; margin-top: 4px; }
.ranking-dot { width: 7px; height: 7px; border-radius: 50%; }
.ranking-dot.gold { background: var(--gold); }.ranking-dot.silver { background: var(--silver); }.ranking-dot.bronze { background: var(--bronze); }
.placeholder-copy { padding: 20px 0 8px; color: var(--muted); text-align: center; font-size: 11px; line-height: 1.5; }
.discipline-item { margin-top: 16px; }
.discipline-label { margin-bottom: 6px; display: flex; justify-content: space-between; font-size: 11px; font-weight: 750; }
.discipline-label span:last-child { color: var(--muted); }
.bar-track { height: 6px; overflow: hidden; border-radius: 8px; background: #edf2f7; }
.bar-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, #1677ff, #60a5fa); }
.field { display: grid; gap: 6px; }
.field span { color: var(--navy-soft); font-size: 11px; font-weight: 800; }
.field input, .field select { width: 100%; padding: 11px 12px; border: 1px solid #d9e2ec; border-radius: 8px; outline: none; background: white; font-size: 13px; }
.field input:focus, .field select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(22,119,255,.11); }
.toast { position: fixed; right: 24px; bottom: 24px; padding: 12px 16px; border-radius: 9px; color: white; background: var(--navy); box-shadow: var(--shadow); font-size: 12px; font-weight: 750; opacity: 0; transform: translateY(15px); pointer-events: none; transition: .2s; }
.toast.visible { opacity: 1; transform: translateY(0); }
.site-footer { width: min(1440px, calc(100% - 48px)); margin: -28px auto 0; padding: 0 0 30px; display: flex; justify-content: space-between; gap: 16px; color: var(--muted); font-size: 11px; font-weight: 750; }
.site-footer nav { display: flex; gap: 14px; }
.site-footer a { color: var(--blue-dark); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.terms-main { max-width: 880px; }
.terms-card { padding: 34px; }
.terms-card h2 { margin: 8px 0 16px; font-size: clamp(28px, 4vw, 42px); letter-spacing: -.055em; }
.terms-card h3 { margin: 25px 0 8px; font-size: 18px; letter-spacing: -.025em; }
.terms-card p, .terms-card li { color: var(--muted); font-size: 13px; line-height: 1.75; }
.terms-card a { color: var(--blue-dark); font-weight: 850; }
.terms-card ul { margin: 10px 0 0; padding-left: 20px; }
.admin-main { max-width: 1180px; }
.admin-card { padding: 30px; }
.admin-card h2 { margin: 8px 0 10px; font-size: clamp(28px, 4vw, 40px); letter-spacing: -.055em; }
.admin-copy, .admin-status { color: var(--muted); font-size: 13px; line-height: 1.7; }
.admin-form { margin-top: 20px; display: grid; grid-template-columns: minmax(240px, 1fr) auto; gap: 12px; align-items: end; }
.admin-status { margin: 16px 0 0; font-weight: 750; }
.admin-users-card { margin-top: 18px; overflow: hidden; }
.admin-count { color: var(--muted); font-size: 12px; font-weight: 850; }
.admin-users-card a { color: var(--blue-dark); font-weight: 800; text-decoration: none; }
.admin-users-card a:hover { text-decoration: underline; }
.records-main { max-width: 1060px; }
.records-hero { min-height: 220px; margin-bottom: 20px; padding: 42px; display: flex; align-items: center; justify-content: space-between; gap: 30px; overflow: hidden; border-radius: 20px; color: white; background: linear-gradient(120deg, #0d3157, #1767a8); box-shadow: var(--shadow); }
.records-hero h2 { margin: 8px 0 10px; font-size: clamp(30px, 4vw, 46px); letter-spacing: -.055em; }
.records-hero p:last-child { max-width: 650px; margin: 0; color: #d2e4f4; line-height: 1.65; }
.records-file-icon { width: 115px; height: 135px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.22); border-radius: 16px; color: #0b6b45; background: #dff7ee; font-size: 22px; font-weight: 900; box-shadow: 0 16px 35px rgba(0,0,0,.14); transform: rotate(4deg); }
.records-generator { padding: 28px; }
.records-form { display: grid; grid-template-columns: minmax(240px, 1.3fr) 1fr 1fr auto; gap: 14px; align-items: end; }
.records-form h2 { margin: 6px 0; font-size: 21px; letter-spacing: -.035em; }
.records-form p:last-child { margin: 0; color: var(--muted); font-size: 11px; }
.records-progress, .records-ready { margin-top: 22px; padding: 18px; display: flex; align-items: center; gap: 14px; border-radius: 12px; background: #e8f2ff; }
.records-progress > div { flex: 1; min-width: 0; }
.records-progress[hidden], .records-ready[hidden] { display: none; }
.records-progress p, .records-ready p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.records-progress-head { display: flex; justify-content: space-between; gap: 12px; }
.records-progress-bar { margin-top: 10px; }
.records-ready { justify-content: space-between; background: #e8f8f1; }
.records-ready h3 { margin: 5px 0 0; font-size: 18px; }
.records-ready .button { text-decoration: none; white-space: nowrap; }
.records-info-grid { margin-top: 20px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.info-card { min-height: 130px; padding: 23px; display: grid; align-content: center; gap: 9px; }
.info-card strong { font-size: 16px; }
.info-card span { color: var(--muted); font-size: 11px; line-height: 1.6; }
@media (max-width: 1200px) { .stats-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 1100px) { .content-grid { grid-template-columns: 1fr; } .side-column { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 760px) {
  .topbar { height: auto; padding: 14px 16px; align-items: flex-start; }
  .brand .eyebrow { display: none; }.brand h1 { font-size: 16px; }.brand-mark { width: 38px; height: 38px; }
  .top-actions .button-ghost { display: none; }.button { padding: 10px 12px; font-size: 12px; }
  main { width: calc(100% - 24px); padding-top: 14px; }
  .source-panel { grid-template-columns: 1fr; gap: 15px; padding: 18px; }.source-controls { grid-template-columns: 1fr; }.source-load { width: 100%; }
  .hero { min-height: 180px; padding: 24px; align-items: flex-start; }.hero-stat { position: absolute; right: 18px; bottom: 18px; padding: 11px 15px; min-width: 110px; }.hero-stat-value { font-size: 28px; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 9px; }.stat-card { min-height: 88px; padding: 12px; gap: 9px; }.medal-icon, .people-icon { width: 40px; height: 40px; }.stat-number { font-size: 22px; }.stat-percent { display: none; }
  .panel-header { align-items: flex-start; flex-direction: column; }.panel-tools { width: 100%; flex-direction: column; }.search-field { min-width: 0; }.panel-tools select { width: 100%; }
  table { min-width: 700px; }.table-wrap { overflow-x: auto; }.empty-state { position: sticky; left: 0; width: calc(100vw - 26px); }
  .side-column { grid-template-columns: 1fr; }.panel-footer { gap: 8px; align-items: flex-start; }.panel-footer div { text-align: right; }
  .records-hero { min-height: 0; padding: 26px; }.records-file-icon { display: none; }
  .records-form, .records-info-grid { grid-template-columns: 1fr; }.records-ready { align-items: flex-start; flex-direction: column; }
  .admin-form { grid-template-columns: 1fr; }
  .site-footer { width: calc(100% - 24px); margin-top: -20px; flex-direction: column; }
  .site-footer nav { flex-wrap: wrap; }
  .terms-card { padding: 24px; }
}
