/* =========================================================
   1. Šachový klub Košice — klubová appka
   Dizajn nadväzuje na 1skke.sk: teplé krémové pozadie,
   tmavohnedý text, terakotový akcent.
   ========================================================= */

:root {
  --cream:        #FBF3EE;
  --cream-deep:   #F3E2D8;
  --cream-line:   #E8D3C6;
  --ink:          #2B2320;
  --ink-soft:     #6B5B52;
  --ink-faint:    #9A8779;
  --terracotta:   #C4573B;
  --terracotta-d: #A8452C;
  --terracotta-l: #F0DCD4;
  --green:        #3F7D53;
  --green-l:      #DEEDE1;
  --red:          #C0392B;
  --red-l:        #F7DFDB;
  --white:        #FFFDFB;

  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-full: 999px;

  --shadow-sm: 0 1px 2px rgba(43, 35, 32, .06);
  --shadow-md: 0 4px 16px rgba(43, 35, 32, .08);
  --shadow-lg: 0 12px 32px rgba(43, 35, 32, .14);

  --font-head: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --nav-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 600; margin: 0; letter-spacing: -.01em; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--terracotta); }

/* ---------- boot ---------- */
.boot { display: grid; place-content: center; gap: 10px; height: 100dvh; text-align: center; color: var(--ink-faint); }
.boot__mark { font-size: 46px; }

/* ---------- layout ---------- */
.app { min-height: 100dvh; }

.shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(var(--nav-h) + var(--safe-b));
}

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  padding: calc(10px + var(--safe-t)) 16px 10px;
  background: color-mix(in srgb, var(--cream) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--cream-line);
}
.topbar__title { font-size: 19px; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__sub { font-size: 12px; color: var(--ink-faint); font-family: var(--font-body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__spacer { flex: 1; }

.avatar {
  width: 38px; height: 38px; flex: none;
  border-radius: var(--r-full);
  display: grid; place-content: center;
  background: var(--terracotta); color: #fff;
  font-weight: 600; font-size: 14px; letter-spacing: .02em;
  border: none; cursor: pointer;
}
.avatar--ghost { background: var(--terracotta-l); color: var(--terracotta-d); }

.main { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 16px 16px 28px; }

/* ---------- bottom nav ---------- */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: color-mix(in srgb, var(--cream-deep) 94%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  border-top: 1px solid var(--cream-line);
  padding-bottom: var(--safe-b);
}
.nav__item {
  appearance: none; border: 0; background: none; cursor: pointer;
  display: grid; justify-items: center; gap: 3px;
  padding: 9px 2px 8px; height: var(--nav-h);
  color: var(--ink-soft); font-size: 10.5px; font-weight: 500;
}
.nav__icon { font-size: 19px; line-height: 1; }
.nav__item[aria-current="page"] { color: var(--terracotta-d); }
.nav__item[aria-current="page"] .nav__icon { transform: translateY(-1px); }

/* ---------- cards & surfaces ---------- */
.card {
  background: var(--white);
  border: 1px solid var(--cream-line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: 16px;
}
.card--warm { background: var(--cream-deep); border-color: transparent; }
.card--flush { padding: 0; overflow: hidden; }
.stack > * + * { margin-top: 12px; }
.stack-lg > * + * { margin-top: 20px; }
.row { display: flex; align-items: center; gap: 10px; }
.row--between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }

.section-title {
  font-family: var(--font-head); font-size: 13.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .09em; color: var(--ink-faint);
  margin: 22px 2px 10px;
}
.section-title:first-child { margin-top: 4px; }

.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); }
.small { font-size: 13px; }
.tiny  { font-size: 11.5px; }
.center { text-align: center; }
.mono { font-variant-numeric: tabular-nums; }

.empty {
  text-align: center; padding: 34px 18px; color: var(--ink-faint);
  border: 1px dashed var(--cream-line); border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--cream-deep) 45%, transparent);
}
.empty__mark { font-size: 32px; opacity: .5; display: block; margin-bottom: 8px; }

/* ---------- buttons ---------- */
.btn {
  appearance: none; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 18px; min-height: 46px;
  border-radius: var(--r-full); border: 1px solid transparent;
  background: var(--terracotta); color: #fff;
  font-weight: 600; font-size: 15px;
  transition: transform .06s ease, background .15s ease, opacity .15s ease;
}
.btn:active { transform: scale(.975); }
.btn:hover { background: var(--terracotta-d); }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--cream-line); }
.btn--ghost:hover { background: var(--cream-deep); }
.btn--soft { background: var(--terracotta-l); color: var(--terracotta-d); }
.btn--soft:hover { background: color-mix(in srgb, var(--terracotta-l) 80%, var(--terracotta)); }
.btn--danger { background: transparent; color: var(--red); border-color: var(--red-l); }
.btn--danger:hover { background: var(--red-l); }
.btn--block { width: 100%; }
.btn--sm { padding: 8px 14px; min-height: 38px; font-size: 13.5px; }
.btn--big { min-height: 62px; font-size: 17px; border-radius: var(--r-lg); }

.iconbtn {
  appearance: none; border: 1px solid var(--cream-line); background: var(--white);
  width: 38px; height: 38px; border-radius: var(--r-full); cursor: pointer;
  display: grid; place-content: center; font-size: 16px; color: var(--ink-soft); flex: none;
}
.iconbtn:hover { background: var(--cream-deep); }

/* ---------- pills / chips ---------- */
.pillbar { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; }
.pillbar::-webkit-scrollbar { display: none; }
.pill {
  appearance: none; cursor: pointer; white-space: nowrap;
  padding: 8px 15px; border-radius: var(--r-full);
  border: 1px solid var(--cream-line); background: var(--white);
  font-size: 13.5px; font-weight: 500; color: var(--ink-soft);
}
.pill[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--cream); }

.tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: var(--r-full);
  font-size: 11.5px; font-weight: 600; letter-spacing: .01em;
  background: var(--cream-deep); color: var(--ink-soft);
}
.tag--paid   { background: var(--green-l); color: var(--green); }
.tag--unpaid { background: var(--red-l); color: var(--red); }
.tag--live   { background: var(--terracotta); color: #fff; }

.dot { width: 10px; height: 10px; border-radius: var(--r-full); flex: none; display: inline-block; }
.dot--paid { background: var(--green); }
.dot--unpaid { background: var(--red); }
.dot--none { background: var(--cream-line); }

/* ---------- forms ---------- */
.field { display: block; }
.field__label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-soft); margin: 0 0 5px 2px; }
.input, .select, .textarea {
  width: 100%; padding: 12px 14px; min-height: 46px;
  background: var(--white); color: var(--ink);
  border: 1px solid var(--cream-line); border-radius: var(--r-md);
  outline: none;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--terracotta); box-shadow: 0 0 0 3px var(--terracotta-l); }
.textarea { min-height: 78px; resize: vertical; }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-soft) 50%), linear-gradient(135deg, var(--ink-soft) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 420px) { .grid2 { grid-template-columns: 1fr; } }

/* ---------- login ---------- */
.login { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 28px 20px calc(28px + var(--safe-b)); }
.login__inner { width: 100%; max-width: 380px; }
.login__logo { font-size: 40px; text-align: center; line-height: 1; }
.login__title { font-size: 26px; text-align: center; margin-top: 10px; }
.login__tag { text-align: center; color: var(--ink-faint); font-size: 13.5px; margin: 4px 0 26px; font-style: italic; }

.trainer-pick { display: grid; gap: 10px; }
.trainer-pick__btn {
  appearance: none; cursor: pointer; text-align: left;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: var(--r-lg);
  background: var(--white); border: 1px solid var(--cream-line);
}
.trainer-pick__btn:hover { border-color: var(--terracotta); }

.pinrow { display: flex; justify-content: center; gap: 12px; margin: 22px 0 18px; }
.pindot { width: 14px; height: 14px; border-radius: var(--r-full); background: var(--cream-line); transition: transform .12s ease, background .12s ease; }
.pindot--on { background: var(--terracotta); transform: scale(1.12); }
.pindot--err { background: var(--red); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.key {
  appearance: none; cursor: pointer;
  height: 62px; border-radius: var(--r-lg);
  background: var(--white); border: 1px solid var(--cream-line);
  font-size: 22px; font-weight: 500; font-family: var(--font-body);
}
.key:active { background: var(--cream-deep); transform: scale(.97); }
.key--soft { background: transparent; border-color: transparent; font-size: 16px; color: var(--ink-soft); }
.shake { animation: shake .38s; }
@keyframes shake { 0%,100%{transform:translateX(0)} 20%{transform:translateX(-8px)} 40%{transform:translateX(8px)} 60%{transform:translateX(-5px)} 80%{transform:translateX(5px)} }

/* ---------- live session ---------- */
.live {
  background: linear-gradient(150deg, var(--terracotta), #A8452C);
  color: #fff; border-radius: var(--r-lg); padding: 18px;
  box-shadow: var(--shadow-md);
}
.live__clock { font-family: var(--font-head); font-size: 40px; font-variant-numeric: tabular-nums; line-height: 1.05; }
.live__meta { opacity: .85; font-size: 13px; }
.live .btn--ghost { border-color: rgba(255,255,255,.5); color: #fff; }
.live .btn--ghost:hover { background: rgba(255,255,255,.14); }
.live .btn--white { background: #fff; color: var(--terracotta-d); }

/* ---------- attendance list ---------- */
.att-list { display: grid; gap: 8px; }
.att {
  appearance: none; cursor: pointer; width: 100%; text-align: left;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: var(--r-md);
  background: var(--white); border: 1px solid var(--cream-line);
  transition: background .12s ease, border-color .12s ease;
}
.att__name { font-weight: 500; }
.att__mark {
  width: 32px; height: 32px; border-radius: var(--r-full); flex: none;
  display: grid; place-content: center; font-size: 15px; font-weight: 700;
  background: var(--cream-deep); color: var(--ink-faint);
}
.att--present { background: var(--green-l); border-color: color-mix(in srgb, var(--green) 30%, transparent); }
.att--present .att__mark { background: var(--green); color: #fff; }
.att--absent { background: var(--red-l); border-color: color-mix(in srgb, var(--red) 25%, transparent); }
.att--absent .att__mark { background: var(--red); color: #fff; }
.att--absent .att__name { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--red) 55%, transparent); }

/* ---------- generic list rows ---------- */
.list { display: grid; }
.list > * + * { border-top: 1px solid var(--cream-line); }
.item {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px; background: transparent; width: 100%;
  border: 0; text-align: left; font: inherit; color: inherit;
}
button.item { cursor: pointer; }
button.item:hover { background: var(--cream-deep); }
.item__title { font-weight: 500; }
.item__sub { font-size: 12.5px; color: var(--ink-faint); }
.chev { color: var(--ink-faint); font-size: 15px; }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--white); border: 1px solid var(--cream-line); border-radius: var(--r-md); padding: 12px; text-align: center; }
.stat__num { font-family: var(--font-head); font-size: 24px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat__lab { font-size: 11px; color: var(--ink-faint); margin-top: 2px; }

.bar { height: 7px; border-radius: var(--r-full); background: var(--cream-line); overflow: hidden; }
.bar__fill { height: 100%; background: var(--terracotta); border-radius: var(--r-full); }
.bar__fill--good { background: var(--green); }

/* ---------- table ---------- */
.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th, table.data td { padding: 9px 10px; text-align: left; white-space: nowrap; }
table.data th { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-faint); font-weight: 600; }
table.data tbody tr + tr { border-top: 1px solid var(--cream-line); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- month grid (platby) ---------- */
.paycell {
  appearance: none; cursor: pointer; border: 1px solid var(--cream-line);
  background: var(--white); border-radius: var(--r-sm);
  min-width: 34px; height: 30px; display: grid; place-content: center; font-size: 12px; font-weight: 600;
}
.paycell--paid { background: var(--green-l); border-color: color-mix(in srgb, var(--green) 30%, transparent); color: var(--green); }
.paycell--unpaid { background: var(--red-l); border-color: color-mix(in srgb, var(--red) 25%, transparent); color: var(--red); }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--safe-b) + 14px);
  transform: translate(-50%, 14px); z-index: 90;
  background: var(--ink); color: var(--cream);
  padding: 11px 18px; border-radius: var(--r-full);
  font-size: 14px; font-weight: 500; box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease;
  max-width: calc(100vw - 32px); text-align: center;
}
.toast--on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- modal / sheet ---------- */
.scrim {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(43, 35, 32, .38);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade .16s ease;
}
@keyframes fade { from { opacity: 0 } }
.sheet {
  width: 100%; max-width: 560px;
  background: var(--cream); border-radius: var(--r-lg) var(--r-lg) 0 0;
  padding: 18px 18px calc(20px + var(--safe-b));
  max-height: 92dvh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: rise .22s cubic-bezier(.2,.8,.3,1);
}
@keyframes rise { from { transform: translateY(22px); opacity: .6 } }
.sheet__grip { width: 38px; height: 4px; border-radius: var(--r-full); background: var(--cream-line); margin: 0 auto 14px; }
.sheet__title { font-size: 20px; margin-bottom: 14px; }
@media (min-width: 620px) {
  .scrim { align-items: center; }
  .sheet { border-radius: var(--r-lg); padding-bottom: 20px; }
}

/* ---------- desktop polish ---------- */
@media (min-width: 800px) {
  /* hlavička zarovnaná s obsahom (max-width 760px) */
  .topbar {
    padding-left: max(16px, calc((100% - 760px) / 2));
    padding-right: max(16px, calc((100% - 760px) / 2));
  }
}
@media (min-width: 900px) {
  .nav { grid-template-columns: repeat(5, minmax(0, 120px)); justify-content: center; }
}
