@font-face{
  font-family:"Ginko";
  src:url("/fonts/Ginko.woff2") format("woff2"),
      url("/fonts/Ginko.woff") format("woff"),
      url("/fonts/Ginko.otf") format("opentype"),
      url("/fonts/Ginko.ttf") format("truetype");
  font-weight:normal; font-style:normal; font-display:swap;
}
:root{
  --paper:#f1f3f4; --surface:#ffffff; --surface-2:#e7ebee; --ink:#1a2233; --ink-soft:#4b5768;
  --rule:#d3d8dc; --accent:#253a6e;
  --critical:#8a3636; --critical-soft:#f3e0df; --ok:#2f6b4f; --ok-soft:#dfeee6;
  --shadow: 0 1px 2px rgba(20,26,40,.06), 0 8px 24px rgba(20,26,40,.05);
}
@media (prefers-color-scheme: dark){
  :root{
    --paper:#10141c; --surface:#171d29; --surface-2:#1e2531; --ink:#e7eaf0; --ink-soft:#a3adbd;
    --rule:#2b3342; --accent:#93a8ee;
    --critical:#d98787; --critical-soft:#3a2426; --ok:#7fc6a4; --ok-soft:#1f3229;
    --shadow: 0 1px 2px rgba(0,0,0,.35), 0 8px 24px rgba(0,0,0,.35);
  }
}
*{ box-sizing:border-box; }
html{ background:var(--paper); }
body{
  margin:0; background:var(--paper); color:var(--ink);
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;
  font-size:15px; line-height:1.5;
}
body.login-page{
  min-height:100vh;
  background:url(/img/wallpaper.jpeg) center/cover no-repeat fixed;
}
.login-logo{ height:96px; width:auto; filter:drop-shadow(0 4px 14px rgba(0,0,0,.35)); }
a{ color:var(--accent); }
h1,h2,h3{ letter-spacing:-.01em; }
button, input, select, textarea{ font-family:inherit; font-size:inherit; color:inherit; }
:focus-visible{ outline:2px solid var(--accent); outline-offset:1px; border-radius:3px; }

.topbar{
  display:grid; grid-template-columns:1fr auto 1fr; align-items:center; padding:10px 22px;
  background:var(--surface); border-bottom:1px solid var(--rule);
}
.brand{ font-family:"Ginko","Segoe UI",sans-serif; font-weight:700; text-decoration:none; color:var(--ink); font-size:19px; letter-spacing:.02em; justify-self:start; }
.topbar-logo-link{ justify-self:center; display:flex; }
.topbar-logo{ height:36px; width:auto; display:block; }
.topnav{ display:flex; align-items:center; gap:16px; font-size:13px; justify-self:end; }
.shell{ max-width:920px; margin:0 auto; padding:26px 18px 80px; }
/* Manager dashboard (trainer.php): its tables (Transakcie, Študenti) are far denser than the
   rest of the app's centered forms/profile cards, so it gets a wider shell instead of
   fighting the default 920px width - see the .tx-table column-width media query below,
   which was overlapping/overflowing at 920px even after trimming every column it could. */
body.dash-page .shell{ max-width:1400px; }

@media (max-width:680px){
  .topbar{ grid-template-columns:auto 1fr; }
  .topbar-logo-link{ display:none; }
}

.card{ background:var(--surface); border:1px solid var(--rule); border-radius:12px; padding:20px 22px; box-shadow:var(--shadow); margin-bottom:20px; }
.card h2{ margin-top:0; font-size:17px; }
.card details summary{
  cursor:pointer; font-weight:700; font-size:17px; list-style:none;
  display:flex; align-items:center; justify-content:space-between;
}
.card details summary::-webkit-details-marker{ display:none; }
.card details summary::after{ content:"›"; color:var(--ink-soft); font-size:20px; transition:transform .15s; }
.card details[open] summary::after{ transform:rotate(90deg); }
.card details summary + *{ margin-top:14px; }
.stack{ display:flex; flex-direction:column; gap:14px; }

.field{ display:flex; flex-direction:column; gap:5px; margin-bottom:14px; }
.field label{ font-size:11.5px; letter-spacing:.06em; text-transform:uppercase; color:var(--ink-soft); }
.field .hint{ font-size:11.5px; color:var(--ink-soft); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input[type=tel], select, textarea{
  background:var(--surface-2); border:1px solid var(--rule); border-radius:7px; padding:9px 11px; color:var(--ink);
}
input[type=password]{ font-size:22px; letter-spacing:4px; }
input:focus, select:focus, textarea:focus{ border-color:var(--accent); }
input.is-invalid,
input.is-invalid:focus{
  border-color:var(--critical);
  background:var(--critical-soft);
  color:var(--critical);
  box-shadow:inset 0 0 0 1px var(--critical);
}
.row2{ display:grid; grid-template-columns:1fr 1fr; gap:14px; }
@media (max-width:560px){ .row2{ grid-template-columns:1fr; } }

.btn{
  display:inline-flex; align-items:center; gap:6px; border:1px solid var(--accent); background:var(--accent);
  color:#fff; padding:10px 18px; border-radius:8px; font-weight:600; font-size:14px; cursor:pointer; text-decoration:none;
}
.btn:hover{ filter:brightness(1.08); }
.btn.secondary{ background:transparent; color:var(--accent); }
.btn.ghost{ background:transparent; color:var(--ink-soft); border-color:var(--rule); }
.btn.danger{ background:var(--critical); color:#fff; border-color:var(--critical); }
.btn.small{ padding:6px 12px; font-size:13px; border-radius:6px; }
.btn.block{ width:100%; justify-content:center; }

.stats{ display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:12px; margin-bottom:20px; }
.stat{ background:var(--surface); border:1px solid var(--rule); border-radius:12px; padding:14px 16px; box-shadow:var(--shadow); }
.stat .label{ font-size:10.5px; letter-spacing:.07em; text-transform:uppercase; color:var(--ink-soft); margin-bottom:6px; }
.stat .value{ font-size:22px; font-weight:700; font-variant-numeric:tabular-nums; }
.stat .value.critical{ color:var(--critical); }
.stat .value.ok{ color:var(--ok); }

table{ width:100%; border-collapse:collapse; font-size:13.5px; }
thead th{ text-align:left; font-size:10.5px; letter-spacing:.06em; text-transform:uppercase; color:var(--ink-soft); padding:8px 10px; border-bottom:1px solid var(--rule); }
tbody td{ padding:8px 10px; border-bottom:1px solid var(--rule); }
td.num, th.num{ text-align:right; font-variant-numeric:tabular-nums; }

/* Every scrollable table wrapper (was plain "overflow-x:auto" - horizontal-scroll-only on
   mobile) also gets a bounded height + vertical scroll here, specifically so its own header
   row can use position:sticky. CSS forces overflow-y to "auto" the moment overflow-x isn't
   "visible" (there's no such thing as x-scroll/y-visible on the same box), which already
   silently made every sticky header below inert - a "position:sticky" element only sticks
   within its NEAREST ancestor that establishes a scroll container, and that was already this
   div, not the page; it just had no visible effect because the div's own height (unbounded)
   meant it never actually scrolled internally. Giving it a real max-height turns that
   pre-existing scroll container into one that's actually usable, so the header now stays
   pinned to the top of the table as its rows scroll underneath - same fix needed regardless
   of whether "always visible" was implemented as page-scroll or a bounded pane; a bounded
   pane is the only version that's reliably correct across browsers when a table also needs
   to scroll horizontally on narrow screens. */
.table-scroll{ overflow:auto; max-height:70vh; }
.table-scroll thead th{ position:sticky; top:0; background:var(--surface); z-index:1; box-shadow:0 1px 0 var(--rule); }

/* Transakcie table: fits the viewport width on desktop (no side-scrolling) by switching to
   a fixed layout instead of letting long Protistrana/Detail text force the table wider than
   its container. Short/predictable columns (date, direction, amount, VS, the pair/unpair
   action) get `nowrap` and enough room to never wrap - only the free-text columns
   (Protistrana, Detail, Stav) wrap, and only at word boundaries (no word-break:break-word,
   which was breaking even short words like "Smer" or "Spárovať" letter-by-letter when a
   column was too narrow for them). Phones AND tablets (below a typical desktop breakpoint)
   fall back to the normal auto-layout table inside its scrollable wrapper, since columns
   this narrow would otherwise squeeze every cell down to a sliver. */
@media (min-width:1024px){
  #tx-table{ table-layout:fixed; }
  #tx-table th:nth-child(1), #tx-table td:nth-child(1){ width:13%; white-space:nowrap; }
  #tx-table th:nth-child(2), #tx-table td:nth-child(2){ width:7%; white-space:nowrap; }
  #tx-table th:nth-child(3), #tx-table td:nth-child(3){ width:10%; white-space:nowrap; }
  #tx-table th:nth-child(4), #tx-table td:nth-child(4){ width:9%; white-space:nowrap; }
  #tx-table th:nth-child(5), #tx-table td:nth-child(5){ width:15%; overflow-wrap:break-word; }
  #tx-table th:nth-child(6), #tx-table td:nth-child(6){ width:19%; overflow-wrap:break-word; }
  #tx-table th:nth-child(7), #tx-table td:nth-child(7){ width:13%; overflow-wrap:break-word; }
  #tx-table th:nth-child(8), #tx-table td:nth-child(8){ width:14%; overflow-wrap:break-word; }
}

.badge{ display:inline-block; font-size:11px; padding:3px 9px; border-radius:20px; font-weight:600; }
.badge.ok{ background:var(--ok-soft); color:var(--ok); }
.badge.critical{ background:var(--critical-soft); color:var(--critical); }
.badge.muted{ background:var(--surface-2); color:var(--ink-soft); }

.avatar{ width:44px; height:44px; border-radius:50%; object-fit:cover; background:var(--surface-2); border:1px solid var(--rule); }
.avatar.lg{ width:88px; height:88px; }
.avatar-placeholder{ display:flex; align-items:center; justify-content:center; color:var(--ink-soft); font-weight:700; font-size:16px; }

.error{ border-left:3px solid var(--critical); background:var(--critical-soft); color:var(--ink); border-radius:0 8px 8px 0; padding:10px 14px; font-size:13.5px; margin-bottom:16px; }
.notice{ border-left:3px solid var(--ok); background:var(--ok-soft); color:var(--ink); border-radius:0 8px 8px 0; padding:10px 14px; font-size:13.5px; margin-bottom:16px; }

.roster-row{ display:flex; align-items:center; gap:12px; padding:10px 0; border-bottom:1px solid var(--rule); }
.roster-row:last-child{ border-bottom:none; }
.roster-name{ flex:1; font-weight:600; font-size:14px; }
.roster-sub{ font-size:12px; color:var(--ink-soft); }

.info-grid{ display:flex; flex-wrap:wrap; gap:12px 28px; margin-top:10px; }
.info-item{ display:flex; flex-direction:column; gap:3px; }
.info-item .info-label{ font-size:10.5px; letter-spacing:.07em; text-transform:uppercase; color:var(--ink-soft); }
.info-item .info-value{ font-size:14px; font-weight:700; color:var(--ink); }

/* attendance marking - big tap targets, phone-first */
.roll{ display:flex; flex-direction:column; gap:10px; }
.roll-row{
  display:flex; align-items:center; gap:12px; padding:12px 14px; border:1px solid var(--rule); border-radius:12px;
  background:var(--surface);
}
.roll-name{ flex:1; }
.roll-name b{ display:block; font-size:15px; }
.debt-amount{ color:var(--critical); font-weight:700; font-size:12.5px; }

.switch{ position:relative; display:inline-block; width:50px; height:28px; flex-shrink:0; }
.switch input{ position:absolute; opacity:0; width:100%; height:100%; margin:0; cursor:pointer; }
.switch .slider{
  position:absolute; inset:0; background:var(--surface-2); border:2px solid var(--rule);
  border-radius:999px; transition:background-color .15s, border-color .15s;
}
.switch .slider::before{
  content:""; position:absolute; height:18px; width:18px; left:3px; top:3px;
  background:var(--surface); border-radius:50%; transition:transform .15s; box-shadow:var(--shadow);
}
.switch input:checked + .slider{ background:var(--ok); border-color:var(--ok); }
.switch input:checked + .slider::before{ transform:translateX(20px); background:#fff; }
.switch input:focus-visible + .slider{ outline:2px solid var(--accent); outline-offset:2px; }

.pill-links{ display:flex; gap:8px; flex-wrap:wrap; margin-bottom:18px; }
.pill-links a{
  text-decoration:none; font-size:13px; padding:7px 13px; border-radius:20px; background:var(--surface);
  border:1px solid var(--rule); color:var(--ink);
}
.pill-links a.active{ background:var(--accent); border-color:var(--accent); color:#fff; }

/* attendance calendar */
.cal-group-filter{ margin-bottom:14px; }
.cal-group-filter summary{
  cursor:pointer; font-size:13px; font-weight:600; color:var(--accent); list-style:none;
  display:inline-block; padding:6px 12px; border:1px solid var(--rule); border-radius:8px;
}
.cal-group-filter summary::-webkit-details-marker{ display:none; }
.cal-group-filter form{
  margin-top:8px; padding:12px 14px; border:1px solid var(--rule); border-radius:10px;
  background:var(--surface); max-width:320px;
}
.cal-nav{ display:flex; align-items:center; gap:10px; margin-bottom:14px; }
.cal-nav select{ flex:1; max-width:220px; text-align:center; }
.cal-weekdays{ display:grid; grid-template-columns:repeat(7,1fr); gap:4px; margin-bottom:4px; }
.cal-weekdays span{ font-size:10px; text-transform:uppercase; letter-spacing:.05em; color:var(--ink-soft); text-align:center; }
.cal-grid{ display:grid; grid-template-columns:repeat(7,1fr); gap:4px; }
.cal-day{
  aspect-ratio:1; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px;
  border-radius:6px; border:none; font-family:inherit;
  font-size:clamp(18px,4.5vw,30px); font-weight:700; font-variant-numeric:tabular-nums;
}
button.cal-day{ cursor:pointer; }
.cal-day.empty{ visibility:hidden; }
.cal-day.present{ background:var(--ok-soft); color:var(--ok); }
.cal-day.absent{ background:var(--critical-soft); color:var(--critical); }
.cal-day.none{ background:var(--surface-2); color:var(--ink-soft); font-weight:500; }
.cal-day.cancelled, .cal-legend .dot.cancelled{
  background:repeating-linear-gradient(45deg, var(--accent) 0px, var(--accent) 8px, var(--critical) 8px, var(--critical) 11px);
  color:#fff;
}
.cal-day-label{
  font-size:7px; font-weight:700; text-transform:uppercase; letter-spacing:.02em;
  color:#fff; text-align:center; line-height:1.1; max-width:90%;
}
.cal-legend{ display:flex; gap:16px; flex-wrap:wrap; font-size:12px; color:var(--ink-soft); margin-top:16px; }
.cal-legend .dot{ display:inline-block; width:10px; height:10px; border-radius:3px; margin-right:5px; vertical-align:middle; }
.cal-legend .dot.present{ background:var(--ok); }
.cal-legend .dot.absent{ background:var(--critical); }
.cal-legend .dot.none{ background:var(--ink-soft); }

.cal-modal{
  border:2px solid var(--accent); border-radius:14px; padding:20px 22px; max-width:360px; width:90vw;
  background:var(--surface); color:var(--ink); box-shadow:var(--shadow);
}
.cal-modal::backdrop{ background:rgba(20,26,40,.45); }
.cal-modal-body p{ margin:0 0 10px; }

/* Wider popup for a real multi-field form (e.g. edit contact info) - .cal-modal is sized
   for the calendar day popup's single field and is too cramped for a row2 grid. Sized to
   fit small phone screens without horizontal scrolling (row2 itself already collapses to
   one column under 560px - see .row2) and scrolls internally if the form is taller than
   the viewport, instead of overflowing off-screen. */
.form-modal{
  border:2px solid var(--accent); border-radius:14px; padding:22px 24px; max-width:480px; width:92vw;
  max-height:85vh; overflow-y:auto;
  background:var(--surface); color:var(--ink); box-shadow:var(--shadow);
}
.form-modal::backdrop{ background:rgba(20,26,40,.45); }
@media (max-width:560px){
  .form-modal{ padding:16px; width:94vw; max-height:90vh; }
}

.photo-modal{
  border:2px solid var(--accent); border-radius:14px; padding:16px; max-width:45vw; width:auto;
  background:var(--surface); color:var(--ink); box-shadow:var(--shadow); text-align:center;
}
.photo-modal::backdrop{ background:rgba(20,26,40,.45); }
.photo-modal-img{ display:block; max-width:100%; max-height:35vh; border-radius:8px; margin:0 auto 14px; }

/* manager dashboard - sidebar tabs */
.dash{ display:flex; align-items:flex-start; gap:20px; }
.dash > input[type=radio]{ position:absolute; opacity:0; width:0; height:0; pointer-events:none; }
.dash-sidebar{
  display:flex; flex-direction:column; gap:4px; width:170px; flex-shrink:0;
  background:var(--surface); border:1px solid var(--rule); border-radius:12px; padding:10px; box-shadow:var(--shadow);
}
.dash-sidebar label{
  display:flex; align-items:center; gap:10px; padding:10px 12px; border-radius:8px; cursor:pointer;
  font-size:14px; font-weight:600; color:var(--ink-soft);
}
.dash-sidebar label svg{ width:20px; height:20px; flex-shrink:0; }
.dash-sidebar label:hover{ background:var(--surface-2); }
.dash-content{ flex:1; min-width:0; }
.dash-panel{ display:none; }

#dash-tab-groups:checked ~ .dash-sidebar label[for="dash-tab-groups"],
#dash-tab-trainers:checked ~ .dash-sidebar label[for="dash-tab-trainers"],
#dash-tab-students:checked ~ .dash-sidebar label[for="dash-tab-students"],
#dash-tab-transakcie:checked ~ .dash-sidebar label[for="dash-tab-transakcie"],
#dash-tab-dlznici:checked ~ .dash-sidebar label[for="dash-tab-dlznici"],
#dash-tab-preplatky:checked ~ .dash-sidebar label[for="dash-tab-preplatky"],
#dash-tab-vynimky:checked ~ .dash-sidebar label[for="dash-tab-vynimky"],
#dash-tab-settings:checked ~ .dash-sidebar label[for="dash-tab-settings"],
#dash-tab-admin:checked ~ .dash-sidebar label[for="dash-tab-admin"]{
  background:var(--accent); color:#fff;
}
#dash-tab-groups:checked ~ .dash-content #dash-panel-groups,
#dash-tab-trainers:checked ~ .dash-content #dash-panel-trainers,
#dash-tab-students:checked ~ .dash-content #dash-panel-students,
#dash-tab-transakcie:checked ~ .dash-content #dash-panel-transakcie,
#dash-tab-dlznici:checked ~ .dash-content #dash-panel-dlznici,
#dash-tab-preplatky:checked ~ .dash-content #dash-panel-preplatky,
#dash-tab-vynimky:checked ~ .dash-content #dash-panel-vynimky,
#dash-tab-settings:checked ~ .dash-content #dash-panel-settings,
#dash-tab-admin:checked ~ .dash-content #dash-panel-admin{
  display:block;
}
@media (max-width:700px){
  .dash{ flex-direction:column; }
  .dash-sidebar{ flex-direction:row; width:100%; overflow-x:auto; }
  .dash-sidebar label{ flex-direction:column; gap:4px; font-size:11px; text-align:center; white-space:nowrap; }
}

footer.note{ font-size:12px; color:var(--ink-soft); margin-top:30px; }

.consent{
  display:flex; gap:10px; align-items:flex-start;
  font-size:13px; line-height:1.45; color:var(--ink);
  margin:4px 0 18px; cursor:pointer;
}
.consent input[type=checkbox]{
  flex-shrink:0; width:16px; height:16px; margin-top:3px; accent-color:var(--accent);
}
.legal h3{ font-size:15px; margin:26px 0 8px; }
.legal p, .legal li{ font-size:14.5px; }
.legal ul, .legal ol{ padding-left:1.25em; margin:8px 0 12px; }
.legal li{ margin-bottom:6px; }
.legal .jp{ color:var(--ink-soft); font-size:13px; }
.site-foot{
  text-align:center; padding:0 18px 28px;
  font-size:12px; color:var(--ink-soft);
}
.site-foot a{ color:var(--ink-soft); }
