/* Trust accounts (stage 5): the licence page, the trust dashboard and the read-only school view.
   Tokens come from 1265.css; every colour here is a token, so light and dark both work. */
.trust-app [hidden], .lic [hidden], .shared [hidden] { display: none !important; }

/* ---------- Shared pieces ---------- */
.t-field { display: grid; gap: 6px; min-width: 0; }
.t-field > span, .t-field > label { font-weight: 650; font-size: var(--step--1); }
.t-field small { color: var(--muted); font-size: var(--step--2); line-height: 1.45; }
.t-field input, .t-field select, .t-field textarea { font: inherit; font-size: 16px; color: var(--ink); background: var(--surface-2); border: 1.5px solid var(--line-strong); border-radius: 10px; padding: 10px 12px; min-height: 46px; width: 100%; min-width: 0; box-sizing: border-box; }
.t-field textarea { min-height: 96px; resize: vertical; }
.t-field input:focus-visible, .t-field select:focus-visible, .t-field textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; border-color: transparent; }
.t-field.is-bad input, .t-field.is-bad select, .t-field.is-bad textarea { border-color: var(--over); }
.t-err { margin: 0; color: var(--over); font-weight: 650; font-size: var(--step--1); }
.t-tick { display: flex; gap: 10px; align-items: flex-start; font-size: var(--step--1); }
.t-tick input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--ink); flex: none; }
.t-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: clamp(18px, 3vw, 32px); }
.t-note { font-size: var(--step--1); color: var(--ink-2); }
.t-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font: 600 var(--step--2)/1.4 var(--font-mono); background: var(--bg-tint); color: var(--ink-2); white-space: nowrap; }
.t-pill.is-admin { background: var(--ink); color: var(--bg); }

/* Role status words, the same three colours as the check */
.st { display: inline-flex; align-items: center; gap: 6px; font-weight: 650; font-size: var(--step--2); padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.st::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: currentColor; }
.st-under { background: var(--under-soft); color: var(--under); }
.st-tight { background: var(--band-soft); color: var(--band); }
.st-over { background: var(--over-soft); color: var(--over); }
.st-outside, .st-none { background: var(--bg-tint); color: var(--muted); }

/* A role's two readings against its limit: a slim range bar. --lo, --hi, --lim and --max are set inline. */
.rbar { position: relative; height: 12px; border-radius: 4px; background: var(--cell-empty); }
.rbar i { position: absolute; top: 0; bottom: 0; }
.rbar .rb-lo { background: var(--cell-fill); }
.rbar .rb-hi { background: var(--cell-band); }
.rbar .rb-over { background: var(--cell-over); }
.rbar .rb-limit { width: 2px; margin-left: -1px; background: var(--ink); top: -2px; bottom: -2px; }

/* ---------- The licence page ---------- */
.lic-bands { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-3); margin: var(--space-6) 0 var(--space-3); padding: 0; list-style: none; }
.lic-band { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: var(--space-5); display: grid; gap: var(--space-2); align-content: start; transition: border-color var(--dur-2) var(--ease-out), box-shadow var(--dur-2) var(--ease-out), transform var(--dur-2) var(--ease-out); }
.lic-band b { font: 700 var(--step-3)/1 var(--font-display); letter-spacing: -0.02em; }
.lic-band span { font-weight: 650; }
.lic-band small { color: var(--muted); font-size: var(--step--2); }
.lic-band.is-chosen { border-color: var(--ink); box-shadow: inset 0 5px 0 var(--mark), var(--shadow-2); transform: translateY(-2px); }
.lic-placeholder { font-size: var(--step--2); color: var(--muted); margin: 0 0 var(--space-6); }
.lic-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); gap: var(--space-7); align-items: start; }
.lic-list { list-style: none; margin: 0 0 var(--space-5); padding: 0; display: grid; gap: 10px; }
.lic-list li { padding-left: 26px; position: relative; color: var(--ink-2); }
.lic-list li::before { content: ""; position: absolute; left: 2px; top: 0.4em; width: 12px; height: 12px; border-radius: 3px; background: var(--mark); }
.lic-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-4); }
.lic-form .btn, .lic-done .btn { white-space: normal; text-align: center; justify-content: center; }
.lic-form h2 { font-size: var(--step-3); margin: 0; }
.lic-form fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: var(--space-4); min-width: 0; }
.lic-form legend { font: 650 var(--step-1)/1.3 var(--font-display); padding: 0; margin-bottom: var(--space-2); }
.lic-two { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); align-items: start; }
.lic-total { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); padding: var(--space-4); border-radius: var(--radius); background: var(--mark-soft); color: #111315; }
.lic-total b { font: 700 var(--step-3)/1 var(--font-display); }
.lic-done { display: grid; gap: var(--space-4); }
.lic-done h2 { font-size: var(--step-4); margin: 0; letter-spacing: -0.02em; }
.lic-steps { margin: 0; padding-left: 1.3em; display: grid; gap: 8px; }
.lic-data { margin-top: var(--space-8); }
.lic-data h2 { font-size: var(--step-3); }
.lic-data-grid { margin-bottom: var(--space-5); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4); margin-top: var(--space-5); }
.lic-data-grid h3 { font-size: var(--step-1); margin: 0 0 var(--space-2); }
.lic-data-grid > div { padding: var(--space-4) 0; border-top: 1px solid var(--line); }
.lic-data-grid p { margin: 0; font-size: var(--step--1); color: var(--ink-2); }
@media (max-width: 900px) { .lic-bands { grid-template-columns: repeat(2, minmax(0, 1fr)); } .lic-grid, .lic-data-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 520px) { .lic-two { grid-template-columns: minmax(0, 1fr); } .lic-band { padding: var(--space-4); } }

/* ---------- The trust dashboard ---------- */
.trust-app { padding: var(--space-6) 0 var(--space-8); }
.t-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-5); }
.t-head h1 { font-size: var(--step-4); line-height: 1.05; letter-spacing: -0.025em; margin: var(--space-2) 0 0; overflow-wrap: anywhere; }
.t-head h1:focus { outline: none; }
.t-who { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); font-size: var(--step--1); color: var(--muted); }
.t-who b { color: var(--ink); overflow-wrap: anywhere; }
.t-licence { margin: 0 0 var(--space-5); }
.t-tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); margin-bottom: var(--space-5); -webkit-overflow-scrolling: touch; }
.t-tabs::-webkit-scrollbar { display: none; }
.t-tab { font: 650 var(--step--1)/1 var(--font-body); color: var(--muted); background: none; border: 0; border-bottom: 3px solid transparent; padding: 14px 14px 12px; cursor: pointer; white-space: nowrap; }
.t-tab:hover { color: var(--ink); }
.t-tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--mark); }
.t-tab:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; border-radius: 6px; }
.t-tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--space-3); margin-bottom: var(--space-5); }
.t-tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--space-4); box-shadow: inset 0 4px 0 var(--line-strong); min-width: 0; }
.t-tile.is-under { box-shadow: inset 0 4px 0 var(--under); }
.t-tile.is-band { box-shadow: inset 0 4px 0 var(--mark); }
.t-tile.is-over { box-shadow: inset 0 4px 0 var(--cell-over); }
.t-tile p { margin: 0; }
.t-tile .k { font: 600 var(--step--2)/1.3 var(--font-mono); text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.t-tile .v { font: 700 var(--step-3)/1.1 var(--font-display); margin-top: var(--space-2); }
.t-tile .s { font-size: var(--step--2); color: var(--muted); margin-top: 2px; }
.t-add { display: flex; flex-wrap: wrap; align-items: end; gap: var(--space-3); margin-bottom: var(--space-5); }
.t-add .t-field { flex: 1 1 260px; }
.t-schools { align-items: start; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); gap: var(--space-4); }
.t-school { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: var(--space-5); display: grid; gap: var(--space-4); align-content: start; min-width: 0; }
.t-school h3 { font-size: var(--step-2); margin: 0; line-height: 1.2; overflow-wrap: anywhere; }
.t-school-meta { margin: 4px 0 0; font-size: var(--step--2); color: var(--muted); overflow-wrap: anywhere; }
.t-roles { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.t-role { display: grid; gap: 6px; }
.t-role-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 10px; }
.t-role-name { font-weight: 650; font-size: var(--step--1); }
.t-role-fig { display: flex; justify-content: space-between; gap: var(--space-3); font-size: var(--step--2); color: var(--muted); }
.t-role-fig b { color: var(--ink); font-weight: 650; }
.t-facts { display: flex; flex-wrap: wrap; gap: 6px; }
.t-facts .t-pill b { font-family: var(--font-body); }
.t-agreed { margin: 0; font-size: var(--step--2); color: var(--ink-2); }
.t-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); padding-top: var(--space-3); border-top: 1px solid var(--line); }
.t-more { border-top: 1px solid var(--line); padding-top: var(--space-3); }
.t-more > summary { cursor: pointer; font-weight: 650; font-size: var(--step--1); list-style: none; display: flex; align-items: center; gap: 8px; }
.t-more > summary::-webkit-details-marker { display: none; }
.t-more > summary::before { content: ""; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform var(--dur-1) var(--ease-out); }
.t-more[open] > summary::before { transform: rotate(45deg); }
.t-more-body { display: grid; gap: var(--space-3); margin-top: var(--space-3); }
.t-versions { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.t-versions li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 10px; font-size: var(--step--2); padding: 8px 10px; border-radius: 8px; background: var(--surface-2); }
.t-empty { text-align: center; padding: var(--space-7) var(--space-5); border: 1.5px dashed var(--line-strong); border-radius: var(--radius-l); }
.t-empty h3 { font-size: var(--step-2); margin: 0 0 var(--space-2); }
.t-empty p { margin: 0 auto var(--space-4); max-width: 52ch; color: var(--ink-2); }

/* Compare a role across schools: hours against each school's own limit (part-time limits are pro rata). */
.t-compare-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-4); }
.t-compare-head h2 { font-size: var(--step-3); margin: 0 0 var(--space-2); }
.t-compare-head .t-field { width: min(320px, 100%); }
.cmp-chart { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.cmp-row { display: grid; grid-template-columns: minmax(120px, 220px) minmax(0, 1fr) 168px; gap: var(--space-3); align-items: center; }
.cmp-name { font-weight: 650; font-size: var(--step--1); overflow-wrap: anywhere; }
.cmp-track { position: relative; height: 26px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); }
.cmp-track i { position: absolute; top: 4px; bottom: 4px; border-radius: 4px; }
.cmp-band { background: var(--cell-band); }
.cmp-band.is-over { background: var(--cell-over); }
.cmp-band.is-under { background: var(--under); }
.cmp-zero { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); left: var(--zero); }
.cmp-fig { font-size: var(--step--2); text-align: right; white-space: nowrap; }
.cmp-axis { display: grid; grid-template-columns: minmax(120px, 220px) minmax(0, 1fr) 168px; gap: var(--space-3); font-size: var(--step--2); color: var(--muted); margin-top: var(--space-2); }
.cmp-axis span:nth-child(2) { display: flex; justify-content: space-between; }
@media (max-width: 640px) {
  .cmp-row, .cmp-axis { grid-template-columns: minmax(0, 1fr) auto; }
  .cmp-track { grid-column: 1 / -1; grid-row: 2; }
  .cmp-axis span:first-child, .cmp-axis span:last-child { display: none; }
  .cmp-axis span:nth-child(2) { grid-column: 1 / -1; }
}

.t-outline { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: var(--space-4); margin: var(--space-5) 0; }
.t-outline section { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--space-4); }
.t-outline h3 { font-size: var(--step-0); margin: 0 0 var(--space-2); }
.t-outline ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; font-size: var(--step--1); }
.t-outline li { display: flex; justify-content: space-between; gap: var(--space-3); }
.t-outline li span:last-child { color: var(--muted); white-space: nowrap; }

.t-table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.t-table { width: 100%; border-collapse: collapse; font-size: var(--step--1); }
.t-table th, .t-table td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.t-table thead th { font: 600 var(--step--2)/1.3 var(--font-mono); text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); background: var(--surface-2); }
.t-table tbody tr:last-child td, .t-table tbody tr:last-child th { border-bottom: 0; }
.t-table td.r { text-align: right; }
.t-table .wrap-any { overflow-wrap: anywhere; }
.t-users-add { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1.4fr) auto; gap: var(--space-3); align-items: end; margin-bottom: var(--space-4); }
@media (max-width: 760px) {
  .t-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .t-users-add { grid-template-columns: minmax(0, 1fr); }
  .t-table-cards thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .t-table-cards tr { display: grid; gap: 2px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
  .t-table-cards td, .t-table-cards th { border: 0; padding: 0; }
  .t-table-cards td[data-k]::before { content: attr(data-k) ": "; color: var(--muted); font-size: var(--step--2); }
}
.t-danger { border-color: color-mix(in srgb, var(--over) 45%, var(--line)); }
.t-danger h2 { color: var(--over); }
.btn-danger { --btn-bg: var(--over); --btn-fg: #fff; --btn-bd: var(--over); }
.t-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-5); }
@media (max-width: 760px) { .t-split { grid-template-columns: minmax(0, 1fr); } }
.t-panel h2 { font-size: var(--step-2); margin: 0 0 var(--space-2); }
.t-panel > p { margin: 0 0 var(--space-4); }
.t-gate { max-width: 640px; margin: var(--space-8) auto; text-align: center; }
.t-gate h1 { font-size: var(--step-4); margin: var(--space-3) 0; }
.t-pick { list-style: none; margin: var(--space-5) 0 0; padding: 0; display: grid; gap: var(--space-3); text-align: left; }
.t-pick a { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); padding: var(--space-4) var(--space-5); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); font-weight: 650; text-decoration: none; color: var(--ink); }
.t-pick a:hover { border-color: var(--ink); }

/* The trust bar on the check and the builder when they work for a trust */
.trust-bar { position: relative; z-index: 5; background: var(--ink); color: var(--bg); }
.trust-bar-in { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-4); padding-block: 10px; }
.trust-bar p { margin: 0; font-size: var(--step--1); min-width: 0; overflow-wrap: anywhere; }
.trust-bar b { color: var(--mark); font-weight: 650; }
.trust-bar small { opacity: 0.8; }
.trust-bar .btn { --btn-bg: var(--mark); --btn-fg: #111315; --btn-bd: var(--mark); }
.trust-bar .btn-ghost { --btn-bg: transparent; --btn-fg: var(--bg); --btn-bd: color-mix(in srgb, var(--bg) 45%, transparent); }
.trust-bar-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.trust-bar-msg { flex-basis: 100%; font-size: var(--step--2) !important; opacity: 0.9; }

/* ---------- The read-only school view ---------- */
.shared { padding: var(--space-6) 0 var(--space-8); }
.shared h1 { font-size: var(--step-4); line-height: 1.05; letter-spacing: -0.025em; margin: var(--space-2) 0 var(--space-2); overflow-wrap: anywhere; }
.shared h1:focus { outline: none; }
.sh-roles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: var(--space-4); margin: var(--space-5) 0; }
.sh-role { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: var(--space-5); display: grid; gap: var(--space-3); }
.sh-role h2 { font-size: var(--step-1); margin: 0; }
.sh-range { font: 700 var(--step-3)/1 var(--font-display); letter-spacing: -0.02em; margin: 0; }
.sh-range small { font: 500 var(--step--1)/1.3 var(--font-body); color: var(--muted); letter-spacing: 0; }
.shared section { margin-top: var(--space-6); }
.shared section > h2 { font-size: var(--step-2); margin: 0 0 var(--space-3); }
.sh-qs { margin: 0; padding-left: 1.3em; display: grid; gap: 8px; }
@media print {
  .site-header, .site-footer, .screen-only, .toast, .t-tabs { display: none !important; }
  .shared, .trust-app { padding: 0; }
}
