/* ==========================================================================
   Admin Padel Club Vilacolum — sistema visual únic
   Menú fosc de marca + àrea de treball clara i contrastada.
   ========================================================================== */
:root {
  --brand: #c6f000;
  --brand-ink: #0b1a10;
  --navy: #0b1620;
  --navy-2: #13222e;
  --bg: #f2f4f7;
  --panel: #ffffff;
  --line: #e1e6ec;
  --line-2: #cfd7df;
  --text: #13202b;
  --muted: #5d6c79;
  --faint: #8a98a5;

  --green: #16a34a;   --green-bg: #e8f7ee;  --green-line: #b9e6c9;
  --amber: #b45309;   --amber-bg: #fff6e6;  --amber-line: #f6d79b;
  --blue: #2563eb;    --blue-bg: #eaf1ff;   --blue-line: #bfd3fb;
  --violet: #7c3aed;  --violet-bg: #f3edff; --violet-line: #d9c8fb;
  --red: #dc2626;     --red-bg: #fdecec;    --red-line: #f5c0c0;
  --wa: #1fa855;

  --r: 12px;
  --r-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 32, 43, .05), 0 4px 16px rgba(16, 32, 43, .04);
  --shadow-lg: 0 20px 60px rgba(10, 20, 30, .25);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.01em; }
code { background: #eef1f4; padding: .1rem .35rem; border-radius: 5px; font-size: .85em; }
small { color: var(--muted); }
.ico { width: 18px; height: 18px; flex: none; }
[hidden] { display: none !important; }

/* ---------- Estructura ---------- */
body.adm { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  background: var(--navy);
  color: #dfe8ee;
  display: flex; flex-direction: column;
  padding: 1rem .75rem;
  gap: 1rem;
  z-index: 40;
}
.sb-brand { display: flex; align-items: center; gap: .65rem; padding: .35rem .5rem .8rem; color: #fff; text-decoration: none !important; border-bottom: 1px solid rgba(255,255,255,.07); }
.sb-brand img { width: 38px; height: 38px; object-fit: contain; }
.sb-brand strong { display: block; font-size: 1rem; }
.sb-brand small { display: block; color: rgba(223,232,238,.55); font-size: .75rem; }
.sb-nav { display: grid; gap: 2px; }
.sb-nav a, .sb-foot a {
  display: flex; align-items: center; gap: .7rem;
  padding: .62rem .7rem;
  border-radius: 9px;
  color: rgba(223, 232, 238, .78);
  font-weight: 500;
  text-decoration: none !important;
  transition: background .15s, color .15s;
}
.sb-nav a:hover, .sb-foot a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sb-nav a.active { background: var(--brand); color: var(--brand-ink); font-weight: 700; }
.sb-nav a.active .sb-badge { background: var(--brand-ink); color: var(--brand); }
.sb-badge {
  margin-left: auto; font-style: normal; font-size: .72rem; font-weight: 700;
  background: #ff6a3d; color: #fff; border-radius: 999px; padding: .05rem .45rem; min-width: 1.3rem; text-align: center;
}
.sb-foot { margin-top: auto; display: grid; gap: 2px; border-top: 1px solid rgba(255,255,255,.07); padding-top: .6rem; }
.sb-logout:hover { color: #ff8a6a !important; }
.main { padding: 1.6rem 2rem 4rem; min-width: 0; }
.menu-btn { display: none; }
.sb-scrim { display: none; }

@media (max-width: 960px) {
  body.adm { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 250px; transform: translateX(-100%); transition: transform .2s; }
  body.menu-open .sidebar { transform: none; }
  body.menu-open .sb-scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 30; }
  .main { padding: 1rem 1rem 4rem; }
  .menu-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line);
    background: var(--panel); margin-bottom: .8rem; cursor: pointer; color: var(--text);
  }
}

/* ---------- Capçalera de pàgina ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.3rem; }
.page-head h1 { font-size: 1.65rem; font-weight: 800; }
.page-head p { margin: .2rem 0 0; color: var(--muted); }
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* ---------- Botons ---------- */
.btn, button.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font: inherit; font-weight: 600; font-size: .9rem;
  padding: .6rem 1rem;
  border-radius: 10px;
  border: 1px solid transparent;
  background: var(--navy); color: #fff;
  cursor: pointer; text-decoration: none !important; white-space: nowrap;
  transition: transform .05s, filter .15s, background .15s;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); color: var(--brand-ink); }
.btn.ghost, .btn.secondary { background: var(--panel); color: var(--text); border-color: var(--line-2); }
.btn.ghost:hover, .btn.secondary:hover { background: #f6f8fa; filter: none; }
.btn.danger { background: var(--red); color: #fff; }
.btn.danger.ghost { background: var(--panel); color: var(--red); border-color: var(--red-line); }
.btn.wa { background: var(--wa); color: #fff; }
.btn.sm { padding: .38rem .65rem; font-size: .8rem; border-radius: 8px; }
.btn.lg { padding: .8rem 1.3rem; font-size: 1rem; }
.btn[disabled], .btn.disabled { opacity: .45; pointer-events: none; }
.btn.icon { padding: .5rem; width: 38px; height: 38px; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn:first-child { border-radius: 10px 0 0 10px; }
.btn-group .btn:last-child { border-radius: 0 10px 10px 0; }
.btn-group .btn + .btn { margin-left: -1px; }

/* ---------- Panells ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 1.2rem 1.3rem; margin-bottom: 1rem; }
.panel > h2, .panel-head h2 { font-size: 1.05rem; font-weight: 700; margin-bottom: .75rem; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: .75rem; }
.panel-head h2 { margin: 0; }
.panel.flush { padding: 0; overflow: hidden; }
.hint { color: var(--muted); font-size: .85rem; margin: .2rem 0; }
.empty { color: var(--muted); padding: 1.4rem; text-align: center; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.kpi {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow);
  padding: .95rem 1.1rem; display: grid; gap: .15rem; text-decoration: none !important; color: inherit;
}
a.kpi:hover { border-color: var(--line-2); }
.kpi strong { font-size: 1.7rem; font-weight: 800; line-height: 1.1; }
.kpi span { color: var(--muted); font-size: .83rem; }
.kpi.green strong { color: var(--green); }
.kpi.amber strong { color: var(--amber); }
.kpi.blue strong { color: var(--blue); }
.kpi.red strong { color: var(--red); }

/* ---------- Alertes "què cal fer" ---------- */
.todo { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .7rem; margin-bottom: 1.1rem; }
.todo a, .todo div {
  display: flex; gap: .75rem; align-items: center;
  padding: .8rem 1rem; border-radius: var(--r);
  background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow);
  color: var(--text); text-decoration: none !important;
}
.todo a:hover { border-color: var(--line-2); }
.todo b { font-size: 1.35rem; min-width: 2.2rem; height: 2.2rem; border-radius: 10px; display: grid; place-items: center; font-weight: 800; }
.todo .amber b { background: var(--amber-bg); color: var(--amber); }
.todo .blue b { background: var(--blue-bg); color: var(--blue); }
.todo .violet b { background: var(--violet-bg); color: var(--violet); }
.todo .green b { background: var(--green-bg); color: var(--green); }
.todo span { font-size: .88rem; line-height: 1.3; }
.todo span small { display: block; }

/* ---------- Flash i toasts ---------- */
.flash { padding: .75rem 1rem; border-radius: var(--r-sm); margin-bottom: 1rem; font-weight: 500; transition: opacity .5s; }
.flash.ok { background: var(--green-bg); color: #126b35; border: 1px solid var(--green-line); }
.flash.err { background: var(--red-bg); color: #a11d1d; border: 1px solid var(--red-line); }
.flash.fade { opacity: .55; }
.alert { padding: .75rem 1rem; border-radius: var(--r-sm); background: var(--green-bg); border: 1px solid var(--green-line); margin-bottom: 1rem; }
.alert.err { background: var(--red-bg); border-color: var(--red-line); }
.toast-wrap { position: fixed; right: 1rem; bottom: 1rem; display: grid; gap: .5rem; z-index: 200; }
.toast {
  background: var(--navy); color: #fff; padding: .75rem 1.1rem; border-radius: 10px; box-shadow: var(--shadow-lg);
  font-weight: 500; transform: translateY(10px); opacity: 0; transition: all .2s; max-width: 360px;
}
.toast.in { transform: none; opacity: 1; }
.toast.ok { border-left: 4px solid var(--brand); }
.toast.err { background: #7f1d1d; }
.toast.warn { background: #7c4a03; }

/* ---------- Formularis ---------- */
input, select, textarea {
  font: inherit; color: var(--text);
  padding: .58rem .75rem; border-radius: 9px; border: 1px solid var(--line-2); background: #fff;
  min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
input[type=checkbox], input[type=radio] { width: 17px; height: 17px; accent-color: var(--green); padding: 0; }
label { font-size: .84rem; color: var(--muted); font-weight: 500; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .8rem; align-items: end; }
.form-grid label { display: grid; gap: .3rem; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid .check { display: flex; align-items: center; gap: .5rem; color: var(--text); }
.field { display: grid; gap: .3rem; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }
.search { position: relative; }
.search input { padding-left: 2.1rem; width: 100%; }
.search::before { content: "⌕"; position: absolute; left: .7rem; top: 50%; transform: translateY(-52%); color: var(--faint); font-size: 1.15rem; }

/* Segmented control (opcions en pastilla) */
.seg { display: inline-flex; background: #e9edf1; border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label, .seg a, .seg button {
  padding: .42rem .8rem; border-radius: 8px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: .85rem;
  border: 0; background: transparent; font-family: inherit; text-decoration: none !important;
}
.seg input:checked + span, .seg label.on, .seg a.on, .seg button.on { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.seg label { padding: 0; }
.seg label span { display: block; padding: .42rem .8rem; border-radius: 8px; }

/* ---------- Taules ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .7rem .75rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; background: #fafbfc; }
tbody tr:hover { background: #fafbfd; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.actions { display: flex; gap: .35rem; flex-wrap: wrap; justify-content: flex-end; }

/* ---------- Etiquetes d'estat ---------- */
.tag, .chip {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .18rem .55rem; border-radius: 999px; font-size: .74rem; font-weight: 600; white-space: nowrap;
  background: #eef1f4; color: var(--muted); border: 1px solid transparent;
}
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag.green, .tag.confirmed { background: var(--green-bg); color: var(--green); }
.tag.amber, .tag.pending, .tag.awaiting_payment { background: var(--amber-bg); color: var(--amber); }
.tag.red, .tag.cancelled { background: var(--red-bg); color: var(--red); }
.tag.blue { background: var(--blue-bg); color: var(--blue); }
.tag.violet { background: var(--violet-bg); color: var(--violet); }
.chips { display: flex; gap: .35rem; flex-wrap: wrap; }
.chip { cursor: pointer; border-color: var(--line-2); background: #fff; color: var(--text); font-size: .8rem; padding: .3rem .7rem; text-decoration: none !important; }
.chip.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip em { font-style: normal; opacity: .6; }

/* ---------- Pestanyes ---------- */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1.2rem; overflow-x: auto; }
.tabs a, .tabs button {
  padding: .7rem 1rem; font-weight: 600; color: var(--muted); border: 0; background: none; font: inherit; font-weight: 600;
  border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; text-decoration: none !important;
  display: inline-flex; align-items: center; gap: .4rem;
}
.tabs a:hover, .tabs button:hover { color: var(--text); }
.tabs a.active, .tabs button.active { color: var(--text); border-bottom-color: var(--text); }
.tabs .count { background: #ff6a3d; color: #fff; border-radius: 999px; font-size: .7rem; padding: 0 .4rem; }

/* ---------- Modal ---------- */
.modal-back {
  position: fixed; inset: 0; background: rgba(11, 22, 32, .45); backdrop-filter: blur(2px);
  display: grid; place-items: center; padding: 1rem; z-index: 100; opacity: 0; transition: opacity .18s;
}
.modal-back.in { opacity: 1; }
.modal {
  position: relative; background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg);
  width: min(100%, 460px); max-height: calc(100vh - 2rem); overflow: auto; padding: 1.4rem 1.5rem;
  transform: translateY(8px) scale(.98); transition: transform .18s;
}
.modal.wide { width: min(100%, 720px); }
.modal-back.in .modal { transform: none; }
.modal h3 { font-size: 1.15rem; margin-bottom: .3rem; padding-right: 2rem; }
.modal .sub { color: var(--muted); margin: 0 0 1rem; }
.modal-x { position: absolute; right: .8rem; top: .7rem; border: 0; background: #f1f3f5; width: 32px; height: 32px; border-radius: 50%; font-size: 1.3rem; cursor: pointer; color: var(--muted); }
.modal-actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: 1.2rem; flex-wrap: wrap; }
.modal form { display: grid; gap: .8rem; }
.modal .two { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: .4rem 1rem; margin: .8rem 0; font-size: .92rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; }
.pin-big { font-size: 2.2rem; font-weight: 800; letter-spacing: .3em; font-variant-numeric: tabular-nums; background: var(--navy); color: var(--brand); border-radius: 12px; padding: .5rem 1rem; text-align: center; }

/* ==========================================================================
   AVUI — quadrícula pistes × hores
   ========================================================================== */
.day-bar { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.day-bar h2 { font-size: 1.15rem; font-weight: 700; min-width: 220px; }
.day-bar h2::first-letter { text-transform: uppercase; }
.legend { display: flex; gap: .9rem; flex-wrap: wrap; font-size: .8rem; color: var(--muted); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-right: .3rem; vertical-align: -2px; }
.lg-paid { background: var(--green); } .lg-wait { background: #f59e0b; } .lg-club { background: #0ea5e9; }
.lg-rank { background: var(--violet); } .lg-open { background: var(--blue); } .lg-free { background: #fff; border: 1px dashed var(--line-2); }

.day-grid-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.day-grid { --rowh: 30px; display: grid; position: relative; min-width: 760px; }
.dg-head { position: sticky; top: 0; z-index: 3; background: #fafbfc; border-bottom: 1px solid var(--line); padding: .65rem .5rem; font-weight: 700; text-align: center; font-size: .88rem; }
.dg-head small { display: block; font-weight: 500; font-size: .72rem; }
.dg-time { border-right: 1px solid var(--line); font-size: .74rem; color: var(--faint); text-align: right; padding: 0 .5rem; transform: translateY(-.55em); font-variant-numeric: tabular-nums; }
.dg-cell { border-right: 1px solid var(--line); border-bottom: 1px solid #f0f2f5; cursor: pointer; position: relative; }
.dg-cell.hour { border-bottom-color: var(--line); }
.dg-cell:hover::after { content: "+ Reservar"; position: absolute; inset: 2px; border-radius: 6px; background: var(--green-bg); color: var(--green); font-size: .74rem; font-weight: 700; display: grid; place-items: center; z-index: 1; }
.dg-cell.closed { background: repeating-linear-gradient(-45deg, #f6f7f9, #f6f7f9 6px, #eef0f3 6px, #eef0f3 12px); cursor: not-allowed; }
.dg-cell.closed:hover::after { display: none; }
.dg-cell.rk { background: #faf7ff; }
.dg-cell.rk:hover::after { content: "+ Ranking"; background: var(--violet-bg); color: var(--violet); }
.dg-cell.past { background-color: #fbfbfc; }
.dg-now { position: absolute; left: 60px; right: 0; height: 2px; background: #ef4444; z-index: 4; pointer-events: none; }
.dg-now::before { content: ""; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: #ef4444; }
.bk {
  position: absolute; left: 4px; right: 4px; z-index: 2;
  border-radius: 8px; padding: .35rem .5rem; overflow: hidden; cursor: pointer;
  font-size: .78rem; line-height: 1.25; color: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.15);
  border-left: 4px solid rgba(0,0,0,.18); transition: transform .1s, box-shadow .1s;
}
.bk:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,.18); z-index: 5; }
.bk b { display: block; font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bk span { opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.bk.paid { background: var(--green); }
.bk.wait { background: #f59e0b; color: #3b2300; }
.bk.club { background: #0ea5e9; }
.bk.open { background: var(--blue); }
.bk.rank { background: var(--violet); }
.bk.rank.proposed { background: #fff; color: var(--violet); border: 2px dashed var(--violet); }
.bk.rank.played { background: #a78bfa; }
.bk .pin { position: absolute; right: .4rem; top: .3rem; font-weight: 800; font-size: .72rem; background: rgba(0,0,0,.2); padding: 0 .3rem; border-radius: 4px; }

.day-side { display: grid; gap: 1rem; }
.mini-list { display: grid; gap: .4rem; }
.mini-list .it { display: flex; gap: .6rem; align-items: center; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; background: #fff; }
.mini-list .it:hover { border-color: var(--line-2); background: #fafbfd; }
.mini-list .t { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 3rem; }

/* Opcions de pagament en targetes */
.pay-opts { display: grid; grid-template-columns: repeat(2, 1fr); gap: .45rem; }
.pay-opts label { display: flex; gap: .5rem; align-items: center; padding: .6rem .7rem; border: 1px solid var(--line-2); border-radius: 10px; cursor: pointer; color: var(--text); font-weight: 600; font-size: .85rem; }
.pay-opts label:has(input:checked) { border-color: var(--green); background: var(--green-bg); }
.price-pill { font-weight: 800; font-size: 1.1rem; }

/* ==========================================================================
   RANKING
   ========================================================================== */
.rk-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .7rem; margin-bottom: 1rem; }
.rk-step { display: flex; gap: .8rem; padding: .9rem 1rem; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line); text-decoration: none !important; color: var(--text); box-shadow: var(--shadow); position: relative; }
.rk-step:hover { border-color: var(--line-2); }
.rk-step .n { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: #eef1f4; color: var(--muted); flex: none; }
.rk-step.done .n { background: var(--green); color: #fff; }
.rk-step.now { border-color: var(--text); box-shadow: 0 0 0 2px var(--text) inset; }
.rk-step.now .n { background: var(--brand); color: var(--brand-ink); }
.rk-step h3 { font-size: .95rem; }
.rk-step p { margin: .15rem 0 0; color: var(--muted); font-size: .82rem; line-height: 1.35; }
.prog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .55rem; }
.prog-card { padding: .65rem .75rem; border: 1px solid var(--line); border-radius: 10px; background: #fff; display: grid; gap: .35rem; text-decoration: none !important; color: var(--text); }
.prog-card:hover { border-color: var(--line-2); }
.prog-card strong { font-size: .9rem; display: flex; justify-content: space-between; }
.prog-card strong em { font-style: normal; color: var(--muted); font-weight: 600; font-size: .8rem; }
.bar { height: 7px; border-radius: 99px; background: #edf0f3; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--green); border-radius: 99px; }
.bar.late > span { background: #f59e0b; }
.bar.done > span { background: var(--green); }
.big-bar { height: 12px; }

/* Tauler setmanal */
.board-layout { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 1rem; align-items: start; }
@media (max-width: 1200px) { .board-layout { grid-template-columns: 1fr; } }
.board-tools { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.board { display: grid; gap: .9rem; }
.bd-day { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.bd-day > header { display: flex; justify-content: space-between; align-items: center; padding: .6rem .9rem; background: #fafbfc; border-bottom: 1px solid var(--line); }
.bd-day > header h3 { font-size: .95rem; text-transform: capitalize; }
.bd-day > header small { font-weight: 600; }
.bd-grid { display: grid; overflow-x: auto; }
.bd-row { display: grid; grid-template-columns: 56px repeat(var(--courts), minmax(86px, 1fr)); border-bottom: 1px solid var(--line); }
.bd-row:last-child { border-bottom: 0; }
.bd-row.head { background: #fff; font-size: .72rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.bd-row.head > div { padding: .4rem .5rem; text-align: center; }
.bd-time { display: grid; place-items: center; font-weight: 800; font-size: .85rem; border-right: 1px solid var(--line); background: #fafbfc; font-variant-numeric: tabular-nums; }
.bd-cell { min-height: 74px; padding: 4px; border-right: 1px solid #f0f2f5; position: relative; transition: background .12s; }
.bd-cell:last-child { border-right: 0; }
.bd-cell.busy { background: repeating-linear-gradient(-45deg, #f7f8fa, #f7f8fa 6px, #eff1f4 6px, #eff1f4 12px); }
.bd-cell.busy > .busy-lbl { font-size: .7rem; color: var(--faint); padding: .3rem; display: block; }
.bd-cell.drop-ok { background: var(--green-bg); box-shadow: inset 0 0 0 2px var(--green-line); }
.bd-cell.drop-warn { background: var(--amber-bg); box-shadow: inset 0 0 0 2px var(--amber-line); }
.bd-cell.drop-no { background: #f5f6f8; }
.bd-cell.over { box-shadow: inset 0 0 0 3px var(--text) !important; }

.mc {
  background: #fff; border: 1px solid var(--violet-line); border-left: 4px solid var(--violet);
  border-radius: 8px; padding: .38rem .5rem; font-size: .76rem; line-height: 1.25; cursor: grab; user-select: none;
  box-shadow: 0 1px 2px rgba(0,0,0,.06); position: relative;
}
.mc:active { cursor: grabbing; }
.mc.dragging { opacity: .4; }
.mc .g { display: inline-block; font-weight: 800; font-size: .68rem; background: var(--violet-bg); color: var(--violet); border-radius: 4px; padding: 0 .3rem; margin-right: .25rem; }
.mc .p { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.mc .vs { color: var(--faint); font-size: .66rem; font-weight: 700; }
.mc.proposed { border-style: dashed; border-left-style: solid; background: #fcfaff; }
.mc.played { border-left-color: var(--green); border-color: var(--green-line); background: var(--green-bg); cursor: default; }
.mc.warn::after { content: "!"; position: absolute; right: 4px; top: 4px; width: 16px; height: 16px; border-radius: 50%; background: #f59e0b; color: #fff; font-weight: 800; font-size: .7rem; display: grid; place-items: center; }
.mc .x { position: absolute; right: 2px; bottom: 2px; border: 0; background: transparent; color: var(--faint); cursor: pointer; font-size: .95rem; line-height: 1; padding: 2px 4px; border-radius: 4px; }
.mc .x:hover { background: var(--red-bg); color: var(--red); }
.mc .st { font-size: .64rem; font-weight: 700; color: var(--violet); text-transform: uppercase; letter-spacing: .04em; }
.mc.played .st { color: var(--green); }

.pool { position: sticky; top: 1rem; max-height: calc(100vh - 2rem); display: flex; flex-direction: column; }
.pool .panel { display: flex; flex-direction: column; min-height: 0; margin: 0; }
.pool-list { overflow-y: auto; display: grid; gap: .4rem; padding: .2rem .1rem .5rem; align-content: start; min-height: 120px; border-radius: 10px; transition: background .12s; }
.pool-list.over { background: var(--amber-bg); }
.pool-list .mc { cursor: grab; }
.pool-list .mc .av { font-size: .68rem; color: var(--muted); }
.pool-list .mc .av.zero { color: var(--red); }

/* Matriu de disponibilitat */
.am-wrap { overflow-x: auto; }
.am { border-collapse: separate; border-spacing: 0; font-size: .82rem; }
.am th, .am td { padding: 0; border-bottom: 1px solid var(--line); text-align: center; background: #fff; }
.am thead th { position: sticky; top: 0; z-index: 2; padding: .35rem .2rem; font-size: .68rem; }
.am thead tr:first-child th { border-bottom: 0; }
.am .day-sep { border-left: 2px solid var(--line-2); }
.am td.name, .am th.name { text-align: left; padding: .45rem .7rem; position: sticky; left: 0; z-index: 1; min-width: 230px; max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.am th.name { z-index: 3; }
.am td.name b { font-weight: 600; }
.am tr.grp td { background: #f6f8fa; font-weight: 800; text-align: left; padding: .45rem .7rem; font-size: .78rem; letter-spacing: .04em; color: var(--muted); }
.am .cb { width: 34px; height: 32px; display: grid; place-items: center; cursor: pointer; }
.am .cb span { width: 22px; height: 22px; border-radius: 6px; border: 1.5px solid var(--line-2); display: block; transition: all .1s; }
.am .cb:hover span { border-color: var(--green); }
.am .cb.on span { background: var(--green); border-color: var(--green); box-shadow: inset 0 0 0 3px #fff; }
.am td.st { padding: 0 .6rem; white-space: nowrap; }
.am tr.no-reply td.name { box-shadow: inset 3px 0 0 #f59e0b; }

/* Resultats ràpids */
.res-list { display: grid; gap: .5rem; }
.res {
  display: grid; grid-template-columns: 52px 1fr 150px 260px; gap: .8rem; align-items: center;
  padding: .7rem .9rem; border: 1px solid var(--line); border-radius: 12px; background: #fff;
}
.res.saved { border-color: var(--green-line); background: linear-gradient(90deg, var(--green-bg), #fff 40%); }
.res .g { width: 40px; height: 40px; border-radius: 10px; background: var(--violet-bg); color: var(--violet); display: grid; place-items: center; font-weight: 800; }
.res .teams { display: grid; gap: .1rem; min-width: 0; }
.res .teams div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.res .teams div.win { color: var(--green); }
.res .teams div.win::after { content: " ✓"; }
.res .when { font-size: .8rem; color: var(--muted); }
.res .score { display: flex; gap: .4rem; align-items: center; }
.res .score input[type=text] { width: 130px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.res .score select { width: 92px; font-size: .8rem; padding: .5rem .4rem; }
.res .pts { font-size: .74rem; color: var(--muted); grid-column: 2 / -1; margin-top: -.3rem; }
@media (max-width: 900px) { .res { grid-template-columns: 44px 1fr; } .res .when, .res .score { grid-column: 2; } }

/* Parelles */
.pair-table td { padding: .45rem .75rem; }
.pair-table input.phone { width: 170px; padding: .4rem .6rem; }
.pair-table input.phone.saved { border-color: var(--green); background: var(--green-bg); }

/* Classificació */
.st-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 1rem; }
.st-grid .panel { margin: 0; }
.mv-up { color: var(--green); font-weight: 800; }
.mv-down { color: var(--red); font-weight: 800; }

/* ==========================================================================
   LOGIN
   ========================================================================== */
body.login-page {
  min-height: 100vh; display: grid; place-items: center; padding: 1rem;
  background: radial-gradient(1000px 600px at 15% 10%, rgba(198,240,0,.18), transparent 60%), var(--navy);
  font-family: var(--font);
}
.login-card { width: min(100%, 390px); background: #fff; border-radius: 18px; padding: 2rem; display: grid; gap: .9rem; box-shadow: var(--shadow-lg); }
.login-logo { width: 76px; margin: 0 auto; }
.login-card h1 { text-align: center; font-size: 1.35rem; }
.login-card p { text-align: center; color: var(--muted); margin: 0; }
.login-card label { display: grid; gap: .3rem; }
.login-card button { padding: .8rem; border-radius: 10px; border: 0; background: var(--brand); color: var(--brand-ink); font: inherit; font-weight: 700; cursor: pointer; }

/* Ajustos ranking */
.add-pair { grid-template-columns: 90px 1fr 1fr 1fr auto; }
@media (max-width: 900px) { .add-pair { grid-template-columns: 1fr 1fr; } }
.grp-cell { background: #f6f8fa; font-weight: 800; color: var(--muted); font-size: .76rem; letter-spacing: .05em; padding: .5rem .75rem !important; }
kbd { background: #eef1f4; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; padding: 0 .35rem; font-size: .8em; font-family: inherit; }
.form-actions { display: flex; gap: .5rem; align-items: end; }
@media (max-width: 900px) {
  .res .score { flex-wrap: wrap; }
  .res .score input[type=text] { flex: 1; width: auto; min-width: 110px; }
  .page-head h1 { font-size: 1.4rem; }
}

.pub-bar { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; padding: .6rem .9rem; margin: -.3rem 0 1rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); }

/* ---------- Disponibilitat: cap de setmana, notes i marca de la setmana ---------- */
.am th.we { background: #f5f3ff; color: #5b21b6; }
.am td.name small.pl { display: block; font-size: .68rem; color: var(--muted); font-weight: 500; }
.am tr.is-skip td { background: #fafafa; }
.am tr.is-skip .cb { opacity: .35; }
.am th.flag-h { font-size: .68rem; padding: .35rem .6rem; }
.am td.notes-c { padding: 0 .5rem; text-align: left; min-width: 150px; max-width: 220px; }
.am .note-btn, .am .note-add { font: inherit; font-size: .74rem; border: 1px solid var(--line); background: #fffbeb; color: #78350f; border-radius: 8px; padding: .3rem .5rem; cursor: pointer; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 210px; }
.am .note-add { background: #fff; color: var(--muted); border-style: dashed; }
.am td.flag-c { padding: 0 .5rem; }
.flag-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.flag-seg button { font: inherit; font-size: .72rem; font-weight: 600; padding: .32rem .55rem; border: 0; background: #fff; color: var(--muted); cursor: pointer; white-space: nowrap; }
.flag-seg button + button { border-left: 1px solid var(--line); }
.flag-seg button.on { background: var(--green-bg, #e8f8ef); color: var(--green, #15803d); }
.flag-seg button.on.skip { background: var(--red-bg, #fdecea); color: var(--red, #b91c1c); }
.flag-seg button.on.double { background: var(--blue-bg, #e8f1fd); color: var(--blue, #1d4ed8); }
.pool-list .mc .av.dbl { color: var(--blue, #1d4ed8); font-weight: 700; }
.bd-day.we header h3 { color: #5b21b6; }
.bd-time b { display: block; font-size: .66rem; text-transform: uppercase; letter-spacing: .04em; color: #5b21b6; }

/* ---------- Classes i reserves fixes ---------- */
.lg-cls { background: #db2777; }
.bk.cls { background: var(--tc, #db2777); }
.bk em.fx { font-style: normal; font-size: .62rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; background: rgba(255,255,255,.25); padding: 0 .25rem; border-radius: 4px; }
.nb-type { display: flex; flex-wrap: wrap; gap: .35rem; margin: -.2rem 0 1rem; }
.nb-type button { font: inherit; font-size: .84rem; font-weight: 600; border: 1px solid var(--line); background: #fff; color: var(--text); border-radius: 999px; padding: .4rem .8rem; cursor: pointer; }
.nb-type button.on { background: var(--green-bg); border-color: var(--green-line); color: var(--green); }
.nb-type button:not(.on):hover { border-color: var(--line-2); background: #f8fafc; }
.sf-days { display: flex; flex-wrap: wrap; gap: .35rem; }
.sf-days label { cursor: pointer; }
.sf-days input { position: absolute; opacity: 0; pointer-events: none; }
.sf-days span { display: inline-block; border: 1px solid var(--line); border-radius: 999px; padding: .38rem .75rem; font-size: .84rem; font-weight: 600; background: #fff; }
.sf-days input:checked + span { background: var(--green); border-color: var(--green); color: #fff; }
.sf-days input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }
.sf-sum { background: var(--green-bg); border: 1px solid var(--green-line); color: var(--green); border-radius: 10px; padding: .6rem .75rem; font-size: .88rem; margin-bottom: .5rem; }
.t-dot { display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; vertical-align: middle; margin-right: .35rem; background: #db2777; }
tr.is-off td { opacity: .55; }

/* ---------- Ascensos i descensos ---------- */
.warn-box { background: var(--amber-bg, #fff7e6); color: #8a5300; border: 1px solid #f3d28b; border-radius: 10px; padding: .65rem .85rem; margin: .4rem 0 .8rem; font-size: .9rem; }
.ok-box { background: var(--green-bg); color: #126b35; border: 1px solid var(--green-line); border-radius: 10px; padding: .65rem .85rem; margin: .4rem 0 .8rem; font-size: .9rem; }
.promo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.2rem; margin-top: .6rem; }
.promo-h { font-size: .95rem; margin: 0 0 .4rem; }
.promo-h.up, .promo-t .up { color: var(--green, #15803d); }
.promo-h.down, .promo-t .down { color: var(--red, #b91c1c); }
.promo-t { width: 100%; border-collapse: collapse; font-size: .85rem; }
.promo-t th { text-align: left; font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: .3rem .4rem; }
.promo-t td { padding: .38rem .4rem; border-top: 1px solid var(--line); }
.promo-t tr.is-done td { background: #f6fcf8; }
/* Parelles: fletxes per pujar/baixar de grup */
.mv-btns { display: inline-flex; gap: .25rem; }
.mv-btns button { font: inherit; font-size: .78rem; font-weight: 700; width: 2rem; height: 2rem; border-radius: 8px; border: 1px solid var(--line); background: #fff; cursor: pointer; line-height: 1; }
.mv-btns button[data-mv=up] { color: var(--green, #15803d); }
.mv-btns button[data-mv=down] { color: var(--red, #b91c1c); }
.mv-btns button:hover:not(:disabled) { background: #f6f8fa; border-color: var(--line-2); }
.mv-btns button:disabled { opacity: .3; cursor: default; }
tr.just-moved td { background: #fffbe6; transition: background 1.5s; }

/* ---------- Setmanes del mes ---------- */
.sw-row { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; justify-content: space-between; }
.sw-row > div { flex: 1 1 360px; }
.sw-row h2 { margin: 0 0 .2rem; }
.sw-form { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; margin: 0; }
.sw-form label { display: grid; gap: .2rem; font-size: .78rem; color: var(--muted); font-weight: 600; }

/* Crèdits del desenvolupador */
.sb-dev { margin: .8rem .4rem 0; padding-top: .7rem; border-top: 1px solid rgba(255,255,255,.08); font-size: .7rem; line-height: 1.5; color: rgba(255,255,255,.45); }
.sb-dev a { color: rgba(255,255,255,.6); text-decoration: none; }
.sb-dev a:hover { color: #c6f000; }
body.login-page { align-content: center; gap: 1rem; }
.login-dev { margin: 0; font-size: .75rem; color: rgba(255,255,255,.55); text-align: center; }
.login-dev a { color: rgba(255,255,255,.75); text-decoration: none; }
.login-dev a:hover { color: #c6f000; }
.sb-foot .sb-dev a { display: inline; padding: 0; border-radius: 0; background: none; font-weight: 500; font-size: inherit; }
.sb-foot .sb-dev a:hover { background: none; }

/* Interruptor «Properament» */
.cs-panel { border: 2px solid var(--green-line); }
.cs-panel.is-on { border-color: #e7c35a; background: #fffbea; }
.cs-row { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; }
.cs-row > div { flex: 1 1 380px; }
.cs-row h2 { margin: 0 0 .3rem; }
