/* The assistant.
 *
 * EVERY COLOUR HERE IS A TOKEN, set in the page by assistant/theme.py from the
 * team's two colours. This file names one colour only: the white tile a logo
 * sits on, which stays white in dark so a crest drawn for paper still reads.
 * So the same rules draw the default look, any team's look, light and dark.
 *
 * The layout is Rich's: a banner, a collapsible sidebar, main, the assistant
 * coach, and a strip along the bottom. Desktop first. On a narrow screen the
 * regions stack and nothing scrolls sideways; a phone is not designed for yet.
 */
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{margin:0;background:var(--bg);color:var(--text);
  font:16px/1.55 -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif}
a{color:inherit}
:focus-visible{outline:3px solid var(--text);outline-offset:2px}
.muted,small{color:var(--muted)}

/* ---- the five regions ---- */
.shell{min-height:100vh;display:grid;grid-template-columns:var(--side,208px) minmax(0,1fr) 320px;
  grid-template-rows:auto minmax(0,1fr) auto;
  grid-template-areas:"banner banner banner" "side main coach" "strip strip coach"}
.shell.folded{--side:60px}
.banner{grid-area:banner;background:var(--banner-bg);color:var(--banner-ink);display:flex;align-items:center;
  gap:12px;padding:10px 18px}
.banner .logo{width:42px;height:42px;border-radius:9px;background:#fff;display:grid;place-items:center;
  overflow:hidden;flex:0 0 auto}
.banner .logo img{width:100%;height:100%;object-fit:contain}
.banner .who{display:flex;flex-direction:column;line-height:1.2;flex:1;min-width:0}
/* A LONG NAME SHORTENS; IT NEVER WIDENS THE BANNER (C-3). A username may be 150
   characters with no break in it, and a flex item will not shrink below its
   content unless told it may. The full name is in the element's title. */
.banner .who strong{font-size:1.05rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
/* NO OPACITY ON A TEAM COLOUR (C-1). The ink is chosen for 4.5:1 against the
   team's colour; fading it blends it back toward that colour and undoes the
   choice. Small text is small, in the full ink. */
.banner .who small,.banner .me{color:inherit;font-size:.8rem}
.banner .me{min-width:0;max-width:14rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.banner form{margin:0}
.banner button.quiet{color:var(--banner-ink);border-color:currentColor;background:transparent}

.side{grid-area:side;background:var(--surface);border-right:1px solid var(--border);padding:10px 8px;
  display:flex;flex-direction:column;gap:4px}
.side a,.side .fold{display:flex;align-items:center;gap:10px;padding:9px 10px;border-radius:8px;text-decoration:none;
  color:var(--text);white-space:nowrap;overflow:hidden;font:inherit;border:0;background:transparent;cursor:pointer;
  text-align:left;min-height:0}
.side .i{flex:0 0 22px;text-align:center;font-weight:800;color:var(--muted)}
/* THE LETTERS ARE FOR THE FOLDED SIDEBAR, where they are all there is to tap.
   Open, beside the full words, they are clutter (Rich). The fold button's
   arrow is not one of them and shows either way. */
.side a .i{display:none}
.shell.folded .side a .i{display:block}
.side a:hover,.side .fold:hover{background:var(--surface2)}
/* The current page: a marker in the team's exact colour, with an edge if pale. */
.side a[aria-current="page"]{background:var(--surface2);font-weight:700;position:relative}
.side a[aria-current="page"]::before{content:"";position:absolute;left:0;top:6px;bottom:6px;width:4px;border-radius:2px;
  background:var(--mark);box-shadow:var(--mark-edge)}
.side a[aria-current="page"] .i{color:var(--text)}
.side .fold{margin-top:auto;color:var(--muted);font-size:.86rem}
.shell.folded .side .l{display:none}

.main{grid-area:main;padding:22px 26px 40px;min-width:0;position:relative}
/* THE TEAM'S LOGO BEHIND THE PAGE, when the team has turned it on. How faint,
   how large and where are the team's, and arrive as tokens. It is a background
   on a layer of its own: it cannot take a click meant for a link, and a screen
   reader never meets it. This layer is the ONE place opacity is allowed; the
   writing over it is not touched. */
/* IT STAYS IN VIEW AS THE PAGE SCROLLS. Placed in the whole main area, "centre"
   on a long page was two screens down and nobody saw it. So the layer is one
   screen tall and sticks to the top of the window; the negative margin lets the
   page's content start at the top, over it, instead of below it. */
.main::before{content:"";display:block;position:sticky;top:16px;z-index:0;pointer-events:none;
  height:calc(100vh - 150px);margin-bottom:calc(150px - 100vh);
  background-image:var(--wm-image,none);background-repeat:no-repeat;
  background-position:var(--wm-place,center);background-size:var(--wm-size,50%) auto;
  opacity:var(--wm-opacity,0)}
.main>*{max-width:44rem;position:relative;z-index:1}
/* A HEADING CARRIES THE TEAM'S COLOUR as a band behind it or a line under it,
   whichever the team chose. Both arrive as tokens. */
.main h1{display:inline-block;margin:0 0 12px;padding:var(--head-pad);border-radius:var(--head-radius);
  border-bottom:var(--head-rule);font-size:1.45rem;line-height:1.25;
  background:var(--head-bg);color:var(--head-ink);box-shadow:var(--head-edge)}
.main h2{font-size:1.05rem;margin:1.7em 0 .5em}
.main p{margin:0 0 12px}

.coach{grid-area:coach;background:var(--surface);border-left:1px solid var(--border);padding:16px 18px}
.coach h2{margin:0 0 12px;font-size:1rem}
.coach h2 small{font-weight:400;font-size:.8rem;margin-left:4px}
.coach p{margin:0 0 10px;font-size:.92rem}

.strip{grid-area:strip;background:var(--surface);border-top:1px solid var(--border);padding:7px 18px;
  font-size:.8rem;color:var(--muted)}
.strip b{color:var(--text)}

/* ---- controls ---- */
button,.btn{display:inline-block;background:var(--btn-bg);color:var(--btn-ink);border:0;border-radius:9px;
  padding:11px 20px;font:inherit;font-weight:800;min-height:46px;cursor:pointer;text-decoration:none}
button.quiet{background:transparent;color:var(--text);border:2px solid var(--border);padding:7px 14px;min-height:40px;
  font-size:.9rem;font-weight:700}
label{font-weight:700;display:block;margin:14px 0 4px}
input[type=text],input[type=password],textarea{width:100%;font:inherit;padding:10px;border:2px solid var(--border);
  border-radius:8px;background:var(--surface);color:var(--text)}
input[type=file]{font:inherit;color:var(--text);max-width:100%}
input[type=color]{width:52px;height:36px;padding:0;border:2px solid var(--border);border-radius:8px;background:none;
  vertical-align:middle;margin-left:8px}
.errors,.errorlist{background:var(--surface);color:var(--bad);border:2px solid var(--bad);border-radius:8px;
  padding:10px 14px;list-style:none;margin:8px 0;font-weight:700}
.tools{list-style:none;padding:0;margin:0 0 12px}
.tools li{border:2px solid var(--border);border-radius:10px;padding:12px 14px;background:var(--surface)}
.tools a{font-weight:700}

/* ---- the usage report's 1-to-5 scale ---- */
ol.scale{padding-left:1.4em}
ol.scale li{margin:0 0 18px}
ol.scale .q{margin:0 0 6px;font-weight:700}
ol.scale .row{max-width:20rem}
ol.scale .btns{display:flex;gap:6px}
ol.scale .btns label{flex:1;margin:0;display:flex;align-items:center;justify-content:center;min-width:44px;
  min-height:44px;border:2px solid var(--border);border-radius:8px;background:var(--surface)}
ol.scale .row input{position:absolute;opacity:0}
ol.scale .row label:has(input:checked){background:var(--btn-bg);color:var(--btn-ink);border-color:var(--text)}
ol.scale .row label:has(input:focus-visible){outline:3px solid var(--text)}
ol.scale .ends{display:flex;justify-content:space-between;padding:2px 2px 0}
ol.scale .hint{font-size:.8rem;color:var(--muted)}

/* ---- team look ---- */
.look .pair{display:flex;flex-wrap:wrap;gap:8px 28px}
.look .tick{font-weight:400;margin-top:8px}
.choice{border:2px solid var(--border);border-radius:10px;padding:10px 14px 14px;margin:18px 0 0;min-width:0}
.choice legend{font-weight:800;padding:0 6px}
.choice p{margin:8px 0 0;font-size:.88rem}
.choice .lbl{display:block;font-weight:700;margin:14px 0 6px}
.choice input[type=range]{width:100%;max-width:22rem;accent-color:var(--text)}
/* Nine places, laid out as the nine places they are. */
.places{display:grid;grid-template-columns:repeat(3,44px);gap:6px}
.places label{margin:0;width:44px;height:44px;position:relative;cursor:pointer}
.places input{position:absolute;inset:0;width:100%;height:100%;margin:0;opacity:0;cursor:pointer}
.places span{display:block;width:100%;height:100%;border:2px solid var(--border);border-radius:8px;background:var(--surface)}
.places input:checked+span{background:var(--text);border-color:var(--text)}
.places input:focus-visible+span{outline:3px solid var(--text);outline-offset:2px}
.look .actions{display:flex;flex-wrap:wrap;gap:10px;margin-top:18px;align-items:center}
.reset{margin-top:22px}
.previews{display:grid;grid-template-columns:repeat(auto-fit,minmax(230px,1fr));gap:14px}
/* Each preview carries its own tokens inline, so light and dark sit side by side. */
.preview{border:1px solid var(--border);border-radius:10px;overflow:hidden;background:var(--bg);color:var(--text)}
.pv-banner{background:var(--banner-bg);color:var(--banner-ink);padding:9px 12px;font-weight:800}
.pv-banner{display:flex;align-items:center;gap:8px}
.pv-banner img{width:26px;height:26px;border-radius:6px;background:#fff;object-fit:contain}
.pv-banner small{color:inherit;font-weight:400}
.held{display:flex;align-items:center;gap:10px;border:2px solid var(--border);border-radius:9px;padding:8px 10px;
  background:var(--surface);margin:10px 0 0}
.held img{width:44px;height:44px;border-radius:8px;background:#fff;object-fit:contain;flex:0 0 auto}
.pv-body{padding:12px;display:flex;flex-direction:column;gap:11px;align-items:flex-start;position:relative;min-height:190px}
.pv-body::before{content:"";position:absolute;inset:8px;z-index:0;pointer-events:none;
  background-image:var(--wm-image,none);background-repeat:no-repeat;
  background-position:var(--wm-place,center);background-size:var(--wm-size,50%) auto;
  opacity:var(--wm-opacity,0)}
.pv-body>*{position:relative;z-index:1}
.pv-head{background:var(--head-bg);color:var(--head-ink);box-shadow:var(--head-edge);padding:var(--head-pad);
  border-radius:var(--head-radius);border-bottom:var(--head-rule);font-weight:800}
.pv-text{margin:0;font-size:.86rem}
.pv-bars{display:flex;gap:3px;height:14px;width:100%}
.pv-bars i{display:block;border-radius:4px}
.pv-bars .one{background:var(--graph);box-shadow:var(--graph-edge)}
.pv-bars .two{background:var(--graph2);box-shadow:var(--graph2-edge)}
.pv-bars .rest{background:var(--surface2);box-shadow:inset 0 0 0 1px var(--border)}
.pv-row{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.pv-btn{background:var(--btn-bg);color:var(--btn-ink);padding:6px 12px;border-radius:7px;font-weight:800;font-size:.86rem}
.pv-bubble{background:var(--bubble-bg);color:var(--bubble-ink);padding:6px 11px;border-radius:12px 12px 3px 12px;font-size:.86rem}

/* ---- the login page: no shell ---- */
body.plain{padding:0 16px 64px}
.plain .wrap{max-width:32rem;margin:0 auto}
.plain header.top{display:flex;align-items:center;gap:10px;padding:14px 0;border-bottom:2px solid var(--border);margin-bottom:20px}
.plain header.top img{width:32px;height:32px}
.plain header.top .name{font-weight:800}
.plain h1{font-size:1.6rem;line-height:1.2;margin:.4em 0 .5em}

/* ---- narrow screens: stacked, never sideways ---- */
@media (max-width:900px){
  .shell{grid-template-columns:minmax(0,1fr);grid-template-rows:auto;
    grid-template-areas:"banner" "side" "main" "strip" "coach"}
  .side{flex-direction:row;flex-wrap:wrap;border-right:0;border-bottom:1px solid var(--border)}
  .side .fold{display:none}
  .shell.folded .side .l{display:inline}
  .coach{border-left:0;border-top:1px solid var(--border)}
  .main{padding:18px 16px 28px}
}

/* ---- roster, lineups, matches, phones ---- */
.rowform{display:flex;flex-wrap:wrap;gap:8px 10px;align-items:flex-end;margin:0 0 6px}
.rowform label{margin:0;display:flex;flex-direction:column;gap:3px;font-size:.88rem;flex:0 1 auto}
/* Inside a label the column runs downward, so the inputs' sideways flex sizes
   below would make them TALL. Here they size by width only. */
.rowform label:has(input[type=text]:not(.num)){flex:1 1 12rem}
.rowform label input[type=text]{flex:none;width:100%}
.rowform label input.num{width:5rem}
.rowform label.tick{flex-direction:row;align-items:center;gap:6px;font-weight:400;padding-bottom:10px}
.rowform input[type=text]{width:auto;min-width:0;flex:1 1 9rem}
.rowform input.num{flex:0 0 5rem;width:5rem}
.rowform.add{border:2px solid var(--border);border-radius:10px;padding:10px 12px;background:var(--surface)}
.rowform button.quiet{min-height:40px}
table.roster,table.matches,table.positions{border-collapse:collapse;width:100%;margin:12px 0}
table.roster th,table.matches th{text-align:left;font-size:.78rem;color:var(--muted);padding:4px 6px}
table.roster td{padding:6px 0;border-top:1px solid var(--border)}
table.matches td{padding:7px 6px;border-top:1px solid var(--border)}
table.positions th{text-align:left;padding:5px 10px 5px 0;white-space:nowrap;font-weight:700}
table.positions th label{display:inline;margin:0}
table.positions td{padding:5px 0;width:100%}
select{font:inherit;padding:8px;border:2px solid var(--border);border-radius:8px;background:var(--surface);color:var(--text);max-width:100%}
ul.lineups,ul.devices,ul.retired{list-style:none;padding:0;margin:8px 0;display:flex;flex-direction:column;gap:8px}
ul.lineups li,ul.devices li{border:2px solid var(--border);border-radius:10px;padding:10px 12px;background:var(--surface)}
ul.lineups .filled{font-size:.86rem}
ul.lineups .acts,ul.devices li{display:flex;flex-wrap:wrap;gap:10px;align-items:center}
ul.lineups .acts{margin-top:6px}
ul.devices li{justify-content:space-between}
form.inline{display:inline;margin:0}
.lineup label{font-weight:700}
.lineup .actions{display:flex;gap:14px;align-items:center;margin-top:10px}
.connect{display:flex;flex-wrap:wrap;gap:18px;align-items:center;border:2px solid var(--border);border-radius:12px;
  padding:14px;background:var(--surface)}
.connect img{background:#fff;border-radius:8px}
.connect .link{word-break:break-all;font-size:.86rem}

/* ---- my teams ---- */
.banner .who a.switch{color:inherit;font-size:.8rem;text-decoration:underline}
ul.myteams{list-style:none;padding:0;margin:8px 0;display:flex;flex-direction:column;gap:8px}
ul.myteams li{border:2px solid var(--border);border-radius:10px;padding:10px 12px;background:var(--surface);
  display:flex;flex-wrap:wrap;gap:8px 12px;align-items:center}
ul.myteams li[aria-current="true"]{box-shadow:inset 4px 0 0 var(--mark)}
ul.myteams .acts{margin-left:auto;display:flex;gap:8px;flex-wrap:wrap}
.confirm{border:2px solid var(--bad);border-radius:12px;padding:12px 14px;background:var(--surface);margin:12px 0}
.confirm h2{margin:0 0 8px}
.confirm .inline{margin-right:12px}
/* Confirming a removal is the one button here that cannot be undone, so it is
   the product's colour for danger, never the team's. */
.confirm button{background:var(--bad);color:var(--surface)}
