:root {
  --bg: #f7f7fb;
  --surface: #fff;
  --text: #1c1b29;
  --muted: #6b6a80;
  --line: #e3e2ee;
  --accent: #5b3fd6;
  --accent-ink: #fff;
  --danger: #d9534f;
  --ok: #1f8a5b;
  --radius: 10px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Segoe UI", sans-serif;
  -webkit-text-size-adjust: 100%;
}
a { color: inherit; }
.muted { color: var(--muted); font-size: 14px; }
.error { color: var(--danger); font-size: 14px; margin: 4px 0 0; }

/* Header + nav */
.top { position: sticky; top: 0; z-index: 5; background: var(--surface); border-bottom: 1px solid var(--line); }
.top-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; max-width: 720px; margin: 0 auto; }
.brand { font-weight: 700; text-decoration: none; }
.logout { background: none; border: 0; color: var(--muted); font-size: 14px; padding: 8px; cursor: pointer; }
.tabs { display: flex; gap: 4px; overflow-x: auto; padding: 0 12px 8px; max-width: 720px; margin: 0 auto; scrollbar-width: none; }
.tabs a { flex: none; padding: 6px 12px; border-radius: 999px; text-decoration: none; font-size: 14px; color: var(--muted); }
.tabs a.active { background: #efeafe; color: var(--accent); font-weight: 600; }

main { max-width: 560px; margin: 0 auto; padding: 16px 16px 96px; }
h1 { font-size: 20px; margin: 4px 0 16px; display: flex; align-items: center; gap: 8px; }
h1 img { width: 22px; height: 22px; }

/* Home */
.menu { display: grid; gap: 10px; }
.menu a {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  text-decoration: none; font-weight: 600; font-size: 17px;
}
.menu img { width: 28px; height: 28px; }
.banner { border-radius: var(--radius); background: linear-gradient(135deg, #efeafe, #e3f4ea); padding: 20px 18px; margin-bottom: 16px; }
.banner strong { display: block; font-size: 22px; }

/* Forms */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; min-width: 0; }
.field > span { font-size: 14px; font-weight: 600; }
.field > span .req { color: var(--danger); margin-left: 2px; }
input, select, textarea {
  font: inherit; width: 100%; min-height: 44px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.time-row { display: grid; grid-template-columns: 88px 1fr auto 1fr; align-items: center; gap: 8px; margin-bottom: 8px; }
.time-row label { font-weight: 600; font-size: 15px; }
.time-row .sep { color: var(--muted); }
.results { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.results label { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); text-align: center; }
.results input { text-align: center; padding: 8px 4px; }
.radios { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.radios label { display: flex; align-items: center; justify-content: center; min-height: 44px; border: 1px solid var(--line); border-radius: 8px; font-size: 15px; cursor: pointer; }
.radios input { position: absolute; opacity: 0; width: 0; height: 0; min-height: 0; }
.radios input:checked + span { color: var(--accent); font-weight: 700; }
.radios label:has(input:checked) { border-color: var(--accent); background: #f4f0ff; }
.actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }
.btn { font: inherit; font-weight: 600; min-height: 44px; padding: 0 20px; border-radius: 8px; border: 1px solid var(--line); background: #fff; cursor: pointer; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn:disabled { opacity: .6; cursor: default; }
.club-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* History */
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { background: #faf9fe; position: sticky; top: 0; font-weight: 600; }
.history-actions { display: flex; justify-content: space-between; align-items: center; margin: 12px 0; gap: 10px; }

/* Toast + modal */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 15px; z-index: 20; max-width: calc(100% - 32px); }
.toast.ok { background: var(--ok); }
.toast.err { background: var(--danger); }
.modal { position: fixed; inset: 0; background: rgba(20, 18, 40, .45); display: grid; place-items: center; z-index: 30; padding: 16px; }
.modal-box { background: #fff; border-radius: 14px; padding: 20px; width: 100%; max-width: 360px; display: grid; gap: 10px; }
.modal-box h2 { margin: 0; font-size: 18px; }

/* Login page */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login form { width: 100%; max-width: 340px; display: grid; gap: 12px; }
.login h1 { justify-content: center; font-size: 24px; margin: 0; }
.login p { text-align: center; margin: 0 0 8px; }

@media (min-width: 720px) {
  main { padding-top: 24px; }
}
