:root{
  --court:#0b1f4d; --court-dark:#071536; --clay:#f5d322; --ball:#f5d322; --line:#fff;
  --bg:#f3f5f9; --card:#fff; --ink:#10182b; --muted:#5a6578; --border:#d7dce6;
  --danger:#c0392b; --radius:20px;
  --sat: env(safe-area-inset-top); --sab: env(safe-area-inset-bottom);
  --sal: env(safe-area-inset-left); --sar: env(safe-area-inset-right);
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html{-webkit-text-size-adjust:100%}
body{margin:0;background:var(--bg);color:var(--ink);font:17px/1.35 -apple-system,BlinkMacSystemFont,"SF Pro Text","Segoe UI",Roboto,sans-serif;
  padding-bottom:calc(72px + var(--sab));min-height:100vh}
button,input{font:inherit;color:inherit}
button{cursor:pointer;touch-action:manipulation}

.top{background-color:var(--court);
  background-image:
    linear-gradient(180deg, rgba(7,21,54,.66) 0%, rgba(7,21,54,.32) 48%, rgba(7,21,54,.58) 100%),
    url(/brand/hero.jpg);
  background-size:cover;background-position:center 48%;background-repeat:no-repeat;
  color:#fff;
  padding:calc(16px + var(--sat)) calc(16px + var(--sar)) 20px calc(16px + var(--sal));
  position:relative;overflow:hidden;min-height:calc(168px + var(--sat));
  display:flex;align-items:flex-start}
.top::after{content:"";position:absolute;left:0;right:0;bottom:0;height:3px;background:var(--ball)}
.top-inner{max-width:1100px;margin:0 auto;width:100%;display:flex;align-items:flex-start;justify-content:space-between;gap:12px;position:relative;z-index:1}
.brand{display:flex;flex-direction:column;align-items:flex-start;gap:7px;min-width:0;flex:1}
h1{margin:0;line-height:0}
.wordmark{display:block;height:34px;width:auto;max-width:100%;object-fit:contain;object-position:left center;filter:drop-shadow(0 1px 8px rgba(0,0,0,.45))}
.sub{margin:0;font-size:13.5px;opacity:.95;text-shadow:0 1px 4px rgba(0,0,0,.45)}
.sub .t{white-space:nowrap}
.tz{display:inline-block;margin-left:4px;padding:1px 7px;border-radius:99px;background:rgba(255,255,255,.18);font-size:12px}
.admin-btn{flex:none;display:inline-flex;align-items:center;gap:7px;min-height:48px;padding:0 16px;border-radius:99px;border:2px solid rgba(255,255,255,.7);background:rgba(7,21,54,.48);color:#fff;font-weight:600;backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px)}
.admin-btn:active{background:rgba(7,21,54,.7)}
@media (max-width:519px){
  .admin-btn{padding:0;width:48px;justify-content:center}
  #adminBtnLabel{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0)}
}
.admin-banner{background:var(--ball);color:var(--court);display:flex;gap:12px;align-items:center;justify-content:center;flex-wrap:wrap;padding:10px 16px;font-size:15px;text-align:center}
.admin-banner[hidden]{display:none}
.admin-banner button{min-height:40px;padding:0 18px;border-radius:99px;border:0;background:var(--court);color:#fff;font-weight:700}

main{max-width:1100px;margin:0 auto;padding:18px calc(14px + var(--sar)) 0 calc(14px + var(--sal))}
.loading,.empty{padding:40px 0;text-align:center;color:var(--muted)}
.week{margin-bottom:26px}
.week-head{display:flex;align-items:baseline;gap:10px;margin:6px 4px 10px;flex-wrap:wrap}
.week-head h2{margin:0;font-size:20px;letter-spacing:-.2px}
.week-head .range{color:var(--muted);font-size:15px}
.grid{display:grid;gap:14px;grid-template-columns:minmax(0,1fr)}

.card{background:var(--card);border:1px solid var(--border);border-radius:var(--radius);box-shadow:0 2px 8px rgba(11,31,77,.06);overflow:hidden}
.card.full{border-color:#e6c7bb}
.card-head{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:14px 16px 10px}
.day{font-size:20px;font-weight:700;line-height:1.1}
.when{color:var(--muted);font-size:15px;margin-top:3px}
.when b{color:var(--court);font-weight:700}
.badge{flex:none;padding:7px 13px;border-radius:99px;font-weight:700;font-size:14.5px;background:#e6ebf5;color:var(--court);white-space:nowrap}
.badge.few{background:#fff4c2;color:#6b5600}
.badge.full{background:#f9dccf;color:#9c3a14}
.spots{list-style:none;margin:0;padding:4px 10px 10px;display:grid;grid-template-columns:minmax(0,1fr);gap:8px}
.spot{display:flex;align-items:center;gap:10px;min-height:56px;padding:6px 8px 6px 10px;border-radius:14px;background:#f4f6fb;border:1px solid var(--border)}
.avatar{flex:none;width:38px;height:38px;border-radius:50%;display:grid;place-items:center;font-weight:700;color:#fff;background:var(--court)}
.avatar.albert{background:var(--ball);color:var(--court)}
.avatar.me{background:#2c5aa0}
.who{flex:1;min-width:0}
.who .n{font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.who .d{font-size:13px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tag{font-size:12px;font-weight:700;border-radius:99px;padding:2px 8px;margin-left:6px;background:#dfe9fb;color:#1d4a96;vertical-align:1px}
.tag.coach{background:var(--ball);color:var(--court)}
.mini{flex:none;min-height:44px;min-width:44px;padding:0 12px;white-space:nowrap;border-radius:12px;border:1.5px solid var(--border);background:#fff;font-weight:600;font-size:15px}
.mini.danger{color:var(--danger);border-color:#efc4be}
.mini:active{background:#eef1f7}
.open-spot{width:100%;min-height:56px;display:flex;align-items:center;gap:12px;padding:6px 14px 6px 10px;border-radius:14px;border:2px dashed #9aa6c4;background:#f7f8fc;color:var(--court);font-weight:600;text-align:left}
.open-spot .plus{flex:none;width:38px;height:38px;border-radius:50%;display:grid;place-items:center;background:var(--ball);color:var(--court);font-size:26px;line-height:1;font-weight:500}
.open-spot .ol{display:flex;flex-direction:column;line-height:1.15}
.open-spot small{font-weight:500;color:var(--muted);font-size:13px;margin-top:1px}
.open-spot:active{background:#eef1f8}
.card-foot{padding:0 10px 12px}
.foot-btn{width:100%;min-height:48px;border-radius:14px;border:1.5px solid var(--court);background:#eef2fa;color:var(--court);font-weight:700}
.more{display:block;width:100%;max-width:420px;margin:8px auto 0;min-height:56px;border-radius:99px;border:0;background:var(--court);color:#fff;font-weight:700;font-size:17px}
.more:disabled{opacity:.6}
.foot-note{text-align:center;color:var(--muted);font-size:14px;margin-top:14px}

/* sheet */
.backdrop{position:fixed;inset:0;background:rgba(8,16,36,.55);z-index:20}
.backdrop[hidden],.sheet[hidden]{display:none}
.sheet{position:fixed;z-index:21;left:0;right:0;bottom:0;background:#fff;border-radius:26px 26px 0 0;
  padding:10px calc(20px + var(--sar)) calc(22px + var(--sab)) calc(20px + var(--sal));max-width:560px;margin:0 auto;max-height:92vh;overflow:auto;box-shadow:0 -10px 40px rgba(0,0,0,.25)}
.sheet-grab{width:44px;height:5px;border-radius:9px;background:#cfd5e0;margin:2px auto 12px}
.sheet h2{margin:0;font-size:22px}
.sheet-sub{margin:4px 0 14px;color:var(--muted)}
label{display:block;font-weight:600;font-size:15px;margin:12px 0 5px}
label .opt{font-weight:400;color:var(--muted)}
input[type=text],input[type=tel],input[type=email],input[type=password],input[type=number],input[inputmode]{width:100%;min-height:52px;padding:0 14px;border:2px solid var(--border);border-radius:14px;background:#fff;font-size:17px;-webkit-appearance:none;appearance:none}
input:focus{outline:none;border-color:var(--court);box-shadow:0 0 0 3px rgba(11,31,77,.2)}
.row{display:flex;gap:10px;margin-top:18px}
.btn{flex:1;min-height:54px;border-radius:16px;border:0;font-weight:700;font-size:17px}
.btn.primary{background:var(--court);color:#fff}
.btn.ghost{background:#eef1f7;color:var(--ink)}
.btn.danger{background:var(--danger);color:#fff}
.btn:disabled{opacity:.6}
.err{color:var(--danger);font-weight:600;margin:10px 0 0;min-height:1.2em}
.hint{color:var(--muted);font-size:13.5px;margin:6px 0 0}
.pin{text-align:center;letter-spacing:10px;font-size:26px!important}
.toast{position:fixed;z-index:30;left:50%;bottom:calc(68px + var(--sab));transform:translateX(-50%);background:var(--court);color:#fff;padding:13px 20px;border-radius:99px;font-weight:600;max-width:90vw;text-align:center;box-shadow:0 8px 24px rgba(0,0,0,.3)}
.toast[hidden]{display:none}

@media (min-width:640px){
  .wordmark{height:44px}
  .sub{font-size:15px}
  .week-head h2{font-size:22px}
  .top{min-height:calc(196px + var(--sat))}
}
@media (min-width:760px){ /* iPad portrait & up: one row per week, three clinics side by side */
  body{font-size:18px}
  main{padding-top:24px}
  .top{min-height:calc(228px + var(--sat))}
  .wordmark{height:52px}
  .grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:16px;align-items:start}
  .sheet{bottom:auto;top:50%;left:50%;right:auto;transform:translate(-50%,-50%);width:520px;border-radius:26px;max-height:88vh}
  .sheet-grab{display:none}
  .admin-btn{min-height:52px}
}
@media (min-width:1000px){ main{padding-left:20px;padding-right:20px} }
@media (prefers-reduced-motion:no-preference){
  .sheet:not([hidden]){animation:up .22s ease-out}
  @keyframes up{from{transform:translateY(30px);opacity:0}}
}
@media (prefers-reduced-motion:no-preference) and (min-width:760px){
  .sheet:not([hidden]){animation:pop .18s ease-out}
  @keyframes pop{from{opacity:0;transform:translate(-50%,-47%)}}
}

.mini .x{display:none}
@media (min-width:760px) and (max-width:1019px){ /* narrow 3-up cards on iPad portrait: compact organizer buttons */
  .mini .lbl{display:none}.mini .x{display:inline;font-size:18px}
  .mini{min-width:48px;padding:0}
  .tag.coach{display:none}
}

.admin-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap;justify-content:center}
.admin-actions button{min-height:40px;padding:0 18px;border-radius:99px;border:0;background:#fff;color:var(--court);font-weight:700}
.count-badge{display:inline-block;min-width:1.4em;padding:0 6px;margin-left:4px;border-radius:99px;background:var(--court);color:#fff;font-size:12px;line-height:1.5;vertical-align:1px}
.count-badge[hidden]{display:none}
.notice{max-width:1100px;margin:0 auto;padding:12px calc(14px + var(--sar)) 0 calc(14px + var(--sal))}
.notice[hidden]{display:none}
.notice-card{background:#fff8d4;border:1px solid #e6d27a;color:var(--court);border-radius:16px;padding:12px 16px;display:flex;gap:12px;align-items:center;justify-content:space-between;flex-wrap:wrap}
.notice-card.ok{background:#e8eef8;border-color:#c5d0e6}
.notice-card.bad{background:#fdecea;border-color:#efc4be;color:#7a1f16}
.notice-card p{margin:0;flex:1;min-width:200px}
.notice-card strong{display:block;margin-bottom:2px}
.notice-card .btn, .notice-card button{flex:none;min-height:44px;padding:0 16px;border-radius:12px;border:0;background:var(--court);color:#fff;font-weight:700}
.notice-card .btn.ghost, .notice-card button.ghost{background:#fff;color:var(--court);border:1.5px solid var(--border)}
.open-spot.visual{cursor:default;opacity:.85}
.player-sec{margin-top:16px}
.player-sec h3{margin:0 0 8px;font-size:16px}
.player-row{display:flex;align-items:center;gap:10px;padding:10px 0;border-bottom:1px solid var(--border)}
.player-row .who{flex:1;min-width:0}
.player-row .n{font-weight:600}
.player-row .d{font-size:13px;color:var(--muted)}
.player-actions{display:flex;gap:8px;flex:none}
.player-actions .mini{min-width:auto}
.sheet.players{max-width:640px}

.pin-hint{margin:6px 0 12px;color:var(--muted);font-size:14px;line-height:1.4}
.field-label{margin:12px 0 6px;font-weight:700}
.pin-len{display:flex;gap:8px;margin:0 0 14px}
.pin-len label{flex:1;display:flex;align-items:center;justify-content:center;gap:8px;min-height:44px;padding:0 10px;border:2px solid #d5dae3;border-radius:12px;font-weight:700;cursor:pointer}
.pin-len input{accent-color:var(--court)}
.pin{letter-spacing:.35em}

.unrated-badge,.level-badge{display:inline-block;margin-left:6px;padding:1px 7px;border-radius:99px;font-size:11px;font-weight:700;letter-spacing:.02em;vertical-align:middle}
.unrated-badge{background:#efe8d8;color:#6a5420}
.level-badge{background:#e8eefc;color:var(--court)}
.level-ctl{display:flex;align-items:center;gap:6px;flex:none}
.level-in{width:4.6rem;min-height:40px;padding:0 6px;border:1.5px solid var(--border);border-radius:10px;font:inherit;font-weight:700;text-align:center}
.play-stat{font-size:13px;color:var(--muted);margin-top:2px}
.player-row{flex-wrap:wrap}
.player-sort{display:flex;align-items:center;gap:8px;margin:0 0 10px}
.player-sort select{min-height:40px;border-radius:10px;border:1.5px solid var(--border);padding:0 10px;font:inherit}
.name-matches{list-style:none;margin:0 0 12px;padding:0;border:1.5px solid var(--border);border-radius:12px;overflow:hidden;max-height:200px;overflow-y:auto}
.name-matches[hidden]{display:none}
.name-matches li{margin:0;padding:0}
.name-matches button{width:100%;text-align:left;border:0;border-bottom:1px solid var(--border);background:#fff;padding:10px 12px;min-height:44px;font:inherit}
.name-matches button:last-child{border-bottom:0}
.name-matches .mn{font-weight:700}
.name-matches .md{display:block;font-size:13px;color:var(--muted)}
.albert-row{background:#f6f8fd;border-radius:12px;padding:10px 12px;margin-bottom:8px}

.where{font-size:13px;color:var(--muted);margin-top:2px}
.coach-label{font-size:13px;color:var(--ink);margin-top:2px;font-weight:700}
.badge.cancelled{background:#8a2b2b;color:#fff}
.card.cancelled{opacity:.92}
.cancel-note{margin:0 12px 10px;padding:8px 12px;border-radius:10px;background:#f8eaea;color:#6a1f1f;font-size:14px}
.waitlist{margin:0 12px 10px;padding:0;list-style:none}
.waitlist h3{margin:8px 0 6px;font-size:14px}
.waitlist li{display:flex;align-items:center;gap:8px;padding:6px 0;border-bottom:1px solid var(--border);font-size:14px}
.waitlist .pos{font-weight:700;width:1.5em}
.waitlist-actions{display:flex;gap:4px;margin-left:auto}
.card-tools{display:flex;flex-wrap:wrap;gap:8px;padding:8px 12px 12px}
.card-tools button{min-height:36px;padding:0 12px;border-radius:99px;border:1.5px solid var(--border);background:#fff;font-weight:700;font-size:13px}

.acee-credit{position:fixed;z-index:5;left:0;right:0;bottom:0;display:flex;align-items:center;justify-content:center;gap:9px;
  padding:8px 16px calc(10px + var(--sab));background:var(--court);color:#FFFAEE;
  border-top:2px solid #D49337;
  font-family:Futura,Avenir,"Avenir Next","Century Gothic",system-ui,sans-serif;
  font-size:11.5px;font-weight:500;letter-spacing:.07em;line-height:1.2;text-align:center}
.acee-mark{display:block;width:28px;height:28px;border-radius:7px;background:#FFFAEE;flex:none;object-fit:cover;box-shadow:0 0 0 1px rgba(255,250,238,.2)}
.acee-credit-sheet{display:flex;align-items:center;justify-content:center;gap:8px;margin:18px 0 0;padding-top:14px;border-top:1px solid var(--border);
  color:#63311A;font-family:Futura,Avenir,"Avenir Next","Century Gothic",system-ui,sans-serif;
  font-size:12px;font-weight:500;letter-spacing:.06em}
.acee-credit-sheet .acee-mark{width:24px;height:24px;border-radius:6px;box-shadow:0 0 0 1px #eee6d6}
