:root{
  --bg:#f6f7fb; --fg:#1f2937; --card:#fff; --muted:#6b7280;
  --p0:#10b981; --p1:#f59e0b; --active:#3b82f6; --border:#e5e7eb;
  --volleyball:#d946ef; --badminton:#06b6d4; --pickleball:#22c55e;
  --basketball:#f97316; --tt:#8b5cf6; --kids:#14b8a6; --timecolor:#c90c35;
}
*{box-sizing:border-box}
body{margin:0;font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;background:var(--bg);color:var(--fg)}
.topbar{position:sticky;top:0;z-index:5;display:grid;grid-template-columns:auto 1fr auto;align-items:center;padding:10px 14px;background:#fff;border-bottom:1px solid var(--border);gap:12px}
.brand{display:flex;align-items:center;gap:8px}
.title-icon{width:48px;height:48px;border-radius:12px;object-fit:cover;box-shadow:0 6px 12px rgba(0,0,0,.15)}
.container{padding:12px}
.legend{display:flex;gap:12px;flex-wrap:wrap;margin:8px 0 12px;color:var(--muted);font-size:14px}
.filters{background:var(--card);border:1px solid var(--border);border-radius:12px;padding:12px;margin-bottom:12px;display:flex;flex-wrap:wrap;gap:12px;align-items:center}
.filter-group{display:flex;flex-direction:column;gap:4px}
.filter-group label{font-size:.75rem;font-weight:600;color:var(--muted);text-transform:uppercase}
.filter-group select{padding:6px 10px;border:1px solid var(--border);border-radius:8px;background:#fff;font-size:14px;cursor:pointer}
.filter-clear{padding:6px 12px;border:1px solid var(--border);border-radius:8px;background:#fff;cursor:pointer;font-weight:600;color:var(--muted);align-self:flex-end}
.pill{display:inline-flex;align-items:center;gap:6px;padding:2px 8px;border-radius:999px;color:#fff;font-weight:600}
.p0{background:var(--p0)} .p1{background:var(--p1)}
.active{background:var(--active)}

.tabs{display:flex;gap:10px;overflow-x:auto;padding:8px 0}
.tab{border:1px solid var(--border);border-radius:999px;padding:6px 14px;background:#fff;font-weight:600;color:var(--muted);cursor:pointer;white-space:nowrap}
.tab.active{background:var(--active);color:#fff;border-color:var(--active)}

.tab-content{display:flex;flex-direction:column;gap:16px}
.day-section{background:var(--card);border:1px solid var(--border);border-radius:16px;padding:14px}
.day-section.today{border-color:var(--active);box-shadow:0 0 0 2px rgba(59,130,246,.2)}
.day-header{font-weight:600;font-size:1rem;margin-bottom:12px;color:#1e293b;display:flex;justify-content:space-between;align-items:center}
.day-header .date{text-transform:uppercase;font-size:.85rem;color:var(--muted)}

.slot-track{display:flex;gap:12px;overflow-x:auto;padding-bottom:4px}
.slot-card{min-width:240px;background:#f8fafc;border:1px solid var(--border);border-radius:14px;padding:12px;display:flex;flex-direction:column;gap:8px}
.slot-card.active{border-color:var(--active)}
.slot-time{font-weight:700;color:var(--timecolor);display:flex;justify-content:space-between;align-items:center}
.priority-pill{border-radius:999px;padding:2px 10px;font-size:.75rem;font-weight:600;color:#fff}
.priority-pill.p0{background:var(--p0)}
.priority-pill.p1{background:var(--p1)}

.sport-tag{font-weight:700;text-transform:uppercase;font-size:.75rem;color:var(--muted)}
.players{display:flex;gap:6px;flex-wrap:wrap}
.player-wrapper{display:inline-flex;align-items:center;gap:2px;position:relative}
.player{background:#e0f2fe;color:#0369a1;border-radius:999px;padding:2px 6px;font-size:12px}
.player.waiting-list{background:#fed7aa;color:#9a3412;font-weight:600}
.remove-guest{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;border-radius:50%;background:#ef4444;color:#fff;font-size:14px;font-weight:700;cursor:pointer;line-height:1;margin-left:-2px}
.remove-guest:hover{background:#dc2626}
.btnbar{display:flex;gap:8px;justify-content:flex-start}
.btn{padding:8px 12px;border-radius:8px;border:1px solid var(--border);background:#fff;cursor:pointer;font-weight:600;font-size:1.2rem;min-width:40px}
.btn.primary{background:var(--active);color:#fff;border-color:var(--active)}
.btn:disabled{opacity:.55;cursor:not-allowed}
.empty{color:var(--muted);font-style:italic}
.metrics{font-size:.85rem;color:var(--muted);display:flex;gap:8px;flex-wrap:wrap}
.waiting-count{color:#ea580c;font-weight:600}
.footer{position:sticky;bottom:0;background:#fff;border-top:1px solid var(--border);display:flex;justify-content:space-around;padding:8px;color:var(--muted)}

/* User Menu Dropdown */
.user-menu{position:relative;display:inline-block}
.user-menu-btn{display:flex;align-items:center;gap:8px;padding:8px 12px;border-radius:8px;border:1px solid var(--border);background:#fff;cursor:pointer;font-weight:600;font-size:14px}
.user-menu-btn:hover{background:#f9fafb;border-color:var(--active)}
.dropdown-arrow{font-size:10px;transition:transform 0.2s}
.user-menu-btn:hover .dropdown-arrow{transform:rotate(180deg)}

.user-dropdown{display:none;position:absolute;right:0;top:calc(100% + 4px);background:#fff;border:1px solid var(--border);border-radius:12px;box-shadow:0 4px 12px rgba(0,0,0,.1);min-width:220px;z-index:1000;overflow:hidden}
.user-dropdown.show{display:block}

.dropdown-item{display:flex;align-items:center;gap:10px;width:100%;padding:12px 16px;border:none;background:transparent;cursor:pointer;font-size:14px;font-weight:500;text-align:left;color:var(--fg);transition:background 0.2s}
.dropdown-item:hover{background:#f3f4f6}
.dropdown-item span:first-child{font-size:16px;width:20px}

.dropdown-divider{height:1px;background:var(--border);margin:4px 0}

.admin-item{color:#0369a1}
.admin-item:hover{background:#f0f9ff}

.logout-item{color:#dc2626}
.logout-item:hover{background:#fef2f2}

.title-bar{text-align:center;margin:0;font-size:clamp(1.2rem,4vw,1.8rem);letter-spacing:.08em;text-transform:uppercase;background:linear-gradient(120deg,#ff8a00,#ff3d7f,#7b2ff7);-webkit-background-clip:text;color:transparent;text-shadow:0 2px 12px rgba(255,61,127,.3)}

.guest-btn{background:#22c55e;color:#fff;border-color:#22c55e}
.guest-btn-top{background:#22c55e;color:#fff;border:1px solid #22c55e;border-radius:8px;padding:4px 8px;font-size:1rem;font-weight:600;cursor:pointer}
.share-btn-top{background:#25d366;color:#fff;border:1px solid #25d366;border-radius:8px;padding:4px 8px;font-size:1rem;font-weight:600;cursor:pointer}
.share-btn-top:hover{background:#20ba5a;border-color:#20ba5a}
.share-icon {
  width: 20px;
  height: 20px;
  vertical-align: middle;
  object-fit: contain;
  pointer-events: none; /* click goes to the button, not the image */
}
.modal{display:none;position:fixed;z-index:1000;left:0;top:0;width:100%;height:100%;background:rgba(0,0,0,.5);align-items:center;justify-content:center}
.modal-content{background:#fff;padding:24px;border-radius:16px;max-width:400px;width:90%;box-shadow:0 10px 25px rgba(0,0,0,.2)}
.modal-close{float:right;font-size:28px;font-weight:700;color:#6b7280;cursor:pointer}
.modal-close:hover{color:#1f2937}
.modal h2{margin:0 0 20px 0;color:#1f2937}
.form-group{margin-bottom:16px}
.form-group label{display:block;margin-bottom:4px;font-weight:600;color:#1f2937;font-size:14px}
.form-group input{width:100%;padding:8px 12px;border:1px solid var(--border);border-radius:8px;font-size:14px}
.form-group input[readonly]{background:#f3f4f6;color:var(--muted);cursor:not-allowed}
.form-actions{display:flex;gap:8px;margin-top:20px;justify-content:flex-end}

/* Sport Preferences Checkboxes */
.sport-checkboxes{display:flex;flex-direction:column;gap:10px;max-height:400px;overflow-y:auto;padding:4px}
.sport-checkbox-item{padding:8px 12px;border:1px solid var(--border);border-radius:8px;transition:background 0.2s}
.sport-checkbox-item:hover{background:#f9fafb}
.sport-checkbox-item label{display:flex;align-items:center;gap:10px;cursor:pointer;margin:0}
.sport-checkbox-item input[type="checkbox"]{width:18px;height:18px;cursor:pointer}
.sport-checkbox-item span{font-size:14px;font-weight:500}
