/* ═══════════════════════════════════════════════════════════════
   PUKAVCI FC — style.css  v1.0.0
   Mobile-first, dark/light mode, CSS custom properties
   ═══════════════════════════════════════════════════════════════ */

/* ── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* ── CSS Variables — Light ──────────────────────────────────────────────────── */
:root {
  --bg:           #f1f5f9;
  --bg2:          #e8edf5;
  --card:         #ffffff;
  --card2:        #f8fafc;
  --text:         #0f172a;
  --text2:        #334155;
  --sub:          #64748b;
  --accent:       #2563eb;
  --accent-h:     #1d4ed8;
  --accent-light: #eff6ff;
  --border:       #e2e8f0;
  --border2:      #cbd5e1;
  --good:         #16a34a;
  --good-bg:      #dcfce7;
  --good-border:  #bbf7d0;
  --bad:          #dc2626;
  --bad-bg:       #fee2e2;
  --bad-border:   #fecaca;
  --warn:         #d97706;
  --warn-bg:      #fef3c7;
  --warn-border:  #fde68a;
  --header-bg:    #0f172a;
  --header-text:  #f1f5f9;
  --header-sub:   #64748b;
  --team-a:       #2563eb;
  --team-b:       #dc2626;
  --nav-bg:       #ffffff;
  --nav-active:   #2563eb;
  --shadow-sm:    0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow:       0 4px 16px rgba(0,0,0,.10);
  --shadow-lg:    0 8px 32px rgba(0,0,0,.14);
  --r:            12px;
  --r-sm:         8px;
  --r-lg:         16px;
  --r-xl:         20px;
}

/* ── CSS Variables — Dark ───────────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg:           #0b1120;
  --bg2:          #111827;
  --card:         #1e293b;
  --card2:        #263449;
  --text:         #f1f5f9;
  --text2:        #cbd5e1;
  --sub:          #94a3b8;
  --accent:       #3b82f6;
  --accent-h:     #60a5fa;
  --accent-light: rgba(59,130,246,.12);
  --border:       #1e3a5f;
  --border2:      #2d4a6e;
  --good:         #22c55e;
  --good-bg:      rgba(34,197,94,.12);
  --good-border:  rgba(34,197,94,.3);
  --bad:          #ef4444;
  --bad-bg:       rgba(239,68,68,.12);
  --bad-border:   rgba(239,68,68,.3);
  --warn:         #fbbf24;
  --warn-bg:      rgba(251,191,36,.12);
  --warn-border:  rgba(251,191,36,.3);
  --header-bg:    #060d1a;
  --header-sub:   #475569;
  --nav-bg:       #0f172a;
  --shadow-sm:    0 1px 3px rgba(0,0,0,.4);
  --shadow:       0 4px 16px rgba(0,0,0,.5);
  --shadow-lg:    0 8px 32px rgba(0,0,0,.6);
}

/* ── Base ───────────────────────────────────────────────────────────────────── */
body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  line-height: 1.5;
}

/* ═══════════════════════════════════════════════════════════════
   AUTH SCREENS
   ═══════════════════════════════════════════════════════════════ */
.auth-overlay {
  position: fixed; inset: 0;
  background: var(--header-bg);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; z-index: 200;
}
.auth-box {
  background: var(--card);
  border-radius: var(--r-xl);
  padding: 32px 28px;
  width: 100%; max-width: 400px;
  box-shadow: var(--shadow-lg);
}
.auth-logo { text-align: center; margin-bottom: 24px; }
.auth-icon-wrap {
  font-size: 40px; margin-bottom: 10px; display: block;
}
.auth-logo h1 { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.auth-sub { font-size: 13px; color: var(--sub); }

.auth-tabs {
  display: flex; border-radius: var(--r-sm); overflow: hidden;
  border: 1px solid var(--border); margin-bottom: 20px;
}
.auth-tab {
  flex: 1; padding: 9px 12px; background: none; border: none;
  font-size: 13px; font-weight: 600; cursor: pointer; color: var(--sub);
  transition: background .15s, color .15s;
}
.auth-tab.active { background: var(--accent); color: #fff; }

.auth-form { display: grid; gap: 14px; }
.auth-form.hidden { display: none; }

.field { display: grid; gap: 5px; }
.field label { font-size: 12px; font-weight: 600; color: var(--sub); }
.field input, .field select, .field textarea {
  padding: 10px 12px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--bg);
  color: var(--text); transition: border-color .15s;
  font-size: 14px;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}

.auth-error {
  padding: 8px 12px; border-radius: var(--r-sm);
  background: var(--bad-bg); border: 1px solid var(--bad-border);
  color: var(--bad); font-size: 13px;
}
.btn-auth {
  padding: 12px; border-radius: var(--r-sm); border: none;
  background: var(--accent); color: #fff; font-size: 14px;
  font-weight: 600; cursor: pointer; width: 100%;
  transition: background .15s, transform .1s;
}
.btn-auth:hover { background: var(--accent-h); }
.btn-auth:active { transform: scale(.98); }
.auth-hint { font-size: 12px; color: var(--sub); text-align: center; margin-top: 16px; line-height: 1.5; }

/* ═══════════════════════════════════════════════════════════════
   APP SHELL
   ═══════════════════════════════════════════════════════════════ */
#app { display: flex; flex-direction: column; min-height: 100dvh; }
#app.hidden { display: none; }

/* ── Header ─────────────────────────────────────────────────────────────────── */
#app-header {
  background: var(--header-bg);
  position: sticky; top: 0; z-index: 50;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.header-inner {
  max-width: 900px; margin: 0 auto;
  padding: 0 16px; height: 54px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.header-brand {
  display: flex; align-items: center; gap: 8px;
  color: var(--header-text);
}
.brand-ball { font-size: 18px; line-height: 1; }
.brand-name { font-size: 16px; font-weight: 700; white-space: nowrap; color: var(--header-text); }

.header-right { display: flex; align-items: center; gap: 6px; }

.icon-btn {
  width: 36px; height: 36px; border-radius: var(--r-sm);
  border: none; background: rgba(255,255,255,.08); color: var(--header-text);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background .15s; flex-shrink: 0;
}
.icon-btn:hover { background: rgba(255,255,255,.14); }

.notif-btn { position: relative; }
.notif-badge {
  position: absolute; top: -3px; right: -3px;
  min-width: 16px; height: 16px; padding: 0 3px;
  border-radius: 99px; background: var(--bad); color: #fff;
  font-size: 9px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--header-bg);
}

.user-pill {
  display: flex; align-items: center; gap: 7px;
  padding: 4px 10px 4px 4px; border-radius: 99px;
  border: none; background: rgba(255,255,255,.08);
  color: var(--header-text); cursor: pointer;
  transition: background .15s; max-width: 160px;
}
.user-pill:hover { background: rgba(255,255,255,.14); }
.user-av {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; flex-shrink: 0;
}
.user-name { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.hamb-btn { display: none; }

/* ── Desktop nav inside header ──────────────────────────────────────────────── */
@media (min-width: 700px) {
  #main-nav {
    background: var(--header-bg);
    border-bottom: 1px solid rgba(255,255,255,.06);
    display: flex; justify-content: center;
    padding: 0 16px;
    position: sticky; top: 54px; z-index: 49;
  }
  .nav-item {
    flex-direction: row; gap: 6px;
    padding: 10px 14px; border-radius: 0;
    border-bottom: 2px solid transparent;
    font-size: 13px; background: none;
    color: var(--header-sub);
    transition: color .15s, border-color .15s;
  }
  .nav-item svg { width: 15px; height: 15px; }
  .nav-item.active { color: #fff; border-bottom-color: var(--accent); }
  .nav-item:hover:not(.active) { color: rgba(255,255,255,.7); }
}

@media (max-width: 699px) {
  .hamb-btn { display: flex; }
  #main-nav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
    background: var(--nav-bg);
    border-top: 1px solid var(--border);
    display: flex; padding-bottom: env(safe-area-inset-bottom, 0);
    box-shadow: 0 -4px 20px rgba(0,0,0,.08);
  }
  .nav-item {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 2px; padding: 8px 4px;
    border: none; background: none;
    color: var(--sub); font-size: 10px; font-weight: 500;
    cursor: pointer; position: relative;
    transition: color .15s;
  }
  .nav-item.active { color: var(--nav-active); }
  .nav-item svg { width: 20px; height: 20px; }
}

.chat-badge {
  position: absolute; top: 4px; right: calc(50% - 18px);
  min-width: 16px; height: 16px; padding: 0 3px;
  border-radius: 99px; background: var(--bad); color: #fff;
  font-size: 9px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* ── Sync dot ────────────────────────────────────────────────────────────────── */
.sync-wrap { display: flex; align-items: center; justify-content: center; }
.sync-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--header-sub); transition: background .3s;
}
.sync-dot.online  { background: var(--good); }
.sync-dot.syncing { background: var(--warn); animation: pulse 1s infinite; }
.sync-dot.offline { background: var(--bad); }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.3} }

/* ── Main content ────────────────────────────────────────────────────────────── */
#app-main {
  flex: 1; max-width: 900px; margin: 0 auto;
  width: 100%; padding: 16px 16px 80px;
}
@media (min-width: 700px) { #app-main { padding-bottom: 24px; } }

.view { display: none; }
.view.active { display: block; }

/* ═══════════════════════════════════════════════════════════════
   SHARED COMPONENTS
   ═══════════════════════════════════════════════════════════════ */

/* ── Card ────────────────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
}
.card-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 700; font-size: 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.card-head .head-sub { font-size: 12px; font-weight: 400; color: var(--sub); }
.card-body { padding: 16px; }
.card-body + .card-body { border-top: 1px solid var(--border); }

/* ── Buttons ─────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--card);
  color: var(--text); font-size: 13px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .1s;
}
.btn:hover { background: var(--bg2); border-color: var(--border2); }
.btn:active { transform: scale(.98); }
.btn.block { width: 100%; }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-h); border-color: var(--accent-h); }
.btn-danger { background: var(--bad-bg); color: var(--bad); border-color: var(--bad-border); }
.btn-danger:hover { background: var(--bad); color: #fff; }
.btn-success { background: var(--good-bg); color: var(--good); border-color: var(--good-border); }
.btn-success:hover { background: var(--good); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon {
  width: 34px; height: 34px; padding: 0;
  border-radius: var(--r-sm); border: 1px solid var(--border);
  background: var(--card); color: var(--text2);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background .15s;
}
.btn-icon:hover { background: var(--bg2); }
.btn-icon.danger { color: var(--bad); }
.btn-icon.danger:hover { background: var(--bad-bg); border-color: var(--bad-border); }
.btn-link { background: none; border: none; color: var(--accent); font-size: 12px; cursor: pointer; padding: 0; }
.btn-link:hover { text-decoration: underline; }

/* ── Badges ──────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 99px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.badge-green { background: var(--good-bg); color: var(--good); border: 1px solid var(--good-border); }
.badge-red   { background: var(--bad-bg);  color: var(--bad);  border: 1px solid var(--bad-border); }
.badge-blue  { background: var(--accent-light); color: var(--accent); border: 1px solid rgba(37,99,235,.2); }
.badge-warn  { background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn-border); }
.badge-gray  { background: var(--card2); color: var(--sub); border: 1px solid var(--border); }
.badge-win   { background: var(--good-bg); color: var(--good); }
.badge-loss  { background: var(--bad-bg);  color: var(--bad);  }
.badge-draw  { background: var(--warn-bg); color: var(--warn); }

/* ── Notice ──────────────────────────────────────────────────────────────────── */
.notice {
  padding: 10px 14px; border-radius: var(--r-sm);
  font-size: 13px; line-height: 1.5;
}
.notice-warn  { background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn-border); }
.notice-info  { background: var(--accent-light); color: var(--accent); border: 1px solid rgba(37,99,235,.2); }
.notice-ok    { background: var(--good-bg); color: var(--good); border: 1px solid var(--good-border); }
.notice-error { background: var(--bad-bg);  color: var(--bad);  border: 1px solid var(--bad-border); }

/* ── Form inputs ─────────────────────────────────────────────────────────────── */
input[type="text"], input[type="number"], input[type="date"], input[type="password"],
input[type="email"], select, textarea {
  width: 100%; padding: 9px 12px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--card);
  color: var(--text); font-size: 14px;
  transition: border-color .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
textarea { resize: vertical; min-height: 80px; }
.search-input {
  padding-left: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 11px center;
}

/* ── Divider ─────────────────────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 12px 0; }

/* ── Avatar ──────────────────────────────────────────────────────────────────── */
.avatar {
  border-radius: 50%; overflow: hidden; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; background: var(--accent); color: #fff;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 30px; height: 30px; font-size: 11px; }
.avatar-md { width: 40px; height: 40px; font-size: 14px; }
.avatar-lg { width: 56px; height: 56px; font-size: 18px; }
.avatar-xl { width: 80px; height: 80px; font-size: 24px; }

/* ── Lists ───────────────────────────────────────────────────────────────────── */
.list-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--card);
  transition: background .12s;
}
.list-item:last-child { border-bottom: none; }
.list-item:hover { background: var(--card2); }
.list-item.clickable { cursor: pointer; }
.item-main { flex: 1; min-width: 0; }
.item-title { font-size: 14px; font-weight: 600; }
.item-sub   { font-size: 12px; color: var(--sub); margin-top: 1px; }
.item-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ── Score display ───────────────────────────────────────────────────────────── */
.score-display {
  display: flex; align-items: center; gap: 8px;
  font-weight: 700;
}
.score-a { color: var(--team-a); }
.score-b { color: var(--team-b); }
.score-sep { color: var(--sub); font-weight: 400; }
.score-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 8px;
  background: var(--bg2); border: 1px solid var(--border);
  font-weight: 700; font-size: 16px; letter-spacing: 1px;
}

/* ── Stats bar ───────────────────────────────────────────────────────────────── */
.stats-row {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.stat-item {
  flex: 1 1 60px; text-align: center;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 10px 8px;
}
.stat-num  { font-size: 20px; font-weight: 700; line-height: 1; }
.stat-label{ font-size: 10px; color: var(--sub); margin-top: 3px; text-transform: uppercase; letter-spacing: .05em; }

/* ── Progress bar ────────────────────────────────────────────────────────────── */
.progress { height: 4px; border-radius: 2px; background: var(--border); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 2px; background: var(--accent); transition: width .4s ease; }
.progress-fill.green { background: var(--good); }
.progress-fill.red   { background: var(--bad); }

/* ── Result dots (form) ──────────────────────────────────────────────────────── */
.form-dots { display: flex; gap: 4px; }
.form-dot {
  width: 24px; height: 24px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700;
}
.form-dot.w { background: var(--good-bg); color: var(--good); }
.form-dot.l { background: var(--bad-bg);  color: var(--bad); }
.form-dot.d { background: var(--warn-bg); color: var(--warn); }

/* ── Tab bar ─────────────────────────────────────────────────────────────────── */
.tab-bar {
  display: flex; border-bottom: 1px solid var(--border);
  background: var(--card); border-radius: var(--r) var(--r) 0 0;
  overflow-x: auto; scrollbar-width: none;
}
.tab-bar::-webkit-scrollbar { display: none; }
.tab-btn {
  padding: 11px 14px; font-size: 13px; font-weight: 600;
  border: none; background: none; color: var(--sub);
  cursor: pointer; white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color .15s;
}
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ═══════════════════════════════════════════════════════════════
   HOME VIEW
   ═══════════════════════════════════════════════════════════════ */
.home-hero {
  background: var(--header-bg);
  border-radius: var(--r-lg); overflow: hidden;
  padding: 20px 18px 16px; margin-bottom: 14px;
  position: relative;
}
.home-hero::before {
  content: '';
  position: absolute; top: 0; right: 0;
  width: 120px; height: 120px; border-radius: 50%;
  background: rgba(255,255,255,.02);
  transform: translate(30px, -30px);
  pointer-events: none;
}
.hero-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 10px; }
.hero-ident { display: flex; align-items: center; gap: 12px; }
.hero-name { font-size: 17px; font-weight: 700; color: #f1f5f9; }
.hero-sub  { font-size: 11px; color: #64748b; margin-top: 2px; }
.debt-badge {
  padding: 4px 10px; border-radius: 99px;
  font-size: 11px; font-weight: 700; white-space: nowrap; flex-shrink: 0;
}
.debt-badge.bad { background: rgba(220,38,38,.25); color: #fca5a5; border: 1px solid rgba(220,38,38,.35); }
.debt-badge.ok  { background: rgba(22,163,74,.2);  color: #86efac; border: 1px solid rgba(22,163,74,.3); }

.hero-stats { display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; margin-bottom: 14px; }
.hero-stat-num   { font-size: 22px; font-weight: 700; color: #f1f5f9; line-height: 1; }
.hero-stat-label { font-size: 9px; color: #475569; margin-top: 2px; text-transform: uppercase; letter-spacing: .05em; }
.hero-form-row { margin-bottom: 14px; }
.hero-form-label { font-size: 9px; color: #475569; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.hero-next { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hero-next-info .nl { font-size: 10px; color: #64748b; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 2px; }
.hero-next-info .nv { font-size: 14px; font-weight: 600; color: #e2e8f0; }
.hero-next-info .ns { font-size: 11px; color: #64748b; margin-top: 1px; }
.hero-next-btn { padding: 8px 14px; border-radius: var(--r-sm); background: var(--accent); color: #fff; border: none; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; flex-shrink: 0; }

.home-grid { display: grid; gap: 12px; }
.home-section-head {
  font-size: 11px; font-weight: 700; color: var(--sub);
  text-transform: uppercase; letter-spacing: .06em;
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.home-mini-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.mini-stat-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 12px 10px; text-align: center; }
.mini-stat-val { font-size: 22px; font-weight: 700; line-height: 1; }
.mini-stat-lbl { font-size: 10px; color: var(--sub); margin-top: 3px; }
.mini-stat-sub { font-size: 10px; color: var(--sub); margin-top: 1px; }
.val-good { color: var(--good); }
.val-bad  { color: var(--bad); }
.val-warn { color: var(--warn); }

.match-history-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background .12s;
}
.match-history-item:hover { background: var(--card2); }
.match-history-item:last-child { border-bottom: none; }
.mhi-date { font-size: 11px; color: var(--sub); min-width: 48px; }
.mhi-score { font-size: 15px; font-weight: 700; min-width: 48px; text-align: center; }
.mhi-teams { flex: 1; font-size: 12px; color: var(--sub); }
.mhi-arrow { color: var(--sub); font-size: 14px; }

/* ═══════════════════════════════════════════════════════════════
   MATCHES VIEW
   ═══════════════════════════════════════════════════════════════ */
.match-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r); margin-bottom: 10px;
  overflow: hidden; cursor: pointer;
  transition: box-shadow .15s;
}
.match-card:hover { box-shadow: var(--shadow); }
.match-card-head {
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.match-card-date { font-size: 13px; font-weight: 600; }
.match-card-loc  { font-size: 11px; color: var(--sub); margin-top: 1px; }
.match-card-body { padding: 12px 14px; }
.match-card-score {
  display: flex; align-items: center; justify-content: center;
  gap: 12px; font-size: 28px; font-weight: 700; margin: 8px 0;
}
.match-card-teams { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--sub); }
.match-card-rsvp  { margin-top: 10px; }

.rsvp-avatars { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 6px; }
.rsvp-face {
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700; border: 2px solid var(--card);
}
.rsvp-face.yes  { background: var(--good-bg); color: var(--good); }
.rsvp-face.no   { background: var(--bad-bg);  color: var(--bad); }
.rsvp-face.maybe{ background: var(--warn-bg); color: var(--warn); }
.rsvp-face.pending { background: var(--card2); color: var(--sub); }

/* ── Match detail ────────────────────────────────────────────────────────────── */
.match-detail-header {
  background: var(--header-bg); border-radius: var(--r-lg);
  padding: 20px 18px; margin-bottom: 14px; color: #f1f5f9;
}
.mdh-top { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.back-btn {
  width: 32px; height: 32px; border-radius: var(--r-sm);
  border: 1px solid rgba(255,255,255,.15); background: none;
  color: #94a3b8; font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
}
.mdh-date { font-size: 16px; font-weight: 700; }
.mdh-sub  { font-size: 12px; color: #64748b; margin-top: 2px; }
.mdh-status { display: flex; align-items: center; gap: 6px; font-size: 12px; margin-bottom: 14px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; }
.status-dot.open   { background: #22c55e; }
.status-dot.locked { background: #f59e0b; }
.status-dot.done   { background: #94a3b8; }
.mdh-score-big { display: flex; align-items: center; justify-content: center; gap: 16px; font-size: 44px; font-weight: 700; }
.mdh-score-a { color: #93c5fd; }
.mdh-score-b { color: #fca5a5; }
.mdh-score-sep { font-size: 28px; color: #475569; }

/* Pitch / lineup */
.pitch-view {
  background: #1a5c2a; border-radius: var(--r); overflow: hidden;
  min-height: 280px; display: grid; grid-template-columns: 1fr 40px 1fr;
  position: relative; border: 2px solid #14481f;
}
.pitch-view::before {
  content: ''; position: absolute; inset: 0;
  background: repeating-linear-gradient(90deg, transparent, transparent 50px, rgba(255,255,255,.03) 50px, rgba(255,255,255,.03) 51px);
  pointer-events: none;
}
.pitch-team { display: flex; flex-direction: column; align-items: center; padding: 12px 6px; gap: 8px; z-index: 1; }
.pitch-team-label {
  font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  padding: 3px 10px; border-radius: 99px; white-space: nowrap;
}
.pitch-team-label.a { background: var(--team-a); color: #fff; }
.pitch-team-label.b { background: var(--team-b); color: #fff; }
.pitch-players { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.pitch-player { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.pitch-player-av {
  width: 44px; height: 44px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.7);
  overflow: hidden; background: #2d4a6e;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff; position: relative;
}
.pitch-player-av img { width: 100%; height: 100%; object-fit: cover; }
.captain-ring { border-color: #fbbf24; box-shadow: 0 0 0 2px rgba(251,191,36,.4); }
.captain-badge {
  position: absolute; bottom: -2px; right: -2px;
  width: 15px; height: 15px; border-radius: 50%;
  background: #fbbf24; color: #000; font-size: 8px; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid #fff;
}
.pitch-player-name {
  font-size: 9px; font-weight: 700; color: rgba(255,255,255,.9);
  text-align: center; max-width: 52px; line-height: 1.2;
  text-shadow: 0 1px 3px rgba(0,0,0,.8);
}
.pitch-center { display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 1; }
.pitch-line { flex: 1; width: 1px; background: rgba(255,255,255,.25); min-height: 40px; }
.pitch-circle { width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(255,255,255,.25); flex-shrink: 0; }
.pitch-empty { color: rgba(255,255,255,.4); font-size: 11px; padding: 12px; text-align: center; }

/* Score input */
.score-entry-row { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 12px 0; }
.score-team-lbl { font-size: 11px; font-weight: 700; text-align: center; }
.score-team-lbl.a { color: var(--team-a); }
.score-team-lbl.b { color: var(--team-b); }
.score-input-big {
  width: 72px; text-align: center; font-size: 32px; font-weight: 700;
  padding: 8px 4px; border-radius: var(--r);
  border: 2px solid var(--border2); background: var(--bg2);
}
.score-colon { font-size: 24px; color: var(--sub); font-weight: 400; }

/* ── Player card (available) ─────────────────────────────────────────────────── */
.player-cards-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.player-card {
  display: flex; flex-direction: column; align-items: center;
  gap: 5px; padding: 10px 8px;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--card2); cursor: pointer; width: 72px; text-align: center;
  transition: border-color .15s, background .15s, transform .1s;
}
.player-card:hover { border-color: var(--accent); background: var(--accent-light); transform: translateY(-1px); }
.player-card-av {
  width: 42px; height: 42px; border-radius: 50%;
  overflow: hidden; background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; font-weight: 700; flex-shrink: 0;
  border: 2px solid var(--border);
}
.player-card-av img { width: 100%; height: 100%; object-fit: cover; }
.player-card-name { font-size: 10px; font-weight: 600; color: var(--text2); line-height: 1.2; word-break: break-word; }

/* ═══════════════════════════════════════════════════════════════
   LEADERBOARD
   ═══════════════════════════════════════════════════════════════ */
.leaderboard-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  transition: background .12s; cursor: pointer;
}
.leaderboard-row:last-child { border-bottom: none; }
.leaderboard-row:hover { background: var(--card2); }
.leaderboard-row.me { background: var(--accent-light); }
.lb-rank { font-size: 13px; color: var(--sub); min-width: 24px; text-align: center; }
.lb-name { flex: 1; font-size: 14px; font-weight: 600; }
.lb-val  { font-size: 14px; font-weight: 700; min-width: 48px; text-align: right; }

/* ═══════════════════════════════════════════════════════════════
   PROFILE VIEW
   ═══════════════════════════════════════════════════════════════ */
.profile-header {
  display: flex; align-items: center; gap: 14px; margin-bottom: 16px;
}
.profile-name-row .name { font-size: 20px; font-weight: 700; }
.profile-name-row .pos  { font-size: 12px; color: var(--sub); margin-top: 3px; }
.profile-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px,1fr)); gap: 8px; }
.stat-cell {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 10px; text-align: center;
}
.stat-cell .sv { font-size: 20px; font-weight: 700; }
.stat-cell .sl { font-size: 10px; color: var(--sub); margin-top: 2px; text-transform: uppercase; letter-spacing: .05em; }
.pm-pos .sv { color: var(--good); }
.pm-neg .sv { color: var(--bad); }

/* ── Table (leaderboard full) ────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--r); }
.data-table { border-collapse: collapse; width: 100%; min-width: 600px; font-size: 13px; }
.data-table th {
  padding: 10px 10px; text-align: left; font-size: 11px; font-weight: 700;
  color: var(--sub); text-transform: uppercase; letter-spacing: .05em;
  border-bottom: 1px solid var(--border); white-space: nowrap; cursor: pointer;
  background: var(--card2); user-select: none;
}
.data-table th:hover { color: var(--text); }
.data-table th.sorted { color: var(--accent); }
.data-table td {
  padding: 10px; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table tbody tr:hover td { background: var(--card2); }
.data-table tbody tr.me td { background: var(--accent-light); }
.data-table .sticky-col {
  position: sticky; left: 0; background: var(--card); z-index: 2;
  border-right: 1px solid var(--border);
}
.player-link { color: var(--text); font-weight: 600; }
.player-link:hover { color: var(--accent); text-decoration: underline; }

/* ═══════════════════════════════════════════════════════════════
   CHAT VIEW
   ═══════════════════════════════════════════════════════════════ */
.chat-view { display: flex !important; flex-direction: column; height: calc(100dvh - 120px); padding: 0 !important; }
.chat-header {
  padding: 12px 16px; background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
}
.chat-match-sel {
  flex: 1; padding: 7px 10px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--bg2);
  font-size: 13px; font-weight: 600;
}
.chat-messages {
  flex: 1; overflow-y: auto; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 2px;
}
.chat-bubble-wrap { display: flex; margin-bottom: 6px; }
.chat-bubble-wrap.me { justify-content: flex-end; }
.chat-bubble {
  max-width: 78%; padding: 8px 12px;
  border-radius: 14px; font-size: 13px; line-height: 1.4;
}
.chat-bubble-wrap.them .chat-bubble {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 4px 14px 14px 14px;
}
.chat-bubble-wrap.me .chat-bubble {
  background: var(--accent); color: #fff;
  border-radius: 14px 4px 14px 14px;
}
.chat-bubble-wrap.system .chat-bubble {
  background: var(--warn-bg); color: var(--warn);
  border: 1px solid var(--warn-border);
  border-radius: 10px; font-size: 12px; font-style: italic;
  max-width: 90%; margin: 0 auto;
}
.chat-name { font-size: 11px; font-weight: 600; color: var(--sub); margin-bottom: 2px; margin-left: 4px; }
.chat-time { font-size: 10px; color: var(--sub); margin-top: 3px; text-align: right; }
.chat-input-bar {
  padding: 10px 14px; background: var(--card);
  border-top: 1px solid var(--border);
  display: flex; gap: 8px; align-items: flex-end;
  flex-shrink: 0; padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
}
.chat-input {
  flex: 1; min-height: 38px; max-height: 120px;
  padding: 9px 12px; border-radius: 20px;
  border: 1px solid var(--border); background: var(--bg2);
  font-size: 14px; resize: none; line-height: 1.4;
}
.chat-send {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--accent); border: none; color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; transition: background .15s;
}
.chat-send:hover { background: var(--accent-h); }

/* ═══════════════════════════════════════════════════════════════
   NOTIFICATIONS PANEL
   ═══════════════════════════════════════════════════════════════ */
.notif-overlay {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(0,0,0,.3); display: none;
}
.notif-overlay.open { display: block; }
.notif-panel {
  position: fixed; top: 54px; right: 12px; z-index: 81;
  width: min(360px, calc(100vw - 24px));
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  display: none; flex-direction: column; max-height: 70dvh;
}
.notif-panel.open { display: flex; }
.notif-panel-head {
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.notif-list { overflow-y: auto; flex: 1; }
.notif-item {
  display: flex; gap: 10px; padding: 12px 14px;
  border-bottom: 1px solid var(--border); cursor: pointer;
  transition: background .12s;
}
.notif-item:hover { background: var(--card2); }
.notif-item:last-child { border-bottom: none; }
.notif-item.unread { background: var(--accent-light); }
.notif-dot-sm { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex-shrink: 0; margin-top: 5px; }
.notif-item.unread .notif-dot-sm { background: var(--accent); }
.notif-item:not(.unread) .notif-dot-sm { background: var(--border2); }
.notif-title { font-size: 13px; font-weight: 600; line-height: 1.3; }
.notif-body  { font-size: 12px; color: var(--sub); margin-top: 1px; line-height: 1.4; }
.notif-time  { font-size: 10px; color: var(--sub); margin-top: 2px; }

/* ═══════════════════════════════════════════════════════════════
   MODALS
   ═══════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,.45);
  display: none; align-items: center; justify-content: center;
  padding: 16px;
  backdrop-filter: blur(2px);
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-xl); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 500px;
  display: flex; flex-direction: column; max-height: 90dvh;
  overflow: hidden;
}
.modal-box.modal-sm { max-width: 360px; }
.modal-box.modal-lg { max-width: 700px; }
.modal-head {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  font-weight: 700; font-size: 15px;
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0; background: var(--card2);
}
.modal-close { background: none; border: none; cursor: pointer; color: var(--sub); font-size: 18px; line-height: 1; padding: 2px; }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-foot {
  padding: 14px 20px; border-top: 1px solid var(--border);
  display: flex; gap: 8px; justify-content: flex-end;
  flex-shrink: 0; background: var(--card2);
}

/* Mobile: sheet from bottom */
@media (max-width: 500px) {
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal-box { border-radius: var(--r-xl) var(--r-xl) 0 0; max-width: 100%; width: 100%; max-height: 90dvh; }
  .modal-box.modal-sm { border-radius: var(--r-xl); max-width: 360px; margin: 0 auto 16px; }
}

/* ── Profile modal content ───────────────────────────────────────────────────── */
.profile-modal-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.profile-modal-name { font-size: 18px; font-weight: 700; }
.profile-modal-role { margin-top: 3px; }
.role-badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 700; }
.role-badge.player      { background: #e0f2fe; color: #0369a1; }
.role-badge.accountant  { background: #fef3c7; color: #92400e; }
.role-badge.admin       { background: #ede9fe; color: #5b21b6; }
.role-badge.superadmin  { background: #fee2e2; color: #991b1b; }
[data-theme="dark"] .role-badge.player     { background: rgba(14,165,233,.2); color: #7dd3fc; }
[data-theme="dark"] .role-badge.accountant { background: rgba(251,191,36,.15); color: #fde68a; }
[data-theme="dark"] .role-badge.admin      { background: rgba(139,92,246,.2); color: #c4b5fd; }
[data-theme="dark"] .role-badge.superadmin { background: rgba(239,68,68,.15); color: #fca5a5; }

.theme-toggle-row { display: flex; gap: 12px; margin: 8px 0; }
.theme-option { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.theme-option-lbl { font-size: 11px; color: var(--sub); }
.theme-option-btn {
  width: 50px; height: 50px; border-radius: var(--r);
  border: 2px solid var(--border); background: var(--bg2);
  color: var(--text); display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: border-color .15s;
}
.theme-option-btn.active { border-color: var(--accent); background: var(--accent-light); color: var(--accent); }

/* ═══════════════════════════════════════════════════════════════
   TOAST
   ═══════════════════════════════════════════════════════════════ */
#toast-wrap {
  position: fixed; bottom: 80px; right: 16px; z-index: 999;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
@media (min-width: 700px) { #toast-wrap { bottom: 20px; } }
.toast {
  padding: 11px 16px; border-radius: var(--r); font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow-lg); pointer-events: auto; max-width: 320px;
  transform: translateX(110%); opacity: 0;
  transition: transform .25s cubic-bezier(.34,1.56,.64,1), opacity .2s;
}
.toast.show { transform: translateX(0); opacity: 1; }
.toast-info    { background: var(--card); border: 1px solid var(--border); color: var(--text); }
.toast-success { background: var(--good-bg); border: 1px solid var(--good-border); color: var(--good); }
.toast-error   { background: var(--bad-bg);  border: 1px solid var(--bad-border);  color: var(--bad); }
.toast-warn    { background: var(--warn-bg); border: 1px solid var(--warn-border); color: var(--warn); }

/* ═══════════════════════════════════════════════════════════════
   UTILITIES
   ═══════════════════════════════════════════════════════════════ */
.hidden   { display: none !important; }
.muted    { color: var(--sub); }
.small    { font-size: 12px; }
.bold     { font-weight: 700; }
.center   { text-align: center; }
.flex-row { display: flex; align-items: center; gap: 8px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.grid-2   { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-3   { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.gap-2    { gap: 8px; }
.gap-3    { gap: 12px; }
.mb-2     { margin-bottom: 8px; }
.mb-3     { margin-bottom: 12px; }
.mb-4     { margin-bottom: 16px; }
.mt-3     { margin-top: 12px; }
.p-0      { padding: 0 !important; }
.overflow-hidden { overflow: hidden; }
.view-title { font-size: 18px; font-weight: 700; margin-bottom: 14px; }
.section-gap { display: grid; gap: 14px; }
.row-gap { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Payments table ──────────────────────────────────────────────────────────── */
.pay-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.pay-table th { padding: 9px 10px; text-align: left; font-size: 11px; color: var(--sub); border-bottom: 1px solid var(--border); white-space: nowrap; }
.pay-table td { padding: 9px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.pay-table tr:last-child td { border-bottom: none; }
.toggle-btn {
  padding: 4px 10px; border-radius: 99px; border: 1px solid;
  font-size: 11px; font-weight: 700; cursor: pointer; white-space: nowrap;
  transition: background .12s;
}
.toggle-btn.good    { background: var(--good-bg); border-color: var(--good-border); color: var(--good); }
.toggle-btn.bad     { background: var(--bad-bg);  border-color: var(--bad-border);  color: var(--bad); }
.toggle-btn.neutral { background: var(--card2);   border-color: var(--border);      color: var(--sub); }
.toggle-btn.pending { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn); }

/* ── Score submission (4-level) ──────────────────────────────────────────────── */
.timeline { display: flex; flex-direction: column; gap: 0; }
.tl-item  { display: flex; gap: 10px; padding-bottom: 12px; position: relative; }
.tl-item:last-child { padding-bottom: 0; }
.tl-dot   { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; margin-top: 3px; }
.tl-dot.done   { background: var(--good); }
.tl-dot.active { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.tl-dot.wait   { background: var(--border2); }
.tl-line  { position: absolute; left: 4px; top: 14px; bottom: 0; width: 1px; background: var(--border); }
.tl-title { font-size: 13px; font-weight: 600; }
.tl-sub   { font-size: 11px; color: var(--sub); margin-top: 1px; }

/* ── Admin panel ─────────────────────────────────────────────────────────────── */
.admin-user-row { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.admin-user-row:last-child { border-bottom: none; }
