* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
  background: #f4efec;
  color: #251f21;
  font-size: 14px;
  line-height: 1.6;
}
.wrap { max-width: 720px; margin: 0 auto; padding: 16px 14px 40px; }
.hero {
  background: linear-gradient(160deg, #0d3057 0%, #123f6e 60%, #17497f 100%);
  border-radius: 20px;
  padding: 18px;
  margin-bottom: 14px;
  color: #fff;
}
.hero-row { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 54px; height: 54px; border-radius: 50%;
  background: rgba(255,255,255,0.12);
  border: 2px solid rgba(255,255,255,0.45);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; flex-shrink: 0;
}
.hero-text { flex: 1; min-width: 0; }
.hero h1 { margin: 0; font-size: 19px; font-weight: 800; color: #fff; line-height: 1.35; }
.hero .sub { margin: 3px 0 0; font-size: 12.5px; color: rgba(255,255,255,0.78); }
.edit-name {
  background: rgba(255,255,255,0.14); color: #fff;
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 999px; padding: 8px 12px;
  font-family: inherit; font-size: 12px; font-weight: 600;
  cursor: pointer; flex-shrink: 0; min-height: 38px;
}
.hero-edit { margin-top: 12px; }
.hero-edit input {
  width: 100%; border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.4);
  background: rgba(255,255,255,0.95);
  padding: 10px 12px; font-family: inherit; font-size: 14px;
  margin-bottom: 8px;
}
.tabs {
  display: flex; gap: 8px; overflow-x: auto;
  padding-bottom: 6px; margin-bottom: 14px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  white-space: nowrap; padding: 10px 16px;
  border-radius: 999px; border: 1.5px solid #123f6e;
  color: #123f6e; font-size: 14px; font-weight: 700;
  text-decoration: none; min-height: 44px;
  display: inline-flex; align-items: center;
  background: #fff; flex-shrink: 0;
}
.tabs a.active { background: #123f6e; color: #fff; }
.section { margin-bottom: 22px; }
.section-title { font-size: 17px; font-weight: 800; color: #123f6e; margin: 0 0 10px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat {
  background: #fff; border: 1px solid #eae9ea; border-radius: 14px;
  padding: 14px 10px; text-align: center;
  display: flex; flex-direction: column; gap: 6px;
}
.stat-label { font-size: 12.5px; color: #585254; font-weight: 600; }
.stat-num { font-size: 32px; font-weight: 800; line-height: 1; }
.navy { color: #123f6e; } .teal { color: #3f8f7a; } .red { color: #d32f2f; } .amber { color: #c98a04; }
.panel {
  background: #fff; border: 1px solid #eae9ea; border-radius: 14px;
  padding: 14px; margin: 10px 0;
  display: flex; flex-direction: column; gap: 10px;
}
.field { display: flex; flex-direction: column; gap: 5px; }
[hidden] { display: none !important; }
.field-label { font-size: 13px; color: #585254; font-weight: 700; }
.input, .date-input {
  border: 1.5px solid #ddd8d6; border-radius: 10px;
  padding: 10px 12px; font-family: inherit; font-size: 16px;
  background: #fff; min-height: 46px; width: 100%;
}
.date-input { text-align: left; direction: ltr; }
.input:focus, .date-input:focus { outline: none; border-color: #123f6e; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1.5px solid #123f6e; color: #123f6e; background: #fff;
  border-radius: 999px; padding: 8px 14px;
  font-family: inherit; font-size: 13px; font-weight: 700;
  cursor: pointer; min-height: 40px;
}
.chip.on { background: #123f6e; color: #fff; }
.chip.dashed { border-style: dashed; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn {
  border: none; border-radius: 10px; padding: 11px 18px;
  font-family: inherit; font-size: 14px; font-weight: 700;
  cursor: pointer; min-height: 46px; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-sm { padding: 8px 14px; min-height: 40px; font-size: 13px; border-radius: 8px; }
.btn-primary { background: #123f6e; color: #fff; }
.btn-primary:disabled { background: #b9c4d2; cursor: not-allowed; }
.btn-secondary { background: #e8eef5; color: #123f6e; }
.btn-ghost { background: transparent; color: #123f6e; }
.btn-danger { background: #fbe3e5; color: #c1121f; }
.btn-wa { background: #25d366; color: #fff; }
.btn-wa-urgent { background: #1ebe5b; color: #fff; box-shadow: 0 2px 8px rgba(30,190,91,0.4); }
.btn-light { background: #fff; color: #123f6e; }
.btn-ghost-light { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,0.5); }
.row {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start;
  padding: 13px 4px; border-bottom: 1px solid #eae9ea;
}
.row:last-child { border-bottom: none; }
.row-main { flex: 1; min-width: 170px; display: flex; flex-direction: column; gap: 3px; }
.row-name { font-size: 15px; font-weight: 800; color: #251f21; }
.row-detail { font-size: 13px; color: #585254; }
.row-side { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.badge {
  font-size: 12px; font-weight: 800; border-radius: 999px;
  padding: 4px 12px; white-space: nowrap;
}
.badge-active { background: #e3efeb; color: #2e6b58; }
.badge-soon { background: #fbf0d3; color: #94690a; }
.badge-expired { background: #fbe3e5; color: #c1121f; }
.badge-none { background: #f0efef; color: #585254; }
.note {
  background: #fdf6e8; border: 1px solid #f0e0b8; border-radius: 12px;
  padding: 12px 14px; font-size: 13.5px; color: #6b5410;
  margin: 10px 0;
}
.note-plain { background: #f0efef; border-color: #e0dedd; color: #585254; }
.foot { margin-top: 24px; font-size: 12px; color: #8a8486; text-align: center; }
bdi { unicode-bidi: isolate; }
@media (min-width: 640px) {
  .stats { grid-template-columns: repeat(4, 1fr); }
  .hero h1 { font-size: 22px; }
}

/* v10: login mode toggle */
.login-mode { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 10px; }
.login-mode .btn { width: 100%; }

/* v6: narrow phones - title wraps cleanly, buttons drop to their own row */
@media (max-width: 480px) {
  .hero { padding: 14px; }
  .hero-row { flex-wrap: wrap; gap: 8px; }
  .hero-text { flex: 1 1 calc(100% - 80px); min-width: 0; }
  .hero h1 { font-size: 17px; line-height: 1.4; }
  .hero .sub { font-size: 11.5px; }
  .logo { width: 44px; height: 44px; font-size: 21px; }
  .edit-name, #logout-btn { padding: 6px 10px; font-size: 11.5px; min-height: 34px; }
  /* v9: keep the floating contact button + Netlify badge off the content */
  .wrap { padding-bottom: 200px; }
  .contact-fab { bottom: 72px; left: 12px; }
  #contact-btn { padding: 10px 16px; font-size: 13px; min-height: 42px; }
}

/* v2 additions */
.login-card { max-width: 420px; margin: 20px auto; }
.rep-item { border: 1px solid #eae9ea; border-radius: 10px; padding: 10px; }
.rep-text { font-size: 14px; font-weight: 600; }
.rep-meta { font-size: 12px; color: #8a8486; margin: 4px 0 8px; }
.btn-att { background: #f0efef; color: #585254; }
.btn-att-on { background: #3f8f7a; color: #fff; }
.btn-abs-on { background: #d32f2f; color: #fff; }
#logout-btn {
  background: transparent; color: #fff;
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 999px; padding: 8px 12px;
  font-family: inherit; font-size: 12px; font-weight: 600;
  cursor: pointer; flex-shrink: 0; min-height: 38px;
}
textarea.input { resize: vertical; min-height: 70px; }
select.input { appearance: auto; }

/* announcements ticker */
.ticker {
  background: #fff; border: 1.5px solid #123f6e; border-radius: 999px;
  overflow: hidden; padding: 9px 0; margin-bottom: 14px;
}
.ticker-track {
  display: flex; gap: 48px; width: max-content;
  animation: tickmove 30s linear infinite;
  font-size: 13.5px; font-weight: 700; color: #123f6e; white-space: nowrap;
}
@keyframes tickmove { from { transform: translateX(0); } to { transform: translateX(50%); } }

/* admin badge for sent reports */
.tab-badge {
  background: #d32f2f; color: #fff; border-radius: 999px;
  font-size: 11px; font-weight: 800; padding: 1px 8px; margin-inline-start: 4px;
}

/* v3 additions */
.skill-row { display: flex; align-items: center; gap: 8px; margin: 3px 0; }
.skill-label { width: 74px; font-size: 13px; font-weight: 700; color: #585254; flex-shrink: 0; }
.skill-bar { flex: 1; height: 10px; background: #f0efef; border-radius: 999px; overflow: hidden; }
.skill-fill { display: block; height: 100%; background: #3f8f7a; border-radius: 999px; }
.skill-val { width: 28px; text-align: center; font-weight: 800; color: #123f6e; flex-shrink: 0; }
.badge-training { background: #e8eef5; color: #123f6e; }
.badge-match { background: #e3efeb; color: #2e6b58; }
.badge-friendly { background: #fbf0d3; color: #94690a; }
.med-box { border: 1px solid #f0d0d0; background: #fffafa; border-radius: 10px; padding: 10px; }

/* v4: contact button + per-section accents */
.wrap { padding-bottom: 100px; }
.contact-fab { position: fixed; bottom: 16px; left: 16px; z-index: 60; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
#contact-btn {
  background: #25d366; color: #fff; border: none; border-radius: 999px;
  padding: 12px 20px; font-family: inherit; font-size: 14px; font-weight: 800;
  cursor: pointer; min-height: 48px; box-shadow: 0 4px 14px rgba(37,211,102,0.45);
}
.contact-menu {
  display: flex; flex-direction: column; gap: 6px;
  background: #fff; border: 1px solid #eae9ea; border-radius: 14px;
  padding: 8px; box-shadow: 0 6px 20px rgba(0,0,0,0.14);
}
.contact-menu a {
  text-decoration: none; font-weight: 800; font-size: 14px;
  padding: 11px 16px; border-radius: 10px; min-width: 150px; text-align: center;
}
.contact-menu a.c-wa { background: #25d366; color: #fff; }
.contact-menu a.c-call { background: #123f6e; color: #fff; }
.hero-label { font-size: 12px; font-weight: 700; color: rgba(255,255,255,0.8); margin: 0 0 6px; }

.acc .section-title { color: var(--acc); }
.acc .row {
  background: #fff; border: 1px solid #efedee;
  border-right: 4px solid var(--acc); border-radius: 12px;
  padding: 12px; margin: 0 0 8px;
}
.acc .row:last-child { border-bottom: 1px solid #efedee; }
.acc .panel { border-top: 3px solid var(--acc); }
.acc-players { --acc: #123f6e; }
.acc-subs { --acc: #c98a04; }
.acc-att { --acc: #3f8f7a; }
.acc-pay { --acc: #2e6b58; }
.acc-coaches { --acc: #b3541e; }
.acc-cats { --acc: #0e7490; }
.acc-msgs { --acc: #4a6fa5; }
.acc-ann { --acc: #94690a; }
.acc-users { --acc: #6d5a72; }
.acc-backup { --acc: #5f6b7a; }
.acc-sched { --acc: #6b5b95; }

/* v5: public registration */
.acc-regs { --acc: #a03d63; }
.hero-check { display: flex; align-items: center; gap: 8px; color: #fff; font-size: 13px; font-weight: 700; margin: 0 0 8px; }
.hero-check input { width: 20px; height: 20px; flex-shrink: 0; }
.hp-field { position: absolute; left: -9999px; top: -9999px; height: 0; overflow: hidden; }

/* v5b: colorful header + per-tab colors (green/red/yellow/orange/blue mix) */
.hero {
  background: linear-gradient(135deg, #0d3057 0%, #1a5fa8 34%, #2e8b8b 66%, #e8710a 100%);
}
.tabs a[data-tab="home"] { border-color: #1e6fd9; color: #1e6fd9; }
.tabs a[data-tab="home"].active { background: #1e6fd9; }
.tabs a[data-tab="players"] { border-color: #2fa85c; color: #2fa85c; }
.tabs a[data-tab="players"].active { background: #2fa85c; }
.tabs a[data-tab="subs"] { border-color: #e0a800; color: #e0a800; }
.tabs a[data-tab="subs"].active { background: #e0a800; }
.tabs a[data-tab="att"] { border-color: #e8710a; color: #e8710a; }
.tabs a[data-tab="att"].active { background: #e8710a; }
.tabs a[data-tab="sched"] { border-color: #d92d20; color: #d92d20; }
.tabs a[data-tab="sched"].active { background: #d92d20; }
.tabs a[data-tab="payments"] { border-color: #1e6fd9; color: #1e6fd9; }
.tabs a[data-tab="payments"].active { background: #1e6fd9; }
.tabs a[data-tab="coaches"] { border-color: #2fa85c; color: #2fa85c; }
.tabs a[data-tab="coaches"].active { background: #2fa85c; }
.tabs a[data-tab="cats"] { border-color: #e0a800; color: #e0a800; }
.tabs a[data-tab="cats"].active { background: #e0a800; }
.tabs a[data-tab="msgs"] { border-color: #e8710a; color: #e8710a; }
.tabs a[data-tab="msgs"].active { background: #e8710a; }
.tabs a[data-tab="ann"] { border-color: #d92d20; color: #d92d20; }
.tabs a[data-tab="ann"].active { background: #d92d20; }
.tabs a[data-tab="regs"] { border-color: #1e6fd9; color: #1e6fd9; }
.tabs a[data-tab="regs"].active { background: #1e6fd9; }
.tabs a[data-tab="users"] { border-color: #2fa85c; color: #2fa85c; }
.tabs a[data-tab="users"].active { background: #2fa85c; }
.tabs a[data-tab="backup"] { border-color: #e0a800; color: #e0a800; }
.tabs a[data-tab="backup"].active { background: #e0a800; }
.tabs a.active { color: #fff; }

/* iOS: احترام مناطق الأمان (النوتش والهوم بار) */
body { padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
.contact-fab { bottom: calc(16px + env(safe-area-inset-bottom)); }

/* v16: شبكة البلاط بدل شريط التبويبات */
.tabs { display: none !important; }
.tile-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 4px 0 20px; }
.tile { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  aspect-ratio: 1 / 1; border-radius: 20px; color: #fff; text-decoration: none; padding: 8px;
  box-shadow: 0 4px 10px rgba(0,0,0,.18); transition: transform .1s; -webkit-tap-highlight-color: transparent; }
.tile:active { transform: scale(.95); }
.tile-ico { display: flex; align-items: center; justify-content: center; filter: drop-shadow(0 2px 2px rgba(0,0,0,.2)); }
.tile-label { font-size: 13px; font-weight: 800; text-align: center; line-height: 1.2; }
.tile-badge { position: absolute; top: 6px; left: 8px; background: #fff; color: #d92d20; font-weight: 800; font-size: 12px;
  min-width: 22px; height: 22px; border-radius: 11px; display: flex; align-items: center; justify-content: center; padding: 0 5px; }
.backbar { display: flex; align-items: center; gap: 12px; margin: 0 0 14px; }
.back-btn { border: 0; background: #123f6e; color: #fff; font-family: inherit; font-size: 15px; font-weight: 800;
  padding: 10px 18px; border-radius: 999px; min-height: 44px; cursor: pointer; }
.back-title { font-size: 18px; font-weight: 800; }
@media (min-width: 560px) { .tile-grid { grid-template-columns: repeat(4, 1fr); } }

.rc-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.75); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 14px; }
.rc-box { background: #fff; border-radius: 14px; padding: 10px; max-width: 100%; max-height: 100%; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.rc-box img { max-width: 100%; max-height: 70vh; object-fit: contain; }

/* v17: بدون سكرول أفقي + بلاط أصغر */
html, body { max-width: 100%; overflow-x: hidden; touch-action: pan-y pinch-zoom; }
.wrap { max-width: 720px; width: 100%; box-sizing: border-box; padding-left: 12px; padding-right: 12px; overflow-x: clip; }
.ticker { max-width: 100%; contain: paint; }
.tile-grid { gap: 8px; margin: 2px 0 14px; }
.tile { aspect-ratio: auto; min-height: 88px; padding: 10px 4px; gap: 4px; border-radius: 16px; }
.tile-ico svg { width: 38px; height: 38px; }
.tile-label { font-size: 12px; }
img, svg, input, select, textarea { max-width: 100%; }
.row, .panel, .stat, .note { max-width: 100%; box-sizing: border-box; overflow-wrap: anywhere; }

.avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex-shrink: 0; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.25); background: #e9eef5; }
.avatar-ini { display: inline-block; text-align: center; font-weight: 800; color: #123f6e; background: #dbe8f6; font-size: 18px; }
.row-name-av { display: flex; align-items: center; gap: 10px; }
.credit { margin: 14px auto 6px; text-align: center; font-size: 11px; line-height: 1.5; color: #777; }
.credit-n { font-weight: 800; color: #14305f; }
.credit a { color: #555; text-decoration: none; font-weight: 700; }
