/* ========================================================================================================
   The Classlings "side list" page: what the School directory and the Admin page share (the teacher,
   14 October 2026: School directory option B, "a side list"; Admin in the same look).
   The shape is the Cup's Settings page: the page's title and Home in a column down the left, with the sections
   under the title (each saying what needs you), and the chosen section filling a tall panel on the right, so
   every list gets the full height of the window. On a phone the sections go across the top.
   Tokens are Login cards' (apps/pupil-access/app.css). Buttons, text boxes and question boxes are the shared
   controls standard (shared/css/classlings-controls.css), never copied here. Fredoka for headings, buttons and
   labels; Atkinson Hyperlegible for reading. Pixel icons from the kit only, written into the page by
   scripts/directory-inline.mjs so they are there from the first frame. Nothing here moves on its own.
   A page uses it with <body class="cla-page">.
   ======================================================================================================== */

body.cla-page {
    --page: #ffffff;
    --ink: #1e1b3a;
    --ink-2: #4a4766;
    --wash: #f3f2f9;
    --wash-2: #e4e1f1;
    --sky: #3aa0ff;       --sky-deep: #1b6fcf;       --sky-tint: #e1efff;
    --grape: #a07cff;     --grape-deep: #6a45dc;     --grape-tint: #eee8ff;
    --lime: #7ed957;      --lime-deep: #3e9a2a;      --lime-tint: #e5f8da;
    --tangerine: #ff8a3d; --tangerine-deep: #cf5a12; --tangerine-tint: #ffeddf;
    --gold: #f7c230;      --gold-deep: #c98a12;      --gold-tint: #fff3c4;
    --scrim: rgba(30, 27, 58, 0.45);
    --float: 0 8px 0 rgba(30, 27, 58, 0.13);
    --display: 'Fredoka', 'Atkinson Hyperlegible', system-ui, sans-serif;
    --body: 'Atkinson Hyperlegible', system-ui, sans-serif;
    --gutter: 32px;
    --r-s: 14px;
    --r-m: 20px;
    --r-l: 28px;
    --edge: 3px;
    /* What's chosen wears sky, as Login cards' choices do; gold is only ever the main action. */
    --pick: var(--sky);   --pick-deep: var(--sky-deep); --pick-tint: var(--sky-tint);

    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    margin: 0;
    overflow: hidden;
    color: var(--ink);
    background: var(--page);
    font: 400 18px / 1.4 var(--body);
    letter-spacing: 0.01em;
    -webkit-font-smoothing: antialiased;
}

/* The page's base rules weigh nothing (:where), so every rule below wins over them. */
:where(body.cla-page) :where(*, *::before, *::after) { box-sizing: border-box; }
:where(body.cla-page) :where(h1, h2, h3, h4, p, ul, ol, figure, dl, dd) { margin: 0; padding: 0; }
:where(body.cla-page) :where(ul, ol) { list-style: none; }
:where(body.cla-page) :where(button, input, select, textarea) { color: inherit; }
:where(body.cla-page) :focus-visible { outline: 4px solid var(--ink); outline-offset: 4px; }
:where(body.cla-page) :where(svg) { display: block; flex: none; image-rendering: pixelated; }
body.cla-page .ic { display: inline-flex; flex: none; align-items: center; justify-content: center; }
body.cla-page [hidden], body.cla-page .hidden { display: none !important; }
.pg-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* A button's pixel icon is the size its picture says (12-wide art at 24 px, 8-wide at 16 or 24): always a whole number of
   screen pixels to an art pixel, so never stretched here. */
/* ------------------------------------------------------------------ the page: a side list and a panel */
.pg-wrap {
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: 296px minmax(0, 1fr);
    gap: 24px;
    min-height: 0;
    padding: 16px var(--gutter);
}

.pg-side { display: flex; flex-direction: column; gap: 14px; min-height: 0; }
.pg-name { display: grid; gap: 4px; padding: 2px 4px 0; }
/* The lettering at 2 screen pixels per art pixel (40 px tall); its bottom 4 art pixels are room for tails. */
.pg-title { --title-scale: 2; margin: 0 0 calc(var(--title-scale) * -4px); line-height: 0; white-space: nowrap; }
.pg-title svg { width: calc(var(--title-scale) * var(--w) * 1px); height: calc(var(--title-scale) * var(--h) * 1px); }
.pg-about { min-width: 0; font: 600 20px / 1.2 var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pg-home svg { width: 32px; height: 32px; }
.pg-side .pg-home { margin-top: auto; align-self: flex-start; }

.pg-secs { display: grid; gap: 6px; }
.pg-sec {
    appearance: none; display: grid; grid-template-columns: 40px minmax(0, 1fr) 16px; grid-template-rows: auto auto;
    align-content: center; column-gap: 12px; min-height: 72px; padding: 6px 12px;
    font: inherit; color: var(--ink); text-align: left; background: var(--wash);
    border: var(--edge) solid transparent; border-radius: var(--r-m); cursor: pointer;
}
.pg-sec > .ic:first-child { grid-row: 1 / span 2; align-self: center; justify-self: center; }
.pg-sec b { font: 600 20px / 1.2 var(--display); }
.pg-sec small { grid-column: 2; font: 400 16px / 1.25 var(--body); color: var(--ink-2); }
.pg-sec > .pg-arrow { grid-column: 3; grid-row: 1 / span 2; align-self: center; visibility: hidden; }
.pg-badge { display: none; }
.pg-sec.is-on { background: var(--pick-tint); border-color: var(--pick-deep); box-shadow: inset 0 0 0 var(--edge) var(--pick-deep); }
.pg-sec.is-on > .pg-arrow { visibility: visible; }
/* What needs you: the words, on gold's tint. */
.pg-flag { padding: 0 4px; font-weight: 700; color: var(--ink); background: var(--gold-tint); border-radius: 6px; box-shadow: inset 0 0 0 1.5px var(--gold-deep); }

.pg-pane {
    display: flex; flex-direction: column; min-width: 0; min-height: 0;
    background: var(--page); border: var(--edge) solid var(--wash-2); border-radius: var(--r-l); overflow: hidden;
}
.pg-view { display: none; flex: 1 1 auto; flex-direction: column; min-height: 0; }
.pg-view.is-on { display: flex; }
.pg-top { flex: none; display: flex; min-height: 90px; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 20px 12px 28px; border-bottom: 2px solid var(--wash-2); }
.pg-top-words { display: grid; gap: 2px; min-width: 0; }
.pg-top-acts { flex: none; display: flex; align-items: center; gap: 12px; }
.pg-top-acts .cla-btn { margin-bottom: var(--ctl-lift); }
.pg-top-acts .cla-btn.is-quiet { margin-bottom: 0; }
.pg-scroll { flex: 1 1 auto; min-height: 0; padding: 12px 28px 20px; overflow-y: auto; overscroll-behavior: contain; }
.pg-acts { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.pg-acts .cla-btn:not(.is-quiet) { margin-bottom: var(--ctl-small-lift); }

/* Section headings and their small line. */
.pg-h2 { font: 700 28px / 1.15 var(--display); }
.pg-h3 { font: 600 20px / 1.2 var(--display); }
.pg-line { font: 400 16px / 1.35 var(--body); color: var(--ink-2); }
.pg-count { font: 600 18px / 1.1 var(--display); color: var(--ink-2); }

/* A message about what just happened floats over the top of the page, so nothing moves under the pointer.
   One that something worked goes by itself; one that something didn't stays. */
.pg-float { position: fixed; top: 12px; right: var(--gutter); left: var(--gutter); z-index: 30; display: flex; justify-content: center; pointer-events: none; }
.pg-status {
    max-width: 720px; padding: 10px 18px; font: 600 20px / 1.25 var(--display); color: var(--ink);
    background: var(--wash); border: 2px solid var(--wash-2); border-radius: var(--r-s); box-shadow: var(--float); pointer-events: auto;
}
.pg-status.success { background: var(--lime-tint); border-color: var(--lime-deep); }
.pg-status.error { background: var(--tangerine-tint); border-color: var(--tangerine-deep); }

/* Something still loading, or nothing to show: a few plain words in the middle of the panel. */
.pg-empty { display: grid; align-content: center; justify-items: start; gap: 6px; min-height: 160px; padding: 24px 4px; }
.pg-empty .pg-h3 { font-size: 22px; }

/* ------------------------------------------------------------------ people */
/* Staff have no Classlings: a plain initial in a soft square. */
.who-pic {
    display: grid; flex: none; place-items: center; width: 44px; height: 44px;
    font: 700 20px / 1 var(--display); color: var(--ink);
    background: var(--wash); border: 2px solid var(--wash-2); border-radius: 12px;
}
.who-pic.is-waiting { background: var(--page); border-color: var(--gold-deep); }
.who-pic.is-invited { background: var(--page); border-style: dashed; border-color: var(--ink-2); color: var(--ink-2); }
.who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.who-text { display: grid; min-width: 0; }
.who-name { font: 600 19px / 1.2 var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-name small { margin-left: 6px; font: 400 16px / 1 var(--body); color: var(--ink-2); }
.who-mail { font: 400 16px / 1.3 var(--body); color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* A role: its word, and for the owner the kit's crown. Colour always comes with the word. */
.role {
    display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 2px 10px;
    font: 600 16px / 1.1 var(--display); white-space: nowrap;
    background: var(--page); border: 2px solid var(--wash-2); border-radius: 10px;
}
.role svg { width: 24px; height: 24px; }
.role.is-owner { background: var(--gold-tint); border-color: var(--gold-deep); padding-left: 6px; }
.role.is-leader { background: var(--sky-tint); border-color: var(--sky-deep); }

/* A class, as a small tag. */
.chips { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.chip {
    display: inline-flex; align-items: center; gap: 4px; min-height: 30px; max-width: 100%; padding: 2px 10px;
    font: 600 16px / 1.1 var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    background: var(--wash); border: 2px solid var(--wash); border-radius: 10px;
}

.seen { display: inline-flex; align-items: center; gap: 6px; font: 400 16px / 1.3 var(--body); color: var(--ink-2); white-space: nowrap; }
.seen svg { width: 24px; height: 24px; }
.seen.is-long { color: var(--ink); font-weight: 700; }

/* "Main" on the school's main email address. */
.tag {
    display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px;
    font: 600 15px / 1.3 var(--display); background: var(--lime-tint); border: 2px solid var(--lime-deep); border-radius: 8px; white-space: nowrap;
}
.tag svg { width: 24px; height: 24px; }

/* A notice (something that needs you): one compact row, its button 40 px tall (the controls standard). */
.pg-notice {
    display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 4px 6px 4px 12px;
    font: 600 18px / 1.2 var(--display);
    background: var(--gold-tint); border: 2px solid var(--gold-deep); border-radius: var(--r-s);
}
.pg-notice > .ic svg { width: 24px; height: 24px; }
.pg-notice > span:not(.ic) { flex: 1 1 auto; min-width: 0; padding: 4px 0; }
.pg-notice .cla-btn { min-height: 40px; }
.pg-notice.is-plain { background: var(--wash); border-color: var(--wash-2); }
.pg-notice.is-error { background: var(--tangerine-tint); border-color: var(--tangerine-deep); }

/* A search box: the kit's magnifier inside the controls standard's text box. */
.pg-search { position: relative; display: block; min-width: 0; }
.pg-search .cla-field { padding-left: 46px; }
.pg-search .ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-2); pointer-events: none; }
.pg-search .ic svg { width: 24px; height: 24px; }

/* A drop-down: a text box with the kit's little arrow, as Login cards' class picker. */
select.cla-field {
    appearance: none;
    padding-right: 44px;
    text-overflow: ellipsis;
    cursor: pointer;
    background: var(--ctl-page) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8' width='16' height='16' shape-rendering='crispEdges'%3E%3Cpath fill='%231e1b3a' d='M0 2h2v1h-2zM6 2h2v1h-2zM1 3h2v1h-2zM5 3h2v1h-2zM2 4h4v1h-4zM3 5h2v1h-2z'/%3E%3C/svg%3E") right 14px center / 16px 16px no-repeat;
}
.pg-select { display: block; min-width: 0; }

/* A choice of a few: the pale track with the chosen one in sky and ticked. */
.pick { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--wash); border-radius: calc(var(--r-m) + 4px); }
.pick > button {
    appearance: none; display: inline-flex; align-items: center; gap: 8px; min-height: var(--ctl-tab-h); padding: 0 16px;
    font: 600 18px / 1 var(--display); color: var(--ink); white-space: nowrap; background: transparent;
    border: var(--edge) solid transparent; border-radius: var(--r-m); cursor: pointer;
}
.pick > button svg { width: 24px; height: 24px; }
.pick > button.is-on { background: var(--pick); border-color: var(--pick-deep); }

/* ------------------------------------------------------------------ "are you sure?" */
/* The Classlings question box (Login cards' askBox): Not now on the left, the action on the right, gold,
   or danger red when it removes someone. */
.pg-ask {
    width: min(560px, calc(100vw - 32px)); max-width: none; max-height: calc(100dvh - 32px);
    padding: 24px 28px 22px; overflow-y: auto; color: var(--ink);
}
.pg-ask::backdrop { background: var(--scrim); }
.pg-ask:focus { outline: none; }
.pg-ask h2 { font: 700 28px / 1.15 var(--display); overflow-wrap: anywhere; }
.pg-ask > p { margin: 8px 0 20px; color: var(--ink-2); }
.pg-ask > p:empty { display: none; }
.pg-ask .cla-ask-actions { margin-top: 20px; }
.pg-ask .cla-ask-actions .cla-btn { flex: none; }
.ask-q { display: grid; gap: 8px; margin-bottom: 4px; }
.ask-q label, .ask-q .ask-label { font: 600 20px / 1.2 var(--display); }
.ask-hint { min-height: 22px; font: 400 16px / 1.35 var(--body); color: var(--tangerine-deep); }
.ask-hint:empty { display: none; }

/* ------------------------------------------------------------------ a phone, and anything that narrow */
@media (max-width: 899px) {
    body.cla-page { --gutter: 16px; }
    .pg-wrap { display: flex; flex-direction: column; gap: 12px; padding: 12px var(--gutter) 12px; }
    .pg-side { display: grid; flex: none; min-height: auto; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 10px 12px; }
    .pg-name { grid-column: 1; grid-row: 1; }
    .pg-side .pg-home { grid-column: 2; grid-row: 1; margin-top: 0; align-self: end; }
    .pg-secs { grid-column: 1 / -1; grid-row: 2; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
    .pg-sec { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto; justify-items: center; align-content: center; gap: 0; min-height: 68px; padding: 6px 4px; text-align: center; }
    .pg-sec > .ic:first-child { grid-row: 1; }
    .pg-sec .ic:first-child svg { width: 24px; height: auto; }
    .pg-sec b { grid-column: 1; grid-row: 2; font-size: 17px; }
    .pg-sec small, body.cla-page .pg-sec > .pg-arrow { display: none; }
    .pg-sec { position: relative; }
    .pg-badge { display: grid; position: absolute; top: 2px; right: 2px; min-width: 22px; height: 22px; padding: 0 5px; place-items: center; font: 700 15px / 1 var(--display); background: var(--gold); border: 2px solid var(--gold-deep); border-radius: 11px; }
    .pg-top { flex-wrap: wrap; gap: 8px 12px; min-height: 0; padding: 12px 14px 10px 16px; }
    .pg-top-acts { flex: 1 1 100%; flex-wrap: wrap; }
    .pg-top-acts .pg-search { flex: 1 1 160px; }
    .pg-scroll { padding: 10px 14px 16px; }
    .pg-h2 { font-size: 24px; }
    .pg-float { top: 8px; }
    .pg-status { font-size: 18px; }
    .pg-ask { padding: 20px 20px 18px; }
    .pg-ask .cla-ask-actions { flex-wrap: nowrap; gap: 12px; }
    .pg-ask .cla-ask-actions .cla-btn { flex: 1 1 auto; padding: 0 14px; }
}

/* A big board: a wider side list and more room round the page. */
@media (min-width: 1600px) {
    .pg-wrap { grid-template-columns: 340px minmax(0, 1fr); gap: 32px; padding: 24px 40px; }
    body.cla-page { --gutter: 40px; }
}
