/* Bolster screen parts. Colours and fonts come from the client's brand file (clients/<name>/brand/*.css),
   which sets these variables; core never names a client's colours. */
:root {
  --bg: var(--brand-bg, #f6f5f2);
  --panel: var(--brand-panel, #ffffff);
  --ink: var(--brand-ink, #1f2328);
  --muted: var(--brand-muted, #5f656d);
  --line: var(--brand-line, #e2e0da);
  --primary: var(--brand-primary, #2d5f8b);
  --primary-ink: var(--brand-primary-ink, #ffffff);
  --accent: var(--brand-accent, #8a5a00);
  --ok: var(--brand-ok, #2e6b3a);
  --bad: var(--brand-bad, #a3271c);
  --info-bg: var(--brand-info-bg, #eef3f8);
  --warn-bg: var(--brand-warn-bg, #fff4e0);
  --head-font: var(--brand-head-font, Georgia, serif);
  --body-font: var(--brand-body-font, system-ui, -apple-system, "Segoe UI", sans-serif);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 16px/1.5 var(--body-font); min-height: 100vh; display: flex; flex-direction: column; }
h1, h2, h3 { font-family: var(--head-font); line-height: 1.2; font-weight: 500; }
h1 { font-size: 28px; margin: 6px 0 14px; }
h2 { font-size: 20px; margin: 0 0 12px; }
a { color: var(--primary); }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[hidden] { display: none !important; }

.top { display: flex; align-items: center; gap: 16px; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.top .home { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); }
.top .logo { height: 40px; width: auto; }
.top .studio { font-family: var(--head-font); font-size: 20px; }
.top .who { color: var(--muted); font-size: 14px; }
.menu { display: flex; gap: 4px 14px; flex-wrap: wrap; align-items: center; margin-left: auto; }
.menu a { text-decoration: none; color: var(--ink); padding: 4px 2px; border-bottom: 2px solid transparent; }
.menu a:hover { border-bottom-color: var(--primary); }
.wrap { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 16px 20px 24px; }

/* Grouped menu (settings "ui", Ui.groupedNav): one line of sections, search, + New and the account menu; one row of
   sub-tabs under it. Below 860px the sections and search fold into the Menu dropdown. */
.top.grouped { flex-wrap: nowrap; gap: 12px; padding: 8px 20px; min-height: 56px; position: sticky; top: 0; z-index: 20; }
.top.grouped .logo { height: 32px; }
.top.grouped .studio { font-size: 18px; font-weight: 600; white-space: nowrap; }
/* The sections never push the page sideways: they shrink, and as a last resort scroll inside their own box. Entries
   in no group sit in the "More" dropdown just after them (outside that box, so its panel isn't cut off). */
.sections { display: flex; gap: 2px; align-items: center; min-width: 0; flex: 0 1 auto; overflow-x: auto; scrollbar-width: none; }
.sections::-webkit-scrollbar { display: none; }
.nav-more { flex: none; }
.nav-more > summary { color: var(--muted); padding: 6px 12px; border-radius: 8px; white-space: nowrap; font-size: 15px; font-weight: 500; }
.nav-more > summary::after { content: " ▾"; font-size: 12px; }
.nav-more > summary:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 6%, transparent); }
.nav-more > summary.on { background: var(--primary); color: var(--primary-ink); }
.top.grouped { min-width: 0; max-width: 100%; }
.top.grouped > .home { flex: none; }
.sections a { text-decoration: none; color: var(--muted); padding: 6px 12px; border-radius: 8px; white-space: nowrap; font-size: 15px; font-weight: 500; }
.sections a:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 6%, transparent); }
.sections a.on { background: var(--primary); color: var(--primary-ink); }
.nav-search { flex: 1 1 200px; min-width: 140px; max-width: 320px; margin: 0; }
.nav-search input { width: 100%; }
.nav-search input { margin: 0; padding: 6px 12px; font-size: 15px; min-height: 36px; background: var(--bg); }
.nav-end { display: flex; align-items: center; gap: 8px; margin-left: auto; flex: none; }
.nav-new { white-space: nowrap; }
details.drop { position: relative; }
details.drop > summary { list-style: none; cursor: pointer; }
details.drop > summary::-webkit-details-marker { display: none; }
.drop-panel { position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; min-width: 220px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 6px; box-shadow: 0 8px 24px rgb(0 0 0 / .18); display: flex; flex-direction: column; }
.drop-panel.right { left: auto; right: 0; }
.drop-panel > a, .drop-panel button.link { display: block; text-align: left; text-decoration: none; color: var(--ink); padding: 8px 10px; border-radius: 6px; font-size: 15px; width: 100%; }
.drop-panel > a:hover, .drop-panel button.link:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); }
.drop-panel form { margin: 0; border-top: 1px solid var(--line); margin-top: 4px; padding-top: 4px; }
.drop-who { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; display: flex; flex-direction: column; font-size: 14px; overflow-wrap: anywhere; }
.account > summary { display: block; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; background: color-mix(in srgb, var(--ink) 12%, var(--panel));
  color: var(--ink); font-size: 14px; font-weight: 600; border: 1px solid var(--line); }
.nav-small { display: none; }
.nav-small > summary { padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); font-size: 15px; }
.nav-small .drop-panel { left: auto; right: 0; min-width: 260px; max-height: 75vh; overflow-y: auto; }
.nav-small .nav-search { max-width: none; padding: 4px 4px 8px; }
.small-section { display: block; font-weight: 600; color: var(--ink); text-decoration: none; padding: 8px 10px 4px; font-size: 15px; }
.small-group { display: flex; flex-direction: column; padding-bottom: 4px; }
.small-group > a { text-decoration: none; color: var(--ink); padding: 6px 10px 6px 22px; font-size: 15px; border-radius: 6px; }
.small-group > a:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); }
.subtabs { background: var(--panel); border-bottom: 1px solid var(--line); }
.subtabs-in { max-width: 1180px; margin: 0 auto; padding: 0 20px; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.subtabs a { text-decoration: none; color: var(--muted); padding: 9px 10px 7px; border-bottom: 2px solid transparent; white-space: nowrap; font-size: 15px; }
.subtabs a:hover { color: var(--ink); }
.subtabs a.on { color: var(--ink); border-bottom-color: var(--primary); font-weight: 600; }
/* Narrow desktops (861-1180px): tighter sections and a smaller search box, so 8 sections still fit beside it. */
@media (max-width: 1180px) {
  .top.grouped { gap: 8px; padding: 8px 14px; }
  .sections a, .nav-more > summary { padding: 6px 8px; font-size: 14px; }
  .nav-search { flex: 1 1 140px; min-width: 110px; }
}
@media (max-width: 860px) {
  .top.grouped .sections, .top.grouped .nav-more, .top.grouped .nav-search.in-bar { display: none; }
  .nav-small { display: block; }
  .top.grouped { padding: 8px 16px; }
  .subtabs-in { padding: 0 16px; }
}
.foot { padding: 10px 16px; font-size: 12px; text-align: center; }

.banner { background: var(--accent); color: #fff; text-align: center; font-size: 14px; padding: 6px 16px; }
.demo-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; margin-bottom: 14px; }
.card > h2:first-child { font-size: 17px; font-weight: 600; margin-bottom: 10px; }
.card > :last-child { margin-bottom: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.cards a.card { display: block; text-decoration: none; color: var(--ink); margin: 0; }
.cards a.card:hover { border-color: var(--primary); }
/* the home with a module's own top (modules/Homes): every page folded away under it */
.home-all { margin: 24px 0 8px; }
.home-all > summary { cursor: pointer; min-height: 44px; line-height: 44px; font-weight: 600; color: var(--muted); }
.home-all[open] > summary { margin-bottom: 8px; }
.notice { border-radius: 8px; padding: 10px 14px; margin: 0 0 14px; background: var(--info-bg); }
.notice.ok { border-left: 4px solid var(--ok); }
.notice.bad { border-left: 4px solid var(--bad); background: var(--warn-bg); }
.notice.info { border-left: 4px solid var(--primary); }
.pill { display: inline-block; font-size: 12px; border-radius: 999px; padding: 1px 8px; border: 1px solid var(--line); color: var(--muted); vertical-align: middle; white-space: nowrap; }
.pill.ok { border-color: var(--ok); color: var(--ok); }
.pill.bad { border-color: var(--bad); color: var(--bad); }
.pill.info { border-color: var(--primary); color: var(--primary); }

button { font: inherit; cursor: pointer; border: 1px solid var(--primary); background: var(--primary); color: var(--primary-ink); border-radius: 8px; padding: 8px 14px; min-height: 40px; }
button.ghost { background: transparent; color: var(--primary); }
button.link { background: none; border: none; color: var(--primary); padding: 0; min-height: 0; text-decoration: underline; }
button.small { padding: 3px 10px; min-height: 32px; font-size: 14px; }
button:disabled { opacity: .55; cursor: default; }
a.button, summary.button { display: inline-flex; align-items: center; text-decoration: none; border: 1px solid var(--primary); background: var(--primary); color: var(--primary-ink); border-radius: 8px; padding: 8px 14px; min-height: 40px; box-sizing: border-box; }
a.button.secondary, button.secondary { background: transparent; color: var(--primary); }
a.button.ghost { background: transparent; color: var(--primary); border-color: transparent; text-decoration: underline; }
a.button.small, summary.button.small { padding: 3px 10px; min-height: 32px; font-size: 14px; }
form.inline { display: inline; margin: 0; }
form.stack { display: grid; gap: 12px; max-width: 520px; }
label { display: block; font-size: 14px; color: var(--muted); }
input, select, textarea { font: inherit; font-size: 16px; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%; margin-top: 4px; }
input[type=checkbox], input[type=radio] { width: auto; margin: 0; }
label:not([class]):has(> input[type=radio]:first-child), label:not([class]):has(> input[type=checkbox]:first-child) { display: flex; align-items: center; gap: 8px; min-height: 44px; }

/* filter bars: a GET form of fields side by side; labels above their control, the button on the same line */
form.filters, .filters { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: flex-end; margin: 0 0 14px; }
.filters label { flex: 0 1 220px; }
.filters input, .filters select { min-height: 38px; padding: 6px 10px; }
.filters button { min-height: 38px; padding: 6px 14px; }

.table-wrap { overflow-x: auto; }
table.data { border-collapse: collapse; width: 100%; font-size: 14px; }
table.data th, table.data td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.data th { font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; text-transform: uppercase; letter-spacing: .03em; }
table.data tbody tr:hover { background: color-mix(in srgb, var(--ink) 4%, transparent); }
table.data tbody tr:last-child td { border-bottom: none; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.neg { color: var(--bad); }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.stat-value { font-family: var(--head-font); font-size: 24px; }
.stat-label { font-size: 13px; color: var(--muted); }

.chart { margin: 0 0 16px; }
.chart figcaption { font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.hbar { display: grid; grid-template-columns: minmax(140px, 32%) 1fr; gap: 10px; align-items: center; padding: 3px 0; font-size: 14px; }
.hbar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { display: flex; align-items: center; min-width: 0; }
.hbar-track.split .hbar-neg, .hbar-track.split .hbar-pos { width: 50%; }
.hbar-pos { flex: 1; display: flex; align-items: center; gap: 6px; min-width: 0; }
.hbar-neg { display: flex; flex-direction: row-reverse; align-items: center; gap: 6px; border-right: 1px solid var(--line); min-width: 0; }
.hbar .bar { display: block; height: 16px; min-width: 2px; border-radius: 3px; background: var(--primary); flex: none; }
.hbar .bar.neg { background: var(--bad); }
.hbar em { font-style: normal; font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }
form.inline label.inline-label { display: inline-flex; align-items: center; gap: 6px; }
form.inline label.inline-label input { margin-top: 0; }

.todos { list-style: none; padding: 0; margin: 0; }
.todos li { display: flex; gap: 12px; justify-content: space-between; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.todos li p { margin: 4px 0 0; }
.grid-avail { border-collapse: collapse; }
.grid-avail th, .grid-avail td { padding: 6px 10px; text-align: center; border-bottom: 1px solid var(--line); }

@media (max-width: 640px) {
  .hbar { grid-template-columns: 1fr; gap: 2px; padding: 4px 0; }
  table.data th, table.data td { white-space: nowrap; }
  table.data.stacked, table.data.stacked tbody { display: block; width: 100%; }
  table.data.stacked thead { display: none; }
  table.data.stacked td > .cv { min-width: 0; overflow-wrap: anywhere; }
  table.data.stacked tr { display: block; padding: 8px 0; border-bottom: 1px solid var(--line); }
  table.data.stacked td { display: flex; justify-content: space-between; gap: 12px; border: none; padding: 3px 0; text-align: right; white-space: normal; }
  table.data.stacked td::before { content: attr(data-label); color: var(--muted); font-size: 13px; text-align: left; flex-shrink: 0; }
  table.data.stacked td:empty { display: none; }
  .menu { margin-left: 0; width: 100%; }
  h1 { font-size: 24px; }
  .wrap { padding: 12px 16px; }
}
/* Team page (core/Team.fs): role tick boxes, sign-in addresses */
fieldset.roles { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin: 0; }
fieldset.roles legend { font-size: 14px; color: var(--muted); padding: 0 4px; }
label.check { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 16px; color: var(--ink); padding: 8px 0; min-height: 40px; }
label.check .muted { font-size: 14px; }
ul.team-addresses { list-style: none; padding: 0; margin: 0 0 12px; }
ul.team-addresses li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 6px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }

/* Owner settings page (modules/OwnerSettings): tabs, two-column fields, teacher rows, history */
.page-tabs { display: flex; flex-wrap: wrap; gap: 4px 6px; margin: 4px 0 12px; }
.page-tabs a { text-decoration: none; color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: 14px; background: var(--panel); }
.page-tabs a.on { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
form.settings { display: grid; gap: 14px; max-width: 760px; }
.fgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 18px; }
.fgrid .wide { grid-column: 1 / -1; }
.fgrid .help, form.settings .help { font-size: 13px; color: var(--muted); margin: 2px 0 0; }
details.trow { border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; background: var(--panel); }
details.trow summary { cursor: pointer; padding: 6px 0; min-height: 32px; }
details.trow[open] summary { margin-bottom: 8px; }
ul.changes { margin: 0; padding-left: 18px; }
ul.changes li { overflow-wrap: anywhere; }
@media (max-width: 640px) { .fgrid { grid-template-columns: 1fr; } }

/* long addresses and keys (callback URLs, tokens) wrap on a phone instead of pushing the page sideways */
code, kbd, samp { overflow-wrap: anywhere; word-break: break-word; }
/* Settings → Studio: brand colour boxes */
.color-row { display: flex; gap: 8px; align-items: center; }
.color-row input { flex: 1; }
.swatch { width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--line, #ccc); flex: none; }
