/* HOJ app — shared styling. House of J palette. */
:root {
  --ink: #102033;
  --muted: #6c7789;
  --line: #dce5f2;
  --paper: #eef3f8;
  --panel: #ffffff;
  --navy: #102033;
  --teal: #10b981;
  --blue: #2563eb;
  --violet: #7c3aed;
  --rose: #ef476f;
  --gold: #f59e0b;
  --shadow: 0 22px 48px rgba(15, 32, 51, 0.14);
  --soft: 0 10px 26px rgba(15, 32, 51, 0.08);
}
* { box-sizing: border-box; }
/* Auth flash guard — a gated body stays hidden until auth.js confirms the
   session state, so signed-in users never see the login form (or a protected
   shell) flash while navigating between pages. JS removes the class to reveal. */
body.auth-gate { visibility: hidden; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.4;
  background:
    radial-gradient(circle at 14% 12%, rgba(16, 185, 129, 0.18), transparent 27%),
    radial-gradient(circle at 88% 8%, rgba(124, 58, 237, 0.16), transparent 24%),
    linear-gradient(180deg, #fbfdff 0%, var(--paper) 100%);
}
a { color: var(--blue); text-decoration: none; }
.wrap { width: min(1120px, calc(100% - 32px)); margin: 0 auto; padding: 24px 0 56px; }

/* Top bar */
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 0; margin-bottom: 8px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 44px; height: 44px; border-radius: 10px; color: #fff; font-weight: 900;
  display: flex; align-items: center; justify-content: center; font-size: 22px;
  background: linear-gradient(135deg, var(--navy), #15435a);
}
.brand small { color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.brand h1 { margin: 0; font-size: 20px; }
.spacer { flex: 1; }
.who { color: var(--muted); font-size: 13px; font-weight: 700; }
.role-pill {
  display: inline-block; font-size: 11px; font-weight: 900; text-transform: uppercase;
  letter-spacing: .05em; padding: 4px 9px; border-radius: 999px; color: #fff; margin-left: 6px;
}
.role-admin { background: var(--violet); }
.role-clerk { background: var(--gold); }
.role-athlete { background: var(--blue); }
.role-client { background: var(--teal); }

/* Hero */
.hero {
  padding: clamp(22px, 5vw, 42px); border-radius: 12px; color: #fff;
  background: linear-gradient(120deg, rgba(8,18,32,.96), rgba(15,82,93,.94) 55%, rgba(80,64,171,.9));
  box-shadow: var(--shadow); margin-bottom: 22px;
}
.hero h2 { margin: 0; font-size: clamp(26px, 5vw, 44px); line-height: 1.02; }
.hero p { margin: 10px 0 0; color: rgba(255,255,255,.85); max-width: 60ch; }

/* Cards / panels */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px; box-shadow: var(--soft); }
.panel h3 { margin: 0 0 4px; font-size: 17px; }
.panel p { margin: 0; color: var(--muted); font-size: 14px; }
.card {
  display: flex; flex-direction: column; justify-content: space-between; gap: 16px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 20px; box-shadow: var(--soft); min-height: 150px; color: inherit;
}
.card h3 { margin: 0 0 6px; font-size: 18px; }
.card p { margin: 0; color: var(--muted); font-size: 14px; }
.section-title { font-size: 13px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 26px 0 12px; }

/* Buttons & forms */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 10px 16px; border-radius: 9px; border: 0; cursor: pointer;
  color: #fff; background: var(--navy); font-weight: 800; font-size: 14px;
}
.btn:hover { filter: brightness(1.08); }
.btn.secondary { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.danger { background: var(--rose); }
.btn.small { min-height: 34px; padding: 6px 11px; font-size: 13px; }

/* Shared "My Dashboard / Sign out" nav pill — pinned far right on every page. */
.back-btn {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 12px;
  background: linear-gradient(135deg, #eceafa, #e6e1f5);
  border: 1px solid rgba(91, 100, 115, 0.12);
  color: #5b6473; font-weight: 800; font-size: 16px;
  text-decoration: none; white-space: nowrap; cursor: pointer;
}
.back-btn:hover { filter: brightness(0.97); color: #434b59; }
label { display: block; font-size: 12px; font-weight: 800; color: var(--muted); margin: 0 0 5px; text-transform: uppercase; letter-spacing: .04em; }
input, select {
  width: 100%; min-height: 42px; padding: 9px 12px; border-radius: 9px;
  border: 1px solid var(--line); background: #fff; font-size: 15px; color: var(--ink);
}
.field { margin-bottom: 14px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > .field { flex: 1; min-width: 160px; }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 11px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }

/* Misc */
.note { font-size: 13px; color: var(--muted); }
.msg { padding: 11px 14px; border-radius: 9px; font-size: 14px; font-weight: 700; margin: 12px 0; }
.msg.ok { background: rgba(16,185,129,.12); color: #047857; }
.msg.err { background: rgba(239,71,111,.12); color: #be123c; }
.checks { display: grid; gap: 8px; }
.check { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; }
.check input { width: auto; min-height: 0; }
.check .meta { display: flex; flex-direction: column; }
.check .meta b { font-size: 14px; }
.check .meta span { font-size: 12px; color: var(--muted); }
.center-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: min(420px, 100%); }
.login-card .logo { width: 56px; height: 56px; font-size: 28px; margin-bottom: 14px; }
.foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 30px; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15,32,51,.45); display: none; align-items: center; justify-content: center; padding: 24px; z-index: 50; }
.modal-backdrop.open { display: flex; }
.modal { width: min(440px, 100%); background: var(--panel); border-radius: 16px; box-shadow: var(--shadow); padding: 22px; max-height: 90vh; overflow: auto; }
.modal h3 { margin: 0 0 4px; }
.modal .sub { margin: 0 0 16px; color: var(--muted); font-size: 14px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

/* Toggle row — a clickable card with a switch */
.toggle-row { display: flex; align-items: center; gap: 12px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 11px; cursor: pointer; user-select: none; transition: border-color .15s, background .15s; }
.toggle-row + .toggle-row { margin-top: 8px; }
.toggle-row:hover { border-color: #b9c8de; }
.toggle-row.on { border-color: var(--teal); background: rgba(16,185,129,.06); }
.toggle-row .meta { display: flex; flex-direction: column; flex: 1; }
.toggle-row .meta b { font-size: 14px; }
.toggle-row .meta span { font-size: 12px; color: var(--muted); }
.switch { position: relative; width: 42px; height: 24px; border-radius: 999px; background: #cdd6e4; flex: 0 0 auto; transition: background .15s; }
.toggle-row.on .switch { background: var(--teal); }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(15,32,51,.3); transition: transform .15s; }
.toggle-row.on .switch::after { transform: translateX(18px); }
