/* IBSA Live — shared brand tokens and components (IBSA teal / navy / orange, Montserrat). */
@font-face { font-family: Montserrat; src: url(/fonts/Montserrat-Regular.ttf); font-weight: 400; font-display: swap; }
@font-face { font-family: Montserrat; src: url(/fonts/Montserrat-Medium.ttf); font-weight: 500; font-display: swap; }
@font-face { font-family: Montserrat; src: url(/fonts/Montserrat-SemiBold.ttf); font-weight: 600; font-display: swap; }
@font-face { font-family: Montserrat; src: url(/fonts/Montserrat-Bold.ttf); font-weight: 700; font-display: swap; }
@font-face { font-family: Montserrat; src: url(/fonts/Montserrat-ExtraBold.ttf); font-weight: 800; font-display: swap; }

:root {
  --teal: #03adad;
  --teal-ink: #007a7a;      /* teal text on white, 4.6:1 */
  --teal-soft: #e3f6f6;
  --navy: #24135f;
  --navy-2: #33207e;
  --navy-soft: #ece9f6;
  --orange: #f6891f;
  --orange-ink: #a85300;
  --orange-soft: #fff1e2;
  --bg: #f3f5f9;
  --surface: #ffffff;
  --ink: #14202b;
  --ink-2: #4a5866;
  --ink-3: #64717d;
  --line: #dde3ea;
  --danger: #b3261e;
  --danger-soft: #fdecea;
  --ok: #146c43;
  --ok-soft: #e6f4ec;
  --warn: #8a5300;
  --warn-soft: #fff3dc;
  --judo-white: #ffffff;
  --judo-blue: #1458c4;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(20, 32, 43, .06), 0 8px 24px rgba(20, 32, 43, .08);
  --shadow-sm: 0 1px 2px rgba(20, 32, 43, .05), 0 2px 8px rgba(20, 32, 43, .04);
  --font: Montserrat, -apple-system, "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 28px; font-weight: 800; letter-spacing: -.015em; color: #120a3a; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
a { color: var(--teal-ink); }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.mono, .tabular { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 18px; border-radius: 10px; border: 1px solid transparent; font: 600 14px var(--font); letter-spacing: .01em; cursor: pointer; text-decoration: none; white-space: nowrap; background: var(--teal); color: #fff; box-shadow: 0 1px 2px rgba(3, 120, 120, .25); transition: background-color .15s, border-color .15s, box-shadow .15s, filter .15s; }
.btn:hover:not(:disabled) { filter: brightness(.95); }
.btn:active:not(:disabled) { filter: brightness(.9); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.plain { background: var(--surface); color: var(--ink); border-color: var(--line); box-shadow: var(--shadow-sm); }
.btn.plain:hover:not(:disabled) { filter: none; background: #f7f9fc; border-color: #c9d2dd; }
.btn.navy { background: var(--navy); }
.btn.orange { background: var(--orange); color: #1d1200; }
.btn.danger { background: var(--danger-soft); color: var(--danger); border-color: #f3c4bf; }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: none; }
.btn.danger, .btn.navy { box-shadow: var(--shadow-sm); }
.btn.sm { min-height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn.lg { min-height: 56px; padding: 0 24px; font-size: 17px; }
.icon { width: 18px; height: 18px; flex: none; }

/* Forms */
label.field { display: grid; gap: 6px; font-weight: 600; font-size: 13px; color: var(--ink-2); }
input, select, textarea { font: 15px var(--font); color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); min-height: 44px; padding: 8px 12px; width: 100%; }
input:hover, select:hover, textarea:hover { border-color: #c9d2dd; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(3, 173, 173, .18); }
textarea { min-height: 120px; font-family: var(--mono); font-size: 13px; }
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; min-height: 0; padding: 0; margin: 0; flex: none; accent-color: var(--teal); }
.stack > .check:has(input[type=radio]) { padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; }
.stack > .check:has(input[type=radio]:checked) { border-color: var(--teal); background: var(--teal-soft); }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* Surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px; box-shadow: var(--shadow-sm); }
.card + .card { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.stack { display: grid; gap: 12px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* Athlete photos */
.avatar { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; flex: none; display: inline-grid; place-items: center; background: var(--navy-soft); }
.avatar.sm { width: 32px; height: 32px; border-radius: 8px; font-size: 12px; }
.avatar.xl { width: 112px; height: 112px; border-radius: 16px; font-size: 34px; box-shadow: var(--shadow-sm); }
.avatar.initials { background: linear-gradient(135deg, var(--navy), #3c2a8f); color: #fff; font-weight: 800; letter-spacing: .02em; }
.name-cell { display: inline-flex; align-items: center; gap: 10px; vertical-align: middle; }
.photo-pick { display: flex; gap: 20px; align-items: center; padding: 16px; border: 1px dashed var(--line); border-radius: 14px; background: #fafbfd; }

/* Badges: status always shown with text (and a symbol), never colour alone */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--navy-soft); color: var(--navy); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.teal { background: var(--teal-soft); color: var(--teal-ink); }
.badge.live { background: var(--danger); color: #fff; }
.dot-j1::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #d62828; }
.dot-hi::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #f2c200; }

/* Tables */
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-sm); }
tbody tr { transition: background-color .12s; }
tbody tr:hover td { background: #f8fafd; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { position: sticky; top: 0; background: #f7f9fc; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); z-index: 1; }
tr:last-child td { border-bottom: 0; }
tr.err td { background: var(--danger-soft); }
tr.warnrow td { background: var(--warn-soft); }
td input, td select { min-height: 34px; padding: 4px 8px; font-size: 13px; }

/* App chrome */
.topbar { display: flex; align-items: center; gap: 16px; padding: 0 20px; height: 60px; background: linear-gradient(90deg, #1c0f4d, var(--navy) 60%, #2c1874); color: #fff; position: sticky; top: 0; z-index: 20; box-shadow: 0 1px 0 rgba(255,255,255,.06), 0 4px 16px rgba(20, 12, 60, .18); }
.topbar .logo { height: 32px; width: auto; display: block; }
.topbar .crumbs .brand { font-weight: 800; font-size: 16px; letter-spacing: .01em; padding-right: 4px; }
.topbar .crumbs .brand em { font-style: normal; color: var(--teal); }
.topbar .crumbs > span[aria-hidden] { opacity: .45; }
.lang-pick { width: auto; min-height: 34px; padding: 4px 8px; font-size: 13px; font-weight: 600; }
.lang-pick.on-dark { background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.25); }
.lang-pick.on-dark option { color: var(--ink); background: var(--surface); }
.login-lang { position: fixed; top: 16px; right: 16px; z-index: 5; }
.topbar a, .topbar button, .topbar .btn.ghost { color: #fff; }
.topbar .crumbs { display: flex; gap: 8px; align-items: center; font-weight: 600; min-width: 0; }
.topbar .crumbs span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .user { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.topbar .user img { width: 30px; height: 30px; border-radius: 50%; }
.tabs { display: flex; gap: 4px; padding: 0 20px; background: var(--surface); border-bottom: 1px solid var(--line); overflow-x: auto; position: sticky; top: 60px; z-index: 19; }
.tabs a { padding: 15px 14px 13px; font-weight: 600; font-size: 14px; color: var(--ink-3); text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap; transition: color .15s, border-color .15s; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current=page] { color: var(--navy); border-color: var(--teal); }
main.page { padding: 24px 20px 60px; max-width: 1400px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.empty { padding: 40px 20px; text-align: center; color: var(--ink-2); }

/* Modal + toast */
.modal-backdrop { position: fixed; inset: 0; background: rgba(20, 16, 50, .55); display: grid; place-items: center; z-index: 100; padding: 16px; }
.modal { background: var(--surface); border-radius: 18px; box-shadow: 0 24px 64px rgba(20, 12, 60, .35); width: min(720px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 24px; }
.modal.wide { width: min(1200px, 100%); }
.modal header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 200; }
.toast { background: var(--navy); color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow); display: flex; gap: 14px; align-items: center; min-width: 320px; font-weight: 600; }
.toast.error { background: var(--danger); }
.toast button { background: rgba(255,255,255,.15); color: #fff; border: 0; border-radius: 999px; padding: 6px 12px; font: 700 13px var(--font); cursor: pointer; }

@media print {
  .topbar, .tabs, .no-print, .toasts { display: none !important; }
  body { background: #fff; }
  .card { border: 0; padding: 0; }
}
