/* AEK Performance — design system
   AEK Larnaca green & yellow chrome + neutral surfaces; chart series colors
   come from the validated categorical palette (see public/js/charts.js). */

:root {
  --navy-900: #05301d;      /* deep AEK green */
  --navy-800: #0a4527;      /* primary AEK green */
  --navy-700: #14603a;
  --gold: #ffcc00;          /* AEK yellow */
  --accent: #159a58;
  --accent-strong: #0b6b3d;
  --page: #f4f5f7;
  --surface: #ffffff;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --ink-3: #898781;
  --hairline: rgba(11, 11, 11, 0.10);
  --grid: #e1e0d9;
  --good: #0ca30c;
  --good-text: #006300;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --critical-bg: #fdeeee;
  --warn-bg: #fdf6e7;
  --good-bg: #eef8ee;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(5, 48, 29, 0.06), 0 4px 14px rgba(5, 48, 29, 0.05);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--page);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
}

a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Coach chrome ---------- */

.topbar {
  background: linear-gradient(135deg, var(--navy-900), var(--navy-700));
  color: #fff;
  padding: 0 20px;
}
.topbar-inner {
  max-width: 1180px; margin: 0 auto;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 0 10px;
}
.crest {
  width: 38px; height: 38px; flex: none;
  display: flex; align-items: center; justify-content: center;
}
.crest img {
  width: 100%; height: 100%; object-fit: contain; display: block;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.30));
}
.topbar h1 { font-size: 17px; margin: 0; font-weight: 700; letter-spacing: 0.2px; }
.topbar .sub { font-size: 12px; color: rgba(255, 255, 255, 0.65); margin: 0; }
.topbar form { margin-left: auto; }
.btn-ghost {
  background: rgba(255, 255, 255, 0.12); color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 6px 14px; border-radius: 8px; font-size: 13px; cursor: pointer;
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.2); }

.nav {
  max-width: 1180px; margin: 0 auto;
  display: flex; gap: 4px; overflow-x: auto; -webkit-overflow-scrolling: touch;
  padding-bottom: 0;
}
.nav a {
  color: rgba(255, 255, 255, 0.75); padding: 9px 14px 11px;
  font-size: 14px; font-weight: 600; white-space: nowrap;
  border-bottom: 3px solid transparent; text-decoration: none;
}
.nav a.active { color: #fff; border-bottom-color: var(--gold); }
.nav a:hover { color: #fff; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 22px 20px 60px; }

/* ---------- Cards & layout ---------- */

.card {
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 20px; margin-bottom: 20px;
}
.card > h2 {
  margin: 0 0 4px; font-size: 16px; font-weight: 700;
}
.card .card-sub { color: var(--ink-2); font-size: 13px; margin: 0 0 14px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
@media (max-width: 860px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

.page-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 18px;
}
.page-head h2 { margin: 0; font-size: 20px; }
.page-head .muted { color: var(--ink-2); font-size: 13px; }

.datenav { display: flex; align-items: center; gap: 8px; }
.datenav a, .datenav span.today-chip {
  border: 1px solid var(--hairline); background: var(--surface);
  padding: 6px 12px; border-radius: 8px; font-size: 13px; font-weight: 600;
  color: var(--ink); text-decoration: none;
}
.datenav a:hover { border-color: var(--accent); color: var(--accent-strong); text-decoration: none; }

/* ---------- Stat tiles ---------- */

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 20px; }
.tile {
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow);
}
.tile .t-label { font-size: 12px; color: var(--ink-2); font-weight: 600; letter-spacing: 0.2px; text-transform: uppercase; }
.tile .t-value { font-size: 26px; font-weight: 750; margin-top: 2px; }
.tile .t-note { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.tile .t-value small { font-size: 14px; font-weight: 600; color: var(--ink-3); }

/* ---------- Tables ---------- */

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -20px; padding: 0 20px; }
table.data {
  border-collapse: collapse; width: 100%; font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}
/* Values and headers are centered across columns (client preference). The
   sticky player-name column and long free-text cells stay left for legibility. */
table.data th {
  text-align: center; color: var(--ink-3); font-size: 11.5px; text-transform: uppercase;
  letter-spacing: 0.4px; font-weight: 700; padding: 8px 10px;
  border-bottom: 1px solid var(--grid); white-space: nowrap;
}
table.data td {
  padding: 8px 10px; border-bottom: 1px solid #f0efec; white-space: nowrap;
  text-align: center;
}
table.data tr:last-child td { border-bottom: none; }
table.data td.name, table.data th.name {
  position: sticky; left: 0; background: var(--surface); font-weight: 600;
  max-width: 200px; overflow: hidden; text-overflow: ellipsis;
  box-shadow: 4px 0 6px -4px rgba(0,0,0,.08);
  text-align: left;
}
table.data td.text-left, table.data th.text-left { text-align: left; }
table.data tfoot td { border-top: 2px solid var(--grid); color: var(--ink-2); font-weight: 600; }
.num { text-align: center; }
td.num, th.num { text-align: center; }

.shirt {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 24px; height: 24px; padding: 0 4px; border-radius: 6px;
  background: var(--navy-800); color: #fff; font-size: 11.5px; font-weight: 700;
  margin-right: 8px;
}

/* cell severity tints (always paired with the value itself, never color-only) */
td.cell-bad { background: var(--critical-bg); color: #8f1f1f; font-weight: 700; }
td.cell-note { background: var(--warn-bg); font-weight: 600; }
td.cell-good { background: var(--good-bg); color: var(--good-text); font-weight: 700; }
td.cell-empty { color: var(--ink-3); }

/* ---------- Badges & pills ---------- */

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px;
}
.badge-good { background: var(--good-bg); color: var(--good-text); }
.badge-warn { background: var(--warn-bg); color: #8a5b00; }
.badge-bad { background: var(--critical-bg); color: #8f1f1f; }
.badge-muted { background: #f0efec; color: var(--ink-2); }
.badge-navy { background: var(--navy-800); color: #fff; }

.type-chip {
  font-size: 11px; font-weight: 800; letter-spacing: 0.5px; padding: 2px 8px;
  border-radius: 6px; background: #e9f2ec; color: var(--navy-700);
}
.type-chip.GAME { background: var(--navy-800); color: #fff; }
.type-chip.COMPENSATORY { background: #f3ecfd; color: #4a3aa7; }        /* purple */
.type-chip.REHAB { background: #fbe4e4; color: #a11f1f; }               /* red */
.type-chip.RECOVERY { background: #e2eefb; color: #1c5cab; }            /* light blue */

/* ---------- Buttons & forms ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: var(--navy-800); color: #fff; border: none; cursor: pointer;
  padding: 9px 16px; border-radius: 9px; font-size: 14px; font-weight: 650;
  text-decoration: none;
}
.btn:hover { background: var(--navy-700); text-decoration: none; }
.btn-secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--hairline); }
.btn-secondary:hover { background: #f4f5f7; }
.btn-danger { background: var(--critical); }
.btn-danger:hover { background: #b32f2f; }
.btn-whatsapp { background: #1fa855; }
.btn-whatsapp:hover { background: #178c46; }
.btn-sm { padding: 5px 11px; font-size: 12.5px; border-radius: 7px; }

label.field { display: block; font-size: 12.5px; font-weight: 650; color: var(--ink-2); margin-bottom: 12px; }
label.field span { display: block; margin-bottom: 4px; }
input[type="text"], input[type="password"], input[type="number"], input[type="date"],
input[type="time"], input[type="tel"], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid #d5d4cd; border-radius: 8px;
  font-size: 14px; font-family: inherit; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-row > label.field { flex: 1 1 140px; }
.inline-check { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; font-weight: 600; }

.notice {
  background: var(--good-bg); border: 1px solid #cfe9cf; color: var(--good-text);
  border-radius: 9px; padding: 10px 14px; font-size: 13.5px; margin-bottom: 16px;
}

details.editor { border-top: 1px solid #f0efec; }
details.editor summary { cursor: pointer; list-style: none; }
details.editor summary::-webkit-details-marker { display: none; }
details.editor .editor-body { padding: 14px 4px 10px; }

.chart-box { position: relative; width: 100%; }
.chart-box canvas { width: 100% !important; }

.legend-note { font-size: 12px; color: var(--ink-3); margin-top: 8px; }

/* ---------- Player portal (mobile-first) ---------- */

.portal {
  max-width: 480px; margin: 0 auto; padding: 0 16px 48px;
}
.portal-hero {
  background: linear-gradient(150deg, var(--navy-900), var(--navy-700));
  color: #fff; border-radius: 0 0 22px 22px;
  padding: 26px 22px 22px; margin: 0 -16px 18px;
  text-align: center;
}
.portal-hero .crest { margin: 0 auto 10px; width: 46px; height: 46px; font-size: 15px; }
.portal-hero h1 { font-size: 19px; margin: 0 0 2px; }
.portal-hero p { margin: 0; font-size: 13px; color: rgba(255, 255, 255, 0.7); }

.task-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: 14px; box-shadow: var(--shadow);
  padding: 16px; margin-bottom: 12px; color: var(--ink); text-decoration: none;
}
.task-card:hover { text-decoration: none; }
.task-icon {
  width: 44px; height: 44px; border-radius: 12px; flex: none;
  display: flex; align-items: center; justify-content: center; font-size: 21px;
  background: #e9f2ec;
}
.task-card .t-title { font-weight: 700; font-size: 15px; }
.task-card .t-sub { font-size: 12.5px; color: var(--ink-2); }
.task-state { margin-left: auto; flex: none; }

.q-block { margin-bottom: 22px; }
.q-label { font-weight: 700; font-size: 15px; margin-bottom: 3px; }
.q-help { font-size: 12.5px; color: var(--ink-2); margin-bottom: 10px; }

.scale {
  display: grid; gap: 8px;
}
.scale-5 { grid-template-columns: repeat(5, 1fr); }
.scale-10 { grid-template-columns: repeat(5, 1fr); }
.scale input { position: absolute; opacity: 0; pointer-events: none; }
.scale label {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 1.5px solid #d5d4cd; border-radius: 11px; background: #fff;
  padding: 10px 2px; cursor: pointer; min-height: 54px;
  font-weight: 750; font-size: 17px; color: var(--ink);
  transition: border-color .12s, background .12s;
}
.scale label small { font-size: 9.5px; font-weight: 600; color: var(--ink-3); margin-top: 2px; letter-spacing: 0.2px; }
.scale input:checked + label {
  border-color: var(--accent-strong); background: #e9f6ee; color: var(--accent-strong);
  box-shadow: inset 0 0 0 1px var(--accent-strong);
}
.scale input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips input { position: absolute; opacity: 0; pointer-events: none; }
.chips label {
  border: 1.5px solid #d5d4cd; border-radius: 999px; background: #fff;
  padding: 7px 13px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.chips input:checked + label {
  border-color: var(--accent-strong); background: #e9f6ee; color: var(--accent-strong);
}

.btn-submit {
  width: 100%; padding: 15px; font-size: 16px; border-radius: 12px; margin-top: 6px;
}

.portal-msg { text-align: center; padding: 40px 10px; }
.portal-msg .big { font-size: 44px; margin-bottom: 10px; }
.portal-msg h1 { font-size: 20px; margin: 0 0 8px; }
.portal-msg p { color: var(--ink-2); }

/* ---------- Login ---------- */

.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(150deg, var(--navy-900), var(--navy-700)); padding: 20px;
}
.login-card {
  background: var(--surface); border-radius: 16px; padding: 34px 30px;
  width: 100%; max-width: 380px; box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  text-align: center;
}
.login-card .crest { margin: 0 auto 14px; width: 54px; height: 54px; font-size: 17px; }
.login-card h1 { font-size: 19px; margin: 0 0 2px; }
.login-card p.sub { color: var(--ink-2); font-size: 13px; margin: 0 0 20px; }
.login-error { color: var(--critical); font-size: 13px; font-weight: 600; margin-top: 10px; }

@media (max-width: 640px) {
  .wrap { padding: 16px 14px 60px; }
  .card { padding: 15px 16px; }
  .table-scroll { margin: 0 -16px; padding: 0 16px; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .topbar { padding: 0 14px; }
}
