/* Racing Notes: the one stylesheet. Colours (tokens), the shared page look, the event pick list, and the hub / login page rules.
   Sections: 1 tokens and page layer (pages put their content in <div class="page">); 2 hub and login page (every rule scoped to body.hub with no extra specificity); 3 event pick list (last, so it wins over the hub .highlight rule).
   Loaded on every page through site-header.php (hub_theme_link()). Edit here only: a page's own <style> must not redefine cards, headings or folds. */

/* ===== 1. tokens and page layer ===== */
:root{
  --ink:#10243b;          /* text */
  --muted:#5b6e81;        /* secondary text */
  --page:#f2f5f7;         /* page background */
  --panel:#fff;           /* cards */
  --line:#d5e0e9;         /* borders of cards and tiles */
  --blue:#1769e0;         /* links, tile titles */
  --blue-dark:#1f3a5f;    /* group headings */
  --btn:#1f5fae;          /* buttons */
  --btn-gray:#6b7a89;
  --header:#101820;       /* header background (also the map in the header) */
  --header-text:#d9e4ef;
  --header-label:#b9c9ff;
  --green:#16834b;        /* role labels, highlight edge */
  --green-bg:#eef9f2;
  --green-ink:#12663b;
  --ok:#1c8a4d;
  --warn-bg:#fff4d6;
  --danger:#b42318;
  --radius:9px;
}

@layer page-theme{
/* ---- the page layer: only inside <div class="page">. It sits in a CSS layer, so any rule a page writes itself always wins over it (these are defaults). ---- */
body:has(.page){margin:0;background:#f4f6f8;color:#17202a;font:16px system-ui,-apple-system,Segoe UI,sans-serif}
.page{max-width:none;margin:0 auto;padding:1rem}
.page.wide{max-width:none}
.page.narrow{max-width:60rem}
.page.full{max-width:none}
.page h2{margin:.1rem 0 .4rem}
.page h3{margin:1rem 0 .3rem}
.page .sub{color:#536474;margin:0 0 1rem}
.page .hint{color:#667a8c;font-size:13px;margin:.3rem 0 0}
.page .muted{color:#667a8c}
.page .card{background:var(--panel);border:1px solid #d9e0e7;border-radius:10px;padding:1rem;margin:1rem 0;overflow-x:auto}
.page label{display:block;font-size:13px;font-weight:700;color:#4d5f72;margin:.6rem 0 .2rem}
.page input[type=text],.page input[type=date],.page input[type=number],.page input[type=password],.page input[type=email],.page input:not([type]),.page textarea,.page select{width:100%;padding:.5rem;font:inherit;border:1px solid #bbc7d3;border-radius:6px;background:#fff}
.page input[type=checkbox],.page input[type=radio]{width:auto}
.page button,.page .btn{padding:.5rem .9rem;font:inherit;font-weight:700;border:0;border-radius:6px;background:var(--btn);color:#fff;cursor:pointer;text-decoration:none;display:inline-block}
.page button.gray,.page .btn.gray{background:var(--btn-gray)}
/* popups sit outside .page: big full-width buttons, same blue as the other Save buttons */
.modal-box .btn,.modal-box button{display:block;width:100%;box-sizing:border-box;margin:10px 0 0;padding:14px 16px;font:inherit;font-size:17px;font-weight:700;color:#fff;border:0;border-radius:8px;background:var(--btn);cursor:pointer;text-decoration:none;text-align:center}
.modal-box .btn.gray,.modal-box button.gray{background:var(--btn-gray)}
.page button.danger,.page .btn.danger,.page .btn.red{background:var(--danger)}
.page .btn.sm{padding:4px 9px;font-size:13px}
.page button:disabled,.page .btn[disabled]{background:#aab4bf;cursor:default}
.page .notice{padding:.7rem;background:#e5f6e9;border-radius:6px}
.page .error{padding:.7rem;background:#ffe1e1;border-radius:6px}
.page .grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:.4rem .8rem}
.page table{border-collapse:collapse;width:100%}
.page td,.page th{border-bottom:1px solid #e3e8ed;padding:.4rem .5rem;text-align:left;font-size:14px;vertical-align:top}
.page th{font-size:12px;color:#596675;text-transform:uppercase;letter-spacing:.02em}
.page td.n,.page th.n{text-align:right;white-space:nowrap}
.page .ok{color:var(--ok);font-weight:700}
.page .warn{background:var(--warn-bg)}
.page .off{color:#8a95a3}
.page .chip{display:inline-block;font-size:12px;font-weight:700;border-radius:99px;padding:2px 10px;background:#d7f1df;color:var(--green-ink);margin-left:.4rem}
.page .chip.off{background:#e7edf2;color:#506579}
.page .chip.soon{background:#ffe9a8;color:#7a5600}
.page .hub-ico{vertical-align:-4px}
.page h2 .hub-ico,.page h3 .hub-ico{margin-right:6px;color:var(--blue)}

/* ---- the unified look: a page opts in with <div class="page unified"> (and removes its own card / heading / fold rules). Pages that have not opted in look exactly as before. ---- */
.page.unified h2{margin:.1rem 0 .4rem;font-size:22px;line-height:1.25}
.page.unified h3{margin:1rem 0 .3rem;font-size:17px}
.page.unified .card{background:var(--panel);border:1px solid #e1e8ef;border-radius:12px;padding:20px;margin:0 0 18px;box-shadow:0 1px 5px #10243b16;overflow-x:auto}   /* the hub card: the one card look */

/* a section that folds: <details class="fold" open><summary>Title</summary><div class="fold-body">...</div></details>  (the one fold look; no script needed) */
.page details.fold{background:var(--panel);border:1px solid #e1e8ef;border-radius:12px;margin:0 0 18px;box-shadow:0 1px 5px #10243b16}
.page details.fold>summary{display:flex;align-items:center;gap:8px;min-height:44px;padding:10px 20px;font-size:18px;font-weight:800;color:var(--ink);cursor:pointer;list-style:none;user-select:none}
.page details.fold>summary::-webkit-details-marker{display:none}
.page details.fold>summary::after{content:"\25BE";margin-left:auto;font-size:.8em;opacity:.6;transition:transform .15s}
.page details.fold:not([open])>summary::after{transform:rotate(-90deg)}
.page details.fold>summary:focus-visible{outline:2px solid #1f4fd8;outline-offset:2px;border-radius:8px}
.page details.fold>.fold-body{padding:0 20px 20px}
.page details.fold .hub-ico{color:var(--blue)}

/* phones (unified pages only): smaller padding, and every button and field is easy to hit with a thumb */
@media(max-width:650px){
  .page.unified{padding:.6rem}
  .page.unified h2{font-size:19px}
  .page.unified .card{padding:14px;margin-bottom:14px}
  .page.unified details.fold>summary,.page details.fold>summary{padding:10px 14px;font-size:16px}
  .page details.fold>.fold-body{padding:0 14px 14px}
  .page.unified button,.page.unified .btn,.page.unified select,.page.unified input[type=text],.page.unified input[type=date],.page.unified input[type=number],.page.unified input[type=password],.page.unified input[type=email],.page.unified input:not([type]){min-height:44px}
  .page.unified .btn.sm{min-height:40px}
}
}

/* ===== 2. hub and login page (body.hub) ===== */
:where(body.hub),:where(body.hub) *{box-sizing:border-box}
:where(body.hub){margin:0;background:var(--page);color:var(--ink);font:15px system-ui,-apple-system,Segoe UI,sans-serif}

/* header */
:where(body.hub) .top{background:var(--header);color:#fff;padding:14px 0}
:where(body.hub) .top-inner{display:flex;align-items:center;gap:20px;width:100%;max-width:none;padding:0 clamp(12px,3vw,48px)}
:where(body.hub) .home-logo{display:block;flex:0 0 auto}
:where(body.hub) .logo{width:min(390px,34vw);height:auto;display:block}
:where(body.hub) .top-inner>div:nth-child(2){min-width:0;flex:1}
:where(body.hub) .top h1{margin:0 0 9px;font-size:29px}
:where(body.hub) .top .sub{margin-top:6px;color:var(--header-label);font-size:14px;letter-spacing:.08em;text-transform:uppercase}
:where(body.hub) .meta{display:flex;flex-wrap:wrap;gap:8px 22px;color:var(--header-text)}
:where(body.hub) .meta b{display:block;color:var(--header-label);font-size:11px;text-transform:uppercase}
:where(body.hub) .user{margin-left:auto;align-self:flex-start;color:var(--header-text);font-size:13px;white-space:nowrap}
:where(body.hub) .hub-logout{position:absolute;right:clamp(12px,3vw,48px);top:74px;background:var(--danger);color:#fff!important;text-decoration:none;font-weight:700;padding:8px 12px;border-radius:5px;z-index:5}
:where(body.hub) .hub-logout:hover{background:#8f1d14}
:where(body.hub) .hdr-map{flex:0 0 auto;display:flex;align-items:center;height:calc(min(390px,34vw)*.36333);background:var(--header);border-radius:8px;padding:4px;margin-left:auto;margin-right:18px;line-height:0}
:where(body.hub) .hdr-map img{display:block;height:100%;width:auto;max-width:300px;object-fit:contain;filter:invert(1) hue-rotate(180deg) brightness(3);mix-blend-mode:screen}

/* page and cards */
:where(body.hub) .shell{width:100%;max-width:none;margin:auto;padding:24px clamp(12px,3vw,48px)}
:where(body.hub) .card{background:var(--panel);border:1px solid #e1e8ef;border-radius:12px;padding:20px;margin-bottom:18px;box-shadow:0 1px 5px #10243b16}
:where(body.hub) .card h2{margin:0 0 6px;font-size:22px;display:flex;align-items:center;gap:8px}
:where(body.hub) .card h2 .hub-ico{color:var(--blue)}
:where(body.hub) .muted{color:var(--muted)}
:where(body.hub) .bar{display:flex;justify-content:space-between;align-items:center;gap:15px;flex-wrap:wrap}
:where(body.hub) .bar select{padding:10px;border:1px solid #b9c7d6;border-radius:6px;background:#fff;font:inherit;min-width:270px}
:where(body.hub) .highlight{border-left:6px solid var(--green);background:var(--green-bg);padding:14px 16px;border-radius:7px;margin-top:15px}
:where(body.hub) .highlight b{color:var(--green-ink)}
:where(body.hub) .highlight .hub-ico{vertical-align:-3px;color:var(--green-ink)}
:where(body.hub) .footer{text-align:center;color:#6a7c8d;font-size:12px;padding:2px 0 12px}
:where(body.hub):has(>.legal){min-height:100vh;display:flex;flex-direction:column}
:where(body.hub):has(>.legal)>main{flex:1 0 auto;width:100%;box-sizing:border-box}
:where(body.hub) .legal{text-align:center;color:#6a7c8d;font-size:12px;line-height:1.6;padding:14px 12px 22px}
:where(body.hub) .legal-mark{font-size:15px;font-weight:700;vertical-align:-1px}
:where(body.hub) .admin{background:#f8fafc}

/* tiles: the one look for everything you can click inside a card (links, areas, buttons) */
:where(body.hub) .link,:where(body.hub) .tile,:where(body.hub) .card .button{display:block;text-decoration:none;color:var(--ink);background:var(--panel);border:1px solid var(--line);border-radius:var(--radius);padding:15px;transition:background .12s,border-color .12s,box-shadow .12s}
:where(body.hub) .link:hover,:where(body.hub) .tile:hover,:where(body.hub) .card .button:hover{background:#f5fbff;border-color:var(--blue);box-shadow:0 0 0 2px #1769e014}
:where(body.hub) .link h3{margin:0 0 4px;color:var(--blue)}
:where(body.hub) .link h3 .hub-ico{margin-right:6px;color:#1f4fd8}
:where(body.hub) .link p{margin:0;color:var(--muted)}
:where(body.hub) .role{font-size:11px;font-weight:800;text-transform:uppercase;color:var(--green)}
:where(body.hub) .card .button{display:inline-flex;align-items:center;gap:8px;padding:10px 14px;font-weight:700;color:var(--blue)}
:where(body.hub) .card .button.gray{color:var(--muted)}
:where(body.hub) .links{display:grid;grid-template-columns:repeat(2,1fr);gap:11px}
:where(body.hub) .cards-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(320px,1fr));gap:14px;align-items:start}
:where(body.hub) .cards-grid>.card{margin:0}
:where(body.hub) .workspace{display:grid;grid-template-columns:1.3fr 1fr;gap:18px}
:where(body.hub) .tile-row{display:flex;gap:10px;flex-wrap:wrap;margin-top:12px}
:where(body.hub) .ep-areas{display:grid;grid-template-columns:repeat(auto-fit,minmax(max(200px,calc(25% - 10px)),1fr));gap:10px;margin-top:12px}   /* four across on a PC */
:where(body.hub) .tile.ep-area{padding:12px 14px;background:#fafbfc}
:where(body.hub) .tile.ep-area .ico{color:var(--blue)}
:where(body.hub) .tile.ep-area ul{margin:0;padding-left:20px;font-size:14px;line-height:1.45}
:where(body.hub) .tile.ep-area .meter{height:7px;background:#e3e8ed;border-radius:4px;overflow:hidden;margin:6px 0 8px}
:where(body.hub) .tile.ep-area .meter span{display:block;height:100%;background:#1c8a4d}

/* sessions */
:where(body.hub) .session-grid{display:grid;grid-template-columns:repeat(5,1fr);gap:10px;margin-top:15px}
:where(body.hub) .session{display:block;text-decoration:none;color:var(--ink);border:1px solid #ced9e3;border-radius:var(--radius);padding:13px;background:#fff}
:where(body.hub) .session:hover,:where(body.hub) .session.selected{border-color:var(--blue);box-shadow:0 0 0 2px #1769e022}
:where(body.hub) .session.selected{background:#f3f8ff}
:where(body.hub) .session strong{display:block;color:var(--blue);margin-bottom:6px}
:where(body.hub) .session small{display:block;color:var(--muted);margin-top:3px}
:where(body.hub) .pill{display:inline-block;font-size:11px;font-weight:700;border-radius:99px;padding:3px 8px;background:#e7edf2;color:#506579}
:where(body.hub) .pill.next{background:#d7f1df;color:var(--green-ink)}
:where(body.hub) .pill.complete{background:#e3e9ee;color:#536678}
:where(body.hub) .task{display:flex;justify-content:space-between;gap:10px;border-top:1px solid #e4e9ee;padding:12px 0}
:where(body.hub) .task:first-of-type{border-top:0}
:where(body.hub) .task span{color:var(--muted)}

/* numbered, foldable groups */
:where(body.hub) .group-head{display:flex;align-items:center;gap:10px;margin:26px 0 8px;color:var(--blue-dark)}
:where(body.hub) .group-head h2{margin:0;font-size:15px;letter-spacing:.14em;text-transform:uppercase;font-weight:800}
:where(body.hub) .group-head .gline{flex:1;height:2px;background:repeating-linear-gradient(135deg,#c3ccd9 0 6px,transparent 6px 12px)}
:where(body.hub) .hub-ico{flex:0 0 auto;vertical-align:-4px}
:where(body.hub) .group-toggle{display:flex;align-items:center;gap:10px;background:none;border:0;padding:0;margin:0;color:inherit;font:inherit;letter-spacing:inherit;text-transform:inherit;cursor:pointer;text-align:left}
:where(body.hub) .group-toggle:focus-visible{outline:2px solid #1f4fd8;outline-offset:3px;border-radius:4px}
:where(body.hub) .group-toggle .chev{margin-left:4px;transition:transform .15s}
:where(body.hub) .group-head.shut .chev{transform:rotate(-90deg)}
:where(body.hub) .group-body[hidden]{display:none}
:where(body.hub) .group-tools{margin:14px 0 -14px;text-align:right;font-size:13px}
:where(body.hub) .group-tools a{color:#1f4fd8}

/* login page */
:where(body.hub) .login-wrap{max-width:26rem;margin:2.5rem auto;padding:0 1rem}
:where(body.hub) .login-wrap label{display:block;margin:.8rem 0 .25rem;font-size:14px;font-weight:700;color:#4d5f72}
:where(body.hub) .login-wrap input{width:100%;padding:.65rem;font:inherit;border:1px solid #b9c7d6;border-radius:6px;background:#fff}
:where(body.hub) .login-wrap button{margin-top:1.1rem;width:100%;padding:.7rem 1rem;background:#087f45;color:#fff;border:0;border-radius:6px;font:inherit;font-weight:700;cursor:pointer}
:where(body.hub) .login-wrap .error{color:#a00;background:#fdecea;border-radius:6px;padding:.6rem .8rem;margin:.6rem 0 0}

@media(max-width:950px){:where(body.hub) .session-grid{grid-template-columns:repeat(3,1fr)}:where(body.hub) .workspace{grid-template-columns:1fr}}
@media(max-width:800px){
  :where(body.hub) .top-inner{flex-direction:column;align-items:center;text-align:center;padding:0 12px;gap:12px}
  :where(body.hub) .home-logo{width:100%;text-align:center}:where(body.hub) .home-logo .logo{margin:0 auto}
  :where(body.hub) .logo{width:min(360px,calc(100vw - 32px));max-width:100%}
  :where(body.hub) .top-inner>div:nth-child(2){width:100%}
  :where(body.hub) .meta{justify-content:center}
  :where(body.hub) .user{margin-left:0;align-self:center}
  :where(body.hub) .hub-logout{position:static;display:inline-block;margin:8px 12px}
  :where(body.hub) .hdr-map{margin:0 auto;height:120px}
  :where(body.hub) .login-wrap{margin:1.5rem auto}
}
@media(max-width:650px){
  :where(body.hub) .shell{padding:8px}
  :where(body.hub) .session-grid,:where(body.hub) .links{grid-template-columns:1fr}
  :where(body.hub) .bar select{min-width:0;width:100%}
}


/* a card title that folds its card (the Event operations card on the hub) */
:where(body.hub) .fold-h{cursor:pointer;user-select:none}
:where(body.hub) .fold-h::after{content:"\25BE";margin-left:8px;font-size:.8em;opacity:.6}
:where(body.hub) .card-shut .fold-h::after{content:"\25B8"}
:where(body.hub) .card-shut .bar .muted{display:none}

/* the tiles of the Event operations card already open the page; its "Open Event operations" button and its description line are redundant */
:where(body.hub) #travel-card .bar .button,:where(body.hub) #travel-card .bar .muted{display:none}

/* ===== 3. event pick list (hub_event_picker() in hub-prefs.php) ===== */
.evpick{position:relative;margin-top:8px;padding:14px 38px 14px 16px;border-left:6px solid var(--green);background:var(--green-bg);border-radius:7px}
.evpick::after{content:"\25BE";position:absolute;right:14px;top:50%;transform:translateY(-50%);color:var(--green-ink)}
.evpick .evshow{display:block;overflow-wrap:anywhere;color:var(--green-ink)}
.evpick .evshow b{color:var(--green-ink)}
.evpick .evdate{white-space:nowrap;font-weight:700;margin-left:6px}
.evpick .hub-ico{vertical-align:-3px;color:var(--green-ink)}
.evpick select{position:absolute;inset:0;width:100%;height:100%;opacity:0;cursor:pointer;font-size:16px;min-width:0}
.yearchips{display:flex;gap:6px}
.yearchips a{padding:6px 14px;border:1px solid #b9c7d6;border-radius:99px;background:#fff;color:var(--green-ink);font-weight:700;text-decoration:none}
.yearchips a.on{background:var(--green-ink);border-color:var(--green-ink);color:#fff}
.evhead{display:flex;justify-content:space-between;align-items:center;gap:10px;flex-wrap:wrap}

/* ===== 4. task strip under the page header (hub_task_strip() in hub-nav.php) and the rider cards (hub_rider_cards() in hub-prefs.php) ===== */
.taskstrip{display:flex;align-items:center;gap:6px;overflow-x:auto;-webkit-overflow-scrolling:touch;padding:8px clamp(12px,3vw,48px);background:#e9eef3;border-bottom:1px solid #d5e0e9;scrollbar-width:thin}
.taskstrip .ts-label{flex:0 0 auto;font-size:11px;font-weight:800;letter-spacing:.12em;text-transform:uppercase;color:#506579;margin-right:6px}
.taskstrip.sticky{position:sticky;top:0;z-index:30}
.taskstrip .ts-rider{flex:0 0 auto;display:inline-flex;align-items:center;margin:0 6px 0 0;padding:0;border:0;background:none;box-shadow:none}
.taskstrip .ts-rider b{display:none}
.taskstrip .ts-rider select{width:auto;min-width:11rem;min-height:44px;padding:0 34px 0 16px;border:1px solid #b9c7d6;border-radius:99px;background-color:#fff;color:var(--green-ink);font:700 15px system-ui,-apple-system,Segoe UI,sans-serif}
.taskstrip a{flex:0 0 auto;display:inline-flex;align-items:center;min-height:44px;padding:0 16px;border:1px solid #b9c7d6;border-radius:99px;background:#fff;color:var(--green-ink);font:700 15px system-ui,-apple-system,Segoe UI,sans-serif;text-decoration:none;white-space:nowrap}
.taskstrip a:hover{border-color:var(--blue)}
.taskstrip a.on{background:var(--green-ink);border-color:var(--green-ink);color:#fff}
@media(max-width:650px){.taskstrip{padding:6px 10px}}

.ridercards{display:flex;flex-wrap:wrap;gap:10px}
.rider-card{flex:1 1 180px;max-width:320px;display:flex;align-items:center;gap:12px;min-height:64px;padding:10px 16px;border:2px solid #ced9e3;border-radius:12px;background:#fff;color:var(--ink);text-decoration:none}
.rider-card:hover{border-color:var(--blue)}
.rider-card.on{border-color:var(--green);background:var(--green-bg);box-shadow:0 0 0 2px #16834b22}
.rider-card .rnum{flex:0 0 auto;min-width:2.2ch;font-size:30px;font-weight:800;line-height:1;color:var(--green-ink);font-family:var(--rider-font,inherit)}
.rider-card .rname{font-size:18px;font-weight:700;overflow-wrap:anywhere;font-family:var(--rider-font,inherit)}
.rider-card .rvo{margin-left:auto;font-size:12px;font-weight:700;color:#6b5400;background:#fff3cd;border-radius:6px;padding:2px 8px}
.rider-card img{display:block;max-width:100%;height:48px;width:auto;object-fit:contain}
.rider-card.has-img{justify-content:center}
@media(max-width:650px){.rider-card{flex:1 1 100%;max-width:none}}

:where(body.hub) .subhead{margin:16px 0 6px;font-size:12px;font-weight:800;letter-spacing:.12em;text-transform:uppercase;color:#506579}
:where(body.hub) .subhead:first-of-type{margin-top:4px}
@media(max-width:650px){:where(body.hub) .session-grid{grid-template-columns:1fr 1fr}}

/* Crew Chief Notes: the task strip is sticky there (--strip-h is its height, 0 elsewhere); the lap sheet's own sticky bars sit below it */
body .slim-bar{top:var(--strip-h,0px)}
body .lap-table thead th{top:calc(var(--strip-h,0px) + var(--bar-h,38px))}

/* hub: compact link cards (two per row, two rows) */
:where(body.hub) .links.compact .link{padding:9px 12px}
:where(body.hub) .links.compact .link h3{margin:0 0 2px;font-size:16px}
:where(body.hub) .links.compact .link p{font-size:13px;line-height:1.3}
:where(body.hub) .links.compact .role{font-size:10px}

/* the page-wide Unfold all / Fold all link moves onto the strip row (Crew Chief Notes), at the right end */
.taskstrip .ts-foldall{flex:0 0 auto;margin-left:auto;display:inline-flex;align-items:center;min-height:44px;padding:0 16px;border:1px solid #cfd9e4;border-radius:99px;background:#fff;color:#33485c;font:600 14px system-ui,-apple-system,Segoe UI,sans-serif;text-decoration:none;white-space:nowrap}
.taskstrip .ts-foldall:hover{border-color:var(--blue)}
