:root {
  /* Club Tennis i Pàdel Lloret brand: navy blue primary, yellow-green accent */
  --green: #10233f;
  --green-dark: #081527;
  --clay: #d9e14a;
  --clay-light: #fbf8dc;
  --bg: #f5f6f8;
  --card: #ffffff;
  --card-2: #eef1f6;
  --text: #1c231f;
  --muted: #5c6b76;
  --border: #e2e6ee;

  /* Fresh Bento: soft, rounded cards on a warm-neutral ground */
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 26px;
  --shadow-card: 0 1px 2px rgba(16,35,63,0.04), 0 10px 26px -16px rgba(16,35,63,0.16);

  --display: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --body-font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono-font: 'IBM Plex Mono', 'Space Mono', monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--body-font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

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

h1, h2, h3 { font-family: var(--display); letter-spacing: -0.01em; text-wrap: balance; }

.mono, .num { font-family: var(--mono-font); font-variant-numeric: tabular-nums; }

/* Header — light, sticky, with a pill nav bar (bento signature) */
.site-header {
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 12px; padding-bottom: 12px; flex-wrap: wrap; gap: 10px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 800; font-family: var(--display); font-size: 1.05rem; }
.brand:hover { text-decoration: none; }
.brand-mark {
  font-size: 1.15rem; width: 36px; height: 36px; border-radius: 11px; background: var(--green);
  display: flex; align-items: center; justify-content: center;
}
.brand-logo { height: 36px; width: 36px; object-fit: cover; border-radius: 11px; }

.nav-toggle {
  display: none; align-items: center; justify-content: center;
  background: var(--card-2); color: var(--green); border: 1px solid var(--border); border-radius: var(--radius-sm);
  width: 40px; height: 40px; padding: 0; cursor: pointer;
}
.nav-toggle-icon { flex: 0 0 auto; }
.nav-toggle:hover, .nav-toggle:focus, .nav-toggle:active { background: var(--border); color: var(--green); }

#siteNav { display: flex; flex-direction: row; align-items: center; gap: 14px; flex-wrap: wrap; }
.nav-pages {
  display: flex; flex-direction: row; align-items: center; gap: 2px; flex-wrap: wrap;
  background: var(--card-2); border-radius: 999px; padding: 4px;
}
.nav-page-link {
  padding: 8px 15px; border-radius: 999px; font-weight: 600; font-size: 0.88rem; color: var(--muted);
  font-family: var(--display);
}
.nav-page-link:hover { background: rgba(16,35,63,0.06); text-decoration: none; color: var(--text); }
.nav-page-link.active { color: #fff; background: var(--green); }
.nav-page-link.active:hover { background: var(--green); }
.nav-auth { display: flex; flex-direction: row; align-items: center; gap: 8px; flex-wrap: wrap; }
.lang-switcher { font-size: 0.78rem; font-weight: 700; color: var(--muted); letter-spacing: 0.02em; }
.lang-switcher a { color: var(--muted); }
.lang-switcher a.active { color: var(--green); }

@media (max-width: 760px) {
  .nav-toggle { display: flex; }
  #siteNav {
    display: none; width: 100%; flex-direction: column; align-items: stretch;
    gap: 4px; padding-top: 10px; border-top: 1px solid var(--border); margin-top: 10px;
  }
  #siteNav.open { display: flex; }
  .nav-pages { flex-direction: column; align-items: stretch; gap: 2px; background: transparent; padding: 0; border-radius: 0; }
  .nav-auth { flex-direction: column; align-items: stretch; gap: 6px; }
  .nav-page-link { padding: 12px 14px; border-radius: var(--radius-sm); }
  .nav-page-link.active { background: var(--green); }
  .nav-auth { margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--border); }
}

.nav-icon-link {
  display: flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 999px; font-size: 1.05rem;
  background: var(--card-2); border: 1px solid var(--border);
}
.nav-icon-link:hover { background: var(--border); text-decoration: none; }

.nav-user {
  display: flex; align-items: center; gap: 8px; color: var(--text);
  padding: 5px 12px 5px 5px; border-radius: 999px; background: var(--card-2); border: 1px solid var(--border);
}
.nav-user:hover { background: var(--border); text-decoration: none; }
.nav-user-avatar {
  width: 28px; height: 28px; border-radius: 50%; background: var(--green); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.8rem; flex: 0 0 auto;
}
.nav-user-name { font-weight: 600; font-size: 0.9rem; }

.btn-ghost-sm {
  color: var(--muted); padding: 8px 14px; border-radius: 999px; font-weight: 600; font-size: 0.9rem;
}
.btn-ghost-sm:hover { background: var(--card-2); text-decoration: none; color: var(--text); }

#siteNav a.cta {
  background: var(--clay); color: var(--green-dark); font-weight: 700; font-family: var(--display);
  padding: 9px 18px; border-radius: 999px; text-align: center;
}
#siteNav a.cta:hover { background: #c8d13e; text-decoration: none; }

/* Flash */
.flash-stack { margin: 16px 0; display: flex; flex-direction: column; gap: 8px; }
.flash { padding: 10px 14px; border-radius: var(--radius-sm); font-size: 0.95rem; }
.flash-success { background: #e3f4e9; color: #1c5c34; }
.flash-error { background: #fbe3de; color: #8a2f14; }
.flash-info { background: #e6eef8; color: #23496f; }

/* Cards & tables */
main { padding: 20px 16px 60px; }
main.wrap { padding-top: 28px; padding-bottom: 60px; }
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 20px 22px; margin-bottom: 18px;
}
h1 { font-size: 1.6rem; margin: 0 0 8px; }
h2 { font-size: 1.15rem; margin: 0 0 10px; color: var(--green-dark); font-weight: 800; }
h3 { font-size: 1.02rem; margin: 18px 0 8px; font-weight: 700; }
.muted { color: var(--muted); font-size: 0.9rem; }

/* Bento grid: a 12-column arrangement of cards at varying spans */
.bento-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; margin-bottom: 18px; }
.bento-grid > * { margin-bottom: 0; min-width: 0; }
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; }
.span-7 { grid-column: span 7; }
.span-8 { grid-column: span 8; }
.span-9 { grid-column: span 9; }
.span-12 { grid-column: span 12; }
@media (max-width: 900px) {
  .span-3, .span-4 { grid-column: span 6; }
  .span-5, .span-7, .span-8, .span-9 { grid-column: span 12; }
}
@media (max-width: 560px) {
  .span-3, .span-4, .span-5, .span-6, .span-7, .span-8, .span-9 { grid-column: span 12; }
}

/* Horizontally-scrolling tables give no visual hint that there's more
   to see off-screen — this is the classic no-JS "scroll shadow" trick:
   two background gradients anchored to the content (which scrolls) show
   a shadow only on whichever edge still has hidden columns, and two more
   anchored to the viewport (which doesn't scroll) mask them at the very
   start/end so the shadow disappears once you've scrolled all the way. */
.table-scroll {
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  background:
    linear-gradient(to right, var(--card) 30%, rgba(255,255,255,0)) 0 0,
    linear-gradient(to left, var(--card) 30%, rgba(255,255,255,0)) 100% 0,
    linear-gradient(to right, rgba(20,23,31,0.22), rgba(20,23,31,0)) 0 0,
    linear-gradient(to left, rgba(20,23,31,0.22), rgba(20,23,31,0)) 100% 0;
  background-repeat: no-repeat;
  background-size: 24px 100%, 24px 100%, 16px 100%, 16px 100%;
  background-attachment: local, local, scroll, scroll;
}
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; min-width: 420px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 700; text-transform: uppercase; font-size: 0.7rem; letter-spacing: 0.05em; font-family: var(--mono-font); }
td { font-variant-numeric: tabular-nums; }
tr.me td { background: var(--clay-light); }
tr.me td:first-child { box-shadow: inset 3px 0 0 var(--clay); border-radius: 8px 0 0 8px; }
tr.playoff-zone td:first-child { border-left: 3px solid #2e9e5b; }
td.num, th.num { text-align: center; }

/* Head-to-head matchup matrix */
.matrix-table { min-width: 560px; font-size: 0.82rem; }
.matrix-table th {
  background: var(--green); color: #fff; text-align: center; font-size: 0.68rem;
  text-transform: none; letter-spacing: 0;
}
.matrix-table th:first-child { text-align: left; }
.matrix-table td { text-align: center; padding: 8px 6px; white-space: nowrap; }
.matrix-player-name {
  text-align: left !important; font-weight: 600; color: var(--text);
  background: var(--card-2); white-space: nowrap;
}
.player-number {
  display: inline-block; background: var(--clay-light); color: var(--green-dark);
  font-size: 0.65rem; font-weight: 700; padding: 1px 5px; border-radius: 4px; margin-right: 6px;
}
.matrix-diagonal { background: var(--green-dark); }
.matrix-score { color: var(--muted); font-size: 0.78rem; }
.matrix-baja {
  background: repeating-linear-gradient(45deg, #f0f0f0, #f0f0f0 4px, #e4e4e4 4px, #e4e4e4 8px);
  color: #aaa; font-style: italic; font-size: 0.7rem;
}

.form-chips { display: flex; gap: 4px; }
.form-chip {
  width: 20px; height: 20px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.65rem; font-weight: 800; color: #fff;
}
.form-chip.win { background: #2e9e5b; }
.form-chip.loss { background: #c1592c; }

.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 700;
}
.badge-pending { background: var(--card-2); color: var(--muted); }
.badge-completed { background: #e3f4e9; color: #1c5c34; }
.badge-walkover { background: #fdf0e0; color: #8a5a10; }
.badge-retired { background: #fbe3de; color: #8a2f14; }
.badge-no_show { background: var(--card-2); color: #6c757d; }

.round-banner {
  background: var(--clay-light); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 14px;
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px;
}

/* Confirmation modals — native <dialog>, styled to match .card */
dialog.modal {
  border: none; border-radius: var(--radius-lg); box-shadow: 0 8px 32px -8px rgba(16,35,63,0.4);
  padding: 24px; width: min(440px, calc(100vw - 40px)); background: var(--card); color: var(--text);
}
dialog.modal::backdrop { background: rgba(16,35,63,0.5); }
dialog.modal select { margin-bottom: 4px; }
.modal-info {
  background: var(--bg); border-radius: var(--radius); padding: 12px 14px; margin: 14px 0;
  font-size: 0.88rem; line-height: 1.5;
}
.modal-info p { margin: 0 0 6px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* Forms */
form.stack { display: flex; flex-direction: column; gap: 12px; max-width: 460px; }
label { font-weight: 600; font-size: 0.9rem; display: block; margin-bottom: 4px; }
input[type=text], input[type=email], input[type=tel], input[type=date], input[type=number], select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 1rem;
  font-family: var(--body-font); background: var(--card);
}
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; }
.checkbox-row { display: flex; align-items: center; gap: 10px; margin: 6px 0; }
.checkbox-row input { width: auto; }

/* Native checkbox/radio boxes render tiny on mobile browsers by default
   (often smaller than their own desktop size once the OS applies its
   own minimum-touch-target shrinking) — fix a real, tappable size and
   tint them to match the app instead of leaving it to each browser's
   default rendering. accent-color is the standards way to recolor a
   native control without giving up its OS-native look entirely. */
input[type="checkbox"], input[type="radio"] {
  width: 20px; height: 20px; min-width: 20px; min-height: 20px;
  accent-color: var(--green); cursor: pointer;
}
.checkbox-row input[type="checkbox"], .checkbox-row input[type="radio"] {
  flex: 0 0 auto; margin-top: 1px;
}

button, .btn {
  background: var(--green); color: #fff; border: none; padding: 10px 20px; border-radius: 999px;
  font-size: 0.95rem; font-weight: 700; font-family: var(--display); cursor: pointer; display: inline-block;
}
button:hover, .btn:hover { background: var(--green-dark); text-decoration: none; }
.btn-secondary { background: var(--card-2); color: var(--text); }
.btn-secondary:hover { background: var(--border); }
.btn-danger { background: #b3391b; }
.btn-danger:hover { background: #8f2c13; }
.btn-sm { padding: 7px 14px; font-size: 0.85rem; }

.grid-2 { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 700px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

.set-inputs { display: flex; gap: 8px; align-items: center; }
.set-inputs input[type=number] { width: 64px; }

.site-footer { padding: 28px 0; color: var(--muted); font-size: 0.85rem; text-align: center; }
.footer-legal-links { margin-top: 6px; }
.footer-legal-links a { color: var(--muted); text-decoration: underline; }

/* Category tabs */
.cat-tabs {
  display: flex; gap: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch;
  margin-bottom: 16px; padding-bottom: 2px;
}
.cat-tab {
  flex: 0 0 auto; background: var(--card-2); border: 1px solid var(--border); color: var(--text);
  padding: 8px 16px; border-radius: 999px; font-size: 0.88rem; font-weight: 600; cursor: pointer; white-space: nowrap;
  text-decoration: none;
}
.cat-tab:hover { text-decoration: none; background: var(--clay-light); }
.cat-tab.active { background: var(--green); color: #fff; border-color: var(--green); }
.cat-tab.active:hover { background: var(--green); }

.slot-filter { background: var(--card-2); color: var(--text); border: 1px solid var(--border); }
.slot-filter:hover { background: var(--bg); }
.slot-filter.active { background: var(--green); color: #fff; border-color: var(--green); }
.slot-filter.active:hover { background: var(--green-dark); }

/* Rules accordion */
details.card summary::-webkit-details-marker { display: none; }
details.card summary { list-style: none; }
details.card[open] summary { margin-bottom: 4px; }

/* Admin impersonation ("view as") banner */
.impersonation-banner {
  background: #3a2e00; color: #ffe9a8; padding: 10px 16px; font-size: 0.88rem;
}
.impersonation-banner .btn-sm { background: #ffe9a8; color: #3a2e00; font-weight: 700; }
.impersonation-banner .btn-sm:hover { background: #fff3c4; }
