*{box-sizing:border-box}body{margin:0;font-family:Arial,system-ui;background:#f4f6f8;color:#17202a}button,input,select,textarea{font:inherit}button{cursor:pointer}header{background:#b51f2b;color:#fff;padding:12px 16px;display:flex;align-items:center;gap:12px;position:sticky;top:0}.logo{width:58px;height:58px;object-fit:contain;background:#fff;border-radius:10px;padding:2px}.brand h1{font-size:17px;margin:0}.menuwrap{margin-left:auto;position:relative}.menubtn{border:0;border-radius:9px;padding:10px 13px;background:#fff;color:#b51f2b;font-weight:bold}.menu{display:none;position:absolute;right:0;top:48px;width:230px;background:#fff;color:#222;border-radius:10px;box-shadow:0 8px 25px #0004;overflow:hidden}.menu.open{display:block}.menu button{display:block;width:100%;border:0;background:#fff;text-align:left;padding:12px 14px}.menu button:hover{background:#f1f3f5}main{max-width:950px;margin:auto;padding:18px 14px}.page{display:none}.page.active{display:block}.card{background:#fff;border-radius:14px;padding:18px;margin-bottom:15px;box-shadow:0 3px 14px #00000012}.hero{border-left:6px solid #b51f2b}.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:12px}.stat{background:#f2f4f6;border-radius:11px;padding:15px}.stat b{font-size:26px;display:block}.event{border:1px solid #e1e5e9;border-radius:11px;padding:13px;margin:10px 0}.type{font-size:11px;font-weight:bold;text-transform:uppercase;color:#b51f2b}.actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:10px}.primary,.secondary,.available,.unavailable,.danger{border:0;border-radius:9px;padding:10px 13px;font-weight:bold}.primary{background:#123b68;color:#fff}.secondary{background:#e9eef3;color:#123b68}.available{background:#dff4e8;color:#12673c}.unavailable,.danger{background:#fde3e5;color:#a71927}.muted{color:#66717d}.badge{display:inline-block;border-radius:999px;padding:5px 9px;font-size:12px;font-weight:bold}.yes{background:#dff4e8;color:#12673c}.no{background:#fde3e5;color:#a71927}.pending{background:#eee;color:#555}label{display:block;font-weight:bold;font-size:13px;margin:11px 0 5px}input,select,textarea{width:100%;padding:10px;border:1px solid #cbd2d8;border-radius:9px}textarea{min-height:80px}.row{display:flex;justify-content:space-between;gap:10px;align-items:center;padding:11px 0;border-bottom:1px solid #eee}.notice{padding:11px;border-radius:9px;background:#eef4fb;margin-top:10px}.error{background:#fde3e5;color:#a71927}.auth{min-height:100vh;display:grid;place-items:center;padding:18px}.authbox{width:min(430px,100%);background:#fff;padding:24px;border-radius:17px;box-shadow:0 15px 45px #0002}.authbox .logo{display:block;width:95px;height:95px;margin:auto}.authbox h1{text-align:center;color:#123b68}.modalbg{display:none;position:fixed;inset:0;background:#0007;align-items:center;justify-content:center;padding:15px}.modalbg.open{display:flex}.modal{background:#fff;width:min(600px,100%);max-height:90vh;overflow:auto;border-radius:15px;padding:18px}.toast{display:none;position:fixed;right:14px;bottom:14px;background:#17202a;color:#fff;padding:12px;border-radius:9px}.toast.show{display:block}footer{text-align:center;color:#777;padding:20px;font-size:12px}@media(max-width:600px){.brand h1{font-size:14px}.logo{width:52px;height:52px}}
.availability-lists{display:grid;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:12px;margin-top:14px}.availability-group{border:1px solid #e1e5e9;border-radius:11px;padding:12px}.availability-group h4{margin:0 0 8px}.availability-person{padding:8px 0;border-bottom:1px solid #eee}.availability-person:last-child{border-bottom:0}.availability-totals{margin-top:12px}

.scoreline{font-size:20px;font-weight:800;color:#123b68;margin-top:8px}.team-sheet{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:8px}.team-player{display:flex;gap:10px;align-items:center;border:1px solid #e1e5e9;border-radius:10px;padding:9px}.team-player small{display:block;color:#66717d}.shirt{display:grid;place-items:center;width:34px;height:34px;border-radius:50%;background:#b51f2b;color:#fff;font-weight:800}.selection-row{display:grid;grid-template-columns:minmax(150px,220px) 1fr;gap:10px;align-items:center;margin:8px 0}.wide{width:min(850px,100%)}.result-head,.result-row{display:grid;grid-template-columns:minmax(180px,2fr) repeat(5,minmax(52px,.55fr));gap:7px;align-items:center;padding:7px 0}.result-head{font-size:12px;font-weight:bold;color:#66717d}.result-row input{padding:7px}.result-row .played{width:22px;height:22px}.tablewrap{overflow-x:auto}table{width:100%;border-collapse:collapse}th,td{text-align:left;padding:9px;border-bottom:1px solid #e5e7eb;white-space:nowrap}@media(max-width:650px){.selection-row{grid-template-columns:1fr}.result-head{display:none}.result-row{grid-template-columns:1fr repeat(5,1fr);border-bottom:1px solid #ddd}.result-row>span{grid-column:1/-1}.result-row input:before{font-size:10px}}

/* v1.4 rugby formation */
.rugby-pitch{position:relative;min-height:650px;border-radius:16px;overflow:hidden;margin:14px 0;background:#91d77d;border:3px solid #fff;box-shadow:inset 0 0 0 1px #78be66}.halfway{position:absolute;left:0;right:0;top:46%;border-top:3px solid rgba(255,255,255,.95)}.pitch-label{position:absolute;right:14px;font-size:18px;font-weight:900;color:#17321a}.forwards-label{top:10px}.backs-label{top:48%}.pitch-player,.edit-pitch-player{position:absolute;transform:translate(-50%,-50%);display:flex;flex-direction:column;align-items:center;text-align:center;min-width:100px;z-index:2}.pitch-player b{font-size:13px;line-height:1.1}.pitch-player small,.edit-pitch-player small{font-size:10px}.pitch-shirt{display:inline-grid;place-items:center;min-width:38px;height:38px;padding:0 8px;border-radius:12px;background:#0e3157;color:white;font-size:20px;font-weight:900;border:2px solid white}.p1,.ep1{left:34%;top:10%}.p2,.ep2{left:50%;top:8%}.p3,.ep3{left:66%;top:10%}.p4,.ep4{left:43%;top:21%}.p5,.ep5{left:57%;top:21%}.p6,.ep6{left:35%;top:34%}.p8,.ep8{left:50%;top:32%}.p7,.ep7{left:65%;top:34%}.p9,.ep9{left:31%;top:53%}.p10,.ep10{left:46%;top:58%}.p12,.ep12{left:59%;top:64%}.p13,.ep13{left:72%;top:70%}.p11,.ep11{left:15%;top:72%}.p14,.ep14{left:87%;top:75%}.p15,.ep15{left:50%;top:90%}.replacements,.replacement-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:8px}.replacements h4{grid-column:1/-1}.replacement{display:grid;grid-template-columns:auto 1fr;gap:3px 10px;align-items:center;border:1px solid #dde3e8;border-radius:10px;padding:8px}.replacement .pitch-shirt{grid-row:1/3}.replacement small{color:#66717d}.replacement-edit{display:flex;align-items:center;gap:8px}.replacement-edit select{flex:1}.edit-pitch{min-height:760px}.edit-pitch-player{width:145px}.edit-pitch-player .pitch-shirt{min-width:32px;height:32px;font-size:16px}.edit-pitch-player select{width:145px;padding:6px;font-size:12px}.manage-event{display:flex;justify-content:space-between;gap:12px;align-items:center;padding:11px 0;border-bottom:1px solid #e3e7eb}.manage-event small{display:block;color:#66717d;margin-top:3px}@media(max-width:650px){.rugby-pitch{min-height:570px}.pitch-player{min-width:70px}.pitch-player b{font-size:10px;max-width:76px}.pitch-player small{font-size:8px}.pitch-shirt{min-width:31px;height:31px;font-size:16px;padding:0 5px}.pitch-label{font-size:13px}.edit-pitch{min-height:700px}.edit-pitch-player{width:88px}.edit-pitch-player select{width:88px;font-size:10px;padding:5px 2px}.edit-pitch-player small{font-size:8px}.manage-event{align-items:flex-start;flex-direction:column}}

/* v1.4.1 team-selection refinement */
.selection-summary{display:flex;gap:7px;flex-wrap:wrap;margin:8px 0 12px}
.edit-pitch-player{appearance:none;border:0;background:transparent;color:#10202e;cursor:pointer;padding:2px;min-height:68px}
.edit-pitch-player b{font-size:11px;line-height:1.05;max-width:120px;overflow-wrap:anywhere;background:rgba(255,255,255,.88);padding:3px 6px;border-radius:7px;margin-top:2px}
.edit-pitch-player small{background:rgba(255,255,255,.65);padding:1px 4px;border-radius:5px}
.edit-pitch-player:focus-visible,.replacement-pick:focus-visible,.player-choice:focus-visible{outline:3px solid #fff;outline-offset:2px}
.edit-pitch-player.filled .pitch-shirt{background:#b51f2b}
.edit-pitch{min-height:790px}
.edit-pitch .ep1{left:25%;top:10%}.edit-pitch .ep2{left:50%;top:8%}.edit-pitch .ep3{left:75%;top:10%}
.edit-pitch .ep4{left:38%;top:22%}.edit-pitch .ep5{left:62%;top:22%}
.edit-pitch .ep6{left:24%;top:36%}.edit-pitch .ep8{left:50%;top:34%}.edit-pitch .ep7{left:76%;top:36%}
.edit-pitch .ep9{left:27%;top:53%}.edit-pitch .ep10{left:43%;top:59%}.edit-pitch .ep12{left:57%;top:65%}.edit-pitch .ep13{left:70%;top:71%}.edit-pitch .ep11{left:12%;top:73%}.edit-pitch .ep14{left:88%;top:76%}.edit-pitch .ep15{left:50%;top:91%}
.replacement-pick{display:flex;gap:9px;align-items:center;text-align:left;border:1px solid #d8e0e7;background:#fff;border-radius:10px;padding:8px;min-height:58px;cursor:pointer}.replacement-pick span:last-child{display:flex;flex-direction:column}.replacement-pick small{color:#66717d}.replacement-pick.filled{border-color:#b51f2b}
.choice-list{display:grid;gap:7px;margin:10px 0}.player-choice{display:grid;grid-template-columns:1fr auto;gap:4px 10px;align-items:center;text-align:left;background:#fff;border:1px solid #d8e0e7;border-radius:10px;padding:11px;cursor:pointer;min-height:50px}.player-choice small{grid-column:1/-1;color:#66717d}.override-choice{border-style:dashed}.override-panel{margin:14px 0;border-top:1px solid #ddd;padding-top:12px}.override-panel summary{font-weight:800;cursor:pointer;padding:8px 0}.fullbtn{width:100%;margin:6px 0}
@media(max-width:650px){.edit-pitch{min-height:680px}.edit-pitch-player{min-width:62px;width:76px}.edit-pitch-player b{font-size:9px;max-width:74px;padding:2px 3px}.edit-pitch-player small{font-size:7px}.edit-pitch .ep1{left:20%}.edit-pitch .ep3{left:80%}.edit-pitch .ep6{left:19%}.edit-pitch .ep7{left:81%}.replacement-grid{grid-template-columns:1fr 1fr}}

/* v1.6 availability management */
.deadline{margin:8px 0;padding:8px 10px;border-radius:8px;background:#fff4d6;color:#755400;font-weight:700;font-size:13px}.deadline.overdue{background:#fde3e5;color:#a71927}.latebadge{background:#fff0c2;color:#7a5600}.chaser-event{border-left:5px solid #123b68}#deadline-fields small{display:block;margin-top:5px}

/* v1.6.1 contact preferences */
.checkrow{display:flex;align-items:center;gap:10px;margin:14px 0;font-weight:600}
.checkrow input{width:auto;margin:0}
.contactrow{display:flex;justify-content:space-between;gap:12px;align-items:center;padding:10px 0;border-bottom:1px solid #e6e8eb}
.contactstack{display:flex;flex-direction:column;margin-top:4px;gap:2px}
.contactline{font-size:13px;color:#53606d}
.contactline.missing{color:#8a6670;font-style:italic}

/* v1.8.5 cancelled clinic visibility */
.physio-cancelled-badge{display:inline-block;margin-left:8px;padding:5px 10px;background:#b51f2b;color:#fff;border-radius:6px;font-size:12px;font-weight:800;letter-spacing:.05em}
.physio-cancelled-message{border-left:4px solid #b51f2b;background:#fff1f2;color:#921725;padding:10px 12px;font-weight:700;border-radius:4px}
#physio-history{margin-top:16px}
#physio-history[hidden]{display:none}

/* v1.9.0 mobile preview — no database or permission changes */
.mobile-tabs{display:none}.mobile-hero{background:linear-gradient(135deg,#102c52,#174875);color:white;border-radius:20px;padding:24px;margin-bottom:20px}.mobile-hero h2{margin:10px 0 5px;font-size:clamp(23px,5vw,32px)}.mobile-hero p{color:#e4ecf8}.eyebrow{font-size:11px;letter-spacing:.13em;font-weight:800;color:#d7e3f7}.next-match{background:#ffffff16;border:1px solid #ffffff28;border-radius:15px;padding:18px;margin-top:22px}.next-match h3{font-size:21px;margin:10px 0}.match-response{margin:14px 0}.hero-action{background:#fff;color:#123b68;border:0;border-radius:10px;padding:11px 16px;font-weight:800}.mobile-section-heading{color:#123b68}.mobile-quick-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.mobile-quick-grid button{text-align:left;display:flex;flex-direction:column;align-items:flex-start;gap:8px;background:#fff;border:1px solid #e0e7ef;border-radius:16px;padding:19px;box-shadow:0 3px 14px #00000009;min-height:138px}.mobile-quick-grid button span{font-size:26px;color:#b51f2b}.mobile-quick-grid button b{font-size:16px;color:#172b49}.mobile-quick-grid button small{color:#657486}.mobile-manager{background:#fff;border-radius:16px;margin-top:15px;padding:18px;border-left:4px solid #b51f2b}.mobile-manager p{color:#66717d}
@media(max-width:700px){body{padding-bottom:calc(76px + env(safe-area-inset-bottom))}header{background:#123b68;z-index:10}.brand h1{font-size:13px}.brand small{color:#dbe7f5}main{padding:16px 13px}.mobile-tabs{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));position:fixed;bottom:0;left:0;right:0;z-index:30;background:#fff;border-top:1px solid #e0e5ed;padding:7px 5px calc(7px + env(safe-area-inset-bottom));box-shadow:0 -4px 20px #00000012}.mobile-tabs button{background:transparent;border:0;color:#66717d;display:flex;align-items:center;flex-direction:column;gap:3px;font-size:10px;font-weight:700;padding:4px 0}.mobile-tabs button span{font-size:24px;line-height:25px}.mobile-tabs button.active{color:#b51f2b}.menu{position:fixed;top:auto;bottom:calc(77px + env(safe-area-inset-bottom));right:9px;max-height:70vh;overflow-y:auto;width:min(300px,calc(100vw - 18px));z-index:40}.menubtn{font-size:12px;padding:9px}.modalbg{z-index:60}footer{padding-bottom:10px}.mobile-hero{padding:19px}.mobile-quick-grid button{padding:15px}}

/* v1.9.1 mobile layout refinement: styling only, no permission/data changes */
.app-icon{display:block;width:23px;height:23px;flex:none}.tab-icon,.quick-icon{display:grid;place-items:center}.quick-icon .app-icon{width:25px;height:25px}.mobile-tabs button:focus-visible,.mobile-quick-grid button:focus-visible,.hero-action:focus-visible{outline:3px solid #b51f2b;outline-offset:2px}
@media(max-width:700px){
 header{padding:8px 12px;min-height:62px;gap:9px}header .logo{width:40px;height:44px;border-radius:8px}header .brand{min-width:0;flex:1}header .brand h1{font-size:11px;line-height:1.3;letter-spacing:.015em}header .brand small{font-size:11px}.menubtn{padding:9px 11px;white-space:nowrap}
 main{padding:12px 12px}.mobile-hero{padding:16px;border-radius:16px;margin-bottom:15px}.mobile-hero h2{font-size:clamp(22px,6vw,28px);margin:6px 0}.mobile-hero>p{font-size:13px;margin:4px 0 0}.eyebrow{font-size:10px;letter-spacing:.11em}.next-match{margin-top:13px;padding:13px 14px;border-radius:12px}.next-match h3{font-size:18px;margin:7px 0}.next-match p{font-size:13px;margin:5px 0 11px;line-height:1.4}.hero-action{padding:10px 13px;min-height:43px;font-size:13px}.mobile-section-heading{margin:15px 0 10px;font-size:17px}
 .mobile-quick-grid{gap:9px}.mobile-quick-grid button{min-height:104px;padding:12px;gap:5px;border-radius:13px}.mobile-quick-grid button b{font-size:14px}.mobile-quick-grid button small{font-size:11px;line-height:1.3}.mobile-manager{padding:14px;margin-top:12px}.mobile-manager p{font-size:12px;margin:7px 0}
 .mobile-tabs{padding:7px 4px calc(7px + env(safe-area-inset-bottom));min-height:66px}.mobile-tabs button{min-height:48px;gap:3px;font-size:10px;justify-content:center;touch-action:manipulation}.mobile-tabs button .tab-icon{height:26px}.mobile-tabs button .app-icon{width:23px;height:23px}.menu{bottom:calc(72px + env(safe-area-inset-bottom))}body{padding-bottom:calc(82px + env(safe-area-inset-bottom))}
}
@media(max-width:360px){header .brand h1{font-size:10px}.mobile-quick-grid button{padding:10px}.mobile-quick-grid button b{font-size:13px}}

/* THA-004 staging: dropdown above pitch on desktop; modal remains highest. */
header{z-index:50}
.menu{z-index:55}
.modalbg{z-index:100}

/* THA-004 v7.4: completed teams collapsed by default; no changes to drafts. */
.completed-team-details{margin:12px 0 14px;border:1px solid #d8e2ed;border-radius:10px;overflow:hidden}
.completed-team-details>summary{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:12px 15px;background:#f4f7fa;color:#123b68;font-weight:700;cursor:pointer;list-style:none;min-height:44px}
.completed-team-details>summary::-webkit-details-marker{display:none}
.completed-team-details>summary::after{content:'▾';font-size:18px}
.completed-team-details[open]>summary::after{content:'▴'}
.completed-team-details .completed-hide-label{display:none}
.completed-team-details[open] .completed-view-label{display:none}
.completed-team-details[open] .completed-hide-label{display:inline}
.completed-team-details>summary:focus-visible{outline:3px solid #b51f2b;outline-offset:-3px}
.completed-team-details>.rugby-pitch,.completed-team-details>.replacements{margin:12px}
@media(max-width:700px){.completed-team-details>summary{padding:12px}.completed-team-details>.rugby-pitch,.completed-team-details>.replacements{margin:8px}}

/* THA-004 v7.5: production-brand footer and compact completed-match layout. */
.production-footer{display:flex;flex-direction:column;align-items:center;gap:4px;color:#123b68;font-size:12px;line-height:1.4;padding:24px 12px 18px;text-align:center}
.production-footer strong{font-size:14px;color:#123b68}
.production-footer span:last-child{font-weight:700;color:#b51f2b}
.completed-team-details{max-width:100%}
.completed-team-details>.rugby-pitch{box-sizing:border-box}
@media(max-width:700px){.production-footer{padding:18px 10px 12px;font-size:11px}.completed-team-details>summary{flex-wrap:wrap;line-height:1.4}.completed-team-details>.rugby-pitch{margin:8px 4px}.completed-team-details>.replacements{margin:8px 4px;grid-template-columns:repeat(auto-fit,minmax(140px,1fr))}}
@media(max-width:390px){.completed-team-details>.replacements{grid-template-columns:1fr}.completed-team-details .pitch-player b{overflow-wrap:anywhere}}

/* THA-004 v1.14.1 — compact admin availability cards and mobile-friendly member close. */
.admin-availability-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}
.admin-availability-heading>div{min-width:0;flex:1}
.admin-availability-heading h3{overflow-wrap:anywhere}
.availability-toggle{flex:0 0 auto;min-height:44px;white-space:nowrap}
.availability-toggle:focus-visible,.member-close-button:focus-visible{outline:3px solid #b51f2b;outline-offset:2px}
.admin-availability-details[hidden]{display:none!important}
.member-modal-heading{position:sticky;top:0;z-index:2;display:flex;align-items:center;justify-content:space-between;gap:12px;background:#fff;padding:2px 0 8px}
.member-modal-heading h2{margin:0;min-width:0}
.member-close-button{flex:0 0 auto;display:grid;place-items:center;width:44px;height:44px;border:1px solid #d6dfe9;border-radius:10px;background:#e9eef3;color:#123b68;font-size:28px;line-height:1;cursor:pointer}
.member-close-button:hover{background:#dce6f0}
@media(max-width:420px){.admin-availability-heading{gap:8px}.availability-toggle{padding:9px 10px}}

/* v1.16 UI polish: keep recurring checkbox beside its label. */
.modal label.recurring-training-toggle{display:flex;align-items:center;justify-content:flex-start;gap:9px;cursor:pointer}
.modal label.recurring-training-toggle input[type="checkbox"]{width:16px;height:16px;padding:0;margin:0;flex:0 0 16px;accent-color:#123b68}

/* THA-004 v1.16.1 — accessible, always-visible Manage Events close control. */
.tha1161-events-modal{position:relative;scroll-padding-top:62px}
.tha1161-events-head{position:sticky;top:-18px;z-index:2;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:14px 0 12px;background:#fff;border-bottom:1px solid #e3e7eb}
.tha1161-events-head h2{margin:0}
.tha1161-close{white-space:nowrap;flex-shrink:0;min-height:42px}
.tha1161-past-events{margin:20px 0 10px;border-top:1px solid #e3e7eb;padding-top:12px}
.tha1161-past-events summary{cursor:pointer;font-weight:700;color:#123b68;padding:10px 0}
.past-availability{border-top:1px solid #e3e7eb;margin-top:14px;padding-top:12px}
@media(max-width:480px){.tha1161-events-head{top:-18px}.tha1161-close{min-width:52px}.tha1161-close span{display:none}}
