:root {
  --bg: #f4f6fa;
  --card: #ffffff;
  --text: #1b2333;
  --muted: #5d6b82;
  --line: #e2e7ef;
  --brand: #1f6feb;
  --brand-ink: #ffffff;
  --ok: #1a7f37;    --ok-bg: #e6f4ea;
  --bad: #c62828;   --bad-bg: #fdecea;
  --warn: #9a6700;  --warn-bg: #fff4d6;
  --late: #bc4c00;  --late-bg: #ffeedd;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(16 24 40 / 6%), 0 1px 3px rgb(16 24 40 / 8%);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1420; --card: #182030; --text: #e8edf6; --muted: #9aa7bd; --line: #283247;
    --brand: #4c8dff;
    --ok: #57d07a;   --ok-bg: #173523;
    --bad: #ff7b72;  --bad-bg: #3d1d1d;
    --warn: #e3b341; --warn-bg: #3a2f12;
    --late: #ffa657; --late-bg: #3b2614;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}
a { color: var(--brand); }
h1 { font-size: 1.35rem; margin: 4px 0 12px; }
h2 { font-size: 1.05rem; margin: 22px 0 8px; color: var(--muted); font-weight: 600; }
h3 { font-size: 1rem; margin: 0 0 4px; }
p { margin: 6px 0; }
.muted { color: var(--muted); font-size: .92rem; }
.small { font-size: .85rem; }
.loading { color: var(--muted); text-align: center; padding: 40px 0; }

/* ---- Κεφαλίδα & πλοήγηση ---- */
.top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: var(--brand); color: var(--brand-ink);
}
.club-name { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; text-align: left; background: none; border: 0; color: inherit; font: inherit; padding: 2px 0; cursor: pointer; }
.club-name svg { flex: none; border-radius: 9px; box-shadow: 0 0 0 1.5px rgb(255 255 255 / 35%); }
.top-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.top-brand { font-size: .68rem; font-weight: 800; letter-spacing: .22em; opacity: .85; }
.top-club { font-weight: 600; font-size: 1.02rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bell { position: relative; background: rgb(255 255 255 / 18%); border: 0; border-radius: 50%; width: 40px; height: 40px; font-size: 1.1rem; cursor: pointer; }
.bell span { position: absolute; top: -2px; right: -2px; background: var(--bad); color: #fff; border-radius: 10px; font-size: .7rem; padding: 1px 6px; font-weight: 700; }
main { max-width: 760px; margin: 0 auto; padding: 14px 16px 24px; }
.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 5; display: flex; background: var(--card);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tabs a { flex: 1; text-align: center; padding: 8px 2px 7px; text-decoration: none; color: var(--muted); font-size: .72rem; }
.tabs a b { display: block; font-size: 1.3rem; line-height: 1.3; font-weight: normal; }
.tabs a.active { color: var(--brand); font-weight: 600; }

/* ---- Κάρτες & λίστες ---- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); padding: 14px; margin: 10px 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); text-decoration: none; color: inherit; display: block; }
.stat .n { font-size: 1.45rem; font-weight: 700; }
.stat .l { color: var(--muted); font-size: .85rem; }
.stat.bad .n { color: var(--bad); }
.stat.ok .n { color: var(--ok); }
.list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin: 10px 0; }
.row { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--line); text-decoration: none; color: inherit; min-height: 52px; }
.row:first-child { border-top: 0; }
.row .grow { flex: 1; min-width: 0; }
/* Στενή οθόνη / μεγάλα γράμματα: αν δεν χωράνε, τα κουμπιά πάνε από κάτω (το κείμενο δεν «σπάει» γράμμα-γράμμα) */
.row { flex-wrap: wrap; row-gap: 8px; }
.row > .grow { min-width: 9em; }
.row .title { font-weight: 600; overflow-wrap: anywhere; }
a.row:active, button.row:active { background: var(--bg); }
button.row { width: 100%; background: none; border: 0; border-top: 1px solid var(--line); font: inherit; text-align: left; cursor: pointer; }
.row .time { font-weight: 700; min-width: 3.2em; }
.empty { color: var(--muted); padding: 16px 14px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .85rem; color: #fff; flex: none; }

/* ---- Ετικέτες ---- */
.tag { display: inline-block; font-size: .78rem; padding: 2px 8px; border-radius: 99px; background: var(--bg); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.tag.ok   { background: var(--ok-bg);   color: var(--ok);   border-color: transparent; }
.tag.bad  { background: var(--bad-bg);  color: var(--bad);  border-color: transparent; }
.tag.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.tag.late { background: var(--late-bg); color: var(--late); border-color: transparent; }
.cancelled .title { text-decoration: line-through; color: var(--muted); }

/* ---- Κουμπιά ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 10px 16px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--text);
  font: 600 .95rem/1.2 inherit; cursor: pointer; text-decoration: none;
}
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.danger { color: var(--bad); }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: .85rem; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 8px; }
.chip { border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 99px; padding: 7px 13px; font: inherit; font-size: .88rem; white-space: nowrap; cursor: pointer; }
.chip.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }

/* ---- Παρουσίες ---- */
.att-head { position: sticky; top: 60px; z-index: 3; background: var(--bg); padding: 4px 0 8px; }
.att { display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px 14px; min-height: 60px; border: 0; border-top: 1px solid var(--line); background: var(--card); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.att:first-child { border-top: 0; }
.att .grow { flex: 1; }
.att .state { font-weight: 700; font-size: .85rem; padding: 6px 10px; border-radius: 10px; min-width: 128px; text-align: center; }
.att.PRESENT .state { background: var(--ok-bg); color: var(--ok); }
.att.ABSENT  .state { background: var(--bad-bg); color: var(--bad); }
.att.EXCUSED .state { background: var(--warn-bg); color: var(--warn); }
.att.LATE    .state { background: var(--late-bg); color: var(--late); }
.savebar { position: sticky; bottom: calc(64px + env(safe-area-inset-bottom)); padding: 10px 0; background: linear-gradient(transparent, var(--bg) 30%); }

/* ---- Φόρμες ---- */
dialog { border: 0; border-radius: 18px; padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); background: var(--card); color: var(--text); box-shadow: 0 10px 40px rgb(0 0 0 / 30%); }
dialog::backdrop { background: rgb(10 15 25 / 55%); }
dialog form { display: flex; flex-direction: column; max-height: calc(100dvh - 24px); }
dialog .dlg-body { padding: 18px 18px 6px; overflow-y: auto; }
dialog .dlg-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 18px 16px; border-top: 1px solid var(--line); }
label.field { display: block; margin: 0 0 12px; font-size: .9rem; color: var(--muted); }
label.field > span { display: block; margin-bottom: 4px; }
input, select, textarea {
  width: 100%; font: inherit; font-size: 16px; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; min-height: 44px;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: transparent; }
label.check { display: flex; gap: 10px; align-items: center; margin: 0 0 10px; color: var(--text); }
label.check input { width: 22px; height: 22px; min-height: 0; flex: none; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.help { font-size: .8rem; color: var(--muted); margin-top: 3px; }

/* ---- Είσοδος ---- */
.auth { max-width: 420px; margin: 6vh auto 0; }
.auth .logo { font-size: 3rem; text-align: center; }
.auth h1 { text-align: center; }
.notice { border-radius: 12px; padding: 12px 14px; margin: 10px 0; background: var(--warn-bg); color: var(--text); }
.notice.info { background: color-mix(in srgb, var(--brand) 12%, var(--card)); }
.notice.err { background: var(--bad-bg); }

#toast {
  position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 20;
  background: #1b2333; color: #fff; padding: 12px 18px; border-radius: 12px; max-width: calc(100vw - 32px); box-shadow: 0 6px 20px rgb(0 0 0 / 25%);
}
pre.share { white-space: pre-wrap; background: var(--bg); border-radius: 10px; padding: 10px; font: inherit; font-size: .9rem; }

/* ---- Πίνακες (κατάσταση παρουσιών, προεπισκόπηση εισαγωγής) ---- */
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin: 10px 0; }
table.grid { border-collapse: collapse; font-size: .85rem; min-width: 100%; }
table.grid th, table.grid td { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: center; white-space: nowrap; }
table.grid th { background: var(--bg); font-weight: 600; position: sticky; top: 0; }
table.grid td.name, table.grid th.name { text-align: left; position: sticky; left: 0; background: var(--card); z-index: 1; }
table.grid th.name { background: var(--bg); z-index: 2; }
table.grid td.PRESENT { color: var(--ok); } table.grid td.ABSENT { color: var(--bad); background: var(--bad-bg); }
table.grid td.EXCUSED { color: var(--warn); } table.grid td.LATE { color: var(--late); }
table.grid tr.err td { background: var(--bad-bg); }
.legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: .82rem; color: var(--muted); }

@media print {
  .top, .tabs, .no-print, #toast { display: none !important; }
  body { background: #fff; color: #000; padding: 0; }
  main { max-width: none; padding: 0; }
  .table-wrap { overflow: visible; border: 0; }
  table.grid { font-size: 9pt; }
  table.grid th, table.grid td { padding: 2px 4px; border: 1px solid #999; }
  table.grid td.name, table.grid th.name { position: static; }
}

/* ---- Ταυτότητα OLYMPION ---- */
.brand, .splash { display: flex; flex-direction: column; align-items: center; text-align: center; margin: 4px 0 18px; }
.brand svg, .splash img { filter: drop-shadow(0 6px 14px rgb(18 56 168 / 30%)); }
.brand-name { margin-top: 12px; font-size: 2rem; font-weight: 800; letter-spacing: .2em; color: var(--brand); padding-left: .2em; }
.brand-tag { margin-top: 2px; font-size: .95rem; color: var(--muted); letter-spacing: .02em; }
.splash { margin-top: 22vh; }
.small-brand { margin: 28px 0 8px; opacity: .8; }
.small-brand .brand-name { font-size: 1.1rem; margin-top: 6px; }
.small-brand .brand-tag { font-size: .8rem; }

details.advanced { margin: 14px 0; }
details.advanced > summary { cursor: pointer; padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); font-weight: 600; list-style: none; }
details.advanced > summary::-webkit-details-marker { display: none; }
details.advanced[open] > summary { color: var(--brand); }

/* ---- Μηνιαίο ημερολόγιο ---- */
.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.cal-head h1 { flex: 1; text-align: center; margin: 0; text-transform: capitalize; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin: 6px 0 10px; }
.cal .dow { text-align: center; font-size: .72rem; font-weight: 600; color: var(--muted); padding: 2px 0; }
.cal .day { display: flex; flex-direction: column; gap: 2px; min-height: 68px; padding: 4px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); color: var(--text); font: inherit; text-align: left; cursor: pointer; overflow: hidden; min-width: 0; }
.cal .day.empty { background: transparent; border-color: transparent; cursor: default; }
.cal .day:hover:not(.empty) { border-color: var(--brand); }
.cal .day .num { font-size: .8rem; font-weight: 700; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; }
.cal .day.today .num { background: var(--brand); color: #fff; }
.cal .ev { display: block; font-size: .64rem; line-height: 1.25; padding: 1px 3px; border-radius: 4px; border-left: 3px solid var(--c);
  background: color-mix(in srgb, var(--c) 16%, var(--card)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal .ev.match { font-weight: 700; }
.cal .ev.cancelled { text-decoration: line-through; opacity: .5; }
.cal .more { font-size: .62rem; color: var(--muted); }
.chip .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
@media (max-width: 600px) { .cal .ev .n { display: none; } .cal { gap: 3px; } .cal .day { min-height: 60px; padding: 3px; } }
@media (min-width: 900px) { .cal .day { min-height: 96px; } .cal .ev { font-size: .72rem; } }
.ev-card { border-left: 5px solid var(--c); background: var(--bg); border-radius: 12px; padding: 10px 12px; margin: 10px 0; }
.ev-title { font-weight: 700; margin-bottom: 4px; }
.ev-line { font-size: .92rem; margin: 3px 0; }

.row.stack { flex-wrap: wrap; row-gap: 8px; }
.row.stack > .grow { flex-basis: 100%; }
.card.contact a { margin-right: 12px; }

/* Επιλογή γλώσσας */
.lang-switch { display: flex; justify-content: center; gap: 6px; margin: 4px 0 10px; }
.lang-switch button { border: 1px solid var(--line, #d0d7de); background: var(--card, #fff); color: inherit; border-radius: 999px; padding: 6px 12px; font: inherit; font-size: .9rem; cursor: pointer; }
.lang-switch button.on { border-color: var(--brand, #1f6feb); color: var(--brand, #1f6feb); font-weight: 600; }

/* Οικονομικά: μία κάρτα ανά αθλητή, από κάτω οι μήνες */
.ath-group { padding: 10px 12px; margin-bottom: 10px; }
.ath-group .ath-head { border: 0; padding: 0 0 8px; min-height: 0; }
.ath-group .list.inner { margin: 0; box-shadow: none; border: 1px solid var(--line); }
.ath-group .list.inner .row { padding: 8px 10px; min-height: 0; }
.row .num { min-width: 1.9em; text-align: right; color: var(--muted); font-weight: 600; font-size: .9rem; }

/* ✅ Φάκελος αθλητή */
.checks { display: flex; flex-wrap: wrap; gap: 6px; }
.checks .chk { display: inline-flex; align-items: center; gap: 4px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 99px; background: var(--card); font-size: .9rem; cursor: pointer; }
.checks .chk.done { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); font-weight: 600; }
.checks .chk input { margin: 0; }
