/* Team pages (team/, team/quiz/, team/compare/). Desktop: compact, top-anchored, content-sized cards.
   Phone (≤720px): one column, filters in a sheet. Only tokens from ui/tokens.css. */

.tm-page { display: flex; flex-direction: column; gap: var(--sp-4); max-width: 1080px; }
.tm-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--sp-4) var(--sp-5); box-shadow: var(--shadow-card); }
.tm-card h2 { font-size: var(--fs-17); margin: 0 0 var(--sp-2); color: var(--text-strong); }
.tm-card h3 { font-size: var(--fs-14); margin: 0 0 var(--sp-2); color: var(--text-strong); }
.tm-sub { color: var(--text-muted); font-size: var(--fs-13); margin: 0 0 var(--sp-3); }
.tm-narrow { max-width: 560px; }
.tm-row { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.tm-row .grow { flex: 1 1 auto; min-width: 0; }
.tm-head { display: flex; align-items: flex-start; gap: var(--sp-3); }
.tm-head .tm-title { font-size: var(--fs-20); margin: 0; color: var(--text-strong); }
.tm-head .tm-meta { color: var(--text-muted); font-size: var(--fs-13); margin-top: 2px; }
.tm-lines { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-14); }
.tm-lines li { display: flex; gap: 8px; align-items: flex-start; line-height: 1.45; }
.tm-lines li .icon { flex: none; margin-top: 2px; width: 16px; height: 16px; }
.tm-yes .icon { color: var(--success); }
.tm-no .icon { color: var(--text-muted); }
.tm-warn .icon { color: var(--warning); }
.tm-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.tm-chip { font-size: var(--fs-11); padding: 2px 8px; border-radius: var(--r-pill); background: var(--surface-subtle); color: var(--text-muted); border: 1px solid var(--border); white-space: nowrap; }
.tm-chip.is-limit { background: var(--warning-bg); color: var(--warning); border-color: transparent; }

/* People lists */
.tm-list { display: flex; flex-direction: column; }
.tm-item { display: flex; align-items: center; gap: var(--sp-3); padding: 10px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.tm-item:first-child { border-top: 0; }
.tm-item .tm-who { flex: 1 1 220px; min-width: 0; }
.tm-item .tm-name { font-weight: 600; color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tm-item .tm-email, .tm-item .tm-small { color: var(--text-muted); font-size: var(--fs-12); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tm-item .tm-actions { display: flex; gap: var(--sp-2); align-items: center; }
.tm-code { font-family: var(--font-mono, monospace); font-size: var(--fs-12); color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Rights editor */
.tm-rights { display: flex; flex-direction: column; gap: var(--sp-3); }
.tm-rights fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.tm-rights legend { font-size: var(--fs-12); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); margin-bottom: 4px; }
.tm-right { display: flex; align-items: center; gap: var(--sp-3); justify-content: space-between; padding: 4px 0; }
.tm-right .tm-right-text { display: flex; flex-direction: column; }
.tm-right .tm-right-sub { font-size: var(--fs-12); color: var(--text-muted); }
.tm-right.is-off { opacity: .5; }
.tm-limit { display: flex; align-items: center; gap: var(--sp-2); }
.tm-limit input { width: 110px; }
.tm-limit input[aria-invalid="true"] { border-color: var(--danger-strong, #a12626); }
.tm-limit-err { font-size: 13px; font-weight: 600; color: var(--danger-strong, #a12626); }
.tm-note { font-size: var(--fs-12); color: var(--text-muted); margin: 0; }

/* Remove dialog */
.tm-remove ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-14); line-height: 1.45; }
.tm-remove .tm-over { color: var(--danger); font-weight: 600; }

/* Quizzes */
.tm-filters { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; margin-bottom: var(--sp-3); }
.tm-filters .input, .tm-filters .select { height: 34px; font-size: var(--fs-13); width: auto; flex: 0 1 170px; min-width: 0; }
.tm-filters input[type="date"] { flex-basis: 150px; }
.tm-filters .tm-search { flex: 1 1 200px; min-width: 160px; }
.tm-applied { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: var(--sp-3); }
.tm-applied .chip { font-size: var(--fs-12); }
.tm-qrow { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: var(--sp-3); align-items: center; padding: 10px 0; border-top: 1px solid var(--border); }
.tm-qrow:first-child { border-top: 0; }
.tm-qrow input[type="checkbox"] { width: 16px; height: 16px; }
.tm-qrow a.tm-qtitle { font-weight: 600; color: var(--text-strong); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.tm-qrow a.tm-qtitle:hover { text-decoration: underline; }
.tm-qmeta { display: flex; flex-wrap: wrap; gap: 6px 10px; font-size: var(--fs-12); color: var(--text-muted); align-items: center; margin-top: 2px; }
.tm-qstats { display: flex; gap: var(--sp-3); align-items: center; font-size: var(--fs-13); color: var(--text); white-space: nowrap; }
.tm-comparebar { position: sticky; bottom: var(--sp-3); z-index: 5; display: flex; gap: var(--sp-3); align-items: center; justify-content: center; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-pill); padding: 8px 12px; box-shadow: var(--shadow-raised); margin: var(--sp-3) auto 0; width: max-content; max-width: 100%; }

/* View-only report */
.tm-viewbar { display: flex; align-items: center; gap: var(--sp-2); padding: 10px 14px; border-radius: var(--r-md); background: var(--info-bg); color: var(--info); font-size: var(--fs-13); font-weight: 600; }
.tm-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--sp-3); }
.tm-stat { background: var(--surface-subtle); border-radius: var(--r-md); padding: 10px 12px; }
.tm-stat .tm-stat-label { font-size: var(--fs-12); color: var(--text-muted); }
.tm-stat .tm-stat-value { font-size: var(--fs-20); font-weight: 700; color: var(--text-strong); }
.tm-table-wrap { overflow-x: auto; }
.tm-table { width: 100%; border-collapse: collapse; font-size: var(--fs-13); }
.tm-table th, .tm-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tm-table th { font-size: var(--fs-12); color: var(--text-muted); font-weight: 600; position: sticky; top: 0; background: var(--surface); }
.tm-table td.tm-wrap { white-space: normal; min-width: 220px; }
.tm-table .tm-num { text-align: right; font-variant-numeric: tabular-nums; }
.tm-up { color: var(--success); font-weight: 600; }
.tm-down { color: var(--danger); font-weight: 600; }
.tm-cell-correct { color: var(--report-correct); }
.tm-cell-wrong { color: var(--report-wrong); }
.tm-cell-partial { color: var(--report-partial); }
.tm-cell-pending { color: var(--report-pending); }
.tm-bar { height: 6px; border-radius: var(--r-pill); background: var(--surface-subtle); overflow: hidden; min-width: 80px; }
.tm-bar > span { display: block; height: 100%; background: var(--primary); }

/* Report: spread, bands, answers, polls */
.tm-spread { margin-top: var(--sp-4); }
.tm-hist { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; align-items: end; height: 120px; margin-bottom: var(--sp-3); }
.tm-hist-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 2px; }
.tm-hist-bar { width: 100%; min-height: 2px; background: var(--primary); border-radius: var(--r-sm) var(--r-sm) 0 0; opacity: .85; }
.tm-hist-n { font-size: var(--fs-11); color: var(--text-muted); }
.tm-hist-l { font-size: var(--fs-11); color: var(--text-faint); }
.tm-chip.tm-band-needs-help { background: var(--band-needs-help-soft); color: var(--band-needs-help-strong); border-color: transparent; }
.tm-chip.tm-band-developing { background: var(--band-developing-soft); color: var(--band-developing-strong); border-color: transparent; }
.tm-chip.tm-band-secure { background: var(--band-secure-soft); color: var(--band-secure-strong); border-color: transparent; }
.tm-answers { display: flex; flex-direction: column; gap: var(--sp-3); max-height: 60vh; overflow-y: auto; }
.tm-ans { border-top: 1px solid var(--border); padding-top: var(--sp-2); font-size: var(--fs-14); }
.tm-ans:first-child { border-top: 0; padding-top: 0; }
.tm-ans-a { margin-top: 4px; }
.tm-cell-blank, .tm-cell-none, .tm-cell-not-scored, .tm-cell-poll { color: var(--text-muted); }
.tm-poll { display: grid; grid-template-columns: minmax(0, 1fr) 120px auto; gap: var(--sp-2); align-items: center; font-size: var(--fs-12); margin-top: 4px; }
.tm-poll-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 720px) { .tm-poll { grid-template-columns: minmax(0, 1fr) 70px auto; } .tm-hist { height: 90px; } }

@media (max-width: 720px) {
  .tm-card { padding: var(--sp-3) var(--sp-4); }
  /* Copy, WhatsApp, Email and the menu wrap under the link instead of pushing the menu off the screen. */
  .tm-item .tm-actions { flex: 1 1 100%; flex-wrap: wrap; }
  .tm-qrow { grid-template-columns: 24px minmax(0, 1fr); }
  .tm-qrow .tm-qstats { grid-column: 2; }
  .tm-filters .tm-search { flex-basis: 100%; }
  .tm-comparebar { border-radius: var(--r-lg); }
}

@media print {
  .tm-viewbar, .tm-noprint, .sidebar, .topbar, .beta-bar, #env-banner { display: none !important; }
  .tm-card { box-shadow: none; border: 0; padding: 0; }
}

/* ══════════════════════════════════════════════════════════════════════════════════════════════════
   Design system for the Team pages (7 Nov 2026 redesign). Same tokens as the rest of Studio.
   Rhythm: 4px grid. Cards 20px apart, 20/24px inside; a section head (icon, title, "i", one line of help, actions)
   sits 16px above its content; list rows have 14px padding. Phone: 16px gutters, actions wrap under the title.
   ══════════════════════════════════════════════════════════════════════════════════════════════════ */
.tm-page { gap: var(--sp-5); padding-bottom: var(--sp-8); }
.tm-stack { display: flex; flex-direction: column; gap: var(--sp-5); }
.tm-card { padding: var(--sp-5) var(--sp-6); }
.tm-card h3 { font-size: var(--fs-14); }

/* Section head */
.tm-sec-head { align-items: flex-start; gap: var(--sp-3); margin-bottom: var(--sp-4); flex-wrap: nowrap; }
.tm-sec-ico { flex: none; width: 36px; height: 36px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; }
.tm-sec-ico .icon { width: 18px; height: 18px; }
.tm-sec-text { min-width: 0; }
.tm-sec-titlerow { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.tm-card h2.tm-sec-title, .tm-sec-title { font-size: var(--fs-17); line-height: 1.3; margin: 0; color: var(--text-strong); }
.tm-sec-sub { margin: 2px 0 0; font-size: var(--fs-13); line-height: 1.45; color: var(--text-muted); }
.tm-sec-actions { display: flex; gap: var(--sp-2); align-items: center; flex: none; flex-wrap: wrap; justify-content: flex-end; }

/* The "i" button: a quiet round button, a larger touch area on phones */
.tm-info { position: relative; flex: none; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-muted); display: inline-grid; place-items: center; padding: 0; cursor: pointer; transition: background .15s, color .15s, border-color .15s, transform .15s; }
.tm-info .icon { width: 13px; height: 13px; }
.tm-info::after { content: ""; position: absolute; inset: -8px; }
.tm-info:hover { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); transform: scale(1.08); }
.tm-info:active { transform: scale(.96); }
.tm-info:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.tm-info[aria-expanded="true"] { background: var(--primary); color: var(--text-on-primary); border-color: var(--primary); }

/* Help sheet: a picture, plain words, ticks, one tip */
.tm-help-dialog .dialog { max-width: 480px; }
.tm-help { display: flex; flex-direction: column; gap: var(--sp-4); }
.tm-help-body { margin: 0; font-size: 15px; line-height: 1.6; color: var(--text); }
.tm-help-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.tm-help-list li { display: flex; gap: 10px; font-size: var(--fs-14); line-height: 1.5; color: var(--text); }
.tm-help-list .icon { flex: none; width: 16px; height: 16px; margin-top: 2px; color: var(--success); }
.tm-help-tip { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--r-md); background: var(--warning-bg); color: var(--warning); font-size: var(--fs-13); line-height: 1.5; }
.tm-help-tip .icon { flex: none; width: 16px; height: 16px; margin-top: 1px; }
.tm-inline-help { background: var(--primary-softer); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font-size: var(--fs-13); line-height: 1.5; color: var(--text); margin: 2px 0 6px; animation: tm-open .25s ease; }
.tm-inline-help p { margin: 0; }
.tm-inline-help ul { margin: 6px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.tm-inline-help .tm-help-tip-line { margin-top: 6px; color: var(--warning); }
.tm-inline-help[hidden] { display: none; }
@keyframes tm-open { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.tm-rights legend { display: flex; align-items: center; gap: var(--sp-2); }

/* Animated pictures (team-art.js). Every picture shows its finished state for people who prefer less motion. */
.tm-art { background: linear-gradient(180deg, var(--primary-softer), var(--primary-soft)); border-radius: 14px; padding: 6px; overflow: hidden; }
.tm-art svg { display: block; width: 100%; height: auto; max-height: 150px; }
.tm-art .a-anim { transform-box: fill-box; transform-origin: center; }
.tm-art .a-node { fill: var(--surface); stroke: var(--primary); stroke-width: 2; }
.tm-art .a-ink { fill: var(--primary); }
.tm-art .a-card { fill: var(--surface); stroke: var(--border-strong); stroke-width: 1.5; }
.tm-art .a-bar { fill: var(--primary); opacity: .85; }
.tm-art .a-bar2 { fill: var(--border-strong); }
.tm-art .a-ring { fill: var(--surface); stroke: var(--border-strong); stroke-width: 2; }
.tm-art .a-ok { fill: var(--success); }
.tm-art .a-ok-bar { fill: var(--success); }
.tm-art .a-tick { fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.tm-art .a-dash { stroke: var(--primary); stroke-width: 2.2; stroke-dasharray: 5 6; stroke-linecap: round; animation: tm-dash 1.2s linear infinite; }
.tm-art .a-stroke { fill: none; stroke: var(--primary); stroke-width: 3; }
.tm-art .a-hand { fill: none; stroke: var(--text-strong); stroke-width: 3; stroke-linecap: round; }
.tm-art .a-hand2 { stroke: var(--primary); }
.tm-art .a-track { fill: var(--border-strong); }
.tm-art .a-trackon { fill: var(--primary); opacity: 1; }
.tm-art .a-knob { fill: #fff; transform: translateX(22px); filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .25)); }
.tm-art .a-btn { fill: var(--primary); }
.tm-art .a-btn2 { fill: var(--surface); stroke: var(--border-strong); stroke-width: 1.5; }
.tm-art .a-ghost { fill: none; stroke: var(--border-strong); stroke-width: 2; stroke-dasharray: 4 5; }
.tm-art .a-pill { fill: var(--success-bg); stroke: var(--success-border); }
.tm-art .a-warnpill { fill: var(--warning-bg); stroke: var(--warning-border); }
.tm-art .a-axis { stroke: var(--border-strong); stroke-width: 2; stroke-linecap: round; }
.tm-art .a-b1 { fill: var(--primary); }
.tm-art .a-b2 { fill: var(--text-faint); }
.tm-art .a-low { fill: var(--danger-strong); }
.tm-art .a-mid { fill: var(--warning-strong); }
.tm-art .a-high { fill: var(--success); }
.tm-art .a-iris { fill: var(--primary-soft); stroke: var(--primary); stroke-width: 3; }
.tm-art .a-q { font: 700 12px var(--font-sans); fill: var(--text-muted); }
.tm-art .a-dotp { fill: var(--primary); opacity: .7; }
.tm-art .a-ping { fill: none; stroke: var(--success); stroke-width: 2; }
.tm-art .a-pencilbody { fill: var(--warning-strong); }
.tm-art .a-pop { animation: tm-pop 3.6s ease-in-out infinite backwards; animation-delay: var(--d, 0s); }
.tm-art .a-pulse { animation: tm-pulse 2.2s ease-in-out infinite; }
.tm-art .a-bob { animation: tm-bob 2.6s ease-in-out infinite; }
.tm-art .a-float { animation: tm-bob 3s ease-in-out infinite; animation-delay: var(--d, 0s); }
.tm-art .a-slide { animation: tm-slide 3.6s ease-in-out infinite; }
.tm-art .a-in { animation: tm-in 3.8s ease-in-out infinite backwards; animation-delay: var(--d, 0s); }
.tm-art .a-grow { transform-origin: 50% 100%; animation: tm-grow 3.8s ease-in-out infinite backwards; animation-delay: var(--d, 0s); }
.tm-art .a-fillx { transform-origin: 0 50%; animation: tm-fillx 3.8s ease-in-out infinite backwards; animation-delay: var(--d, 0s); }
.tm-art .a-fillbar { transform-origin: 0 50%; transform: scaleX(.66); fill: var(--primary); animation: tm-fillbar 3.8s ease-in-out infinite; }
.tm-art .a-travel { transform: translateX(134px); animation: tm-travel 3.8s ease-in-out infinite; }
.tm-art .a-merge { animation: tm-merge 4s ease-in-out infinite; animation-delay: var(--d, 0s); }
.tm-art .a-trackon { animation: tm-trackon 4s ease-in-out infinite; animation-delay: var(--d, 0s); }
.tm-art .a-knob { animation: tm-knob 4s ease-in-out infinite; animation-delay: var(--d, 0s); }
.tm-art .a-look { animation: tm-look 4.2s ease-in-out infinite; }
.tm-art .a-ping { animation: tm-ping 2s ease-out infinite; }
.tm-art .a-sway { animation: tm-sway 4s ease-in-out infinite; }
.tm-art .a-spin { transform-origin: 50% 100%; animation: tm-spin 6s linear infinite; }
.tm-art .a-fade { animation: tm-fade 3.6s ease-in-out infinite; }
.tm-art .a-pencil { animation: tm-pencil 3s ease-in-out infinite; }
@keyframes tm-dash { to { stroke-dashoffset: -22; } }
@keyframes tm-pop { 0%, 8% { transform: scale(0); opacity: 0; } 18% { transform: scale(1.18); opacity: 1; } 26%, 86% { transform: scale(1); opacity: 1; } 100% { transform: scale(.9); opacity: 0; } }
@keyframes tm-pulse { 0%, 100% { transform: scale(.96); } 50% { transform: scale(1.07); } }
@keyframes tm-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes tm-slide { 0% { transform: translateX(-70px); opacity: 0; } 20%, 80% { transform: none; opacity: 1; } 100% { transform: none; opacity: 0; } }
@keyframes tm-in { 0%, 6% { transform: translateX(30px); opacity: 0; } 22%, 88% { transform: none; opacity: 1; } 100% { transform: none; opacity: 0; } }
@keyframes tm-grow { 0%, 5% { transform: scaleY(0); } 30%, 88% { transform: scaleY(1); } 100% { transform: scaleY(0); } }
@keyframes tm-fillx { 0%, 5% { transform: scaleX(0); } 35%, 88% { transform: scaleX(1); } 100% { transform: scaleX(0); } }
@keyframes tm-fillbar { 0% { transform: scaleX(.04); } 55%, 100% { transform: scaleX(.66); } }
@keyframes tm-travel { 0% { transform: translateX(96px); opacity: 0; } 15% { opacity: 1; } 70% { transform: translateX(168px); opacity: 1; } 90%, 100% { transform: translateX(176px); opacity: 0; } }
@keyframes tm-merge { 0%, 15% { transform: none; opacity: 1; } 50%, 80% { transform: translate(var(--tx), var(--ty)); opacity: .9; } 100% { transform: none; opacity: 1; } }
@keyframes tm-trackon { 0%, 15% { opacity: 0; } 25%, 70% { opacity: 1; } 85%, 100% { opacity: 0; } }
@keyframes tm-knob { 0%, 15% { transform: translateX(0); } 25%, 70% { transform: translateX(22px); } 85%, 100% { transform: translateX(0); } }
@keyframes tm-look { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-14px); } 60% { transform: translateX(14px); } }
@keyframes tm-ping { 0% { transform: scale(1); opacity: .9; } 100% { transform: scale(2.6); opacity: 0; } }
@keyframes tm-sway { 0%, 100% { transform: translateX(-26px); } 50% { transform: translateX(26px); } }
@keyframes tm-spin { to { transform: rotate(360deg); } }
@keyframes tm-fade { 0%, 30% { opacity: 1; } 42%, 90% { opacity: 0; } 100% { opacity: 1; } }
@keyframes tm-pencil { 0%, 100% { transform: translate(0, 0) rotate(0); } 50% { transform: translate(-64px, 4px) rotate(-6deg); } }
@media (prefers-reduced-motion: reduce) {
  .tm-art *, .tm-info, .tm-inline-help, .tm-how-step, .tg-reveal { animation: none !important; transition: none !important; }
  .tg-reveal { opacity: 1 !important; transform: none !important; }
}

/* Header card of the Team page */
.tm-hero { padding: 0; overflow: hidden; }
.tm-hero .tm-head { padding: var(--sp-5) var(--sp-6) var(--sp-4); align-items: center; gap: var(--sp-4); }
.tm-teamico { flex: none; width: 48px; height: 48px; border-radius: 14px; background: linear-gradient(135deg, var(--primary), var(--primary-hover)); color: var(--text-on-primary); display: grid; place-items: center; box-shadow: 0 6px 14px var(--primary-ring); }
.tm-teamico .icon { width: 24px; height: 24px; }
.tm-head .tm-title { font-size: var(--fs-20); line-height: 1.25; margin: 0; color: var(--text-strong); }
.tm-rolepill { display: inline-flex; align-items: center; gap: 6px; }
.tm-statrow { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--border); }
.tm-stat-tile { display: flex; gap: var(--sp-3); align-items: center; padding: var(--sp-4) var(--sp-6); border-left: 1px solid var(--border); }
/* A box that opens its screen: the whole box is the target, a small arrow says so. */
button.tm-stat-tile, a.tm-stat-tile { appearance: none; background: none; border-top: 0; border-right: 0; border-bottom: 0; font: inherit; color: inherit; text-align: start; text-decoration: none; cursor: pointer; min-width: 0; border-radius: 0; }
.tm-stat-tile.is-link > span:not(.tm-stat-ico):not(.tm-stat-go) { display: grid; min-width: 0; }
.tm-stat-tile.is-link { transition: background-color .15s; }
.tm-stat-tile.is-link:hover { background: color-mix(in srgb, var(--primary) 7%, transparent); }
.tm-stat-tile.is-link:focus-visible { outline: 2px solid var(--primary); outline-offset: -3px; }
.tm-stat-go { margin-left: auto; flex: none; color: var(--text-muted); opacity: .55; display: grid; place-items: center; transition: transform .15s, opacity .15s; }
.tm-stat-go .icon { width: 16px; height: 16px; }
.tm-stat-tile.is-link:hover .tm-stat-go { opacity: 1; transform: translateX(2px); color: var(--primary); }
@media (max-width: 720px) { .tm-stat-tile.is-link { position: relative; } .tm-stat-go { position: absolute; top: 14px; right: 12px; } }
button.tm-stat { appearance: none; font: inherit; color: inherit; text-align: start; cursor: pointer; }
button.tm-stat:hover { border-color: var(--primary); }
.myc-stat.is-link, .myc-sum > div.is-link { position: relative; transition: border-color .15s; }
.myc-stat.is-link:hover, .myc-sum > div.is-link:hover { border-color: var(--primary); }
.myc-boxlink { appearance: none; border: 0; background: none; padding: 0; font: inherit; color: inherit; text-decoration: none; cursor: pointer; }
.myc-boxlink::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.myc-boxlink:focus-visible { outline: none; }
.myc-stat:has(> dd > .myc-boxlink:focus-visible), .myc-sum > div:has(.myc-boxlink:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
.tm-stat-tile:first-child { border-left: 0; }
.tm-stat-ico { flex: none; width: 36px; height: 36px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; }
.tm-stat-ico .icon { width: 18px; height: 18px; }
.tm-stat-tile .tm-stat-v { font-size: 22px; font-weight: 800; line-height: 1.1; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.tm-stat-tile .tm-stat-l { font-size: var(--fs-12); color: var(--text-muted); margin-top: 2px; }
.tm-head-foot { padding: var(--sp-2) var(--sp-4); border-top: 1px solid var(--border); background: var(--surface-subtle); display: flex; }

/* Getting started */
.tm-start { border-color: var(--primary-ring); background: linear-gradient(180deg, var(--primary-softer), var(--surface) 70%); }
.tm-progress { height: 6px; border-radius: var(--r-pill); background: var(--border); overflow: hidden; margin: calc(var(--sp-2) * -1) 0 var(--sp-4); }
.tm-progress span { display: block; height: 100%; background: var(--primary); border-radius: var(--r-pill); transition: width .6s ease; }
.tm-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.tm-s { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--border); font-size: var(--fs-13); font-weight: 600; color: var(--text-strong); }
.tm-s-dot { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: var(--fs-12); font-weight: 700; background: var(--surface-subtle); color: var(--text-muted); border: 1px solid var(--border-strong); }
.tm-s-dot .icon { width: 14px; height: 14px; }
.tm-s.is-done { color: var(--text-muted); }
.tm-s.is-done .tm-s-dot { background: var(--success); border-color: var(--success); color: #fff; }
.tm-s.is-next { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.tm-s.is-next .tm-s-dot { background: var(--primary); border-color: var(--primary); color: var(--text-on-primary); }
.tm-s-text { flex: 1; min-width: 0; }
.tm-s-next { font-size: var(--fs-11); font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: .04em; }

/* No team: two cards, then how it works */
.tm-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-5); align-items: start; }
.tm-actionrow { margin-top: var(--sp-4); }
.tm-codebox { align-items: stretch; flex-wrap: nowrap; }
.tm-how { padding: var(--sp-2) 0 0; }
.tm-how-head { margin-bottom: var(--sp-4); }
.tm-how-head h3 { margin: 0; font-size: var(--fs-16); color: var(--text-strong); }
.tm-how-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-4); }
.tm-how-step { position: relative; display: flex; gap: var(--sp-3); align-items: flex-start; animation: tm-rise .5s ease backwards; animation-delay: calc(var(--i) * 90ms); }
.tm-how-step:not(:last-child)::after { content: ""; position: absolute; top: 22px; left: 56px; right: -8px; border-top: 2px dashed var(--border-strong); }
.tm-how-ico { position: relative; flex: none; width: 44px; height: 44px; border-radius: 14px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; z-index: 1; }
.tm-how-ico .icon { width: 22px; height: 22px; }
.tm-how-n { position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; border-radius: 50%; background: var(--primary); color: var(--text-on-primary); font-size: 11px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--canvas); }
.tm-how-t { font-weight: 700; color: var(--text-strong); font-size: var(--fs-14); }
.tm-how-b { font-size: var(--fs-13); color: var(--text-muted); line-height: 1.4; margin-top: 2px; }
@keyframes tm-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Join, waiting, notices */
.tm-group { margin-top: var(--sp-4); }
.tm-group-t { font-size: var(--fs-12); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin: 0 0 var(--sp-2); }
.tm-lines { gap: 8px; }
.tm-joinas { margin: var(--sp-5) 0 0; }
.tm-notice { display: flex; flex-direction: column; align-items: flex-start; gap: var(--sp-3); }
.tm-notice p { margin: 0; font-size: 15px; line-height: 1.55; }
.tm-notice-ico { width: 44px; height: 44px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; }
.tm-notice-ico.is-bad { background: var(--danger-bg); color: var(--danger); }
#tm-waiting > .tm-art { margin-bottom: var(--sp-4); }
.tm-wait-head h2 { margin: 0; }

/* Lists: invites, people */
.tm-item { padding: 14px 0; gap: var(--sp-3) var(--sp-4); }
.tm-item .tm-name { font-size: var(--fs-14); }
.tm-code { display: block; margin: 4px 0 6px; padding: 4px 8px; border-radius: 8px; background: var(--surface-subtle); }
.tm-chips { gap: 6px; }
.tm-chip { padding: 3px 9px; }
.tm-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: var(--sp-2) 0 var(--sp-1); }
.tm-empty .tm-art { width: 100%; max-width: 300px; margin-bottom: var(--sp-2); }
.tm-empty h3 { margin: 0; font-size: var(--fs-16); }
.tm-empty .tm-sub { margin: 0; max-width: 360px; }
.tm-empty .tm-note { margin-top: 2px; }

/* Limits as meters */
.tm-meters { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: var(--sp-3); }
.tm-meter { padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-subtle); }
.tm-meter-t { display: block; font-size: var(--fs-13); font-weight: 600; color: var(--text-strong); }
.tm-meter-bar { display: block; height: 6px; border-radius: var(--r-pill); background: var(--border); margin-top: 8px; overflow: hidden; }
.tm-meter-bar span { display: block; height: 100%; background: var(--primary); border-radius: var(--r-pill); }
.tm-meter.is-full .tm-meter-bar span { background: var(--warning-strong); }

/* Quizzes */
.tm-filters { padding: var(--sp-3); background: var(--surface-subtle); border: 1px solid var(--border); border-radius: var(--r-md); }
.tm-qrow { padding: 14px 8px; margin: 0 -8px; border-radius: 10px; transition: background .15s; }
.tm-qrow:hover { background: var(--surface-hover); }
.tm-qrow a.tm-qtitle { font-size: var(--fs-14); }

/* Report and Compare */
.tm-viewbar { padding: 12px 16px; border: 1px solid var(--border); }
.tm-viewbar .grow { flex: 1; min-width: 0; }
.tm-stat { border: 1px solid var(--border); padding: 12px 14px; }
.tm-stat .tm-stat-label { display: flex; align-items: center; gap: 6px; }
.tm-h3i { display: flex; align-items: center; gap: var(--sp-2); }
.tm-banner-row { display: flex; align-items: center; gap: var(--sp-2); }
.tm-banner-row .grow { flex: 1; min-width: 0; }
.tm-table th .tm-info { margin-left: 6px; vertical-align: middle; }
.tm-table tbody tr:hover td { background: var(--surface-hover); }

/* Phone */
@media (max-width: 720px) {
  .tm-page { gap: var(--sp-4); }
  .tm-card { padding: var(--sp-4); }
  .tm-hero { padding: 0; }
  .tm-hero .tm-head { padding: var(--sp-4); flex-wrap: wrap; gap: var(--sp-3); }
  .tm-hero .tm-head .grow { flex-basis: calc(100% - 120px); }
  .tm-stat-tile { padding: var(--sp-3); flex-direction: column; align-items: flex-start; gap: 6px; }
  .tm-stat-ico { width: 30px; height: 30px; }
  .tm-sec-head { flex-wrap: wrap; }
  .tm-sec-text { flex: 1 1 calc(100% - 52px); }
  .tm-sec-actions { flex: 1 1 100%; justify-content: flex-start; }
  .tm-two { grid-template-columns: minmax(0, 1fr); }
  .tm-how-steps { grid-template-columns: minmax(0, 1fr); gap: var(--sp-3); }
  .tm-how-step:not(:last-child)::after { display: none; }
  .tm-codebox { flex-wrap: wrap; }
  .tm-codebox .grow { flex: 1 1 100%; }
  .tm-info { width: 26px; height: 26px; }
  .tm-info .icon { width: 14px; height: 14px; }
  .tm-help-dialog .dialog { max-width: none; }
  .tm-steps { grid-template-columns: minmax(0, 1fr); }
  .tm-qrow { margin: 0 -4px; padding: 14px 4px; }
}

/* ══ Team guide (team/guide/) ═══════════════════════════════════════════════════════════════════════ */
.tg-page { display: flex; flex-direction: column; gap: var(--sp-10); max-width: 1000px; padding-bottom: var(--sp-12); }
.tg-reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.tg-reveal.is-in { opacity: 1; transform: none; }
.tg-section { display: flex; flex-direction: column; gap: var(--sp-5); }
.tg-sec-t { font-size: var(--fs-26); line-height: 1.2; margin: 0; color: var(--text-strong); }
.tg-sec-sub { margin: 4px 0 0; font-size: var(--fs-14); color: var(--text-muted); }
.tg-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--sp-5) var(--sp-6); box-shadow: var(--shadow-card); }

.tg-hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: var(--sp-8); align-items: center; padding: var(--sp-8); border-radius: 20px; border: 1px solid var(--border); background: linear-gradient(135deg, var(--primary-soft), var(--primary-softer) 60%, var(--surface)); }
.tg-eyebrow { display: inline-block; padding: 4px 12px; border-radius: var(--r-pill); background: var(--primary); color: var(--text-on-primary); font-size: var(--fs-12); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.tg-h1 { font-size: var(--fs-30); line-height: 1.15; margin: var(--sp-3) 0; color: var(--text-strong); }
.tg-h1-line { display: block; }
.tg-words { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-height: 1.5em; margin: 4px 0; color: var(--primary); transition: opacity .5s ease, transform .5s ease; }
.tg-words.is-out { opacity: 0; transform: translateY(-6px); }
.tg-word { display: inline-block; animation: tg-word-in .8s cubic-bezier(.2, .8, .3, 1) backwards; animation-delay: calc(var(--k) * 330ms); }
.tg-word:not(:last-child)::after { content: ","; color: var(--text-muted); }
@keyframes tg-word-in { from { opacity: 0; transform: translateY(14px) scale(.92); } to { opacity: 1; transform: none; } }
.tg-hero p { margin: 0; font-size: 16px; line-height: 1.6; color: var(--text); }
.tg-pills { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-5); }
.tg-pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--border); font-size: var(--fs-13); font-weight: 600; color: var(--text-strong); }
.tg-pill .icon { width: 16px; height: 16px; color: var(--primary); }
.tg-cta-row { margin-top: var(--sp-5); display: flex; flex-wrap: wrap; gap: var(--sp-3); }
.tg-hero .tm-art { background: var(--surface); box-shadow: 0 10px 30px rgba(17, 28, 45, .08); padding: 10px; border-radius: 18px; }
.tg-hero .tm-art svg { max-height: 220px; }

.tg-flow { display: flex; flex-direction: column; gap: var(--sp-5); }
.tg-step { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-6); align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--sp-5) var(--sp-6); box-shadow: var(--shadow-card); }
.tg-flow .tg-step:nth-child(even) .tg-step-art { order: 2; }
.tg-step-n { display: inline-block; font-size: var(--fs-12); font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: .06em; }
.tg-step-text { display: flex; flex-direction: column; gap: var(--sp-3); }
.tg-step-text h3, .tg-card h3 { margin: 0; font-size: var(--fs-20); color: var(--text-strong); }
.tg-step-text p, .tg-card p { margin: 0; font-size: 15px; line-height: 1.6; color: var(--text); }
.tg-card { display: flex; flex-direction: column; gap: var(--sp-3); }
.tg-card h3 { font-size: var(--fs-17); }
.tg-three { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-4); }

.tg-table .tg-rowh { text-align: left; font-weight: 600; color: var(--text-strong); white-space: normal; min-width: 200px; }
.tg-yes, .tg-no { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; }
.tg-yes { background: var(--success-bg); color: var(--success); animation: tm-pop .5s ease backwards; animation-delay: calc(var(--i) * 40ms); }
.tg-no { background: var(--surface-subtle); color: var(--text-muted); }
.tg-yes .icon, .tg-no .icon { width: 14px; height: 14px; }

.tg-faq { display: flex; flex-direction: column; gap: var(--sp-2); }
.tg-faq details { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); }
.tg-faq summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: 14px 16px; font-weight: 600; color: var(--text-strong); cursor: pointer; border-radius: var(--r-md); }
.tg-faq summary::-webkit-details-marker { display: none; }
.tg-faq summary:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.tg-faq summary .icon { width: 18px; height: 18px; color: var(--text-muted); transition: transform .2s; transform: rotate(90deg); }
.tg-faq details[open] summary .icon { transform: rotate(0deg); color: var(--primary); }
.tg-faq-body { display: flex; flex-direction: column; gap: var(--sp-3); padding: 0 16px 16px; animation: tm-open .25s ease; }
.tg-faq-body p { margin: 0; font-size: var(--fs-14); line-height: 1.6; }

.tg-promise { display: flex; gap: var(--sp-4); align-items: center; padding: var(--sp-5) var(--sp-6); border-radius: var(--r-lg); background: var(--success-bg); border: 1px solid var(--success-border); }
.tg-promise-ico { flex: none; width: 48px; height: 48px; border-radius: 14px; background: var(--success); color: #fff; display: grid; place-items: center; }
.tg-promise-ico .icon { width: 24px; height: 24px; }
.tg-promise h3 { margin: 0 0 2px; font-size: var(--fs-17); color: var(--text-strong); }
.tg-promise p { margin: 0; font-size: var(--fs-14); line-height: 1.5; color: var(--text); }
.tg-cta { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap; padding: var(--sp-6); border-radius: 20px; background: linear-gradient(135deg, var(--primary), var(--primary-hover)); color: var(--text-on-primary); }
.tg-cta h2 { margin: 0; font-size: var(--fs-26); color: var(--text-on-primary); }
.tg-cta p { margin: 4px 0 0; opacity: .9; }
.tg-cta .btn-primary { background: #fff; color: var(--primary); }

@media (max-width: 720px) {
  .tg-page { gap: var(--sp-8); }
  .tg-hero, .tg-step { grid-template-columns: minmax(0, 1fr); padding: var(--sp-5) var(--sp-4); gap: var(--sp-4); }
  .tg-flow .tg-step:nth-child(even) .tg-step-art { order: 0; }
  .tg-three { grid-template-columns: minmax(0, 1fr); }
  .tg-h1 { font-size: var(--fs-26); }
  .tg-sec-t { font-size: var(--fs-20); }
  .tg-card { padding: var(--sp-4); }
  .tg-cta { padding: var(--sp-5) var(--sp-4); }
}

.tm-hidden-until[hidden] { display: none; }

/* ── Campuses (team-campuses.js; shown only once a team has a campus) ── */
.tm-head-foot { align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.tm-campus-filter { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-13); font-weight: 600; color: var(--text-strong); }
.tm-campus-filter .icon { width: 16px; height: 16px; color: var(--primary); }
.tm-campus-filter .select { height: 32px; font-size: var(--fs-13); width: auto; min-width: 160px; max-width: 240px; }
.tm-campus-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: var(--sp-3); }
.tm-campus { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; background: var(--surface); display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tm-campus.is-on { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.tm-campus.is-unplaced { background: var(--surface-subtle); border-style: dashed; }
.tm-campus-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tm-campus-ico { flex: none; width: 30px; height: 30px; border-radius: 9px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; }
.tm-campus-ico .icon { width: 16px; height: 16px; }
.tm-campus-name { font-size: var(--fs-16); font-weight: 700; color: var(--text-strong); margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tm-campus-admin { margin: 0; font-size: var(--fs-13); color: var(--text); }
.tm-campus-admin.is-none { color: var(--text-muted); }
.tm-campus-foot { display: flex; align-items: center; gap: 8px; justify-content: space-between; min-height: 30px; }
.tm-campus-counts { font-size: var(--fs-12); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.tm-chip.is-campus { background: var(--primary-soft); color: var(--text-strong); border-color: transparent; font-weight: 600; }
.tm-chip.is-ca { background: var(--surface-subtle); color: var(--text-strong); border-color: var(--primary); font-weight: 600; }
.tm-qcampus { font-weight: 600; color: var(--text-strong); }
@media (max-width: 720px) {
  .tm-campus-grid { grid-template-columns: minmax(0, 1fr); gap: var(--sp-2); }
  .tm-campus-filter { flex: 1 1 100%; }
  .tm-campus-filter .select { flex: 1; max-width: none; }
}

/* Classes (team-classes.js) */
.tm-qclass { font-weight: 600; color: var(--text-strong); background: var(--surface-subtle); border: 1px solid var(--border); border-radius: var(--r-pill); padding: 0 8px; }
.tm-class .tm-campus-ico { background: var(--primary-soft); color: var(--primary); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tm-class .tm-campus-ico { background: #2c2147; color: #cdb8f5; } }
:root[data-theme="dark"] .tm-class .tm-campus-ico { background: #2c2147; color: #cdb8f5; }

/* ── Tabs: Overview · People · Quizzes · Invite links ── */
.tm-tabs { display: flex; gap: 4px; position: sticky; top: 0; z-index: 5; background: var(--bg, var(--surface)); padding: 8px 0 0; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tm-tabs::-webkit-scrollbar { display: none; }
.tm-tab { appearance: none; border: 0; background: transparent; font: inherit; font-weight: 600; font-size: var(--fs-14); color: var(--text-muted); padding: 10px 14px; border-bottom: 3px solid transparent; margin-bottom: -1px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; border-radius: 8px 8px 0 0; }
.tm-tab:hover { color: var(--text-strong); background: var(--surface-hover); }
.tm-tab[aria-selected="true"] { color: var(--primary); border-bottom-color: var(--primary); }
.tm-tab:focus-visible { outline: 3px solid var(--primary-soft); outline-offset: -2px; }
.tm-tab-badge { background: var(--danger, #c0264b); color: #fff; font-size: var(--fs-11); font-weight: 800; border-radius: 99px; min-width: 20px; height: 20px; display: inline-grid; place-items: center; padding: 0 6px; }
.tm-panel[hidden] { display: none; }

/* ── Needs your attention ── */
.tm-needs { border-color: var(--warning); }
.tm-needs-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.tm-needs-list li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; background: var(--warning-bg); color: var(--text-strong); font-weight: 600; font-size: var(--fs-14); }
.tm-needs-ico { flex: none; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; background: var(--surface); color: var(--warning); }
.tm-needs-ico .icon { width: 16px; height: 16px; }

/* ── Schools and classes: one card per school with the whole chain ── */
.tm-school-list { display: flex; flex-direction: column; gap: var(--sp-4); }
.tm-school { border: 1px solid var(--border); border-radius: 14px; background: var(--surface); overflow: hidden; }
.tm-school.is-unplaced { border-style: dashed; background: var(--surface-subtle); }
.tm-school-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--primary-softer); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.tm-school-ico { flex: none; width: 36px; height: 36px; border-radius: 10px; background: var(--primary); color: #fff; display: grid; place-items: center; }
.tm-school-ico .icon { width: 18px; height: 18px; }
.tm-school-name { margin: 0; font-size: var(--fs-17); font-weight: 800; line-height: 1.3; color: var(--text-strong); }
.tm-school-head > .grow { display: grid; gap: 2px; min-width: 0; }
.tm-school-head .tm-school-name, .tm-school-head .tm-school-prin .tm-sub, .tm-school-empty .tm-sub { margin: 0; }
.tm-school-prin { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0; font-size: var(--fs-13); line-height: 1.4; }
.tm-school-count { font-size: var(--fs-12); color: var(--text-muted); white-space: nowrap; }
.tm-school-body { padding: 8px 16px 4px; }
.tm-school-empty { display: flex; align-items: center; gap: 12px; margin: 8px 0 12px; padding: 14px 16px; border: 1px dashed var(--border); border-radius: 12px; background: var(--surface-subtle); }
.tm-school-empty-ico { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--surface); border: 1px solid var(--border); color: var(--text-muted); }
.tm-school-empty-ico .icon { width: 16px; height: 16px; }
.tm-crows { display: flex; flex-direction: column; }
.tm-crow { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.tm-crow:first-child { border-top: 0; }
.tm-crow-ico { flex: none; width: 30px; height: 30px; border-radius: 9px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; }
.tm-crow-ico .icon { width: 16px; height: 16px; }
.tm-crow-main { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.tm-crow-name { font-weight: 700; font-size: var(--fs-15, 15px); color: var(--text-strong); }
.tm-crow-people { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tm-crow-count { font-size: var(--fs-12); color: var(--text-muted); white-space: nowrap; }
.tm-pchip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 3px; border-radius: 99px; background: var(--surface-subtle); border: 1px solid var(--border); font-size: var(--fs-13); font-weight: 600; color: var(--text-strong); }
.tm-pchip .avatar { width: 22px; height: 22px; font-size: 10px; }
.tm-pchip.is-prin { background: var(--primary-soft); border-color: transparent; }
.tm-pchip.is-general { background: var(--surface); border-style: dashed; cursor: pointer; }
.tm-pchip.is-general:hover { border-color: var(--primary); }
.tm-pchip.is-general:focus-visible { outline: 3px solid var(--primary-soft); }
.tm-label { font-size: var(--fs-12); font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
.tm-general { margin-top: 4px; padding: 12px 0; border-top: 1px dashed var(--border); display: flex; flex-direction: column; gap: 8px; }
.tm-general-t { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
/* The campus's bottom bar: a quiet white strip under a thin line (owner, 23 Nov 2026: the grey band looked heavy and cut off). */
.tm-school-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 16px 14px; border-top: 1px solid var(--border); background: var(--surface); }
.tm-school-foot:empty { display: none; }

/* Waiting teacher: classes picked right where you approve */
.tm-cpick { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.tm-cpick-chip { appearance: none; font: inherit; font-size: var(--fs-13); font-weight: 600; padding: 4px 12px; border-radius: 99px; border: 1.5px solid var(--border); background: var(--surface); color: var(--text-strong); cursor: pointer; }
.tm-cpick-chip:hover { border-color: var(--primary); }
.tm-cpick-chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }
.tm-cpick-chip:focus-visible { outline: 3px solid var(--primary-soft); outline-offset: 2px; }

/* People grouped by school */
.tm-group-head { margin: 22px 0 2px; font-size: var(--fs-12); font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--primary); padding-bottom: 6px; border-bottom: 2px solid var(--primary-soft); }
.tm-group-head:first-child { margin-top: 0; }
.tm-list .tm-item { padding: 10px 0; }

@media (max-width: 720px) {
  .tm-tab { padding: 10px 12px; }
  .tm-school-head { padding: 12px; }
  .tm-school-body { padding: 6px 12px 2px; }
  .tm-school-foot { padding: 8px 12px 12px; }
  .tm-school-count { flex: 1 1 100%; }
  .tm-crow-count { margin-left: auto; }
}

/* ── First screen, no team yet ── */
.tm-start-hero { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; padding: 0; margin-bottom: calc(var(--sp-2) * -1); }
.tm-start-h { margin: 0; font-size: var(--fs-17); font-weight: 800; color: var(--text-strong); display: inline; }
.tm-start-sub { margin: 0; display: inline; color: var(--text-muted); font-size: var(--fs-14); line-height: 1.5; }
.tm-start-sub:before { content: " · "; }
.tm-start-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: var(--sp-5); align-items: start; }
.tm-start-side { display: flex; flex-direction: column; gap: var(--sp-4); }
.tm-make { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary), var(--shadow-card); }
.tm-kinds { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 4px 0 8px; }
.tm-kind { appearance: none; font: inherit; text-align: left; display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 14px; border: 2px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; position: relative; }
.tm-kind:hover { border-color: var(--primary); }
.tm-kind[aria-checked="true"] { border-color: var(--primary); background: var(--primary-softer); }
.tm-kind:focus-visible { outline: 3px solid var(--primary-soft); outline-offset: 2px; }
.tm-kind-ico { flex: none; width: 38px; height: 38px; border-radius: 11px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; }
.tm-kind-ico .icon { width: 20px; height: 20px; }
.tm-kind-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; padding-right: 22px; }
.tm-kind-t { font-weight: 800; font-size: var(--fs-15, 15px); color: var(--text-strong); }
.tm-kind-b { font-size: var(--fs-13); color: var(--text-muted); line-height: 1.4; }
.tm-kind-tick { position: absolute; top: 10px; right: 10px; width: 22px; height: 22px; border-radius: 99px; background: var(--primary); color: #fff; display: none; place-items: center; }
.tm-kind-tick .icon { width: 14px; height: 14px; }
.tm-kind[aria-checked="true"] .tm-kind-tick { display: grid; }
.tm-kind-next { margin: 0 0 8px; font-size: var(--fs-13); font-weight: 600; color: var(--primary); }
.tm-make .tm-actionrow { margin-top: var(--sp-3); }
.tm-trustcard { background: var(--surface-subtle); }
.tm-trust-t { margin: 0 0 10px; font-size: var(--fs-14); font-weight: 800; color: var(--text-strong); }
.tm-trust { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.tm-trust li { display: flex; gap: 10px; align-items: flex-start; font-size: var(--fs-14); line-height: 1.45; color: var(--text); }
.tm-trust li .icon { flex: none; width: 18px; height: 18px; margin-top: 2px; color: var(--success, #1f7a4a); }
.tm-tree { display: flex; flex-direction: column; align-items: center; gap: 0; padding: 6px 0 2px; }
.tm-tree-row { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; width: min(560px, 100%); position: relative; padding-top: 18px; margin-top: 0; }
.tm-tree-row:before { content: ""; position: absolute; top: 0; left: 25%; right: 25%; height: 18px; border: 2px solid var(--border); border-bottom: 0; border-radius: 10px 10px 0 0; }
.tm-tree > .tm-tnode.is-main { position: relative; }
.tm-tree > .tm-tnode.is-main:after { content: ""; position: absolute; left: 50%; bottom: -10px; width: 2px; height: 10px; background: var(--border); }
.tm-tree { padding-bottom: 4px; }
.tm-tree-col { display: flex; flex-direction: column; align-items: center; gap: 8px; border: 2px dashed var(--border); border-radius: 14px; padding: 10px; }
.tm-tnode { display: block; width: 100%; text-align: center; padding: 6px 12px; border-radius: 10px; font-size: var(--fs-13); font-weight: 700; border: 2px solid var(--border); background: var(--surface); color: var(--text-strong); }
.tm-tnode.is-main { width: auto; background: var(--primary); border-color: var(--primary); color: #fff; padding: 8px 20px; margin-bottom: 10px; }
.tm-tnode.is-school { background: var(--primary-soft); border-color: var(--primary); }
.tm-tnode.is-class { background: var(--primary-soft); border-color: var(--primary); color: var(--team-sec); }
.tm-tnode.is-teacher { background: #fff0d9; border-color: #8a4b00; color: #5a3100; }
:root[data-theme="dark"] .tm-tnode.is-class { background: #2c2147; color: #cdb8f5; }
:root[data-theme="dark"] .tm-tnode.is-teacher { background: #3a2a10; color: #f2cf9a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tm-tnode.is-class { background: #2c2147; color: #cdb8f5; } :root:not([data-theme="light"]) .tm-tnode.is-teacher { background: #3a2a10; color: #f2cf9a; } }
@media (max-width: 860px) { .tm-start-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 560px) { .tm-kinds { grid-template-columns: 1fr; } .tm-start-sub { display: block; } .tm-start-sub:before { content: none; } .tm-tree-row { gap: 10px; } }

/* ── Motion: it explains, it never decorates. Everything is off for people who prefer less motion. ── */
@keyframes tm-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes tm-pop { 0% { transform: scale(.4); opacity: 0; } 70% { transform: scale(1.18); opacity: 1; } 100% { transform: scale(1); } }
@keyframes tm-grow { from { opacity: 0; transform: scale(.86); } to { opacity: 1; transform: none; } }
@keyframes tm-draw { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes tm-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes tm-nudge { 0%, 100% { box-shadow: 0 0 0 0 rgba(217, 119, 6, 0); } 50% { box-shadow: 0 0 0 5px rgba(217, 119, 6, .18); } }

/* first screen: the hero, then the two columns, then the tree and the steps arrive one after the other */
.tm-start-hero { animation: tm-rise .5s cubic-bezier(.2, .7, .2, 1) both; }
.tm-start-grid > .tm-make { animation: tm-rise .55s .08s cubic-bezier(.2, .7, .2, 1) both; }
.tm-start-side > :nth-child(1) { animation: tm-rise .55s .16s cubic-bezier(.2, .7, .2, 1) both; }
.tm-start-side > :nth-child(2) { animation: tm-rise .55s .24s cubic-bezier(.2, .7, .2, 1) both; }
.tm-treecard { animation: tm-rise .55s .32s cubic-bezier(.2, .7, .2, 1) both; }
.tm-start-grid ~ .tm-how { animation: tm-rise .55s .4s cubic-bezier(.2, .7, .2, 1) both; }
/* choosing "one school" or "a group": the tick pops, the card lifts a little */
.tm-kind { transition: border-color .15s, background-color .15s, transform .15s, box-shadow .15s; }
.tm-kind:hover { transform: translateY(-2px); box-shadow: var(--shadow-card); }
.tm-kind[aria-checked="true"] .tm-kind-tick { animation: tm-pop .35s cubic-bezier(.2, .9, .3, 1.4) both; }
.tm-kind-next:not([hidden]) { animation: tm-rise .3s both; }
/* the tree builds itself from the top: you, then each school with its principal, class and teacher */
.tm-tree .tm-tnode.is-main { animation: tm-grow .4s .5s cubic-bezier(.2, .8, .3, 1.2) both; }
.tm-tree .tm-tree-row:before { transform-origin: top; animation: tm-draw .3s .85s both; }
.tm-tree .tm-tree-col { animation: tm-fade .35s 1s both; }
.tm-tree .tm-tnode.is-school { animation: tm-grow .4s 1.1s cubic-bezier(.2, .8, .3, 1.2) both; }
.tm-tree .tm-tnode.is-prin { animation: tm-grow .4s 1.3s cubic-bezier(.2, .8, .3, 1.2) both; }
.tm-tree .tm-tnode.is-class { animation: tm-grow .4s 1.5s cubic-bezier(.2, .8, .3, 1.2) both; }
.tm-tree .tm-tnode.is-teacher { animation: tm-grow .4s 1.7s cubic-bezier(.2, .8, .3, 1.2) both; }

/* in a team: a tab's content fades in, schools and classes slide in one by one, the first thing that needs you breathes */
.tm-panel:not([hidden]) { animation: tm-fade .25s both; }
.tm-panel:not([hidden]) > .tm-card { animation: tm-rise .4s cubic-bezier(.2, .7, .2, 1) both; }
.tm-panel:not([hidden]) > .tm-card:nth-child(2) { animation-delay: .05s; }
.tm-panel:not([hidden]) > .tm-card:nth-child(3) { animation-delay: .1s; }
.tm-panel:not([hidden]) > .tm-card:nth-child(4) { animation-delay: .15s; }
.tm-school { animation: tm-rise .45s cubic-bezier(.2, .7, .2, 1) both; }
.tm-school:nth-child(2) { animation-delay: .08s; }
.tm-school:nth-child(3) { animation-delay: .16s; }
.tm-crow { animation: tm-fade .35s both; }
.tm-crow:nth-child(2) { animation-delay: .06s; }
.tm-crow:nth-child(3) { animation-delay: .12s; }
.tm-crow:nth-child(4) { animation-delay: .18s; }
.tm-needs { animation: tm-nudge 2.4s 1s 2; }
.tm-needs-list li, .tm-pchip, .tm-cpick-chip, .tm-tab, .tm-crow { transition: background-color .15s, border-color .15s, color .15s, transform .15s; }
.tm-pchip.is-general:hover, .tm-cpick-chip:hover { transform: translateY(-1px); }
.tm-cpick-chip[aria-pressed="true"] { animation: tm-pop .25s cubic-bezier(.2, .9, .3, 1.3); }
.tm-tab-badge { animation: tm-pop .4s .3s cubic-bezier(.2, .9, .3, 1.4) both; }
.tm-tab[aria-selected="true"] { transition: color .2s, border-color .2s; }

@media (prefers-reduced-motion: reduce) {
  .tm-start-hero, .tm-start-grid > *, .tm-start-side > *, .tm-treecard, .tm-start-grid ~ .tm-how, .tm-kind, .tm-kind-tick, .tm-kind-next, .tm-tree *, .tm-tree,
  .tm-panel, .tm-panel > .tm-card, .tm-school, .tm-crow, .tm-needs, .tm-cpick-chip, .tm-tab-badge, .tm-tree .tm-tree-row:before { animation: none !important; transition: none !important; }
  .tm-kind:hover, .tm-pchip.is-general:hover, .tm-cpick-chip:hover { transform: none; }
}

.tm-tab-count { font-size: var(--fs-12); font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text-muted); background: var(--surface-subtle); border-radius: 99px; padding: 0 8px; min-width: 22px; height: 20px; display: inline-grid; place-items: center; }
.tm-tab[aria-selected="true"] .tm-tab-count { background: var(--primary-soft); color: var(--primary); }
.tm-tab-count:empty { display: none; }

.tm-more { border-style: dashed; }
.tm-more .tm-note { margin: 10px 0 0; }

/* ── Inside a campus: the page becomes that campus's own page ── */
.tm-hero-campus { border-top: 4px solid var(--primary); background: linear-gradient(180deg, var(--primary-softer), var(--surface) 140px); }
.tm-crumbs { display: flex; align-items: center; gap: 8px; padding: 10px 16px 0; flex-wrap: wrap; font-size: var(--fs-13); }
.tm-crumb { color: var(--text-muted); font-weight: 600; }
.tm-crumb.is-now { color: var(--text-strong); font-weight: 800; }
.tm-crumb-sep { color: var(--text-muted); }
.tm-campus-switch { height: 32px; font-size: var(--fs-13); max-width: 220px; }
.tm-teamico.is-campus { background: var(--primary); color: #fff; }
.tm-prin-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.tm-statrow.is-four { grid-template-columns: repeat(4, 1fr); }
.tm-inside-ribbon { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 10px 16px; background: var(--primary); color: #fff; font-size: var(--fs-13); font-weight: 600; border-radius: 0 0 var(--r-lg) var(--r-lg); }
.tm-inside-ribbon .icon { width: 16px; height: 16px; flex: none; }
.tm-inside-ribbon .grow { min-width: 0; }
.tm-inside-off { font-weight: 500; opacity: .85; }
.tm-school.is-inside { border: 0; border-radius: 0; }
.tm-school.is-inside .tm-school-body { padding: 0 0 4px; }
.tm-school.is-inside .tm-school-foot { padding: 12px 0 4px; background: none; }
.tm-schools .tm-school-list:has(.is-inside) { gap: 0; }
@media (max-width: 720px) { .tm-statrow.is-four { grid-template-columns: repeat(2, 1fr); } .tm-crumbs { padding: 10px 12px 0; } }

.tm-head-foot .btn + .grow, .tm-head-foot .grow { flex: 1; }
.tm-head-foot { gap: 10px; }
/* The quiet white pill is for the ordinary button; a primary one (green, white text) must keep its own colours or it turns into a blank box. */
#tm-head-add-campus:not(.btn-primary), #tm-head-add-class:not(.btn-primary) { background: var(--surface); border: 1px solid var(--border); }
#tm-head-add-campus:not(.btn-primary):hover, #tm-head-add-class:not(.btn-primary):hover { border-color: var(--primary); color: var(--primary); }
.tm-more-row { display: flex; justify-content: center; padding: 12px 0 2px; }
/* One short line per school when a group has many schools */
.tm-sline { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.tm-sline:first-child { border-top: 0; }
.tm-sline-main { min-width: 0; }
.tm-sline-name { font-weight: 600; overflow-wrap: anywhere; }

/* ── Progress tab and position cards (docs/TEAMS.md section 20) ───────────────────────────── */
.tm-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tm-ptiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: var(--sp-3); }
.tm-ptile { border: 1px solid var(--border); border-radius: var(--r-md, 10px); padding: var(--sp-3) var(--sp-4); min-width: 0; }
.tm-ptile-l { font-size: var(--fs-12); color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.tm-ptile-v { font-size: var(--fs-16, 16px); font-weight: 800; color: var(--text-strong); overflow-wrap: anywhere; margin: 2px 0; }
.tm-posbadge { display: inline-block; min-width: 3ch; padding: 2px 8px; border-radius: 999px; background: var(--surface-2, #f1f3f2); font-weight: 700; font-variant-numeric: tabular-nums; }
.tm-posbadge.is-top { background: var(--primary-soft, #d9efe9); color: var(--primary-strong, #0b5d4b); }
.tm-ptable td { vertical-align: middle; }
.tm-avgbar { display: inline-flex; align-items: center; gap: 8px; min-width: 120px; justify-content: flex-end; }
.tm-avgbar-track { flex: 1; height: 6px; background: var(--border); border-radius: 999px; overflow: hidden; min-width: 56px; }
.tm-avgbar-fill { display: block; height: 100%; background: var(--primary, #0f766e); border-radius: 999px; }
.tm-avgbar-n { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 4ch; text-align: right; }
.tm-change { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.tm-change.is-up { color: var(--success-strong, #0b6b3a); }
.tm-change.is-down { color: var(--danger-strong, #a12626); }
.tm-change.is-steady, .tm-change.is-new { color: var(--text-muted); }

.tm-pcard { border: 1px solid var(--border); border-radius: var(--r-lg, 14px); padding: var(--sp-5); display: flex; flex-direction: column; gap: var(--sp-4); background: var(--surface); }
.tm-pcard-head { display: flex; justify-content: space-between; gap: var(--sp-4); align-items: flex-start; flex-wrap: wrap; }
.tm-pcard-title { margin: 0; font-size: var(--fs-20, 20px); overflow-wrap: anywhere; }
.tm-pcard-h { margin: 0 0 6px; font-size: var(--fs-14, 14px); }
.tm-pcard-move { margin: -8px 0 0; font-weight: 600; }
.tm-pos { text-align: center; border-radius: var(--r-md, 10px); padding: 8px 16px; background: var(--surface-2, #f1f3f2); min-width: 120px; }
.tm-pos.is-top { background: var(--primary-soft, #d9efe9); }
.tm-pos-n { font-size: 30px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tm-pos-l { font-size: var(--fs-12); color: var(--text-muted); max-width: 160px; }
.tm-cstats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: var(--sp-3); }
.tm-cstat { border-left: 3px solid var(--border); padding-left: 10px; min-width: 0; }
.tm-cstat-v { font-size: 18px; font-weight: 800; }
.tm-cstat-l { font-size: var(--fs-12); color: var(--text-muted); }
.tm-cstats.is-small .tm-cstat-v { font-size: 15px; }
.tm-pcard-foot { margin: 0; }
.tm-tcard { border: 1px solid var(--border); border-radius: var(--r-md, 10px); padding: var(--sp-3) var(--sp-4); break-inside: avoid; display: flex; flex-direction: column; gap: 6px; }
.tm-tcard-name { margin: 0; font-size: var(--fs-16, 16px); }
.tm-cards-bar { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; }
.tm-cards-pages { display: flex; flex-direction: column; gap: var(--sp-5); }
.tm-tcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--sp-3); }
@media print {
  @page { size: A4; margin: 12mm; }
  .tm-pcard { border: 0; padding: 0; break-after: page; border-radius: 0; }
  .tm-pcard:last-child { break-after: auto; }
  .tm-tcards { grid-template-columns: repeat(2, 1fr); break-after: page; }
  .tm-table th { position: static; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.tm-check { display: inline-flex; gap: 6px; align-items: center; font-size: var(--fs-13); }
.tm-sec-actions .select-sm { width: auto; min-width: 150px; }
.tm-cards-bar .select { width: auto; min-width: 170px; }
.tm-copy-list { max-height: 46vh; overflow-y: auto; }
.tm-copy-row { display: flex; gap: 12px; align-items: center; cursor: pointer; }
.tm-copy-foot { justify-content: flex-end; gap: var(--sp-3); padding-top: var(--sp-3); }

/* Rights dialog: presets and the live "In short" */
.tm-presets { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: var(--sp-3); }
.tm-preset { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 5px 12px; font: inherit; font-size: var(--fs-13); cursor: pointer; }
.tm-preset:hover { border-color: var(--primary, #0f766e); }
.tm-rsum { border: 1px solid var(--border); border-radius: var(--r-md, 10px); padding: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-4); background: var(--surface-2, #f7f8f7); }
.tm-rsum-t { font-weight: 700; margin-bottom: 6px; }
.tm-rsum-cols { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
@media (max-width: 640px) { .tm-rsum-cols { grid-template-columns: 1fr; } }
.tm-rsum-h { font-size: var(--fs-12); text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); font-weight: 700; margin-bottom: 4px; }
.tm-rsum ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-13); }
.tm-rsum li { display: flex; gap: 8px; align-items: flex-start; }
.tm-rsum li svg { flex: none; width: 14px; height: 14px; margin-top: 3px; }
.tm-rsum .is-can li svg { color: var(--success-strong, #0b6b3a); }
.tm-rsum .is-cannot li svg { color: var(--danger-strong, #a12626); }
/* Wide tables scroll inside their own box, never widen the page (flex children default to min-width:auto) */
.tm-pcard > *, .tm-pcard section, .tm-stack > *, .tm-card { min-width: 0; }
.tm-table-wrap { max-width: 100%; }
/* The hidden screen-reader words sit inside their own box, so a wide scrolling table can't push the page sideways through them */
.tm-change, .tm-table-wrap { position: relative; }
/* Phone: a long school name must not make the school picker wider than the card, and three counters must fit in a row */
@media (max-width: 720px) {
  .tm-campus-filter .select { min-width: 0; width: 100%; max-width: 100%; }
  .tm-campus-filter { min-width: 0; max-width: 100%; }
  .tm-stat-tile { padding: var(--sp-3); gap: 8px; min-width: 0; }
  .tm-stat-tile .tm-stat-v { font-size: 18px; }
}

/* Number blocks on the cards: the bar sits left under its label and nothing overlaps in a narrow card */
.tm-cstats { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.tm-cstats.is-small { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tm-cstat .tm-avgbar { justify-content: flex-start; min-width: 0; }
.tm-cstat .tm-avgbar-track { min-width: 40px; max-width: 80px; }

/* ══ Team guide, living parts (team/guide/guide-live.js) ═════════════════════════════════════ */
.tg-hero { position: relative; overflow: hidden; }
.tg-hero > * { position: relative; z-index: 1; }
.tg-orb { position: absolute !important; z-index: 0 !important; border-radius: 50%; filter: blur(40px); opacity: .5; pointer-events: none; animation: tg-drift 14s ease-in-out infinite alternate; }
.tg-orb.is-a { width: 220px; height: 220px; background: var(--primary-soft); top: -60px; right: 10%; }
.tg-orb.is-b { width: 180px; height: 180px; background: var(--success-bg); bottom: -50px; left: 30%; animation-delay: -6s; }
@keyframes tg-drift { to { transform: translate(40px, 30px) scale(1.15); } }

.tg-nav { position: sticky; top: 0; z-index: 6; display: flex; gap: 8px; overflow-x: auto; padding: 10px 2px; background: var(--bg, var(--surface)); border-bottom: 1px solid var(--border); scrollbar-width: none; }
.tg-nav::-webkit-scrollbar { display: none; }
.tg-chip { flex: none; padding: 7px 14px; border-radius: var(--r-pill); border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: var(--fs-13); font-weight: 600; text-decoration: none; transition: background .2s, color .2s, border-color .2s; }
.tg-chip:hover { border-color: var(--primary); }
.tg-chip.is-on { background: var(--primary); border-color: var(--primary); color: var(--text-on-primary); }
.tg-section { scroll-margin-top: 64px; }

/* the picture: a group that lights up for the role */
.tg-picture { gap: var(--sp-5); }
.tg-picture-roles { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; }
.tg-roles { display: flex; flex-wrap: wrap; gap: 8px; }
.tg-role { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: var(--r-pill); border: 1px solid var(--border); background: var(--surface); font: inherit; font-weight: 600; font-size: var(--fs-14); color: var(--text); cursor: pointer; transition: all .2s; }
.tg-role .icon { width: 16px; height: 16px; color: var(--primary); }
.tg-role[aria-selected="true"] { background: var(--primary); border-color: var(--primary); color: var(--text-on-primary); box-shadow: 0 6px 16px rgba(15, 118, 110, .25); }
.tg-role[aria-selected="true"] .icon { color: inherit; }
.tg-picture-body { display: grid; grid-template-columns: 1.4fr 1fr; gap: var(--sp-6); align-items: center; }
.tg-tree { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: var(--sp-4); background: var(--surface-subtle); border-radius: var(--r-lg); min-width: 0; overflow-x: auto; }
.tg-branches { display: flex; gap: 14px; justify-content: center; }
.tg-branch { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 10px; border: 1px dashed var(--border); border-radius: 12px; }
.tg-classes { display: flex; gap: 8px; }
.tg-classcol { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.tg-node { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 10px; font-size: var(--fs-12); font-weight: 700; background: var(--surface); border: 1px solid var(--border); color: var(--text-strong); white-space: nowrap; transition: opacity .35s, transform .35s, box-shadow .35s, background .35s; }
.tg-node .icon { width: 14px; height: 14px; color: var(--primary); }
.tg-node.is-group { background: var(--primary); color: var(--text-on-primary); border-color: var(--primary); font-size: var(--fs-13); padding: 8px 14px; }
.tg-node.is-group .icon { color: inherit; }
.tg-node.is-class { background: var(--primary-soft); border-color: transparent; }
.tg-node.is-teacher { background: var(--success-bg); border-color: transparent; }
.tg-reveal.is-in .tg-node { animation: tm-pop .5s ease backwards; animation-delay: var(--d); }
.tg-tree[data-role] .tg-node, .tg-tree[data-role] .tg-branch { opacity: .28; transform: scale(.96); }
.tg-tree[data-role="main"] .tg-node, .tg-tree[data-role="main"] .tg-branch { opacity: 1; transform: none; }
.tg-tree[data-role="principal"] .tg-branch.is-mine, .tg-tree[data-role="principal"] .tg-branch.is-mine .tg-node { opacity: 1; transform: none; }
.tg-tree[data-role="principal"] .tg-branch.is-mine { box-shadow: 0 0 0 2px var(--primary); }
.tg-tree[data-role="teacher"] .tg-classcol.is-mine .tg-node { opacity: 1; transform: none; box-shadow: 0 0 0 2px var(--primary); }
.tg-tree[data-role="teacher"] .tg-branch.is-mine { opacity: 1; }
.tg-tree[data-role="student"] .tg-classcol.is-mine .tg-node.is-class { opacity: 1; transform: none; box-shadow: 0 0 0 2px var(--primary); }
.tg-tree[data-role="student"] .tg-branch.is-mine { opacity: 1; }
.tg-picture-text { display: flex; flex-direction: column; gap: var(--sp-3); }
.tg-role-t { margin: 0; font-size: var(--fs-20); color: var(--text-strong); }
.tg-roleline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.tg-roleline.is-in li { animation: tm-open .4s ease backwards; }
.tg-roleline.is-in li:nth-child(2) { animation-delay: .08s; }
.tg-roleline.is-in li:nth-child(3) { animation-delay: .16s; }
.tg-roleline li { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; line-height: 1.5; }
.tg-roleline .icon { flex: none; width: 16px; height: 16px; margin-top: 4px; color: var(--success); }

/* positions */
.tg-two { display: grid; grid-template-columns: 1.3fr 1fr; gap: var(--sp-4); align-items: start; }
.tg-ladder-bar { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; justify-content: space-between; }
.tg-seg { display: inline-flex; padding: 3px; border-radius: var(--r-pill); background: var(--surface-subtle); border: 1px solid var(--border); }
.tg-seg button { border: 0; background: transparent; padding: 6px 14px; border-radius: var(--r-pill); font: inherit; font-size: var(--fs-13); font-weight: 600; color: var(--text-muted); cursor: pointer; }
.tg-seg button[aria-pressed="true"] { background: var(--primary); color: var(--text-on-primary); }
.tg-ladder { position: relative; }
.tg-lrow { position: absolute; left: 0; right: 0; top: 0; height: 48px; display: grid; grid-template-columns: 28px minmax(0, 1fr) 44px 86px; gap: 10px; align-items: center; padding: 0 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); transition: transform .9s cubic-bezier(.3, .7, .2, 1); }
.tg-lpos { width: 24px; height: 24px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-weight: 800; font-size: var(--fs-12); display: grid; place-items: center; }
.tg-lname { font-size: var(--fs-13); font-weight: 600; color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tg-lbar { display: block; height: 6px; border-radius: 999px; background: var(--border); overflow: hidden; margin-top: 4px; }
.tg-lbar-fill { display: block; height: 100%; width: 0; background: var(--primary); border-radius: 999px; transition: width .9s ease; }
.tg-lnum { font-weight: 800; font-variant-numeric: tabular-nums; text-align: right; }
.tg-lmove { font-size: var(--fs-12); font-weight: 700; white-space: nowrap; color: var(--text-muted); min-height: 1em; }
.tg-lmove.is-up { color: var(--success); animation: tm-pop .5s ease backwards .6s; }
.tg-lmove.is-down { color: var(--danger, #b42318); animation: tm-pop .5s ease backwards .6s; }
.tg-cardinfo { gap: var(--sp-3); }
.tg-pcardmock { border: 1px solid var(--border); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 8px; background: var(--surface-subtle); transform: rotate(-1.5deg); box-shadow: 0 10px 24px rgba(17, 28, 45, .1); transition: transform .4s; }
.tg-cardinfo:hover .tg-pcardmock { transform: rotate(0deg) translateY(-3px); }
.tg-pm-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.tg-pm-badge { padding: 6px 12px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); font-weight: 800; }
.tg-pm-line { display: block; height: 8px; border-radius: 4px; background: var(--border); }
.tg-pm-line.is-w60 { width: 60%; } .tg-pm-line.is-w70 { width: 70%; } .tg-pm-line.is-w80 { width: 80%; } .tg-pm-line.is-w90 { width: 90%; } .tg-pm-line.is-w100 { width: 100%; }
.tg-pm-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.tg-pm-stat { height: 26px; border-radius: 6px; background: var(--primary-soft); opacity: .7; }

/* send a copy */
.tg-copystage { display: grid; grid-template-columns: minmax(180px, 240px) minmax(0, 1fr); gap: var(--sp-6); align-items: center; }
.tg-quizcard { display: flex; gap: 12px; align-items: center; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-card); }
.tg-quizcard .icon { width: 28px; height: 28px; color: var(--primary); flex: none; }
.tg-qname { font-weight: 700; color: var(--text-strong); }
.tg-copylist { display: flex; flex-direction: column; gap: 10px; }
.tg-trow { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); min-height: 56px; }
.tg-tname { font-weight: 600; color: var(--text-strong); }
.tg-draft { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 10px; font-size: var(--fs-12); font-weight: 700; background: var(--warning-bg, #fff4d6); color: var(--text-strong); opacity: 0; transform: translateX(-60px) scale(.9); transition: opacity .4s, transform .5s cubic-bezier(.3, .7, .2, 1); }
.tg-draft .icon { width: 14px; height: 14px; }
.tg-trow.is-got .tg-draft { opacity: 1; transform: none; }
.tg-trow.is-got { border-color: var(--success); }
.tg-copyfoot { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; margin-top: var(--sp-4); }
.tg-copyfoot .tm-sub { display: inline-flex; align-items: center; gap: 6px; }
.tg-copyfoot .tm-sub .icon { width: 14px; height: 14px; }

/* rights practice */
.tg-play-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: var(--sp-5); align-items: start; }
.tg-switches { display: flex; flex-direction: column; }
.tg-play .tm-rsum { margin: 0; }
.tm-preset[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--text-on-primary); }

@media (max-width: 720px) {
  .tg-picture-body, .tg-two, .tg-copystage, .tg-play-body { grid-template-columns: minmax(0, 1fr); }
  .tg-lrow { grid-template-columns: 24px minmax(0, 1fr) 38px 66px; gap: 6px; padding: 0 8px; }
  .tg-lmove { font-size: 11px; }
  .tg-branches { gap: 8px; }
  .tg-branch { padding: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .tg-orb, .tg-reveal.is-in .tg-node, .tg-lmove, .tg-roleline.is-in li { animation: none !important; }
  .tg-lrow, .tg-lbar-fill, .tg-draft, .tg-node { transition: none !important; }
}
/* guide tree: compact, and centred without clipping its left side when it must scroll */
.tg-tree { align-items: stretch; }
.tg-tree > .tg-node.is-group { align-self: center; }
.tg-branches { margin-inline: auto; gap: 8px; }
.tg-branch { padding: 8px; gap: 8px; }
.tg-classes { gap: 4px; }
.tg-tree .tg-node { padding: 4px 8px; }
.tg-picture-body { grid-template-columns: 1.8fr 1fr; }
@media (max-width: 720px) { .tg-picture-body { grid-template-columns: minmax(0, 1fr); } }

/* ── Clickable rows (Quizzes tab) and the report's expandable questions ──────────────────────────── */
/* The whole quiz row opens the quiz: the name link is stretched over the row; the checkbox and the menu sit above it. */
.tm-qrow { position: relative; cursor: pointer; }
.tm-qrow a.tm-qtitle::after { content: ""; position: absolute; inset: 0; border-radius: 10px; }
.tm-qrow a.tm-qtitle:focus-visible { outline: none; text-decoration: underline; }
.tm-qrow a.tm-qtitle:focus-visible::after { outline: 2px solid var(--primary); outline-offset: -2px; }
.tm-qrow input[type="checkbox"], .tm-qrow .tm-qstats button { position: relative; z-index: 1; }

/* Report: people rows open that person's answers */
.tm-rowopen { cursor: pointer; }
.tm-rowbtn { all: unset; cursor: pointer; font-weight: 600; color: var(--text-strong); }
.tm-rowbtn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
.tm-table td.tm-go { color: var(--text-muted); text-align: right; }
.tm-table td.tm-go .icon { width: 16px; height: 16px; vertical-align: middle; margin-left: 2px; }
.tm-rowopen:hover td.tm-go { color: var(--primary); }
.tm-ans-head { display: flex; align-items: baseline; gap: var(--sp-3); margin-bottom: var(--sp-2); }
.tm-ans-score { font-size: var(--fs-20, 20px); font-weight: 700; color: var(--text-strong); }

/* Report: one card per question; open it to see every answer and who gave it */
.tm-qa-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-2); flex-wrap: wrap; }
.tm-qa-list { display: flex; flex-direction: column; }
.tm-qa { border-top: 1px solid var(--border); }
.tm-qa:first-child { border-top: 0; }
.tm-qa-head { all: unset; box-sizing: border-box; display: grid; grid-template-columns: 28px minmax(0, 1fr) minmax(160px, 260px) 20px; gap: var(--sp-3); align-items: center; width: 100%; padding: 12px 8px; border-radius: 10px; font-size: var(--fs-14); }
.tm-qa.is-poll .tm-qa-head { grid-template-columns: 28px minmax(0, 1fr) minmax(160px, 260px); }
button.tm-qa-head { cursor: pointer; }
button.tm-qa-head:hover { background: var(--surface-hover); }
button.tm-qa-head:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.tm-qa-n { color: var(--text-muted); font-variant-numeric: tabular-nums; text-align: right; }
.tm-qa-text { color: var(--text-strong); font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tm-qa-stat { display: flex; align-items: center; gap: var(--sp-2); justify-content: flex-end; font-size: var(--fs-13); white-space: nowrap; }
.tm-qa-stat .tm-bar { flex: 1 1 80px; }
.tm-qa-chev { width: 18px; height: 18px; color: var(--text-muted); transition: transform .15s; }
.tm-qa.is-open .tm-qa-chev { transform: rotate(180deg); }
.tm-qa-body { display: none; padding: 4px 8px 16px 44px; }
.tm-qa.is-open .tm-qa-body, .tm-qa.is-poll .tm-qa-body { display: block; }
.tm-qa-key { margin: 0 0 var(--sp-2); font-size: var(--fs-13); color: var(--text); }
.tm-ag-list { list-style: none; margin: var(--sp-2) 0 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-2); }
.tm-ag { border: 1px solid var(--border); border-radius: var(--r-md); padding: 10px 12px; background: var(--surface); }
.tm-ag-correct { border-color: var(--report-correct); }
.tm-ag-top { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-14); }
.tm-ag-mark { display: inline-flex; flex: none; }
.tm-ag-mark .icon { width: 16px; height: 16px; }
.tm-ag-correct .tm-ag-mark { color: var(--report-correct); }
.tm-ag-wrong .tm-ag-mark { color: var(--report-wrong); }
.tm-ag-partial .tm-ag-mark, .tm-ag-pending .tm-ag-mark { color: var(--report-partial); }
.tm-ag-text { flex: 1; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.tm-ag-n { all: unset; box-sizing: border-box; display: inline-flex; align-items: center; gap: 2px; cursor: pointer; color: var(--primary); font-size: var(--fs-12); font-weight: 600; white-space: nowrap; padding: 3px 6px; border-radius: var(--r-pill); }
.tm-ag-n:hover { background: var(--surface-hover); }
.tm-ag-n:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.tm-ag-chev { width: 14px; height: 14px; transition: transform .15s; }
.tm-ag-n.is-open .tm-ag-chev { transform: rotate(180deg); }
.tm-ag-names[hidden] { display: none; }
.tm-qa-btns { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.tm-ag-names { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
@media (max-width: 720px) {
  .tm-qa-head { grid-template-columns: 22px minmax(0, 1fr) 18px; }
  .tm-qa.is-poll .tm-qa-head { grid-template-columns: 22px minmax(0, 1fr); }
  .tm-qa-stat { grid-column: 2 / -1; justify-content: flex-start; }
  .tm-qa-head .tm-qa-chev { grid-column: 3; grid-row: 1; }
  .tm-qa-body { padding-left: 8px; }
  .tm-table td.tm-go span { display: none; }
}
@media print { .tm-qa-chev, .tm-ag-chev { display: none; } .tm-ag-names[hidden] { display: flex; } .tm-qa-body { display: block; } }

/* ── New invite link: two numbered steps, a segmented preset, every switch one click away ──────────── */
.tm-invite-dlg { width: min(640px, calc(100vw - 24px)); }
.tm-invite-dlg .tm-step { display: flex; flex-direction: column; gap: var(--sp-3); padding: var(--sp-4) 0; border-top: 1px solid var(--border); }
.tm-invite-dlg .tm-step:first-of-type { border-top: 0; padding-top: 0; }
.tm-step[hidden], .tm-cpick[hidden] { display: none; }
.tm-step-h { display: flex; align-items: center; gap: var(--sp-2); margin: 0; font-size: var(--fs-16, 16px); font-weight: 700; color: var(--text-strong); }
.tm-step-n { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--primary); color: var(--text-on-primary, #fff); font-size: var(--fs-12); font-weight: 700; }
.tm-invite-dlg .tm-step .field, .tm-invite-dlg .tm-step .tm-cpick { margin: 0; }
.tm-invite-dlg .tm-right { padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); }
.tm-invite-dlg .tm-rights .tm-right { border: 0; border-radius: 0; background: none; padding: 8px 0; border-top: 1px solid var(--border); }
.tm-invite-dlg .tm-rights fieldset .tm-right:first-of-type { border-top: 0; }
.tm-inv-classes { padding: 10px 12px; border: 1px dashed var(--border-strong, var(--border)); border-radius: var(--r-md); }
.tm-inv-classes .tm-cpick-hint { flex-basis: 100%; }
/* One row of four equal choices instead of loose pills; the label sits above, the chosen one is filled. */
.tm-invite-dlg .tm-presets { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-bottom: var(--sp-3); }
.tm-invite-dlg .tm-presets .tm-label { grid-column: 1 / -1; }
.tm-invite-dlg .tm-preset { border-radius: var(--r-md); padding: 8px 6px; font-weight: 600; text-align: center; }
@media (max-width: 520px) { .tm-invite-dlg .tm-presets { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tm-invite-dlg .tm-rsum { margin-bottom: 0; }
.tm-fine { margin-top: var(--sp-3); border: 1px solid var(--border); border-radius: var(--r-md); }
.tm-fine > summary { cursor: pointer; padding: 10px 12px; font-weight: 600; font-size: var(--fs-14); list-style: none; display: flex; align-items: center; justify-content: space-between; }
.tm-fine > summary::-webkit-details-marker { display: none; }
.tm-fine > summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--text-muted); border-bottom: 2px solid var(--text-muted); transform: rotate(45deg); transition: transform .15s; margin-right: 4px; }
.tm-fine[open] > summary::after { transform: rotate(-135deg); }
.tm-fine > summary:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; border-radius: var(--r-md); }
.tm-fine-body { display: flex; flex-direction: column; gap: var(--sp-3); padding: 4px 12px 12px; border-top: 1px solid var(--border); }
.tm-chip.is-class { background: var(--primary-soft, var(--surface-subtle)); }
.tm-go-in { display: inline-flex; align-items: center; gap: 2px; }
.tm-table td.tm-go .icon { margin-left: 0; }
.tm-invite-dlg .dialog-actions { position: sticky; bottom: calc(var(--sp-6) * -1); margin: 0 calc(var(--sp-6) * -1) calc(var(--sp-6) * -1); padding: var(--sp-3) var(--sp-6) var(--sp-6); background: var(--surface); border-top: 1px solid var(--border); }

/* ── Student report (team/student/) ─────────────────────────────────────────────────────────────── */
.tm-student { display: flex; flex-direction: column; gap: var(--sp-4); }
.tm-student-head { display: flex; align-items: center; gap: var(--sp-4); flex-wrap: wrap; }
.tm-student-name { margin: 0; font-size: var(--fs-24, 24px); color: var(--text-strong); }
.tm-segs { display: inline-flex; gap: 4px; padding: 4px; background: var(--surface-subtle); border: 1px solid var(--border); border-radius: var(--r-pill); align-self: flex-start; flex-wrap: wrap; }
.tm-seg { appearance: none; border: 0; background: none; font: inherit; font-size: var(--fs-13); font-weight: 600; padding: 6px 14px; border-radius: var(--r-pill); cursor: pointer; color: var(--text); }
.tm-seg[aria-pressed="true"] { background: var(--primary); color: var(--text-on-primary, #fff); }
.tm-seg:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.tm-up { color: var(--report-correct); }
.tm-down { color: var(--report-wrong); }
/* Scores over time */
.tm-sp { display: flex; align-items: flex-end; gap: 8px; overflow-x: auto; padding: 8px 0 4px; min-height: 190px; }
.tm-sp-col { flex: 1 0 44px; max-width: 90px; display: flex; flex-direction: column; align-items: center; gap: 4px; text-decoration: none; color: var(--text); }
.tm-sp-n { font-size: var(--fs-12); font-variant-numeric: tabular-nums; color: var(--text-muted); }
.tm-sp-track { position: relative; width: 100%; height: 130px; display: flex; align-items: flex-end; background: var(--surface-subtle); border-radius: 6px; overflow: hidden; }
.tm-sp-bar { display: block; width: 100%; background: var(--primary); border-radius: 6px 6px 0 0; }
.tm-sp-bar.is-none { background: repeating-linear-gradient(135deg, transparent 0 5px, var(--border) 5px 7px); opacity: .7; }
.tm-sp-bar.is-wait { background: repeating-linear-gradient(135deg, transparent 0 5px, var(--report-pending) 5px 7px); }
.tm-sp-med { position: absolute; left: 0; right: 0; height: 0; border-top: 2px dashed var(--text-strong); opacity: .75; }
.tm-sp-l { font-size: var(--fs-11, 11px); color: var(--text-muted); text-align: center; line-height: 1.2; overflow-wrap: anywhere; }
.tm-sp-col:hover .tm-sp-bar { filter: brightness(1.1); }
.tm-sp-col:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
.tm-sp-key { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-top: var(--sp-2); }
.tm-sp-swatch { width: 14px; height: 10px; border-radius: 2px; display: inline-block; margin-left: 6px; }
.tm-sp-swatch.is-bar { background: var(--primary); }
.tm-sp-swatch.is-med { height: 0; border-top: 2px dashed var(--text-strong); border-radius: 0; }
.tm-student-notes { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-14); }
/* Every quiz */
.tm-sq-head { grid-template-columns: minmax(0, 1fr) 64px 110px 150px 20px; }
.tm-sq-head[disabled] { cursor: default; opacity: .75; }
.tm-sq-head[disabled]:hover { background: none; }
.tm-sq .tm-qa-text { display: flex; flex-direction: column; -webkit-line-clamp: unset; }
.tm-sq-score { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.tm-sq-diff { font-size: var(--fs-13); text-align: right; white-space: nowrap; }
.tm-sq-state { justify-self: start; }
.tm-sq-state.is-wait { background: var(--warning-soft, var(--surface-subtle)); }
.tm-sq-state.is-missed { color: var(--text-muted); }
.tm-sq.is-open .tm-qa-chev { transform: rotate(180deg); }
.tm-student-answers { padding: 4px 8px 12px 8px; display: flex; flex-direction: column; gap: var(--sp-2); }
.tm-student-answers[hidden] { display: none; }
.tm-sq-link { display: inline-block; margin: 0 8px 12px; font-size: var(--fs-13); }
.tm-sq:not(.is-open) .tm-sq-link { display: none; }
/* A name that opens the student's report */
a.tm-chip.is-student { text-decoration: none; color: inherit; }
a.tm-chip.is-student:hover { border-color: var(--primary); color: var(--primary); }
@media (max-width: 720px) {
  .tm-sq-head { grid-template-columns: minmax(0, 1fr) 54px 20px; }
  .tm-sq-head .tm-sq-diff, .tm-sq-head .tm-sq-state { grid-column: 1 / -1; justify-self: start; text-align: left; }
}
@media print { .tm-sq .tm-student-answers[hidden] { display: flex; } .tm-sq-link { display: none; } }
.tm-ans-head { flex-wrap: wrap; }
.tm-ans-full { order: 3; margin-left: auto; font-size: var(--fs-13); font-weight: 600; }
a.tm-namelink { text-decoration: none; }
a.tm-namelink:hover { text-decoration: underline; color: var(--primary); }

/* Quizzes: grouped view (class, teacher, quizzes) and quick status chips */
.tm-segs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: var(--sp-2); }
.tm-viewbar-row { display: flex; flex-wrap: wrap; gap: 4px var(--sp-4); }
.tm-seg-label { font-size: var(--fs-11); font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
.tm-seg { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border-strong, var(--border)); background: var(--surface); color: var(--text); border-radius: var(--r-pill); padding: 4px 12px; font: inherit; font-size: var(--fs-13); font-weight: 600; cursor: pointer; min-height: 32px; }
.tm-seg:hover { background: var(--surface-subtle); }
.tm-seg.is-on { background: var(--primary); border-color: var(--primary); color: var(--on-primary, #fff); }
.tm-seg-n { font-size: var(--fs-11); font-weight: 800; opacity: .75; }
.tm-groups { display: flex; flex-direction: column; gap: var(--sp-2); }
.tm-grp-h { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); text-align: left; background: var(--surface-subtle); border: 1px solid var(--border); border-radius: var(--r-md); padding: 10px 12px; font: inherit; color: var(--text-strong); cursor: pointer; }
.tm-grp-h:hover { border-color: var(--primary); }
.tm-grp-name { display: flex; flex-direction: column; min-width: 0; font-weight: 700; padding-left: 20px; position: relative; }
.tm-grp-name small { font-weight: 500; font-size: var(--fs-12); color: var(--text-muted); }
.tm-grp-badges { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.tm-grp.lv-campus > .tm-grp-h { background: var(--primary-soft); border-color: transparent; }
.tm-grp-body { margin: 6px 0 4px 10px; padding-left: 10px; border-left: 3px solid var(--border); display: flex; flex-direction: column; gap: 6px; }
.tm-groups > .tm-grp-body { margin: 0; padding: 0; border: 0; }
.tm-sec-t { font-size: var(--fs-11); font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin: 8px 0 0; }
.tm-sec-btn { background: none; border: 0; padding: 4px 0; cursor: pointer; text-align: left; font-family: inherit; color: var(--primary); }
.tm-sec-btn::after { content: " \25B8"; }
.tm-sec-btn[aria-expanded="true"]::after { content: " \25BE"; }
.tm-month { font-size: var(--fs-12); font-weight: 700; color: var(--text-muted); margin-top: 6px; }
.tm-grp-body .tm-qrow { border: 1px solid var(--border); border-radius: var(--r-md); padding: 8px 10px; background: var(--surface); }
.tm-qrow { cursor: pointer; }
@media (max-width: 640px) { .tm-grp-body { margin-left: 4px; padding-left: 6px; } }
.tm-grp-row { display: flex; gap: 6px; align-items: stretch; }
.tm-grp-row > .tm-grp-h { flex: 1 1 auto; min-width: 0; }
.tm-grp-new { display: inline-flex; align-items: center; padding: 0 14px; border-radius: var(--r-md); background: var(--primary); color: var(--on-primary, #fff); font-weight: 700; font-size: var(--fs-13); text-decoration: none; white-space: nowrap; }
.tm-grp-new:hover { filter: brightness(1.08); }
.tm-topbar { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; margin-bottom: var(--sp-2); }
.tm-topbar .tm-search { flex: 1 1 220px; min-width: 0; height: 36px; }
.tm-topbar .tm-modes { margin: 0; flex: none; }
.tm-topbar .tm-seg { min-height: 34px; }
@media (max-width: 640px) { .tm-topbar .tm-search { flex-basis: 100%; } }
.tm-segs { overflow-x: auto; scrollbar-width: none; }
@media (max-width: 640px) { .tm-segs:not(.tm-modes) { flex-wrap: nowrap; } .tm-segs:not(.tm-modes)::-webkit-scrollbar { display: none; } .tm-segs .tm-seg { flex: none; } }

/* Quizzes tab, second pass (8 Nov 2026): white group cards with a tile, flat chips with state dots, class header, tiles on rows */
.tm-grp-h { background: var(--surface); gap: 12px; padding: 10px 14px; border-radius: 16px; transition: border-color .14s, box-shadow .14s, transform .14s; }
.tm-grp-h:hover { border-color: var(--tc, var(--primary)); box-shadow: 0 8px 20px -14px rgba(0, 0, 0, .35); }
.tm-grp-name { padding-left: 0; flex: 1; }
.tm-grp.lv-campus > .tm-grp-h { background: var(--primary-soft); }
.tm-ava { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 800; background: var(--surface-subtle); color: var(--text-muted); border: 1px solid var(--border); }
.tm-ava.is-campus { border-radius: 12px; background: var(--primary); color: #fff; border-color: transparent; }
.tm-chev { flex: none; width: 9px; height: 9px; border-right: 2px solid var(--text-muted); border-bottom: 2px solid var(--text-muted); transform: rotate(-45deg); transition: transform .15s; margin: 0 4px; }
.tm-grp-h[aria-expanded="true"] .tm-chev { transform: rotate(45deg); }
.tm-grp-body { border-left-color: transparent; margin-left: 20px; padding-left: 0; }
.tm-segs.tm-flat { background: none; border: 0; border-radius: 0; padding: 0; overflow-x: auto; display: flex; align-self: stretch; }
.tm-segs.tm-flat .tm-seg-label { margin-right: 4px; }
.tm-seg { border-color: var(--border); }
.tm-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong, #b5bfcc); }
.tm-dot.is-live { background: var(--success, #1a9b52); }
.tm-dot.is-scheduled { background: var(--info, #2b7cd3); }
.tm-dot.is-ended { background: #9aa5b4; }
.tm-dot.is-pending { background: var(--warning, #d97706); }
.tm-seg.is-on .tm-dot { box-shadow: 0 0 0 2px rgba(255, 255, 255, .5); }
.tm-grp-body .tm-qrow { grid-template-columns: 24px 40px minmax(0, 1fr) auto; gap: 12px; padding: 10px 12px; border-radius: 14px; transition: border-color .12s, background .12s; }
.tm-grp-body .tm-qrow:hover { border-color: var(--tc, var(--primary)); background: var(--surface-subtle); }
.tm-qrow.is-live .cls-tile { background: var(--tc); color: #fff; }
.tm-qstats .tm-subm { color: var(--text-muted); font-size: var(--fs-12); }
.tm-avg { font-size: var(--fs-12); font-weight: 800; padding: 2px 10px; border-radius: var(--r-pill); }
.tm-avg.is-high { background: var(--success-bg, #dcf5e3); color: var(--success-strong, #0b5a26); }
.tm-avg.is-mid { background: var(--warning-bg, #fff0d9); color: var(--warning-strong, #8a4b00); }
.tm-avg.is-low { background: #ffe3e6; color: #a1122a; }
.tm-chero { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 16px 18px; margin-bottom: var(--sp-3); border-radius: 18px; border: 1px solid color-mix(in srgb, var(--tc) 35%, var(--border)); background: linear-gradient(120deg, color-mix(in srgb, var(--tc) 12%, var(--surface)), var(--surface) 70%); }
.tm-chero-ava { width: 58px; height: 58px; border-radius: 18px; font-size: 17px; }
.tm-chero-b { flex: 1 1 220px; min-width: 0; }
.tm-chero-b h3 { margin: 0; font-size: var(--fs-20, 20px); color: var(--text-strong); letter-spacing: -.01em; }
.tm-chero-b p { margin: 2px 0 6px; color: var(--text-muted); font-size: var(--fs-13); }
.tm-chero-sts { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.tm-chero-st { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-12); font-weight: 700; color: var(--text); }
.tm-chero-act { display: flex; align-items: center; gap: 8px; }
@media (max-width: 640px) { .tm-grp-body { margin-left: 8px; } .tm-grp-body .tm-qrow { grid-template-columns: 24px 36px minmax(0, 1fr); } .tm-grp-body .tm-qstats { grid-column: 3; flex-wrap: wrap; } .tm-chero-act { width: 100%; } }

/* A section sits under its class: a step in, and a thin line. */
.tm-crow.is-section { margin-left: 22px; padding-left: 12px; border-left: 2px solid var(--border-strong); }

/* Team structure dialog */
.tm-struct { display: grid; gap: var(--sp-3); }
.tm-struct-h { margin: 0; font-size: var(--fs-14); }
.tm-struct-add { display: flex; flex-wrap: wrap; gap: 8px; padding-top: var(--sp-2); }

/* The three things that happen when a team is set up, before the button. */
.tm-setup-steps { list-style: none; margin: var(--sp-3) 0 0; padding: 0; display: grid; gap: var(--sp-2); counter-reset: tms; }
.tm-setup-steps li { display: flex; align-items: center; gap: var(--sp-3); font-size: var(--fs-14); color: var(--text); }
.tm-setup-steps li::before { counter-increment: tms; content: counter(tms); flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); font-weight: 800; font-size: var(--fs-12); }

/* The class actions in plain sight, under who teaches it. */
.tm-crow-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-2); }

/* Overview: a class with its sections is one card; open or close it. */
.tm-crows { display: grid; gap: var(--sp-3); }
.tm-cgroup { border: 1px solid var(--border); border-radius: var(--r-lg, 14px); background: var(--surface); overflow: hidden; }
.tm-cgroup > .tm-crow { border-top: 0; padding: var(--sp-3) var(--sp-4); }
.tm-cgroup.has-kids > .tm-crow { background: var(--surface-subtle); }
.tm-cgroup-body { border-top: 1px solid var(--border); padding: 0 var(--sp-4) 0 calc(var(--sp-4) + 44px); }
.tm-cgroup-body .tm-crow.is-section { margin-left: 0; padding-left: 0; border-left: 0; }
/* Class cards get room around them: a gap between cards and above the campus's Invite bar (it sat 4px under the last card). */
.tm-cgroup + .tm-cgroup { margin-top: 10px; }
.tm-school-body:has(.tm-cgroup) { padding-bottom: 16px; }
@media (max-width: 600px) { .tm-cgroup-body { padding-left: var(--sp-4); } .tm-school-body:has(.tm-cgroup) { padding-bottom: 12px; } }
.tm-cgroup-body .tm-crow:first-child { border-top: 0; }
.tm-cgroup-toggle { flex: none; width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent; color: var(--text-muted); display: grid; place-items: center; cursor: pointer; }
.tm-cgroup-toggle svg { transition: transform .2s; transform: rotate(-90deg); }
.tm-cgroup-toggle[aria-expanded="true"] svg { transform: rotate(0); }
.tm-cgroup-toggle:hover { background: var(--primary-soft); color: var(--primary); }
.tm-cgroup-toggle:focus-visible { outline: 3px solid var(--primary-ring); outline-offset: 1px; }
.tm-crow-titlerow { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2); }
.tm-crow-link { color: var(--text-strong); text-decoration: none; }
.tm-crow-link:hover { color: var(--primary); text-decoration: underline; }
.tm-group-pill { border: 0; border-radius: 999px; padding: 1px 10px; background: var(--primary-soft); color: var(--primary); font: inherit; font-size: var(--fs-12); font-weight: 700; cursor: pointer; }
.tm-group-pill:hover { filter: brightness(.96); }
a.tm-pchip { text-decoration: none; color: inherit; }
a.tm-pchip:hover { border-color: var(--primary); }
/* Expand all / Collapse all: one toggle at the right end of the campus's bottom bar. */
.tm-cgroup-tools { display: flex; gap: var(--sp-2); margin-left: auto; }
.tm-cgroup-tools .btn[hidden] { display: none; }
.tm-edit-note { margin: 0; }
@media (prefers-reduced-motion: reduce) { .tm-cgroup-toggle svg { transition: none; } }

/* The class page and the teacher page. */
.tm-detail-list { display: grid; gap: var(--sp-2); }
.tm-detail-row { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3); border: 1px solid var(--border); border-radius: var(--r-md, 10px); background: var(--surface); color: inherit; text-decoration: none; }
.tm-detail-row:hover { border-color: var(--primary); background: var(--surface-hover); }
.tm-detail-classes { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--border); }
.tm-link { color: var(--primary); text-decoration: none; font-weight: 600; }
.tm-link:hover { text-decoration: underline; }

/* Team reports tables: the quiz, school, class, teacher and principal columns share the width instead of each taking 220px. */
.tm-rep-table td.tm-wrap { min-width: 0; }
.tm-rep-table td:first-child { min-width: 180px; }
.tm-rep-table td, .tm-rep-table th { padding: 8px 8px; }
.tm-rep-prin { font-weight: 600; color: var(--text-strong); }

/* Quizzes tab, third pass (9 Nov 2026): every level is a real box that holds the next one. School > class > teacher > quiz rows,
   each step a different tint and a label on top, so it is clear where you are. Colours come from tokens, so dark mode follows. */
.tm-groups { gap: var(--sp-4); }
.tm-grp { border: 1px solid var(--border); border-radius: 18px; background: var(--surface); overflow: hidden; }
.tm-grp-row { gap: 0; }
.tm-grp .tm-grp-h { background: transparent; border: 0; border-radius: 0; box-shadow: none; transform: none; padding: 12px 16px; }
.tm-grp .tm-grp-h:hover { box-shadow: none; background: color-mix(in srgb, var(--tc, var(--primary)) 7%, transparent); }
.tm-grp-body { margin: 0; padding: 0 12px 12px; border: 0; gap: 10px; }
.tm-grp-eyebrow { font-size: var(--fs-11); font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.tm-grp-title { font-size: var(--fs-15, 15px); color: var(--text-strong); }
.tm-grp-prin { color: var(--text-muted); font-weight: 600; }

/* School: the outer box, tinted header band, thick top line */
.tm-grp.lv-campus { border-color: color-mix(in srgb, var(--primary) 30%, var(--border)); box-shadow: 0 6px 18px -14px rgba(0, 0, 0, .35); }
.tm-grp.lv-campus > .tm-grp-row { background: var(--primary-soft); border-bottom: 1px solid color-mix(in srgb, var(--primary) 20%, var(--border)); }
.tm-grp.lv-campus > .tm-grp-row .tm-grp-eyebrow { color: var(--primary); }
.tm-grp.lv-campus > .tm-grp-body { padding-top: 12px; }

/* Class: a box inside the school, with a coloured edge */
.tm-grp.lv-class { border-left: 5px solid var(--tc, var(--primary)); border-radius: 14px; background: var(--surface-subtle); }
.tm-grp.lv-class .tm-grp-h:hover { background: color-mix(in srgb, var(--tc, var(--primary)) 9%, transparent); }
.tm-grp.lv-class > .tm-grp-row .tm-grp-eyebrow { color: var(--tc, var(--primary)); }

/* Teacher: a lighter inner box, dashed so it reads as "a list inside the class" */
.tm-grp.lv-teacher { border-style: dashed; border-radius: 12px; background: var(--surface); }
.tm-grp.lv-teacher .tm-grp-h { padding: 8px 14px; }
.tm-grp.lv-teacher .tm-ava { width: 32px; height: 32px; font-size: 11px; }
.tm-grp.lv-teacher > .tm-grp-body .tm-qrow { background: var(--surface-subtle); }

/* Quiz rows stay white cards inside the lightest box */
.tm-grp.lv-class > .tm-grp-body > .tm-qrow, .tm-grp.lv-campus > .tm-grp-body > .tm-qrow { background: var(--surface); }
@media (max-width: 640px) { .tm-grp { border-radius: 14px; } .tm-grp .tm-grp-h { padding: 10px 12px; } .tm-grp-body { padding: 0 8px 8px; } }

/* Loading shapes (team/team-skeleton.js) */
.tm-sk-rows { display: grid; gap: 2px; }
.tm-sk-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.tm-sk-head .sk-who { flex: 1; }
.tm-hero .sk-title { margin: 0 0 8px; }
.tm-hero .sk-meta { width: min(420px, 80%); }
.sk-title-s { height: 16px; width: 200px; flex: 0 0 auto; max-width: 70%; }

/* One header for the class and teacher pages (detailHeader in team/team-detail.js): trail, tile + name, facts, one sentence, numbers. */
.tm-dh-trail { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 14px 24px 0; font-size: var(--fs-13); color: var(--text-muted); }
.tm-dh-trail .icon { width: 16px; height: 16px; }
.tm-dh-crumb { color: var(--text-muted); font-weight: 600; }
.tm-dh-crumb.is-now { color: var(--text-strong); font-weight: 800; }
.tm-dh-sep { color: var(--text-muted); }
.tm-dh-main { display: flex; align-items: flex-start; gap: 18px; padding: 18px 24px 22px; }
.tm-dh-main > .avatar, .tm-dh-main > .tm-teamico { flex: none; width: 64px; height: 64px; font-size: 22px; border-radius: 18px; }
.tm-dh-main > .tm-teamico .icon { width: 30px; height: 30px; }
.tm-dh-text { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.tm-dh-text .tm-title { margin: 0; }
.tm-dh-eyebrow { font-size: var(--fs-11); font-weight: 800; text-transform: uppercase; letter-spacing: .06em; padding: 3px 10px; border-radius: 99px; background: var(--primary-soft); color: var(--primary-text, var(--primary)); }
.tm-dh-facts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.tm-dh-chip { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 99px; background: var(--surface-subtle); border: 1px solid var(--border); font-size: var(--fs-13); font-weight: 600; color: var(--text-strong); }
.tm-dh-chip small { font-size: var(--fs-11); font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
.tm-dh-note { margin: 6px 0 0; padding: 10px 14px; border-radius: 12px; background: var(--surface-subtle); border-left: 3px solid var(--primary); color: var(--text); font-size: var(--fs-14); max-width: 72ch; }
@media (max-width: 720px) { .tm-dh-trail { padding: 12px 16px 0; } .tm-dh-main { padding: 14px 16px 18px; flex-wrap: wrap; } .tm-dh-main > .avatar, .tm-dh-main > .tm-teamico { width: 52px; height: 52px; font-size: 18px; } .tm-dh-text { flex-basis: 100%; } }

/* Sections that start closed (collapsible in team/team-help.js): only the header shows until it is tapped. */
.tm-collapsible > .tm-sec-head { cursor: pointer; position: relative; padding-right: 36px; margin-bottom: 0; border-radius: 10px; }
.tm-collapsible > .tm-sec-head:hover { background: var(--surface-hover, var(--surface-subtle)); }
.tm-collapsible > .tm-sec-head:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.tm-collapsible > .tm-sec-head::after { content: ""; position: absolute; right: 10px; top: 50%; width: 9px; height: 9px; border-right: 2px solid var(--text-muted); border-bottom: 2px solid var(--text-muted); transform: translateY(-65%) rotate(45deg); transition: transform .15s; }
.tm-collapsible.is-open > .tm-sec-head { margin-bottom: var(--sp-4); }
.tm-collapsible.is-open > .tm-sec-head::after { transform: translateY(-25%) rotate(225deg); }
.tm-collapsible:not(.is-open) > :not(.tm-sec-head) { display: none; }
@media (prefers-reduced-motion: reduce) { .tm-collapsible > .tm-sec-head::after { transition: none; } }

/* A table row opens its report from anywhere on the row, not only on the title words: the title link is stretched over the row, and the
   other links and buttons in the row (class, teacher, school) sit above it so they still go where they say. */
.tm-table tbody tr:has(a.tm-qtitle) { position: relative; cursor: pointer; transition: background .12s; }
.tm-table tbody tr:has(a.tm-qtitle):hover { background: var(--surface-hover, var(--surface-subtle)); }
.tm-table tbody tr a.tm-qtitle::after { content: ""; position: absolute; inset: 0; }
.tm-table tbody tr:hover a.tm-qtitle { text-decoration-thickness: 2px; text-decoration-color: currentColor; }
.tm-table tbody tr a:not(.tm-qtitle), .tm-table tbody tr button, .tm-table tbody tr input { position: relative; z-index: 1; }
.tm-table tbody tr a.tm-qtitle:focus-visible { outline: none; }
.tm-table tbody tr:has(a.tm-qtitle:focus-visible) { outline: 2px solid var(--primary); outline-offset: -2px; }

/* Closed or open, the header fills the card edge to edge, so the whole row is the button (the card's own padding moves into the header). */
.tm-collapsible { --cy: var(--sp-5); --cx: var(--sp-6); padding: 0; }
@media (max-width: 720px) { .tm-collapsible { --cy: var(--sp-4); --cx: var(--sp-4); } }
.tm-collapsible:not(.is-open) { cursor: pointer; transition: background .12s, border-color .12s; }
.tm-collapsible:not(.is-open):hover { background: var(--surface-hover, var(--surface-subtle)); border-color: var(--border-strong, var(--border)); }
.tm-collapsible > .tm-sec-head { padding: var(--cy) calc(var(--cx) + 30px) var(--cy) var(--cx); margin: 0; border-radius: var(--r-lg); background: transparent; }
.tm-collapsible > .tm-sec-head:hover { background: transparent; }
.tm-collapsible > .tm-sec-head::after { right: var(--cx); }
.tm-collapsible > .tm-sec-head:focus-visible { outline: none; }
.tm-collapsible:has(> .tm-sec-head:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
.tm-collapsible.is-open > .tm-sec-head { padding-bottom: var(--sp-3); margin-bottom: 0; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.tm-collapsible > :not(.tm-sec-head) { margin-left: var(--cx); margin-right: var(--cx); }
/* Padding, not a margin on the last child: that child can be hidden (the compare bar), and the buttons then touched the edge. */
.tm-collapsible.is-open { padding-bottom: var(--cy); }

/* Buttons on the right of a section header sit in the middle of the row, not at its top. */
.tm-sec-head { align-items: center; }
.tm-sec-head .tm-sec-actions { align-self: center; display: flex; align-items: center; gap: var(--sp-2); }

/* Progress tab, redesigned (9 Nov 2026): period buttons, one sentence about the group, three short lists, then a filterable table. */
.tm-pg-bar { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 var(--sp-4); }
.tm-pg-hero { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-5); padding: var(--sp-4) var(--sp-5); margin-bottom: var(--sp-4); border-radius: var(--r-lg); background: linear-gradient(120deg, var(--primary-soft), var(--surface-subtle)); border: 1px solid var(--border); }
.tm-pg-big { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; }
.tm-pg-big-l { flex-basis: 100%; font-size: var(--fs-11); font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.tm-pg-big-n { font-size: 44px; line-height: 1; font-weight: 800; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.tm-pg-delta { font-size: var(--fs-13); font-weight: 800; padding: 3px 10px; border-radius: 99px; background: var(--surface); border: 1px solid var(--border); color: var(--text-muted); }
.tm-pg-delta.is-up { color: var(--success-strong, #0b5a26); background: var(--success-bg, #dcf5e3); border-color: transparent; }
.tm-pg-delta.is-down { color: var(--warning-strong, #8a4b00); background: var(--warning-bg, #fff0d9); border-color: transparent; }
.tm-pg-sentence { flex: 1 1 280px; margin: 0; font-size: var(--fs-15, 15px); color: var(--text-strong); max-width: 60ch; }
.tm-pg-none { margin: 0 0 var(--sp-4); padding: var(--sp-4); border-radius: var(--r-md); background: var(--surface-subtle); }
.tm-pg-panels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-3); margin-bottom: var(--sp-5); }
.tm-pg-panel { padding: var(--sp-4); border-radius: var(--r-lg); border: 1px solid var(--border); border-top: 4px solid var(--border-strong, var(--border)); background: var(--surface); min-width: 0; }
.tm-pg-panel.is-best { border-top-color: var(--primary); }
.tm-pg-panel.is-rising { border-top-color: var(--success, #1a9b52); }
.tm-pg-panel.is-look { border-top-color: var(--warning, #d97706); }
.tm-pg-panel-t { margin: 0; font-size: var(--fs-15, 15px); color: var(--text-strong); }
.tm-pg-panel > .tm-sub { margin: 2px 0 var(--sp-3); }
.tm-pg-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; }
.tm-pg-item { display: flex; align-items: center; gap: 10px; padding: 8px 8px; border-radius: 10px; color: var(--text-strong); text-decoration: none; }
.tm-pg-item:hover { background: var(--surface-subtle); }
.tm-pg-n { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; background: var(--surface-subtle); color: var(--text-muted); }
.tm-pg-name { flex: 1; min-width: 0; font-weight: 600; font-size: var(--fs-13); overflow-wrap: anywhere; }
.tm-pg-val { flex: none; font-size: var(--fs-13); }
.tm-pg-empty { padding: 8px 0; }
.tm-pg-all-t { margin: 0; font-size: var(--fs-17); color: var(--text-strong); }
.tm-pg-all > .tm-sub { margin: 2px 0 var(--sp-3); }
.tm-pg-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: var(--sp-3); }
.tm-pg-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.tm-pg-controls .tm-search { flex: 1 1 200px; min-width: 160px; height: 34px; }
.tm-pg-controls .select { height: 34px; }
@media (max-width: 900px) { .tm-pg-panels { grid-template-columns: minmax(0, 1fr); } .tm-pg-big-n { font-size: 36px; } }

/* Editing schools in a long list: the three-dots actions are also written out as buttons under the row. */
.tm-sline.is-editing { flex-wrap: wrap; }
.tm-sline-actions { flex: 1 0 100%; display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 0 4px 52px; }
@media (max-width: 640px) { .tm-sline-actions { padding-left: 0; } }
/* Progress: the sort drop-down is as wide as its words, not the whole row. */
.tm-pg-controls .select { width: auto; flex: 0 0 auto; min-width: 190px; }

/* The kind picker at the top of the guide: chips like the chapter row, wrapped in groups. */
.tg-kinds { display: flex; flex-direction: column; gap: var(--sp-3); }
.tg-kinds .tg-sec-t, .tg-kinds .tg-sec-sub { margin: 0; }
.tg-kindgroup { display: flex; flex-direction: column; gap: 6px; }
.tg-kindrow { display: flex; flex-wrap: wrap; gap: 8px; }
.tg-kind { appearance: none; font: inherit; font-size: var(--fs-13); font-weight: 600; display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.tg-kind-em { font-size: 16px; line-height: 1; }
.tg-kind:focus-visible { outline: 3px solid var(--primary-soft); outline-offset: 2px; }

/* "How Teams work": a clear, coloured button wherever it appears, with a soft ring that draws the eye a few times. */
.tm-guidebtn { background: var(--primary-soft); border: 2px solid var(--primary); color: var(--primary); font-weight: 800; font-size: var(--fs-14); padding-inline: 16px; box-shadow: 0 0 0 0 var(--primary-ring); animation: tm-guide-ring 2.4s ease-out 3; }
.tm-guidebtn .icon { color: var(--primary); }
.tm-guidebtn:hover { background: var(--surface); border-color: var(--primary); color: var(--primary); transform: translateY(-1px); }
@keyframes tm-guide-ring { 0% { box-shadow: 0 0 0 0 var(--primary-ring); } 70% { box-shadow: 0 0 0 12px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@media (prefers-reduced-motion: reduce) { .tm-guidebtn { animation: none; } .tm-guidebtn:hover { transform: none; } }

/* Quiz rows with a class tile (Class / Teacher views): every part has its own column, wherever the row sits. Before this the
   tile could fall into the 24px checkbox column and sit on top of the title (the title then cut off early with "…"). */
.tm-qmain { min-width: 0; }
.tm-qrow:has(> .cls-tile) { grid-template-columns: 24px 40px minmax(0, 1fr) auto; }
.tm-qrow:has(> .cls-tile) > input[type="checkbox"] { grid-column: 1; grid-row: 1; }
.tm-qrow:has(> .cls-tile) > .cls-tile { grid-column: 2; grid-row: 1; }
.tm-qrow:has(> .cls-tile) > .tm-qmain { grid-column: 3; grid-row: 1; }
.tm-qrow:has(> .cls-tile) > .tm-qstats { grid-column: 4; grid-row: 1; }
@media (max-width: 720px) {
  .tm-qrow:has(> .cls-tile) { grid-template-columns: 24px 36px minmax(0, 1fr); }
  .tm-qrow:has(> .cls-tile) > .cls-tile { width: 36px; height: 36px; }
  .tm-qrow:has(> .cls-tile) > .tm-qstats { grid-column: 3; grid-row: 2; flex-wrap: wrap; }
}
/* No checkbox in the row: no empty column in front of the tile. */
.tm-qrow:has(> .cls-tile):not(:has(> input[type="checkbox"])) { grid-template-columns: 40px minmax(0, 1fr) auto; }
.tm-qrow:has(> .cls-tile):not(:has(> input[type="checkbox"])) > .cls-tile { grid-column: 1; }
.tm-qrow:has(> .cls-tile):not(:has(> input[type="checkbox"])) > .tm-qmain { grid-column: 2; }
.tm-qrow:has(> .cls-tile):not(:has(> input[type="checkbox"])) > .tm-qstats { grid-column: 3; }
@media (max-width: 720px) {
  .tm-qrow:has(> .cls-tile):not(:has(> input[type="checkbox"])) { grid-template-columns: 36px minmax(0, 1fr); }
  .tm-qrow:has(> .cls-tile):not(:has(> input[type="checkbox"])) > .tm-qstats { grid-column: 2; }
}

/* Share between campuses (team-allowances.js): guide, summary chips, three ways to share as cards, one bar + legend, a table of
   campuses with their use, and a save bar that only wakes up when something changed. Campus colours: data-c 0-5. */
.tm-al { margin-top: var(--sp-5, 24px); padding-top: var(--sp-5, 24px); border-top: 1px solid var(--border); display: grid; gap: var(--sp-4, 16px); }
.tm-al.is-campus { margin-top: 0; padding-top: 0; border-top: 0; gap: var(--sp-3); }
.tm-al-head { display: flex; align-items: flex-start; gap: 12px; }
.tm-al-ico { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--primary-soft, #ecebff); color: var(--primary); }
.tm-al-ico .icon { width: 20px; height: 20px; }
.tm-al-title { margin: 0; font-size: 17px; font-weight: 800; letter-spacing: -.01em; color: var(--text-strong); }
.tm-al-sub { margin: 3px 0 0; font-size: var(--fs-13); line-height: 1.5; color: var(--text-muted); max-width: 70ch; }

.tm-al-guide { border: 1px solid var(--border); border-radius: 14px; background: var(--surface-subtle); }
.tm-al-guide > summary { display: flex; align-items: center; gap: 8px; padding: 12px 14px; cursor: pointer; font-weight: 700; color: var(--text-strong); list-style: none; }
.tm-al-guide > summary::-webkit-details-marker { display: none; }
.tm-al-guide > summary::after { content: ""; margin-left: auto; width: 8px; height: 8px; border-right: 2px solid var(--text-muted); border-bottom: 2px solid var(--text-muted); transform: rotate(45deg); transition: transform .2s; }
.tm-al-guide[open] > summary::after { transform: rotate(-135deg); }
.tm-al-guide > summary .icon { width: 18px; height: 18px; color: var(--primary); }
.tm-al-guide > summary:focus-visible { outline: 3px solid var(--primary-ring, rgba(53,37,205,.3)); outline-offset: 2px; border-radius: 14px; }
.tm-al-steps { margin: 0; padding: 0 14px 4px; list-style: none; display: grid; gap: 10px; }
.tm-al-steps li { display: flex; gap: 10px; align-items: flex-start; font-size: var(--fs-13); line-height: 1.5; color: var(--text); }
.tm-al-stepn { flex: none; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 12px; font-weight: 800; }
.tm-al-safe { display: flex; gap: 8px; align-items: flex-start; margin: 10px 14px 14px; padding: 10px 12px; border-radius: 10px; background: var(--success-bg); color: var(--success); font-size: var(--fs-13); font-weight: 600; line-height: 1.5; }
.tm-al-safe .icon { flex: none; width: 16px; height: 16px; margin-top: 2px; }

.tm-al-tabs { display: inline-flex; padding: 4px; gap: 4px; border-radius: 12px; background: var(--surface-subtle); border: 1px solid var(--border); justify-self: start; }
.tm-al-tab { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 16px; border: 0; border-radius: 9px; background: transparent; color: var(--text-muted); font: inherit; font-size: var(--fs-13); font-weight: 700; cursor: pointer; }
.tm-al-tab .icon { width: 16px; height: 16px; }
.tm-al-tab:hover { color: var(--text-strong); }
.tm-al-tab.is-on { background: var(--surface); color: var(--primary); box-shadow: 0 1px 3px rgba(15, 23, 42, .12); }
.tm-al-tab:focus-visible, .tm-al-mode:focus-visible { outline: 3px solid var(--primary-ring, rgba(53,37,205,.3)); outline-offset: 2px; }

.tm-al-editor { display: grid; gap: var(--sp-3); }
.tm-al-sum { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.tm-al-chip { display: grid; gap: 2px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); }
.tm-al-chip-l { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.tm-al-chip-v { font-size: 20px; font-weight: 800; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.tm-al-chip.is-reserve .tm-al-chip-v { color: var(--primary); }
.tm-al-chip.is-bad { border-color: var(--danger); background: var(--danger-bg); }
.tm-al-chip.is-bad .tm-al-chip-v { color: var(--danger); }
.tm-al-label { margin: 4px 0 0; font-size: var(--fs-13); font-weight: 700; color: var(--text-strong); }

.tm-al-modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; }
.tm-al-mode { position: relative; display: flex; align-items: flex-start; gap: 10px; padding: 12px 40px 12px 12px; text-align: left; border-radius: 12px; border: 1.5px solid var(--border); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.tm-al-mode:hover { border-color: var(--primary); }
.tm-al-mode.is-on { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring, rgba(53,37,205,.18)); }
.tm-al-mode-ico { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--surface-subtle); color: var(--text-muted); }
.tm-al-mode.is-on .tm-al-mode-ico { background: var(--primary-soft, #ecebff); color: var(--primary); }
.tm-al-mode-ico .icon { width: 17px; height: 17px; }
.tm-al-mode-t { display: grid; gap: 2px; }
.tm-al-mode-t b { font-size: 14px; color: var(--text-strong); }
.tm-al-mode-t small { font-size: 12.5px; line-height: 1.45; color: var(--text-muted); }
.tm-al-radio { position: absolute; top: 12px; right: 12px; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border-strong, #cbd5e1); }
.tm-al-mode.is-on .tm-al-radio { border-color: var(--primary); background: radial-gradient(circle, var(--primary) 0 4px, transparent 5px); }

.tm-al-barwrap { display: grid; gap: 8px; }
.tm-al-bar { display: flex; height: 16px; border-radius: var(--r-pill); overflow: hidden; background: var(--border); }
.tm-al-seg { display: block; height: 100%; min-width: 0; background: var(--al-c); transition: width .25s ease; }
.tm-al-seg + .tm-al-seg { box-shadow: inset 2px 0 0 var(--surface); }
.tm-al-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--text-muted); }
.tm-al-legend span { display: inline-flex; align-items: center; gap: 6px; }
.tm-al-dot { flex: none; display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--al-c); }
.tm-al-seg, .tm-al-dot { --al-c: #4f46e5; }
.tm-al [data-c="1"] { --al-c: #0d9488; }
.tm-al [data-c="2"] { --al-c: #d97706; }
.tm-al [data-c="3"] { --al-c: #db2777; }
.tm-al [data-c="4"] { --al-c: #2563eb; }
.tm-al [data-c="5"] { --al-c: #65a30d; }
.tm-al-seg.is-reserve, .tm-al-dot.is-reserve { background: repeating-linear-gradient(45deg, var(--text-muted) 0 3px, transparent 3px 6px); opacity: .5; }

.tm-al-rows { display: grid; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: var(--surface); }
.tm-al-row { display: grid; grid-template-columns: minmax(0, 1.6fr) 110px minmax(120px, 1fr) 96px; align-items: center; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--border); }
.tm-al-row.is-head { border-top: 0; padding-block: 8px; background: var(--surface-subtle); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.tm-al-row.is-reserve { background: color-mix(in srgb, var(--primary) 4%, var(--surface)); }
.tm-al-name { display: flex; align-items: center; gap: 10px; min-width: 0; font-weight: 600; color: var(--text-strong); overflow-wrap: anywhere; }
.tm-al-name-t { display: grid; gap: 1px; }
.tm-al-name-t small { font-size: 12px; font-weight: 400; color: var(--text-muted); }
.tm-al-c-share { text-align: right; }
.tm-al-in { width: 100%; max-width: 110px; height: 38px; padding: 0 10px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.tm-al-num { font-size: 15px; font-variant-numeric: tabular-nums; color: var(--text-strong); }
.tm-al-use { display: grid; gap: 5px; font-size: var(--fs-13); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.tm-al-mini { display: block; height: 5px; border-radius: var(--r-pill); background: var(--border); overflow: hidden; }
.tm-al-mini span { display: block; height: 100%; border-radius: var(--r-pill); background: var(--success-strong, #047857); }
.tm-al-mini.is-full span { background: var(--danger-strong, #e11d48); }
.tm-al-pill { justify-self: start; padding: 3px 9px; border-radius: var(--r-pill); font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.tm-al-pill.is-ok { background: var(--success-bg); color: var(--success); }
.tm-al-pill.is-near { background: var(--warning-bg); color: var(--warning); }
.tm-al-pill.is-full, .tm-al-pill.is-over { background: var(--danger-bg); color: var(--danger); }

.tm-al-notes:empty { display: none; }
.tm-al-notes { display: grid; gap: 6px; }
.tm-al-note { display: flex; gap: 8px; align-items: flex-start; margin: 0; padding: 10px 12px; border-radius: 10px; font-size: var(--fs-13); font-weight: 600; line-height: 1.45; }
.tm-al-note .icon { flex: none; width: 16px; height: 16px; margin-top: 1px; }
.tm-al-note.is-error { background: var(--danger-bg); color: var(--danger); }
.tm-al-note.is-warn { background: var(--warning-bg); color: var(--warning); }
.tm-al-note.is-ok { background: var(--success-bg); color: var(--success); }
.tm-al-note.is-info { background: var(--surface-subtle); color: var(--text); }
.tm-al-tip { display: flex; gap: 8px; align-items: flex-start; margin: 0; font-size: var(--fs-13); line-height: 1.5; color: var(--text-muted); }
.tm-al-tip .icon { flex: none; width: 16px; height: 16px; margin-top: 2px; color: var(--warning-strong); }

.tm-al-savebar { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; padding: 10px 12px; border-radius: 12px; border: 1px solid transparent; transition: background .15s, border-color .15s; }
.tm-al-savebar .tm-al-unsaved { display: none; align-items: center; gap: 6px; margin-right: auto; font-size: var(--fs-13); font-weight: 600; color: var(--primary); }
.tm-al-savebar .tm-al-unsaved .icon { width: 16px; height: 16px; }
.tm-al-savebar.is-dirty { position: sticky; bottom: 12px; z-index: 2; background: var(--surface); border-color: var(--primary); box-shadow: 0 8px 24px rgba(15, 23, 42, .12); }
.tm-al-savebar.is-dirty .tm-al-unsaved { display: inline-flex; }
.tm-al-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.tm-al-mine-full { display: block; margin-top: 6px; font-size: 12px; font-weight: 600; color: var(--danger); }

.tm-al-reqs { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--warning-strong); border-radius: 14px; background: var(--warning-bg); }
.tm-al-reqs-t { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--warning); }
.tm-al-reqs-t .icon { width: 18px; height: 18px; }
.tm-al-req { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 12px; border-radius: 10px; background: var(--surface); }
.tm-al-req-t { display: grid; gap: 2px; min-width: 0; color: var(--text-strong); font-weight: 600; }
.tm-al-req-t small { font-size: 12.5px; font-weight: 400; color: var(--text-muted); }
.tm-al-req-t small.is-bad { color: var(--danger); font-weight: 600; }
.tm-al-req-b { display: flex; gap: 6px; }

/* The whole section folds: closed until the heading is clicked. */
.tm-al-fold { display: block; }
.tm-al-fold > summary { list-style: none; cursor: pointer; align-items: center; padding: 6px; margin: -6px; border-radius: 14px; transition: background .15s; }
.tm-al-fold > summary::-webkit-details-marker { display: none; }
.tm-al-fold > summary:hover { background: var(--surface-subtle); }
.tm-al-fold > summary:focus-visible { outline: 3px solid var(--primary-ring, rgba(53,37,205,.3)); outline-offset: 2px; }
.tm-al-head-t { flex: 1; min-width: 0; }
.tm-al-head-t .tm-al-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tm-al-chev { flex: none; width: 10px; height: 10px; margin: 0 8px 0 4px; border-right: 2px solid var(--text-muted); border-bottom: 2px solid var(--text-muted); transform: rotate(45deg); transition: transform .2s; }
.tm-al-fold[open] > summary .tm-al-chev { transform: rotate(-135deg); }
.tm-al-badge { padding: 2px 9px; border-radius: var(--r-pill); background: var(--warning-bg); color: var(--warning); font-size: 12px; font-weight: 700; letter-spacing: 0; }
.tm-al-body { display: grid; gap: var(--sp-4, 16px); margin-top: var(--sp-4, 16px); }

@media (max-width: 640px) {
  .tm-al-tabs { justify-self: stretch; }
  .tm-al-tab { flex: 1; justify-content: center; }
  .tm-al-row.is-head { display: none; }
  .tm-al-row { grid-template-columns: minmax(0, 1fr) auto; row-gap: 8px; }
  .tm-al-row > .tm-al-use { grid-column: 1 / -1; }
  .tm-al-row > [role="cell"]:last-child { grid-column: 1 / -1; }
  .tm-al-savebar .tm-al-unsaved { flex-basis: 100%; }
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tm-al-reqs { background: color-mix(in srgb, var(--warning-strong) 12%, var(--surface)); }
  :root:not([data-theme="light"]) .tm-al-reqs-t, :root:not([data-theme="light"]) .tm-al-pill.is-near, :root:not([data-theme="light"]) .tm-al-note.is-warn { color: #fbbf24; }
  :root:not([data-theme="light"]) .tm-al-tab.is-on { box-shadow: 0 1px 3px rgba(0, 0, 0, .5); }
}
:root[data-theme="dark"] .tm-al-reqs { background: color-mix(in srgb, var(--warning-strong) 12%, var(--surface)); }
:root[data-theme="dark"] .tm-al-reqs-t, :root[data-theme="dark"] .tm-al-pill.is-near, :root[data-theme="dark"] .tm-al-note.is-warn { color: #fbbf24; }
:root[data-theme="dark"] .tm-al-tab.is-on { box-shadow: 0 1px 3px rgba(0, 0, 0, .5); }

/* Teams & Groups (teams-groups.js): chooser with two animations, tabs + team switcher, team list, groups grid, colour swatches. */
/* Group colours, only on the Teams & Groups elements (tng-*), so no other Team page element picks them up. */
[class*="tng-"].is-indigo { --g: #4f46e5; } [class*="tng-"].is-teal { --g: #0d9488; } [class*="tng-"].is-amber { --g: #d97706; } [class*="tng-"].is-rose { --g: #e11d48; }
[class*="tng-"].is-blue { --g: #2563eb; } [class*="tng-"].is-lime { --g: #65a30d; } [class*="tng-"].is-violet { --g: #7c3aed; } [class*="tng-"].is-slate { --g: #475569; }

.tng-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.tng-tabs { display: inline-flex; padding: 4px; gap: 4px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); }
.tng-tab { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px 18px; border-radius: 10px; color: var(--text-muted); font-weight: 700; font-size: 14px; text-decoration: none; }
.tng-tab .icon { width: 17px; height: 17px; }
.tng-tab em { font-style: normal; min-width: 22px; padding: 1px 7px; border-radius: var(--r-pill); background: var(--surface-subtle); color: var(--text-muted); font-size: 12px; text-align: center; }
.tng-tab:hover { color: var(--text-strong); }
.tng-tab.is-on { background: var(--primary); color: #fff; }
.tng-tab.is-on em { background: rgba(255, 255, 255, .22); color: #fff; }
.tng-tab:focus-visible, .tng-current:focus-visible, .tng-choice:focus-visible, .tng-team:focus-visible, .tng-swatch:focus-visible { outline: 3px solid var(--primary-ring, rgba(53,37,205,.3)); outline-offset: 2px; }
.tng-current { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text-strong); font: inherit; cursor: pointer; }
.tng-current:hover { border-color: var(--primary); }
.tng-current-l { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.tng-current b { font-size: 14px; max-width: 26ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tng-current em { font-style: normal; padding: 1px 8px; border-radius: var(--r-pill); background: var(--primary-soft, #ecebff); color: var(--primary); font-size: 12px; font-weight: 700; }
.tng-chev { width: 8px; height: 8px; margin-left: 2px; border-right: 2px solid var(--text-muted); border-bottom: 2px solid var(--text-muted); transform: rotate(45deg) translateY(-2px); }

.tng-team-list { display: grid; gap: 8px; margin-top: 8px; }
.tng-team { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; text-align: left; border-radius: 12px; border: 1.5px solid var(--border); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; }
.tng-team:hover:not(:disabled) { border-color: var(--primary); }
.tng-team.is-current { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 5%, var(--surface)); cursor: default; }
.tng-team-ico { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--primary-soft, #ecebff); color: var(--primary); }
.tng-team-t { flex: 1; min-width: 0; display: grid; gap: 2px; }
.tng-team-t b { color: var(--text-strong); overflow-wrap: anywhere; }
.tng-team-t small { font-size: 12.5px; color: var(--text-muted); }
.tng-pill { padding: 3px 9px; border-radius: var(--r-pill); background: var(--primary); color: #fff; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.tng-open { font-size: 13px; font-weight: 700; color: var(--primary); }
.tng-pool-explain { display: flex; gap: 12px; align-items: flex-start; }
.tng-pool-explain b { color: var(--text-strong); }
.tng-pool-explain .hint-text { margin: 6px 0 0; }
.tm-al.is-top { margin-top: 0; padding-top: 0; border-top: 0; }

/* The chooser */
.tng-chooser { display: grid; gap: 20px; max-width: 980px; margin: 0 auto; width: 100%; }
.tng-chooser-head { text-align: center; }
.tng-chooser-head h2 { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -.02em; color: var(--text-strong); }
.tng-chooser-head p { margin: 6px 0 0; color: var(--text-muted); }
.tng-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.tng-choice { display: grid; gap: 14px; align-content: start; padding: 18px; text-align: left; border-radius: 20px; border: 1.5px solid var(--border); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
.tng-choice:hover { border-color: var(--primary); box-shadow: 0 12px 32px rgba(15, 23, 42, .1); transform: translateY(-2px); }
.tng-choice-t { display: grid; gap: 2px; }
.tng-choice-t b { font-size: 20px; font-weight: 800; color: var(--text-strong); }
.tng-choice-t small { font-size: 14px; color: var(--text-muted); }
.tng-points { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.tng-points li { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; line-height: 1.45; }
.tng-points .icon { flex: none; width: 16px; height: 16px; margin-top: 2px; color: var(--success-strong, #047857); }
.tng-choice-cta { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; border-radius: 12px; background: var(--primary); color: #fff; font-weight: 700; }
.tng-choice-cta .icon { width: 16px; height: 16px; }
.tng-choice.is-group .tng-choice-cta { background: #0d9488; }

.tng-art { position: relative; height: 150px; border-radius: 14px; overflow: hidden; background: var(--surface-subtle); }
/* Group: three quiz cards drop one by one into coloured folders, again and again */
.tng-cards { position: absolute; left: 0; right: 0; top: 14px; display: flex; justify-content: center; gap: 22px; }
.tng-mini { display: grid; gap: 5px; align-content: start; width: 54px; height: 38px; padding: 8px; border-radius: 8px; background: var(--surface); box-shadow: 0 4px 10px rgba(15, 23, 42, .12); animation: tg-drop 3.6s ease-in-out infinite; }
.tng-mini i { display: block; height: 5px; border-radius: 3px; background: var(--border-strong, #cbd5e1); }
.tng-mini i + i { width: 60%; }
.tng-mini-2 { animation-delay: .5s; } .tng-mini-3 { animation-delay: 1s; }
.tng-folders { position: absolute; left: 0; right: 0; bottom: 14px; display: flex; justify-content: center; gap: 22px; }
.tng-folder { position: relative; width: 62px; height: 46px; border-radius: 4px 10px 10px 10px; background: var(--g); opacity: .9; animation: tg-bump 3.6s ease-in-out infinite; animation-delay: calc(var(--d) * .5s); }
.tng-folder::before { content: ""; position: absolute; left: 0; top: -8px; width: 26px; height: 10px; border-radius: 4px 4px 0 0; background: var(--g); }
@keyframes tg-drop { 0%, 12% { transform: translateY(0); opacity: 1; } 40% { transform: translateY(58px) scale(.8); opacity: 0; } 41%, 70% { transform: translateY(-10px); opacity: 0; } 85%, 100% { transform: translateY(0); opacity: 1; } }
@keyframes tg-bump { 0%, 34% { transform: scale(1); } 42% { transform: scale(1.08); } 52%, 100% { transform: scale(1); } }
/* Team: three people at the bottom, the admin at the top; results flow up to the admin */
.tng-admin { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: var(--primary); color: #fff; box-shadow: 0 0 0 6px color-mix(in srgb, var(--primary) 18%, transparent); animation: tg-glow 2.4s ease-in-out infinite; }
.tng-admin > .icon { width: 22px; height: 22px; }
.tng-admin-badge { position: absolute; right: -4px; bottom: -4px; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #fff; color: #0f766e; box-shadow: 0 0 0 2px var(--primary), 0 2px 6px rgba(15, 23, 42, .25); }
.tng-admin-badge .icon { width: 13px; height: 13px; }
.tng-people { position: absolute; left: 0; right: 0; bottom: 14px; display: flex; justify-content: center; gap: 34px; }
.tng-person { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--surface); color: var(--text-muted); box-shadow: 0 4px 10px rgba(15, 23, 42, .12); animation: tg-join 2.4s ease-in-out infinite; }
.tng-person .icon { width: 18px; height: 18px; }
.tng-person-2 { animation-delay: .3s; } .tng-person-3 { animation-delay: .6s; }
.tng-flow { position: absolute; inset: 0; }
.tng-dot { position: absolute; bottom: 56px; width: 8px; height: 8px; border-radius: 50%; background: #0d9488; animation: tg-up 2.4s ease-in infinite; }
.tng-dot-1 { left: calc(50% - 78px); } .tng-dot-2 { left: calc(50% - 4px); animation-delay: .4s; } .tng-dot-3 { left: calc(50% + 70px); animation-delay: .8s; }
@keyframes tg-up { 0% { transform: translate(0, 0); opacity: 0; } 15% { opacity: 1; } 80% { opacity: 1; } 100% { transform: translate(var(--x, 0), -48px); opacity: 0; } }
.tng-dot-1 { --x: 74px; } .tng-dot-3 { --x: -70px; }
@keyframes tg-join { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes tg-glow { 0%, 100% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--primary) 18%, transparent); } 50% { box-shadow: 0 0 0 10px color-mix(in srgb, var(--primary) 8%, transparent); } }
@media (prefers-reduced-motion: reduce) { .tng-art *, .tng-art *::before { animation: none !important; } .tng-dot { opacity: 0; } }

.tng-compare { display: grid; border: 1px solid var(--border); border-radius: 16px; overflow: hidden; background: var(--surface); }
.tng-cmp-row { display: grid; grid-template-columns: minmax(110px, .8fr) 1fr 1fr; gap: 12px; padding: 11px 16px; border-top: 1px solid var(--border); font-size: 13.5px; }
.tng-cmp-row.is-head { border-top: 0; background: var(--surface-subtle); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.tng-cmp-row b { color: var(--text-strong); }
.tng-join { margin: 0; text-align: center; color: var(--text-muted); font-size: 14px; }
.tng-link { padding: 0; border: 0; background: none; color: var(--primary); font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }

/* Groups */
.tng-gh { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.tng-gh-t { flex: 1; min-width: 220px; }
.tng-gh-t h2 { margin: 0; font-size: 20px; font-weight: 800; color: var(--text-strong); }
.tng-empty { display: grid; justify-items: center; gap: 10px; text-align: center; padding-block: 28px; }
.tng-empty .tng-art { width: min(360px, 100%); }
.tng-empty h2, .tng-empty h3 { margin: 6px 0 0; font-size: 20px; font-weight: 800; color: var(--text-strong); }
.tng-empty .tm-al-sub { max-width: 52ch; }
/* The empty Groups card: three icon steps, read in a second (no paragraph). */
.tng-steps { list-style: none; margin: 6px 0 10px; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.tng-step { position: relative; display: grid; justify-items: center; gap: 8px; width: 150px; padding: 14px 10px 12px; border-radius: 14px; background: var(--surface-2, var(--bg-soft, #f6f5f2)); }
.tng-step-ico { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); }
.tng-step-ico svg { width: 22px; height: 22px; }
.tng-step-n { position: absolute; top: 8px; left: 10px; font-size: 12px; font-weight: 800; color: var(--text-muted, #888); }
.tng-step-t { font-size: 14px; font-weight: 700; color: var(--text-strong); line-height: 1.3; }
@media (max-width: 520px) {
  .tng-steps { flex-direction: column; align-items: stretch; width: 100%; gap: 8px; }
  .tng-step { width: auto; grid-template-columns: auto 1fr; justify-items: start; align-items: center; gap: 12px; padding: 10px 12px; text-align: start; }
  .tng-step-n { display: none; }
}
.tng-group-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.tng-group { position: relative; display: flex; align-items: center; gap: 4px; padding: 4px 4px 4px 0; border-radius: 14px; border: 1px solid var(--border); border-left: 5px solid var(--g, var(--border-strong, #cbd5e1)); background: var(--surface); text-decoration: none; color: inherit; transition: box-shadow .15s, border-color .15s; }
.tng-group:hover { box-shadow: 0 6px 18px rgba(15, 23, 42, .08); }
.tng-group-main { flex: 1; min-width: 0; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 4px 10px; padding: 10px 12px; color: inherit; text-decoration: none; }
.tng-group-main .tm-al-mini { grid-column: 2; }
.tng-group-ico { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: color-mix(in srgb, var(--g, #64748b) 14%, var(--surface)); color: var(--g, #64748b); grid-row: span 2; }
.tng-group-ico .icon { width: 17px; height: 17px; }
.tng-group-t { display: grid; gap: 1px; min-width: 0; }
.tng-group-t b { color: var(--text-strong); overflow-wrap: anywhere; }
.tng-group-t small { font-size: 12.5px; color: var(--text-muted); }
.tng-group-acts { display: flex; gap: 2px; }
.tng-swatches { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.tng-swatch { width: 32px; height: 32px; border-radius: 50%; border: 3px solid var(--surface); background: var(--g); box-shadow: 0 0 0 1px var(--border); cursor: pointer; }
.tng-swatch.is-on { box-shadow: 0 0 0 3px var(--g); }

/* In the top bar (team-page.js puts it there): as tall as the title, no extra row. */
.topbar-actions .tng-current { min-height: 38px; padding: 4px 12px; }
.topbar-actions .tng-current { max-width: 100%; min-width: 0; }
.topbar-actions .tng-current b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 767px) {
  .topbar:has(.topbar-actions .tng-top) .topbar-title { flex: 0 1 auto; }
  .topbar-actions:has(.tng-top) { flex: 1 1 0; min-width: 0; justify-content: flex-end; }
  .topbar-actions .tng-top, .topbar-actions .tng-switch { min-width: 0; max-width: 100%; }
  .topbar-actions .tng-switch, .topbar-actions .tng-current { width: auto; }
  .topbar-actions .tng-current-l { display: none; }
}
@media (max-width: 640px) {
  .tng-top { align-items: stretch; }
  .tng-tabs { width: 100%; }
  .tng-tab { flex: 1; justify-content: center; padding-inline: 10px; }
  .tng-switch, .tng-current { width: 100%; }
  .tng-chooser-head h2 { font-size: 22px; }
  .tng-cmp-row { grid-template-columns: 1fr 1fr; }
  .tng-cmp-row > :first-child { grid-column: 1 / -1; }
  .tng-cmp-row.is-head > :first-child { display: none; }
}
.tng-limit { display: grid; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.tng-limit-t { display: flex; gap: 8px; align-items: flex-start; font-size: var(--fs-13); line-height: 1.5; color: var(--text-muted); }
.tng-limit-t .icon { flex: none; width: 16px; height: 16px; margin-top: 2px; color: var(--primary); }
.tng-arch { margin-left: 6px; padding: 1px 7px; border-radius: var(--r-pill); background: var(--surface-subtle); color: var(--text-muted); font-size: 11px; font-weight: 700; }
.tng-group.is-archived { opacity: .7; border-left-style: dashed; }
.tng-add-list { display: grid; gap: 6px; max-height: 50vh; overflow: auto; margin: 10px 0; padding-right: 2px; }
.tng-add-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); cursor: pointer; }
.tng-add-row:hover { border-color: var(--primary); }
.tng-add-row input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--primary); flex: none; }
.tng-add-row:has(input:checked) { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 5%, var(--surface)); }
.tng-add-t { display: grid; gap: 2px; min-width: 0; }
.tng-add-t b { overflow-wrap: anywhere; color: var(--text-strong); }
.tng-add-t small { font-size: 12.5px; color: var(--text-muted); }
.tng-add-count { font-size: var(--fs-13); font-weight: 700; color: var(--primary); }
.tng-group-acts .btn-secondary { white-space: nowrap; }
/* group card wraps */
.tng-group { flex-wrap: wrap; }
.tng-group-main { flex: 1 1 170px; }
.tng-group-acts { margin-left: auto; padding: 0 6px 6px; align-items: center; }
.tng-group-grid { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.tng-wait { font-style: normal; padding: 2px 8px; border-radius: var(--r-pill); background: var(--warning-bg); color: var(--warning); font-size: 11.5px; font-weight: 700; white-space: nowrap; }

/* ── Team invites by email (team-email-invite.js, the invite dialog) ─────────────────────────────────────────── */
.tm-ei-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 4px; }
.tm-ei-mode { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: 14px; border: 1.5px solid var(--border); background: var(--surface); color: var(--text-strong); font: inherit; text-align: left; cursor: pointer; transition: border-color .15s, background .15s; }
.tm-ei-mode:hover { border-color: var(--primary); }
.tm-ei-mode:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.tm-ei-mode.is-on { border-color: var(--primary); background: var(--primary-soft); }
.tm-ei-mode-ico { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--surface-subtle); color: var(--primary); }
.tm-ei-mode.is-on .tm-ei-mode-ico { background: var(--surface); }
.tm-ei-mode-ico .icon { width: 18px; height: 18px; }
.tm-ei-mode-t { display: grid; gap: 2px; min-width: 0; }
.tm-ei-mode-t b { font-size: var(--fs-14); font-weight: 700; }
.tm-ei-mode-t small { font-size: var(--fs-12); color: var(--text-muted); line-height: 1.4; }
.tm-ei-modenote { display: flex; align-items: flex-start; gap: 8px; margin: 0 0 4px; font-size: var(--fs-13); line-height: 1.5; color: var(--text-muted); }
.tm-ei-modenote .icon { flex: none; width: 16px; height: 16px; margin-top: 2px; color: var(--primary); }
.tm-ei-err { color: var(--danger); }
/* Teacher / Reviewer / Principal in one row on a wide screen (team-people.js openInviteDialog). */
.tm-ei-modes.is-three { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 560px) { .tm-ei-modes, .tm-ei-modes.is-three { grid-template-columns: 1fr; } }

.tm-ei-list { margin-top: var(--sp-4); }
.tm-ei-row { align-items: center; }
.tm-ei-ava { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); }
.tm-ei-ava .icon { width: 17px; height: 17px; }
.tm-ei-state { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: var(--fs-12); font-weight: 700; background: var(--surface-subtle); color: var(--text-muted); }
.tm-ei-state.is-opened { background: var(--warning-bg); color: var(--warning); }
.tm-ei-state.is-joined { background: var(--success-bg); color: var(--success-strong); }
.tm-ei-state.is-expired, .tm-ei-state.is-cancelled { background: var(--surface-subtle); color: var(--text-faint, var(--text-muted)); text-decoration: line-through; }

.tm-ei-notice { display: grid; justify-items: center; gap: 10px; padding: 36px 24px; text-align: center; }
.tm-ei-notice h2 { margin: 0; font-size: var(--fs-20); color: var(--text-strong); }
.tm-ei-notice p { max-width: 46ch; margin: 0; }
.tm-ei-notice-ico { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: var(--primary-soft); color: var(--primary); }
.tm-ei-notice-ico.is-bad { background: var(--warning-bg); color: var(--warning); }
.tm-ei-notice-ico.is-good { background: var(--success-bg); color: var(--success-strong); }
.tm-ei-notice-ico .icon { width: 24px; height: 24px; }
.tm-ei-actions { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.tm-ei-card .tm-ei-actions { justify-content: flex-start; }
.tm-ei-card { display: grid; gap: 12px; }
.tm-ei-badge { display: inline-flex; align-items: center; gap: 6px; justify-self: start; padding: 4px 10px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: var(--fs-12); font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.tm-ei-badge .icon { width: 14px; height: 14px; }
.tm-ei-h1 { margin: 0; font-size: var(--fs-24, 24px); font-weight: 800; line-height: 1.25; color: var(--text-strong); overflow-wrap: anywhere; }
.tm-ei-facts { display: grid; gap: 6px; }
.tm-ei-expiry { display: flex; align-items: center; gap: 8px; margin: 0; font-size: var(--fs-13); color: var(--text-muted); }
.tm-ei-expiry .icon { width: 15px; height: 15px; }
.tm-ei-bare { min-height: 100dvh; display: grid; place-items: center; padding: 16px; background: var(--canvas); }
.tm-ei-bare .tm-ei-notice { width: min(520px, 100%); }
/* Signed out: the invite takes the sign-in page's left half. */
.tm-ei-page .tm-ei-story { justify-content: center; gap: 16px; }
.tm-ei-page .tm-ei-lead { margin: 0; font-size: var(--fs-15, 15px); line-height: 1.6; color: var(--text); max-width: 52ch; }
.ea .ea-input.is-locked, .ea input.is-locked { background: var(--surface-subtle); color: var(--text-muted); cursor: not-allowed; }
.tm-ei-page .tm-ei-story .tm-ei-badge { align-self: flex-start; }
.tm-ei-page .tm-ei-story .tm-ei-h1 { font-size: clamp(24px, 3vw, 32px); }

/* Class page (team/class): actions at the top right of the title block, a card head row with its button, and an empty card's action. */
.tm-dh-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-left: auto; align-self: flex-start; }
.tm-card-headrow { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.tm-card-headrow > :first-child { flex: 1; min-width: 0; }
/* Phone: the buttons go under the heading (they used to squeeze it to one letter per line). */
@media (max-width: 640px) { .tm-card-headrow { flex-wrap: wrap; margin-bottom: 14px; } .tm-card-headrow > :first-child { flex: 1 1 100%; } }
.tm-empty-act { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 4px 0 2px; }
.tm-empty-act .tm-sub { margin: 0; }
@media (max-width: 640px) { .tm-dh-main { flex-wrap: wrap; } .tm-dh-actions { margin-left: 0; width: 100%; } }

/* What principals and class admins can do (team-page.js rolePermsCard) */
.tm-rp-group { border: 0; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.tm-rp-group legend { font-size: 12px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 6px; padding: 0; }

/* What I can do with a quiz, by role (team-detail.js quizActions; docs/TEAM_RESULTS_FLOW.md): the maker's Mark / Results / Report,
   anyone else's View report (+ Download) and "Waiting for … to mark". */
.tm-acts { display: inline-flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; }
.tm-acts-cell { text-align: right; white-space: nowrap; }
.tm-acts-wait { font-size: var(--fs-12, 12px); white-space: normal; max-width: 18ch; text-align: right; }
.tm-qstats .tm-acts { flex-wrap: nowrap; }
@media (max-width: 860px) { .tm-acts-cell { white-space: normal; } .tm-acts-wait { max-width: none; } }
@media print { .tm-acts, .tm-acts-cell { display: none; } }

/* Welcome after joining from an invite (team-email-invite.js welcomeCard): a medal, confetti the first time, role, next steps. */
.tm-wc { position: relative; overflow: hidden; display: grid; justify-items: center; gap: 10px; padding: 40px 28px 30px; text-align: center; }
.tm-wc.is-party { background: radial-gradient(120% 70% at 50% 0%, color-mix(in srgb, var(--primary) 12%, var(--surface)) 0%, var(--surface) 60%); }
.tm-wc-medal { position: relative; display: grid; place-items: center; width: 76px; height: 76px; border-radius: 50%; background: var(--primary); color: #fff; box-shadow: 0 10px 30px color-mix(in srgb, var(--primary) 35%, transparent); }
.tm-wc-medal .icon { width: 38px; height: 38px; stroke-width: 2.6; }
.tm-wc-ring { position: absolute; inset: -8px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--primary) 40%, transparent); }
.tm-wc-eyebrow { margin: 6px 0 0; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--primary); }
.tm-card.tm-wc .tm-wc-title { margin: 0; font-size: clamp(24px, 3vw, 30px); font-weight: 800; line-height: 1.2; color: var(--text-strong); }
.tm-wc-role { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; margin: 0; color: var(--text-strong); font-weight: 600; }
.tm-wc-pill { padding: 3px 10px; border-radius: 999px; background: color-mix(in srgb, var(--primary) 14%, var(--surface)); color: var(--primary); font-size: 12.5px; font-weight: 800; }
.tm-wc-by { margin: 0; max-width: 46ch; }
.tm-wc-next { width: 100%; max-width: 440px; margin-top: 8px; text-align: left; }
.tm-wc-steps { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.tm-wc-steps li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text-strong); font-size: 14px; }
.tm-wc-step-ico { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: color-mix(in srgb, var(--primary) 12%, var(--surface)); color: var(--primary); }
.tm-wc-step-ico .icon { width: 17px; height: 17px; }
.tm-wc-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 10px; }
.tm-wc-confetti { position: absolute; inset: 0; pointer-events: none; }
.tm-wc-confetti i { position: absolute; top: -14px; left: var(--x); width: calc(8px * var(--s)); height: calc(12px * var(--s)); border-radius: 2px; background: var(--c); opacity: 0; transform: rotate(var(--r)); }
@media (prefers-reduced-motion: no-preference) {
  .tm-wc-medal { animation: tm-wc-pop .6s cubic-bezier(.2, 1.4, .4, 1) both; }
  .tm-wc-ring { animation: tm-wc-ring 1.4s ease-out .3s both; }
  .tm-wc-eyebrow, .tm-wc-title, .tm-wc-role, .tm-wc-by { animation: tm-wc-up .5s ease-out .25s both; }
  .tm-wc-steps li { animation: tm-wc-up .45s ease-out both; animation-delay: calc(.45s + var(--i) * .12s); }
  .tm-wc-actions { animation: tm-wc-up .45s ease-out .85s both; }
  .tm-wc-confetti i { animation: tm-wc-fall 2.6s cubic-bezier(.25, .6, .4, 1) var(--d) forwards; }
}
@keyframes tm-wc-pop { from { transform: scale(.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes tm-wc-ring { from { transform: scale(.8); opacity: 1; } to { transform: scale(1.5); opacity: 0; } }
@keyframes tm-wc-up { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes tm-wc-fall { 0% { opacity: 0; } 10% { opacity: 1; } 100% { opacity: 0; transform: translateY(520px) rotate(calc(var(--r) + 540deg)); } }
@media (max-width: 640px) { .tm-wc { padding: 32px 18px 24px; } .tm-wc-actions .btn { flex: 1 1 100%; justify-content: center; } }

/* Invite by email: what happened to each address after a send that was not a plain "all sent" (team-people.js). */
.tm-ei-results { margin-top: 6px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-subtle); }
.tm-ei-res-list { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 6px; }
.tm-ei-res { display: flex; align-items: flex-start; gap: 8px; font-size: 13.5px; color: var(--text-strong); overflow-wrap: anywhere; }
.tm-ei-res .icon { flex: none; width: 16px; height: 16px; margin-top: 2px; }
.tm-ei-res.is-ok .icon { color: var(--success, #15803d); }
.tm-ei-res.is-warn .icon { color: var(--warning, #b45309); }
.tm-ei-res.is-bad .icon { color: var(--danger, #b3261e); }

/* A shared team link opened signed out: why they are asked to sign in (team-page.js start). */
.tm-join-gate { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 16px; padding: 12px 14px; border: 1px solid color-mix(in srgb, var(--primary) 30%, var(--border)); border-radius: 12px; background: color-mix(in srgb, var(--primary) 8%, var(--surface)); color: var(--text-strong); font-size: 13.5px; }
.tm-join-gate > .icon { flex: none; width: 20px; height: 20px; margin-top: 1px; color: var(--primary); }
.tm-join-gate b { display: block; margin-bottom: 2px; }

/* Your classes (team/my-classes.js): Team page (teacher) and My classes (teacher, principal, class admin, main admin).
   Each class is a card with its colour (from its quizzes' themes), a badge, its FULL name (it wraps, never "…"), numbers, a few lines
   and buttons. */
.myc-card { display: flex; flex-direction: column; gap: var(--sp-4, 16px); }
.myc-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.myc-title { margin: 0; font-size: 18px; font-weight: 800; }
.myc-head .tm-sub { margin: 2px 0 0; }
.myc-sum { display: flex; gap: 8px; margin: 0; flex-wrap: wrap; }
.myc-sum > div { min-width: 82px; padding: 8px 12px; border-radius: 12px; background: var(--surface-2, #f1f5f9); text-align: center; }
.myc-sum dd { margin: 0; font-size: 20px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.myc-sum dt { font-size: var(--fs-12, 12px); color: var(--text-muted); }
.myc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 14px; }
.myc-tile { --myc: var(--primary); position: relative; display: flex; flex-direction: column; gap: 12px; padding: 16px 16px 14px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); overflow: hidden; transition: border-color .14s, box-shadow .14s, transform .14s; }
.myc-tile::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--myc); }
.myc-tile:hover { border-color: color-mix(in srgb, var(--myc) 45%, var(--border)); box-shadow: 0 6px 18px rgb(0 0 0 / .07); transform: translateY(-1px); }
.myc-top { display: flex; align-items: flex-start; gap: 12px; }
.myc-badge { flex: none; display: grid; place-items: center; min-width: 44px; height: 44px; padding: 0 6px; border-radius: 12px; font-weight: 800; font-size: 14px; letter-spacing: .02em; color: #fff; background: var(--myc); }
.myc-name { min-width: 0; flex: 1; }
.myc-name h3 { margin: 0; font-size: 17px; font-weight: 800; line-height: 1.3; overflow-wrap: anywhere; }
.myc-name small { display: block; margin-top: 2px; color: var(--text-muted); font-size: var(--fs-12, 12px); }
.myc-stats { display: grid; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); gap: 6px; margin: 0; }
.myc-stat { padding: 8px 6px; border-radius: 10px; background: var(--surface-2, #f1f5f9); text-align: center; }
.myc-stat dd { margin: 0; font-size: 18px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.myc-stat dt { font-size: 11px; line-height: 1.3; color: var(--text-muted); overflow-wrap: normal; word-break: normal; hyphens: none; }
.myc-stat { display: flex; flex-direction: column-reverse; gap: 2px; }
.myc-stat.is-live dd { color: var(--success, #15803d); }
.myc-stat.is-warn dd { color: var(--warning-strong, #b45309); }
.myc-lines { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-13, 13px); }
.myc-lines li { display: flex; align-items: flex-start; gap: 8px; color: var(--text); line-height: 1.4; }
.myc-lines li .icon { flex: none; width: 15px; height: 15px; margin-top: 2px; color: var(--text-muted); }
.myc-lines li span { overflow-wrap: anywhere; }
.myc-lines li.is-warn, .myc-lines li.is-warn .icon { color: var(--warning-strong, #b45309); }
.myc-note { margin: 0; font-size: var(--fs-13, 13px); color: var(--text-muted); }
.myc-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.myc-actions .btn { text-decoration: none; }
.myc-campus + .myc-campus { margin-top: var(--sp-4, 16px); }
.myc-campus-t { margin: 0 0 10px; font-size: var(--fs-12, 12px); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.myc-empty { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px; border: 1px dashed var(--border); border-radius: 14px; color: var(--text-muted); }
.myc-empty p { margin: 0; flex: 1; min-width: 200px; }
.myc-empty-ico { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--surface-2, #f1f5f9); }
@media (max-width: 560px) { .myc-sum { width: 100%; } .myc-sum > div { flex: 1; min-width: 0; padding: 8px 4px; } .myc-sum dt { font-size: 11px; } }
@media (max-width: 420px) { .myc-stats[style*="--n:4"] { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (prefers-reduced-motion: reduce) { .myc-tile, .myc-tile:hover { transition: none; transform: none; } }

/* The invite form's class check: a note that points at the class chips, and the chips pulse once. */
.tm-inv-classcheck { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--warning-border, #f5c46b); background: var(--warning-bg, #fff8e6); }
.tm-inv-classcheck b { font-size: var(--fs-14, 14px); }
.tm-inv-classcheck p { margin: 0; font-size: var(--fs-13, 13px); color: var(--text-muted); }
.tm-inv-classcheck .tm-inv-cc-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tm-inv-classes.is-nudge { animation: tm-nudge 1.2s ease-out 1; border-radius: 12px; }
@keyframes tm-nudge { 0% { box-shadow: 0 0 0 0 rgb(245 158 11 / .55); } 70% { box-shadow: 0 0 0 10px rgb(245 158 11 / 0); } 100% { box-shadow: 0 0 0 0 rgb(245 158 11 / 0); } }
@media (prefers-reduced-motion: reduce) { .tm-inv-classes.is-nudge { animation: none; outline: 2px solid var(--warning, #f59e0b); } }

/* Teachers with no class (the principal's tab). */
.tm-noclass-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.tm-noclass-list li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; }
.tm-noclass-list .tm-nc-who { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.tm-noclass-list .tm-nc-who small { color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; }
.tm-tab.is-alert .tm-tab-count { background: var(--warning-bg, #fff4d6); color: var(--warning-strong, #92400e); }

/* "Ask for more" under the limits (a class, not an inline style, so the closed card can hide it). */
.tm-ask { margin-top: var(--sp-3); display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.tm-collapsible:not(.is-open) > .tm-ask { display: none; }
/* A campus with sections: five numbers (members, quizzes, classes, sections, waiting). */
.tm-statrow.is-five { grid-template-columns: repeat(5, 1fr); }
.tm-statrow.is-five .tm-stat-tile { padding: var(--sp-4); }
@media (max-width: 1100px) { .tm-statrow.is-five { grid-template-columns: repeat(3, 1fr); } .tm-statrow.is-five .tm-stat-tile:nth-child(4) { border-left: 0; } .tm-statrow.is-five .tm-stat-tile:nth-child(n+4) { border-top: 1px solid var(--border); } }
@media (max-width: 720px) { .tm-statrow.is-five { grid-template-columns: repeat(2, 1fr); } .tm-statrow.is-five .tm-stat-tile { border-left: 1px solid var(--border); border-top: 0; } .tm-statrow.is-five .tm-stat-tile:nth-child(odd) { border-left: 0; } .tm-statrow.is-five .tm-stat-tile:nth-child(n+3) { border-top: 1px solid var(--border); } }
/* Sections as tags inside a class card (team/my-classes.js). */
.myc-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: -2px; }
.myc-tags-l { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); margin-right: 2px; }
.myc-tag { display: inline-flex; align-items: center; max-width: 100%; padding: 4px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 700; line-height: 1.3; color: var(--myc, var(--primary)); background: color-mix(in srgb, var(--myc, var(--primary)) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--myc, var(--primary)) 25%, transparent); text-decoration: none; overflow-wrap: anywhere; }
a.myc-tag:hover { background: color-mix(in srgb, var(--myc, var(--primary)) 18%, var(--surface)); }
.myc-tag.is-warn { color: var(--warning-strong, #b45309); background: var(--warning-bg, #fff8e6); border-color: var(--warning-border, #f5c46b); border-style: dashed; }
/* Search and filters over the class cards (team/my-classes.js filterBar); section tags are never underlined. */
.myc-card a.myc-tag, .myc-card a.myc-tag:hover { text-decoration: none; }
.myc-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.myc-search { flex: 1 1 240px; min-width: 0; max-width: 420px; }
.myc-campus-sel { flex: 0 1 200px; }
.myc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.myc-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font: inherit; font-size: 13px; font-weight: 700; color: var(--text); cursor: pointer; }
.myc-chip em { font-style: normal; font-size: 12px; color: var(--text-muted); }
.myc-chip.on { background: var(--text-strong, #0f172a); border-color: var(--text-strong, #0f172a); color: var(--surface, #fff); }
.myc-chip.on em { color: inherit; opacity: .8; }
.myc-chip:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.myc-none { margin: 0; padding: 14px; border: 1px dashed var(--border); border-radius: 12px; color: var(--text-muted); }
.myc-campus[hidden], .myc-tile[hidden] { display: none; }
@media (max-width: 560px) { .myc-search, .myc-campus-sel { flex-basis: 100%; max-width: none; } }
/* A class card's sections: a heading, then one row per section, joined to the class by a line (team/my-classes.js). */
.myc-secs { display: flex; flex-direction: column; gap: 6px; padding-top: 10px; border-top: 1px solid var(--border); }
.myc-secs-h { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.myc-secs ul { list-style: none; margin: 0; padding: 0 0 0 10px; display: flex; flex-direction: column; gap: 6px; border-left: 2px solid color-mix(in srgb, var(--myc, var(--primary)) 30%, transparent); }
.myc-sec { position: relative; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2, #f1f5f9); color: var(--text); text-decoration: none; }
.myc-sec::before { content: ""; position: absolute; left: -12px; top: 50%; width: 10px; border-top: 2px solid color-mix(in srgb, var(--myc, var(--primary)) 30%, transparent); }
.myc-sec:hover { background: color-mix(in srgb, var(--myc, var(--primary)) 10%, var(--surface)); }
.myc-sec:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.myc-sec-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--myc, var(--primary)); }
.myc-sec.is-warn .myc-sec-dot { background: var(--warning, #f59e0b); }
.myc-sec-t { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.myc-sec-t b { font-size: 14px; font-weight: 700; overflow-wrap: anywhere; }
.myc-sec-t small { font-size: 12px; color: var(--text-muted); overflow-wrap: anywhere; }
.myc-sec.is-warn .myc-sec-t small { color: var(--warning-strong, #b45309); }
.myc-sec-go { flex: none; display: grid; color: var(--text-muted); }
.myc-sec-go .icon { width: 16px; height: 16px; }
/* The class page's top: who teaches it and who runs it, as two clean labelled rows of people (team/class/team-class.js). */
/* One line of people: each label sits beside its chips, like the campus card on the Team page (owner, 23 Nov 2026: "messy"). */
.tm-clsp-people { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 24px; margin-top: 4px; }
.tm-clsp-grp { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-width: 0; }
.tm-clsp-l { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.tm-clsp-v { display: flex; flex-wrap: wrap; gap: 6px; }
.tm-clsp-none { font-size: 13px; color: var(--warning-strong, #b45309); }
.tm-clsp-none.is-quiet { color: var(--text-muted); }
.tm-clsp-add { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 4px 14px 4px 10px; border: 1.5px dashed var(--primary); border-radius: 999px; background: var(--surface); color: var(--primary); font: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer; }
.tm-clsp-add:hover { border-style: solid; }
.tm-clsp-add:focus-visible { outline: 3px solid var(--primary-ring); outline-offset: 2px; }
.tm-clsp-add .icon { width: 15px; height: 15px; }
.tm-clsp-add.is-sm { min-height: 28px; padding: 2px 12px 2px 8px; text-decoration: none; }
.tm-empty > .btn { margin-top: 10px; }
.tm-crow-people .tm-sub { margin: 0; }
.tm-rename-btn { color: var(--text-muted); }
[data-details] { min-width: 112px; justify-content: center; }
.tm-cp-acts { flex-wrap: wrap; }
.tg-chip-name > .icon { width: 12px; height: 12px; opacity: .6; flex: none; }
@media (max-width: 860px) { .tm-cp-row .tm-cp-acts { grid-column: 1 / -1; justify-content: flex-start; } }
.tm-cadm-invite .tm-sub { margin: 0; }
.tm-cadm-invite { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 10px; }
/* A person's email line in the people lists: the email (emailLink) first, then the other facts; both may shorten with "…". */
.tm-item .tm-email:has(> .email-link) { display: flex; align-items: center; min-width: 0; }
.tm-item .tm-email > .email-link { flex: 0 1 auto; }
.tm-email-rest { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: pre; }
/* The name with its kind pill beside it, and a smaller tile, so the top is two short lines, not five. */
.tm-dh-titlerow { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; min-width: 0; }
.tm-dh-titlerow .tm-title { overflow-wrap: anywhere; }
.tm-dh-main { align-items: center; }
.tm-dh-main > .avatar, .tm-dh-main > .tm-teamico { width: 52px; height: 52px; border-radius: 16px; }
.tm-dh-main > .tm-teamico .icon { width: 26px; height: 26px; }
/* Phone: no big tile on a line of its own (the pill beside the name says what it is), and the ⋯ stays at the top right. */
@media (max-width: 720px) {
  .tm-dh-main { position: relative; }
  .tm-dh-main > .avatar, .tm-dh-main > .tm-teamico { display: none; }
  /* Only a lone ⋯ floats at the top right; a labelled button (Compare's "Change classes") sits under the text on its own line. */
  .tm-dh-main.is-menu-only .tm-dh-titlerow { padding-right: 40px; }
  .tm-dh-main.is-menu-only > .tm-dh-actions { position: absolute; top: 10px; right: 10px; width: auto; margin: 0; }
}
.tm-dh .tm-meta { margin-top: 2px; }
/* Teacher page: their classes as chips at the top; each class row with "theirs vs whole class" (team/teacher/team-teacher.js). */
.tm-clsp-cls { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px 5px 8px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-size: 13px; font-weight: 700; color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.tm-clsp-cls .icon { width: 15px; height: 15px; color: var(--primary); flex: none; }
.tm-clsp-cls:hover { border-color: var(--primary); color: var(--primary); }
.tm-tch-cmp { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: flex-end; }
.tm-tch-cmp > span { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; }
.tm-tch-cmp small { font-size: 11px; color: var(--text-muted); }
.tm-tch-cmp b { font-size: 16px; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) { .tm-tch-row { flex-wrap: wrap; } .tm-tch-cmp { width: 100%; justify-content: flex-start; } .tm-tch-cmp > span { align-items: flex-start; } }

/* ── Team tags (team-tags-ui.js): word picker, tag chips, the where/what picture. Same on the setup page and in Settings. ── */
.tg-q { margin: 14px 0 6px; font-size: var(--fs-14); font-weight: 700; color: var(--text-strong, var(--text)); }
.tag-words { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tag-word { appearance: none; font: inherit; font-size: var(--fs-14); font-weight: 600; padding: 7px 16px; min-height: 36px; border-radius: var(--r-pill); border: 1px solid var(--border-strong, var(--border)); background: var(--surface); color: var(--text); cursor: pointer; }
.tag-word:hover { background: var(--surface-subtle); }
.tag-word.is-on { background: var(--primary); border-color: var(--primary); color: var(--on-primary, #fff); }
.tag-word:focus-visible, .tg-chip button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.tg-own-in { width: 180px; max-width: 100%; }
.tg-chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tg-chip { display: inline-flex; align-items: center; gap: 2px; min-height: 34px; padding: 0 4px 0 12px; border-radius: var(--r-pill); background: var(--surface-subtle); border: 1px solid var(--border); font-size: var(--fs-14); font-weight: 600; color: var(--text-strong, var(--text)); max-width: 100%; }
.tg-chip-name { appearance: none; border: 0; background: none; font: inherit; color: inherit; padding: 0; display: inline-flex; align-items: center; gap: 6px; min-width: 0; overflow-wrap: anywhere; }
button.tg-chip-name { cursor: pointer; }
button.tg-chip-name:hover span:first-child { text-decoration: underline; }
.tg-chip-name small { font-size: var(--fs-11); font-weight: 800; opacity: .65; }
.tg-chip-x { appearance: none; border: 0; background: none; color: var(--muted); width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center; cursor: pointer; }
.tg-chip-x:hover { background: var(--border); color: var(--text); }
.tg-chip-x .icon { width: 14px; height: 14px; }
.tg-chip.is-demo { padding: 0 12px; background: var(--primary); border-color: var(--primary); color: var(--on-primary, #fff); }
.tg-add { display: inline-flex; gap: 6px; align-items: center; flex: 1 1 220px; min-width: 0; }
.tg-add-in { flex: 1; min-width: 0; }
.tg-explain { display: grid; gap: 8px; margin: 12px 0 4px; padding: 12px 14px; border-radius: var(--r-md); border: 1px dashed var(--border-strong, var(--border)); background: var(--surface-subtle); }
.tg-ex-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.tg-ex-k { min-width: 110px; font-size: var(--fs-12, 12px); font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.tg-ex-v { font-weight: 700; color: var(--text-strong, var(--text)); overflow-wrap: anywhere; }
.tg-nav-r { display: inline-flex; gap: 8px; }
@media (max-width: 520px) { .tg-ex-k { min-width: 0; width: 100%; } .tg-add { flex-basis: 100%; } }
.tg-chip.is-ro { padding: 0 12px; background: var(--surface); }
.tg-from { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0 2px; }
.tg-from-l { font-size: var(--fs-13); font-weight: 700; color: var(--muted); margin-right: 2px; }
.tg-tabs { margin-bottom: 4px; }
.tg-area-sub { margin: 6px 0 8px; }

/* ── Class page quizzes, grouped by where they belong (team-class.js): Whole class first, then one group per section. ── */
.tm-cq-chips { margin: 4px 0 12px; flex-wrap: wrap; }
.tm-cq-dot { display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--border-strong, #b5bfcc); }
.tm-cq-dot.is-whole { background: var(--primary); }
.tm-cq-dot.is-sec { background: var(--team-sec); }
.tm-seg.is-on .tm-cq-dot { box-shadow: 0 0 0 2px rgba(255, 255, 255, .6); }
.tm-detail-row > .tm-cq-dot { margin: 0 4px; }
.tm-cq-groups { display: grid; gap: 14px; }
.tm-cq-group { border: 1px solid var(--border); border-radius: var(--r-md, 14px); overflow: hidden; background: var(--surface); }
.tm-cq-group.is-plain { border: 0; background: none; }
.tm-cq-h { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--surface-subtle); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.tm-cq-group.is-whole .tm-cq-h { background: color-mix(in srgb, var(--primary) 8%, var(--surface)); }
.tm-cq-group.is-sec .tm-cq-h { background: color-mix(in srgb, var(--team-sec) 7%, var(--surface)); }
.tm-cq-ht { font-weight: 800; font-size: var(--fs-14); color: var(--text-strong, var(--text)); text-transform: uppercase; letter-spacing: .03em; overflow-wrap: anywhere; }
a.tm-cq-ht:hover { text-decoration: underline; }
.tm-cq-hs { font-size: var(--fs-13); color: var(--muted); }
.tm-cq-hn { margin-left: auto; min-width: 26px; text-align: center; padding: 2px 8px; border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--border); font-size: var(--fs-12, 12px); font-weight: 800; }
.tm-cq-rows { display: grid; }
.tm-cq-row { display: grid; grid-template-columns: minmax(0, 1fr) 120px auto; align-items: center; gap: 14px; padding: 10px 14px; border-top: 1px solid var(--border); }
.tm-cq-rows > .tm-cq-row:first-child { border-top: 0; }
.tm-cq-row:hover { background: var(--surface-subtle); }
.tm-cq-main { min-width: 0; display: grid; gap: 2px; }
.tm-cq-main .tm-qtitle { font-weight: 700; overflow-wrap: anywhere; }
.tm-cq-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: var(--fs-13); color: var(--muted); }
.tm-cq-tag { padding: 0 8px; border-radius: var(--r-pill); background: var(--surface-subtle); border: 1px solid var(--border); font-weight: 600; color: var(--text); }
.tm-cq-row .tm-acts { display: flex; flex-wrap: nowrap; align-items: center; gap: 6px; justify-content: flex-end; }
.tm-cq-empty { margin: 0; padding: 12px 14px; font-size: var(--fs-13); color: var(--muted); }
.tm-cq-group.is-plain .tm-cq-row { border: 1px solid var(--border); border-radius: var(--r-md, 14px); margin-bottom: 8px; }
@media (max-width: 720px) {
  .tm-cq-row { grid-template-columns: minmax(0, 1fr) auto; }
  .tm-cq-row .tm-acts { grid-column: 1 / -1; justify-content: flex-start; flex-wrap: wrap; }
}
#tm-class-quizzes .tm-note { margin-top: 12px; }
/* A narrow window: the buttons go under the title instead of squeezing it. */
@media (max-width: 1180px) { .tm-cq-row .tm-acts { grid-column: 1 / -1; justify-content: flex-start; flex-wrap: wrap; } .tm-cq-row .tm-acts-wait { max-width: none; text-align: left; } }
/* One click target per row (team-class.js): the row opens the quiz; the title is plain bold text, not an underlined link. */
.tm-cq-row { grid-template-columns: minmax(0, 1fr) auto; cursor: pointer; }
.tm-cq-title { font-weight: 700; color: var(--text-strong, var(--text)); text-decoration: none; overflow-wrap: anywhere; }
.tm-cq-row:hover .tm-cq-title { color: var(--primary); }
.tm-cq-title:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
.tm-cq-meta > span + span::before { content: "·"; margin-right: 8px; color: var(--muted); }
.tm-cq-meta { gap: 2px 8px; }
.tm-cq-meta > .tm-cq-tag::before { content: none; }
.tm-cq-avgtxt { font-weight: 700; color: var(--text); }
.tm-cq-hn { margin-left: auto; }
.tm-cq-open { margin-left: 4px; gap: 2px; }
.tm-cq-open .icon { width: 16px; height: 16px; }
/* A section taught by its class teacher: the person chip with a small "Class teacher" tag (team-class.js). */
.tm-cq-person { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tm-cq-badge { padding: 2px 8px; border-radius: var(--r-pill); font-size: var(--fs-11, 11px); font-weight: 800; letter-spacing: .02em; color: var(--primary); background: var(--primary-soft, color-mix(in srgb, var(--primary) 12%, var(--surface))); }
/* Group cards (teams-groups.js): one visible action + a ⋯ menu; the limit is one quiet line. */
.tng-group-acts { display: flex; align-items: center; gap: 6px; width: 100%; }
.tng-limit.tm-note { display: flex; align-items: center; gap: 6px; margin-top: 12px; }
.tng-limit.tm-note .icon { width: 15px; height: 15px; flex: none; }
/* Teacher page rows: where in the class the quiz is, as a small coloured tag (team-teacher.js). */
.tm-cq-place { padding: 0 8px; border-radius: var(--r-pill); font-weight: 700; font-size: var(--fs-12, 12px); }
.tm-cq-place.is-whole { color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, var(--surface)); }
.tm-cq-place.is-sec { color: var(--team-sec); background: color-mix(in srgb, var(--team-sec) 10%, var(--surface)); }
.tm-cq-meta > .tm-cq-place + span::before, .tm-cq-meta > span:has(.pill) + span::before { content: "·"; margin-right: 8px; color: var(--muted); }
.tm-cq-meta > span:has(.pill)::before, .tm-cq-meta > .tm-cq-place::before { content: none; }
.tm-cq-warn { color: var(--danger, #b3261e); font-weight: 700; }
/* An empty action slot that keeps a row's buttons in line with the rows above and below (team-campuses.js). */
.tm-slot-gap { visibility: hidden; pointer-events: none; }
/* Every action group: the same gap, kept on one line, aligned to the right edge. */
.tm-acts { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; justify-content: flex-end; }
@media (max-width: 560px) { .tm-acts { flex-wrap: wrap; justify-content: flex-start; } }
/* Report tables: a short value (campus, teacher, principal) stays on one line (team-reports.js). */
.tm-table td.tm-nowrap { white-space: nowrap; }
/* Class rows on Team / campus pages: the count is one right-aligned column, so the Details buttons line up row after row. */
.tm-crow-count { min-width: 230px; text-align: right; }
@media (max-width: 720px) { .tm-crow-count { min-width: 0; text-align: left; } }
/* A section is purple everywhere (class page groups, teacher tags, Team rows): My classes too. */
.myc-sec:not(.is-warn) .myc-sec-dot { background: var(--team-sec); }
/* Progress tab (team-progress.js): one click target per row; nothing ranked yet = one message and how close each school is. */
.tm-pg-row { cursor: pointer; }
.tm-pg-row:hover { background: var(--surface-subtle); }
.tm-pg-rowname { font-weight: 700; color: var(--text-strong, var(--text)); text-decoration: none; }
.tm-pg-row:hover .tm-pg-rowname { color: var(--primary); }
.tm-pg-wait { margin-top: 14px; padding: 14px 16px; border-radius: var(--r-md, 14px); background: var(--surface-subtle); border: 1px solid var(--border); }
.tm-pg-wait-t { margin: 0 0 4px; font-weight: 700; color: var(--text-strong, var(--text)); }
.tm-pg-wait .tm-sub { margin: 0; }
.tm-pg-near { display: grid; gap: 8px; margin-top: 12px; }
.tm-pg-near-row { appearance: none; font: inherit; display: grid; grid-template-columns: minmax(0, 1fr) 160px 110px; align-items: center; gap: 14px; width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--r-md, 12px); background: var(--surface); color: var(--text); text-align: left; cursor: pointer; }
.tm-pg-near-row:hover { border-color: var(--primary); }
.tm-pg-near-name { font-weight: 700; overflow-wrap: anywhere; }
.tm-pg-near-bar { height: 6px; border-radius: 99px; background: var(--border); overflow: hidden; }
.tm-pg-near-bar > span { display: block; height: 100%; background: var(--primary); border-radius: 99px; }
.tm-pg-near-n { font-size: var(--fs-13); color: var(--muted); text-align: right; }
@media (max-width: 560px) { .tm-pg-near-row { grid-template-columns: minmax(0, 1fr) auto; } .tm-pg-near-bar { grid-column: 1 / -1; grid-row: 2; } }

/* ── My classes, livelier (owner, 23 Nov 2026: "it looks very boring"). A coloured banner per class, numbers with icons, sections as
   tiles; one class fills the width (banner across the top, numbers and buttons left, sections right). ── */
.myc-head .myc-sum { margin-left: auto; }
.myc-sum > div { display: grid; grid-template-columns: auto auto; grid-template-rows: auto auto; column-gap: 8px; align-items: center; text-align: left; min-width: 0; padding: 8px 14px; background: var(--surface); border: 1px solid var(--border); }
.myc-sum > div .myc-stat-ico { grid-row: 1 / 3; }
.myc-sum dd { grid-column: 2; }
.myc-sum dt { grid-column: 2; }
.myc-stat-ico { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; color: var(--myc, var(--primary)); background: color-mix(in srgb, var(--myc, var(--primary)) 12%, var(--surface)); }
.myc-stat-ico .icon { width: 16px; height: 16px; }

/* The banner: the class's colour, soft, with a light dot pattern; the badge sits on it. */
.myc-tile { padding: 0 0 16px; gap: 14px; }
.myc-tile::before { content: none; }
.myc-tile > :not(.myc-top) { margin-inline: 16px; }
.myc-top { align-items: center; padding: 18px 16px 16px; background:
    radial-gradient(color-mix(in srgb, var(--myc) 22%, transparent) 1px, transparent 1.4px) 0 0 / 14px 14px,
    linear-gradient(135deg, color-mix(in srgb, var(--myc) 20%, var(--surface)), color-mix(in srgb, var(--myc) 6%, var(--surface)));
  border-bottom: 1px solid color-mix(in srgb, var(--myc) 18%, var(--border)); }
.myc-badge { min-width: 52px; height: 52px; border-radius: 14px; font-size: 16px; box-shadow: 0 6px 14px color-mix(in srgb, var(--myc) 35%, transparent); }
.myc-name h3 { font-size: 19px; }

/* Numbers: a white tile with an icon, the number big. */
.myc-stat { flex-direction: column; align-items: flex-start; gap: 6px; padding: 10px 12px; text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.myc-stat dt { display: flex; align-items: center; gap: 6px; order: 0; font-size: 12px; font-weight: 600; }
.myc-stat dt .myc-stat-ico { width: 24px; height: 24px; border-radius: 7px; }
.myc-stat dt .myc-stat-ico .icon { width: 14px; height: 14px; }
.myc-stat dd { order: 1; font-size: 22px; }

/* Sections as tiles: name, then "1 quiz + 2 for the whole class · teacher" on one line (full text on hover). */
.myc-secs { border-top: 0; padding-top: 0; }
.myc-secs ul { border-left: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 8px; }
.myc-sec { padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--team-sec); }
.myc-sec::before { content: none; }
.myc-sec:hover { border-color: var(--team-sec); background: color-mix(in srgb, var(--team-sec) 5%, var(--surface)); }
.myc-sec-t { min-width: 0; display: grid; gap: 2px; }
.myc-sec-t small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-muted); }
.myc-sec-t small > span + span::before { content: " · "; }
.myc-sec-q { color: var(--text); font-weight: 600; }
.myc-sec-dot { display: none; }

/* One class: it fills the width. Banner across the top; numbers, people and buttons on the left; sections on the right. */
.myc-grid:has(> .myc-tile:only-child) { grid-template-columns: 1fr; }
@media (min-width: 900px) {
  .myc-grid > .myc-tile:only-child:has(> .myc-secs) { display: grid; grid-template-columns: minmax(260px, 360px) minmax(0, 1fr); column-gap: 24px; row-gap: 14px;
    grid-template-areas: "top top" "stats secs" "lines secs" "acts secs" ". secs"; align-items: start; }
  .myc-grid > .myc-tile:only-child:has(> .myc-secs) > .myc-top { grid-area: top; }
  .myc-grid > .myc-tile:only-child:has(> .myc-secs) > .myc-stats { grid-area: stats; margin-right: 0; }
  .myc-grid > .myc-tile:only-child:has(> .myc-secs) > .myc-lines { grid-area: lines; margin-right: 0; }
  .myc-grid > .myc-tile:only-child:has(> .myc-secs) > .myc-actions { grid-area: acts; margin-right: 0; }
  .myc-grid > .myc-tile:only-child:has(> .myc-secs) > .myc-secs { grid-area: secs; margin-left: 0; }
  .myc-grid > .myc-tile:only-child:has(> .myc-secs) > .myc-tags { grid-area: lines; }
}
/* The school card (team-cards.js): plain empty state, five numbers, strong/need-help line, sections under their class. */
.tm-pcard-empty { display: grid; gap: 8px; padding: 14px 16px; border-radius: var(--r-md, 14px); background: var(--surface-subtle); border: 1px solid var(--border); }
.tm-pcard-empty p { margin: 0; font-weight: 600; color: var(--text-strong, var(--text)); }
.tm-pcard-empty small { color: var(--muted); }
.tm-pcard-split { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0; font-size: var(--fs-13); }
.tm-pcard-split .is-strong { color: var(--report-correct, #15803d); font-weight: 600; }
.tm-pcard-split .is-weak { color: var(--warning-strong, #b45309); font-weight: 600; }
.tm-pcard-sec { padding-left: 22px !important; color: var(--text); }
.tm-pcard-sec-mark { color: var(--team-sec); }
.tm-pcard-classlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.tm-pcard-classlist li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; }
.tm-pcard-classlist li.is-sec { margin-left: 22px; border-left: 3px solid var(--team-sec); }
.tm-pcard-cl-name { font-weight: 600; overflow-wrap: anywhere; }

/* Class card numbers: as many per row as fit, each wide enough for its label on one line (a teacher's card cut "Submitted" short). */
.myc-stats { grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); }
.myc-stat dt { white-space: nowrap; }
.myc-stat dt > span:last-child { overflow: hidden; text-overflow: ellipsis; }
/* One class without sections (a teacher's): its numbers in one row, not squeezed into a narrow left column. */
.myc-grid > .myc-tile:only-child:not(:has(> .myc-secs)) .myc-stats { max-width: 760px; }

/* A class or section page's People card (team-class.js): one row per person, role tags next to the name, ⋯ for actions. */
.tm-cp-list { display: grid; gap: 8px; }
.tm-cp-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r-md, 12px); background: var(--surface); cursor: pointer; }
.tm-cp-row:hover { background: var(--surface-subtle); }
.tm-cp-main { min-width: 0; display: grid; gap: 4px; }
.tm-cp-name { font-weight: 700; color: var(--text-strong, var(--text)); }
.tm-cp-link { color: inherit; text-decoration: none; }
.tm-cp-row:hover .tm-cp-link { color: var(--primary); }
.tm-cp-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tm-cp-tags .tm-chips { display: contents; }
.tm-chip.is-role { background: color-mix(in srgb, var(--primary) 12%, var(--surface)); color: var(--primary); border-color: transparent; font-weight: 700; }
.tm-chip.is-inherit { background: color-mix(in srgb, var(--team-sec) 10%, var(--surface)); color: var(--team-sec); border-color: transparent; }
.tm-cp-sub { overflow-wrap: anywhere; }
@media (max-width: 640px) { .tm-cp-row { grid-template-columns: auto minmax(0, 1fr) auto; } .tm-cp-avg { display: none; } }
/* Group cards look like real folders (owner, 23 Nov 2026), the same shape as the dashboard's folders: a coloured tab on top, the
   colour along the top edge, a soft tint, a filled folder icon. */
.tng-group-grid { padding-top: 10px; row-gap: 22px; }
.tng-group { margin-top: 10px; padding: 4px 4px 4px 0; border: 1px solid color-mix(in srgb, var(--g, #94a3b8) 26%, var(--border)); border-top: 3px solid var(--g, #94a3b8); border-radius: 0 14px 14px 14px; background: linear-gradient(180deg, color-mix(in srgb, var(--g, #94a3b8) 9%, var(--surface)) 0%, var(--surface) 75%); }
.tng-group::before { content: ""; position: absolute; top: -13px; left: -1px; width: 38%; max-width: 120px; height: 12px; border-radius: 9px 9px 0 0; background: color-mix(in srgb, var(--g, #94a3b8) 85%, var(--surface)); }
.tng-group:hover { box-shadow: 0 12px 28px -8px color-mix(in srgb, var(--g, #94a3b8) 35%, transparent); }
.tng-group-ico { background: var(--g, #64748b); color: #fff; box-shadow: 0 4px 10px -4px var(--g, #64748b); }
.tng-group.is-archived { border-style: dashed; border-top-style: solid; }
/* Teams follow the theme colour (owner, 23 Nov 2026: "no colours a person did not choose"). A section is a deeper shade of it. */
:root { --team-sec: color-mix(in srgb, var(--primary) 70%, #0f172a); }
/* Which level a class row is: Class / Section in the team's own words (core/team-rules.js levelWordFor; owner, 23 Nov 2026). */
.tm-level-tag { flex: none; display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 6px; font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--primary); background: var(--primary-soft); }
.tm-level-tag.is-sec { color: var(--team-sec); background: color-mix(in srgb, var(--team-sec) 10%, var(--surface)); }
.tm-crow-titlerow { flex-wrap: wrap; }
/* Where a teacher teaches (team-classes.js classTree): a class with its sections under it; a ticked class covers them. */
.tm-ctree-wrap { display: grid; gap: 12px; }
.tm-ctree { display: grid; gap: 10px; max-height: 52vh; overflow: auto; padding-right: 2px; }
.tm-ct-group { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.tm-ct-group.is-on { border-color: var(--primary); }
.tm-ct-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; }
.tm-ct-row input { flex: none; width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; }
.tm-ct-row.is-top { background: var(--surface-2, var(--surface-subtle)); }
.tm-ct-group.is-on .tm-ct-row.is-top { background: var(--primary-soft); }
.tm-ct-row.is-kid { padding-left: 34px; border-top: 1px solid var(--border); }
.tm-ct-row.is-covered { cursor: default; }
.tm-ct-row.is-covered input { cursor: default; }
.tm-ct-t { display: grid; gap: 1px; min-width: 0; }
.tm-ct-t b { font-size: 14.5px; color: var(--text-strong); overflow-wrap: anywhere; }
.tm-ct-t small { font-size: 12.5px; color: var(--text-muted); }
.tm-ct-row.is-covered .tm-ct-t small { color: var(--primary); font-weight: 600; }
.tm-ct-sum { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--surface-2, var(--surface-subtle)); font-size: 13.5px; color: var(--text-muted); }
.tm-ct-sum b { color: var(--text-strong); }
/* A section chip covered by its picked class (invite form, Waiting for approval). */
.tm-cpick-chip.is-covered { opacity: .75; cursor: default; }
/* The invite form's classes: the class tree, full width (owner, 23 Nov 2026). */
.tm-inv-classes { display: grid; gap: 8px; padding: 0; border: 0; }
.tm-role-now { margin-left: 8px; padding: 1px 8px; border-radius: 999px; background: var(--primary); color: #fff; font-style: normal; font-size: 11px; font-weight: 800; vertical-align: 2px; }
.tm-role-grid { margin-bottom: 4px; }
.tm-role-opt:disabled { opacity: .55; cursor: default; }
/* The invite steps already say it: no second label under "Who are they?" / "Where do they go?" (the controls keep their aria-labels). */
.tm-invite-dlg .tm-step .tm-role > .tm-label, .tm-invite-dlg .tm-step label[for="tm-inv-campus"] { display: none; }
/* "Share between your teams" inside the Limits card (owner, 23 Nov 2026): a folded part under a line, like the campus shares. */
.tm-card > .tng-pool-in { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line, var(--border)); }
/* A right the role fixes (team-people.js rightsForm locked): a plain row with a tick or a dash, no switch (owner, 23 Nov 2026). */
.tm-right.is-locked { opacity: .9; }
.tm-right-lock { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; }
.tm-right.is-on .tm-right-lock { background: var(--primary-soft); color: var(--primary); }
.tm-right.is-off-role .tm-right-lock { background: var(--surface-2, var(--surface-subtle)); color: var(--text-muted); }
.tm-right-lock .icon { width: 14px; height: 14px; }
.tm-right.is-locked .tm-right-sub { font-weight: 600; }
/* "Add a teacher" on a section page: people already teaching it through the class, shown as already here (not offered again). */
.tm-cp-covered-h { margin: 14px 0 6px; }
.tm-copy-row.is-covered { cursor: default; background: var(--surface-2, var(--surface-subtle)); }
.tm-cp-done { flex: none; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); }
.tm-cp-done .icon { width: 13px; height: 13px; }

/* ── Compare classes (team/compare/?classes=…), redesigned 23–24 Nov 2026 ──────────────────────────────────────────────────
   Header (class page look) with Change classes → the classes as letter chips → either a friendly empty state with three steps, or
   one bar chart (one series, theme colour, value at the end of each bar, tooltip), one insight line, and a card per class.
   Colours follow the theme only (no per-class colours); letters A, B, C… tie the chart, cards and table together. */
.tm-dh .tm-statrow:empty { display: none; }
.tm-cmp-letter { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--primary-soft); color: var(--primary-text, var(--primary)); font-weight: 800; font-size: var(--fs-14, 14px); }
.tm-cmp-letter.is-sm { display: inline-grid; width: 22px; height: 22px; border-radius: 7px; font-size: 11px; vertical-align: middle; }

/* The classes being compared */
.tm-cmp-chips { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.tm-cmp-chips-l { font-size: var(--fs-12); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); margin-right: 4px; }
.tm-cmp-chip { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 4px 6px 4px 4px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font-size: var(--fs-13); font-weight: 700; }
.tm-cmp-chip > a:not(.tm-cmp-chip-x) { color: var(--text-strong); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 6px; }
.tm-cmp-chip > a:not(.tm-cmp-chip-x):hover { color: var(--primary); text-decoration: underline; }
.tm-cmp-chip-x { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: var(--text-muted); }
.tm-cmp-chip-x:hover { background: var(--surface-subtle); color: var(--text-strong); }

/* Nothing to compare yet: a small bar picture, one title, one sentence, three numbered steps, one main button */
.tm-cmp-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; padding: 36px 24px 30px; }
.tm-cmp-empty-art { display: flex; align-items: flex-end; gap: 8px; width: 96px; height: 72px; padding: 12px 14px 0; border-radius: 20px; background: var(--primary-soft); }
.tm-cmp-empty-art span { flex: 1; border-radius: 6px 6px 0 0; background: var(--primary); opacity: .85; }
.tm-cmp-empty-art span:nth-child(2) { opacity: 1; }
.tm-cmp-empty-art span:nth-child(3) { opacity: .6; }
.tm-cmp-empty .tm-cmp-empty-t { margin: 6px 0 0; font-size: var(--fs-20, 20px); font-weight: 800; color: var(--text-strong); }
.tm-cmp-empty-b { margin: 0; max-width: 56ch; color: var(--text-muted); font-size: var(--fs-14); line-height: 1.55; }
.tm-cmp-steps { list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; width: 100%; max-width: 760px; margin: 12px 0 4px; padding: 0; counter-reset: none; }
.tm-cmp-step { position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 20px 14px 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); text-align: center; }
.tm-cmp-step-n { position: absolute; top: 10px; left: 12px; font-size: var(--fs-12); font-weight: 800; color: var(--text-muted); }
.tm-cmp-step-ico { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: var(--primary-soft); color: var(--primary); }
.tm-cmp-step-ico .icon { width: 22px; height: 22px; }
.tm-cmp-step-t { font-size: var(--fs-14); font-weight: 700; color: var(--text-strong); line-height: 1.4; }
.tm-cmp-empty-acts { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }

/* The chart: one row per class: letter, name, bar on one 0–100 scale, value */
.tm-cmp-rows { list-style: none; display: grid; gap: 6px; margin: 8px 0 0; padding: 0; }
.tm-cmp-row { display: grid; grid-template-columns: 22px minmax(90px, 200px) 1fr 76px; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 10px; outline: none; }
.tm-cmp-row:hover, .tm-cmp-row:focus-visible { background: var(--surface-subtle); }
.tm-cmp-row:focus-visible { box-shadow: 0 0 0 2px var(--primary); }
.tm-cmp-row-name { font-size: var(--fs-14); font-weight: 700; color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tm-cmp-row-track { position: relative; height: 14px; border-radius: 4px; background: var(--surface-subtle); overflow: hidden; background-image: linear-gradient(to right, transparent calc(50% - .5px), var(--border) calc(50% - .5px), var(--border) calc(50% + .5px), transparent calc(50% + .5px)); }
.tm-cmp-row-track > span { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--primary); transition: width .6s cubic-bezier(.2, .7, .2, 1); }
.tm-cmp-row-track.is-empty { background: none; border: 1px dashed var(--border); }
.tm-cmp-row-v { font-size: var(--fs-15, 15px); font-weight: 800; color: var(--text-strong); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tm-cmp-row-track.is-empty + .tm-cmp-row-v { font-size: var(--fs-12); font-weight: 600; color: var(--text-muted); white-space: normal; }
.tm-cmp-scale { display: grid; grid-template-columns: 22px minmax(90px, 200px) 1fr 76px; gap: 12px; padding: 0 10px; font-size: 11px; color: var(--text-muted); }
.tm-cmp-scale span:nth-child(1) { grid-column: 3; justify-self: start; }
.tm-cmp-scale span:nth-child(2) { grid-column: 3; justify-self: center; }
.tm-cmp-scale span:nth-child(3) { grid-column: 3; justify-self: end; }
.tm-cmp-scale span { grid-row: 1; }
.tm-cmp-insight { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: var(--primary-softer, var(--surface-subtle)); color: var(--text-strong); font-size: var(--fs-14); font-weight: 600; text-decoration: none; }
.tm-cmp-insight:hover { background: var(--primary-soft); }
.tm-cmp-insight > span:nth-child(2) { flex: 1; }
.tm-cmp-insight-ico { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--surface); color: var(--primary); flex: none; }

/* Each class in detail */
.tm-cmp-h { margin: 4px 0 10px; font-size: var(--fs-15, 15px); font-weight: 800; color: var(--text-strong); }
.tm-cmp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--sp-4, 16px); }
.tm-cmp-card { display: flex; flex-direction: column; gap: 14px; min-width: 0; padding: 16px 18px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: 0 1px 2px rgb(0 0 0 / .04); }
.tm-cmp-top { display: flex; align-items: center; gap: 12px; min-width: 0; }
.tm-cmp-who { flex: 1; min-width: 0; display: grid; gap: 3px; }
.tm-cmp-namerow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.tm-cmp-name { font-size: var(--fs-16, 16px); font-weight: 800; color: var(--text-strong); text-decoration: none; overflow-wrap: anywhere; }
.tm-cmp-name:hover { color: var(--primary); text-decoration: underline; }
.tm-cmp-sub { font-size: var(--fs-13); color: var(--text-muted); overflow-wrap: anywhere; }
.tm-cmp-avg { flex: none; font-size: 26px; font-weight: 800; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.tm-cmp-avg.is-none { color: var(--text-muted); }
.tm-cmp-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin: 0; padding-top: 12px; border-top: 1px solid var(--border); }
.tm-cmp-stats > div { min-width: 0; }
.tm-cmp-stats dt { font-size: var(--fs-12); color: var(--text-muted); font-weight: 600; }
.tm-cmp-stats dd { margin: 2px 0 0; font-size: var(--fs-16, 16px); font-weight: 800; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.tm-cmp-note { display: flex; align-items: flex-start; gap: 8px; margin: 0; padding: 0 4px; font-size: var(--fs-13); color: var(--text-muted); }
.tm-cmp-note .icon { flex: none; margin-top: 2px; }
.tm-cmp-table th[scope="col"].tm-num { white-space: nowrap; }
.tm-cmp-table th[scope="col"] .tm-cmp-letter { margin-right: 6px; }

/* Change classes window */
.tm-cmp-pick-hint { margin: 10px 0 0; font-size: var(--fs-13); font-weight: 600; color: var(--primary-text, var(--primary)); }
.tm-cmp-pick-hint.is-warn { color: var(--text-muted); }

@media (max-width: 720px) {
  .tm-cmp-steps { grid-template-columns: 1fr; }
  .tm-cmp-step { flex-direction: row; text-align: left; padding: 12px 14px; }
  .tm-cmp-step-n { position: static; }
  .tm-cmp-row, .tm-cmp-scale { grid-template-columns: 22px minmax(0, 1fr) 64px; }
  .tm-cmp-row-track { grid-column: 1 / -1; grid-row: 2; }
  .tm-cmp-scale { display: none; }
  .tm-cmp-stats { grid-template-columns: 1fr 1fr; }
  .tm-cmp-empty { padding: 28px 16px 22px; }
}
@media (prefers-reduced-motion: reduce) { .tm-cmp-row-track > span { transition: none; } }

/* ══ Teams look, 24 Nov 2026 (owner: "headers and the left and right margins are not good; make it attractive, professional
   and clean on every Teams and Folders screen") ══════════════════════════════════════════════════════════════════════════════
   1. Width: Team pages use the dashboard's width and line up with the page title (they were a narrow column in the middle).
   2. Headers (.tm-hero: the Team page, a campus, a class, a teacher, Compare, Groups): a soft theme-colour wash, a 4px accent
      line on top, a faint dot pattern in the corner, a bigger title, a gradient tile or avatar, and a clean numbers strip.
   3. Section cards: rounder, lighter shadow, a gradient icon tile, a slightly bigger title.
   Colours: the theme only (var(--primary)); folders use their own colour (dashboard.css). */
main.page:has(> .tm-page) { max-width: 1440px; margin: 0; }
.tm-page { max-width: none; }

.tm-hero { position: relative; isolation: isolate; border-radius: 20px; border-color: color-mix(in srgb, var(--primary) 16%, var(--border));
  background:
    radial-gradient(120% 150% at 100% 0%, color-mix(in srgb, var(--primary) 12%, transparent) 0%, transparent 46%),
    linear-gradient(180deg, color-mix(in srgb, var(--primary) 5%, var(--surface)) 0%, var(--surface) 64%);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 18px 40px -26px color-mix(in srgb, var(--primary) 55%, transparent); }
.tm-hero::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; z-index: 1; background: linear-gradient(90deg, var(--primary), color-mix(in srgb, var(--primary) 40%, var(--surface))); }
.tm-hero::after { content: ""; position: absolute; top: 0; right: 0; width: 44%; height: 170px; z-index: -1; pointer-events: none;
  background-image: radial-gradient(color-mix(in srgb, var(--primary) 26%, transparent) 1.2px, transparent 1.5px); background-size: 16px 16px;
  -webkit-mask-image: linear-gradient(215deg, #000 0%, transparent 62%); mask-image: linear-gradient(215deg, #000 0%, transparent 62%); }
.tm-hero.tm-hero-campus { border-top: 0; }
.tm-hero .tm-title { font-size: 24px; font-weight: 800; letter-spacing: -.015em; line-height: 1.2; }

/* The trail at the top of a class / teacher / Compare header: soft clickable crumbs, the back arrow in a round button */
.tm-dh-trail { padding: 18px 24px 0; }
/* The back arrow is backButton (.nav-back, ui/components.css). */
a.tm-dh-crumb { padding: 2px 8px; margin: 0 -4px; border-radius: 8px; text-decoration: none; transition: background-color .15s, color .15s; }
a.tm-dh-crumb:hover { background: color-mix(in srgb, var(--primary) 10%, var(--surface)); color: var(--primary-text, var(--primary)); }
.tm-dh-main { padding: 16px 24px 22px; gap: 18px; }
.tm-dh-main > .avatar, .tm-dh-main > .tm-teamico { width: 60px; height: 60px; border-radius: 18px; font-size: 20px; }
.tm-dh-main > .avatar { background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 62%, #000)); color: #fff; font-weight: 800; box-shadow: 0 10px 22px -10px var(--primary); }
.tm-dh-main > .tm-teamico, .tm-head > .tm-teamico { box-shadow: 0 10px 22px -10px var(--primary); }
.tm-dh-eyebrow { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 22%, transparent); }

/* The numbers strip under a header: white, evenly spaced, gradient icon tiles */
.tm-hero .tm-statrow { background: color-mix(in srgb, var(--surface) 92%, transparent); border-top-color: color-mix(in srgb, var(--primary) 10%, var(--border)); }
.tm-hero .tm-stat-tile { padding: 18px 24px; }
.tm-hero .tm-stat-ico { width: 40px; height: 40px; border-radius: 12px; background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 16%, var(--surface)), color-mix(in srgb, var(--primary) 6%, var(--surface))); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 14%, transparent); }
.tm-hero .tm-stat-tile .tm-stat-v { font-size: 24px; letter-spacing: -.01em; }

/* Section cards */
.tm-page > .tm-card:not(.tm-hero) { border-radius: 18px; border-color: color-mix(in srgb, var(--border) 85%, transparent); box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 10px 30px -24px rgba(15, 23, 42, .25); }
.tm-sec-ico { width: 40px; height: 40px; border-radius: 12px; background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 16%, var(--surface)), color-mix(in srgb, var(--primary) 6%, var(--surface))); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 14%, transparent); }
.tm-sec-title { font-size: 18px; letter-spacing: -.01em; }

@media (max-width: 720px) {
  .tm-hero { border-radius: 16px; }
  .tm-hero::after { width: 60%; height: 120px; }
  .tm-hero .tm-title { font-size: 20px; }
  .tm-dh-trail { padding: 14px 16px 0; }
  .tm-dh-main { padding: 12px 16px 18px; }
  .tm-hero .tm-stat-tile { padding: 14px 16px; }
  .tm-page > .tm-card:not(.tm-hero) { border-radius: 16px; }
}

/* Groups / Folders page (team/?view=groups), 24 Nov 2026: the same header look as the other Teams screens, bigger folder cards,
   the whole card opens the folder (the name link covers it; Add quizzes and the menu stay above). */
.tng-hero .tng-gh { padding: 24px 26px; gap: 16px; align-items: center; }
.tng-hero .tm-al-ico { width: 56px; height: 56px; border-radius: 16px; background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 62%, #000)); color: #fff; box-shadow: 0 10px 22px -10px var(--primary); }
.tng-hero .tm-al-ico .icon { width: 26px; height: 26px; }
.tng-hero .tng-gh-t h2 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -.015em; }
.tng-hero .tng-gh-t .tm-al-sub { margin-top: 4px; font-size: 14px; }

.tng-group-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 26px 18px; padding-top: 14px; }
.tng-group { padding: 8px 8px 10px 0; transition: transform .15s, box-shadow .15s, border-color .15s; }
.tng-group:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--g, #94a3b8) 45%, var(--border)); }
.tng-group-main { padding: 14px 16px 8px; gap: 4px 14px; }
.tng-group-ico { width: 46px; height: 46px; border-radius: 13px; }
.tng-group-ico .icon { width: 22px; height: 22px; }
.tng-group-t b { font-size: 16.5px; font-weight: 800; letter-spacing: -.01em; }
.tng-group-t small { font-size: 13px; }
.tng-group-acts { padding: 4px 8px 0 16px; }
/* The whole card opens the folder */
.tng-group > .tng-group-main::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.tng-group > .tng-group-acts { position: relative; z-index: 2; }
.tng-group > .tng-group-acts > .grow { pointer-events: none; }
.tng-group { cursor: pointer; }
@media (max-width: 720px) {
  .tng-hero .tng-gh { padding: 18px 16px; flex-wrap: wrap; }
  .tng-hero .tm-al-ico { width: 46px; height: 46px; }
  .tng-hero .tng-gh-t h2 { font-size: 20px; }
  .tng-group-grid { grid-template-columns: 1fr; }
}

/* ── Scores by class (team-results.js), redesigned 24 Nov 2026 ──────────────────────────────────────────────────────────────
   No marked results: one small friendly line with a bar picture. Results: a By class | By subject switch, one bar per row on one
   0–100 scale (theme colour; a weak row in the danger colour with a "Needs attention" tag), then the latest results as rows. */
.tm-res-empty { display: flex; align-items: center; gap: 16px; padding: 16px 18px; border: 1px dashed color-mix(in srgb, var(--primary) 30%, var(--border)); border-radius: 14px; background: color-mix(in srgb, var(--primary) 4%, var(--surface)); }
.tm-res-empty b { font-size: 15px; color: var(--text-strong); }
.tm-res-empty p { margin: 2px 0 0; font-size: 13.5px; line-height: 1.5; color: var(--text-muted); }
.tm-res-empty-art { flex: none; display: flex; align-items: flex-end; gap: 5px; width: 56px; height: 44px; padding: 8px 9px 0; border-radius: 12px; background: var(--primary-soft); box-sizing: border-box; }
.tm-res-empty-art i { flex: 1; border-radius: 4px 4px 0 0; background: var(--primary); }
.tm-res-empty-art i:nth-child(1) { opacity: .55; } .tm-res-empty-art i:nth-child(3) { opacity: .75; }

.tm-res-tabs { display: inline-flex; gap: 4px; padding: 4px; margin-bottom: 12px; border-radius: 12px; background: var(--surface-subtle); border: 1px solid var(--border); }
.tm-res-tab { padding: 6px 14px; border: 0; border-radius: 9px; background: none; font: inherit; font-size: 13px; font-weight: 700; color: var(--text-muted); cursor: pointer; transition: background-color .15s, color .15s, box-shadow .15s; }
.tm-res-tab:hover { color: var(--text-strong); }
.tm-res-tab[aria-selected="true"] { background: var(--surface); color: var(--primary-text, var(--primary)); box-shadow: 0 1px 3px rgba(15, 23, 42, .12); }
.tm-res-tab:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }

.tm-res-list { display: grid; gap: 6px; }
.tm-res-row { display: grid; grid-template-columns: minmax(160px, 1.1fr) minmax(120px, 2fr) 92px 20px; align-items: center; gap: 16px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: inherit; text-decoration: none; transition: border-color .15s, box-shadow .15s, transform .15s; }
a.tm-res-row:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); box-shadow: 0 8px 20px -14px color-mix(in srgb, var(--primary) 60%, transparent); transform: translateY(-1px); }
a.tm-res-row:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.tm-res-row.is-weak { border-left: 4px solid var(--danger, #dc2626); }
.tm-res-who { display: grid; gap: 4px; min-width: 0; }
.tm-res-name { display: grid; gap: 1px; min-width: 0; }
.tm-res-name b { font-size: 14.5px; font-weight: 800; color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tm-res-name small { font-size: 12.5px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tm-res-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; font-size: 12px; color: var(--text-muted); }
.tm-res-weak { padding: 1px 8px; border-radius: 999px; background: color-mix(in srgb, var(--danger, #dc2626) 12%, var(--surface)); color: var(--danger, #b91c1c); font-style: normal; font-weight: 800; font-size: 11px; }
.tm-res-track { height: 10px; border-radius: 999px; background: var(--surface-subtle); overflow: hidden; background-image: linear-gradient(to right, transparent calc(50% - .5px), var(--border) calc(50% - .5px), var(--border) calc(50% + .5px), transparent calc(50% + .5px)); }
.tm-res-track > span { display: block; height: 100%; border-radius: inherit; background: var(--primary); transition: width .6s cubic-bezier(.2, .7, .2, 1); }
.tm-res-track.is-weak > span { background: var(--danger, #dc2626); }
.tm-res-track.is-empty { background: none; border: 1px dashed var(--border); box-sizing: border-box; }
.tm-res-v { text-align: right; font-size: 17px; font-weight: 800; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.tm-res-v.is-none { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.tm-res-go { display: grid; place-items: center; color: var(--text-muted); }
.tm-res-go .icon { width: 16px; height: 16px; }

.tm-res-recent-l { margin: 18px 0 8px; }
.tm-res-recent { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.tm-res-qrow { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: inherit; text-decoration: none; transition: border-color .15s, box-shadow .15s; min-width: 0; }
.tm-res-qrow:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); box-shadow: 0 8px 20px -14px color-mix(in srgb, var(--primary) 60%, transparent); }
.tm-res-qrow .tm-res-name { flex: 1; }
.tm-res-qico { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); }
.tm-res-qico .icon { width: 17px; height: 17px; }
.tm-res-pill { flex: none; padding: 3px 10px; border-radius: 999px; background: var(--primary-soft); color: var(--primary-text, var(--primary)); font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; }
.tm-res-pill.is-weak { background: color-mix(in srgb, var(--danger, #dc2626) 12%, var(--surface)); color: var(--danger, #b91c1c); }
.tm-res-pill.is-none { background: var(--surface-subtle); color: var(--text-muted); }

@media (max-width: 720px) {
  .tm-res-row { grid-template-columns: minmax(0, 1fr) auto 16px; gap: 8px 12px; }
  .tm-res-row > .tm-res-track { grid-column: 1 / -1; grid-row: 2; }
  .tm-res-empty { align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) { .tm-res-track > span { transition: none; } a.tm-res-row:hover { transform: none; } }
.tm-res-row, .tm-res-row:hover, .tm-res-row:hover *, .tm-res-qrow, .tm-res-qrow:hover, .tm-res-qrow:hover * { text-decoration: none; }

/* ── Position cards page (team/cards/), redesigned 24 Nov 2026 with the same patterns as Compare ─────────────────────────────── */
.tm-cards-tools { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 14px 22px; padding: 16px 20px; }
.tm-cards-field { display: grid; gap: 6px; }
.tm-cards-field > span { font-size: var(--fs-12); font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--text-muted); }
.tm-cards-field .select { min-width: 170px; }
.tm-cards-pills { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.tm-cards-pill { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px 7px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font: inherit; font-size: 13px; font-weight: 700; color: var(--text-muted); cursor: pointer; transition: background-color .15s, border-color .15s, color .15s; }
.tm-cards-pill .icon { width: 14px; height: 14px; opacity: 0; transition: opacity .15s; }
.tm-cards-pill[aria-pressed="true"] { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 35%, transparent); color: var(--primary-text, var(--primary)); }
.tm-cards-pill[aria-pressed="true"] .icon { opacity: 1; }
.tm-cards-pill:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.tm-cards-near { list-style: none; display: grid; gap: 8px; width: 100%; max-width: 620px; margin: 10px 0 0; padding: 0; text-align: left; }
.tm-cards-near li { display: grid; grid-template-columns: 30px minmax(0, 1fr) minmax(90px, 160px) auto; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.tm-cards-near b { font-size: 14px; color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tm-cards-near small { font-size: 12.5px; color: var(--text-muted); white-space: nowrap; }
.tm-cards-near-ico { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--primary-soft); color: var(--primary); }
.tm-cards-near-ico .icon { width: 15px; height: 15px; }
.tm-cards-near-bar { height: 8px; border-radius: 999px; background: var(--surface-subtle); overflow: hidden; }
.tm-cards-near-bar > span { display: block; height: 100%; border-radius: inherit; background: var(--primary); }
/* On screen the "Counts fully marked results…" note is said once (.tm-cards-note); each printed page keeps its own. */
@media screen { .tm-cards-pages .tm-pcard-foot { display: none; } }
@media (max-width: 720px) {
  .tm-cards-tools { padding: 14px 16px; }
  .tm-cards-field, .tm-cards-field .select { width: 100%; }
  .tm-cards-near li { grid-template-columns: 30px minmax(0, 1fr) auto; }
  .tm-cards-near-bar { grid-column: 1 / -1; grid-row: 2; }
}

/* ── Team reports (team/reports/), redesigned 24 Nov 2026 with the same patterns as Compare / Position cards ─────────────────── */
.tm-rep-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 14px 16px; }
.tm-rep-tools .select { min-width: 160px; flex: 0 1 200px; }
.tm-rep-search { position: relative; flex: 1 1 280px; display: flex; align-items: center; }
.tm-rep-search > .icon { position: absolute; left: 12px; width: 16px; height: 16px; color: var(--text-muted); pointer-events: none; }
.tm-rep-search .input { width: 100%; padding-left: 36px; }
.tm-rep-lists .tm-res-tabs { margin-bottom: 6px; }
.tm-res-tab em { margin-left: 6px; padding: 0 7px; border-radius: 999px; background: var(--surface-subtle); font-style: normal; font-size: 11.5px; font-weight: 800; color: var(--text-muted); }
.tm-res-tab[aria-selected="true"] em { background: var(--primary-soft); color: var(--primary-text, var(--primary)); }
.tm-rep-hint { margin: 0 0 10px; }
.tm-rep-name { min-width: 200px; }
.tm-rep-name > .tm-qtitle { font-weight: 700; }
.tm-rep-name > small { display: block; margin-top: 2px; font-size: 12.5px; color: var(--text-muted); }
.tm-rep-tag { margin-left: 8px; padding: 1px 8px; border-radius: 999px; background: var(--surface-subtle); font-size: 11px; font-weight: 700; color: var(--text-muted); }
.tm-rep-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.tm-rep-tile { display: flex; align-items: center; gap: 14px; padding: 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: inherit; font: inherit; text-align: left; text-decoration: none; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
.tm-rep-tile:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); box-shadow: 0 10px 24px -16px color-mix(in srgb, var(--primary) 60%, transparent); transform: translateY(-1px); text-decoration: none; }
.tm-rep-tile:hover * { text-decoration: none; }
.tm-rep-tile:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.tm-rep-tile-ico { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 13px; background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 16%, var(--surface)), color-mix(in srgb, var(--primary) 6%, var(--surface))); color: var(--primary); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 14%, transparent); }
.tm-rep-tile-ico .icon { width: 21px; height: 21px; }
.tm-rep-tile-t { flex: 1; display: grid; gap: 2px; min-width: 0; }
.tm-rep-tile-t b { font-size: 15px; color: var(--text-strong); }
.tm-rep-tile-t small { font-size: 12.5px; line-height: 1.45; color: var(--text-muted); }
.tm-rep-tile-go { flex: none; color: var(--text-muted); }
@media (max-width: 720px) { .tm-rep-tools .select { flex: 1 1 100%; } .tm-rep-name { min-width: 160px; } }
@media (prefers-reduced-motion: reduce) { .tm-rep-tile:hover { transform: none; } }

/* My classes (classes/), 24 Nov 2026: the same look as the other Teams screens (owner: "still old design").
   Width: lines up with the page title like the Team pages (it was a narrow column in the middle).
   Header: the hero wash, a 4px accent line, the dot pattern, a bigger title, a gradient tile, white number pills. */
main.page:has(> .cls-page) { max-width: 1440px; margin: 0; }
.cls-page { max-width: none; margin: 0; }
.myc-card > .myc-head { position: relative; isolation: isolate; overflow: hidden; margin: calc(-1 * var(--sp-5)) calc(-1 * var(--sp-6)) 0; padding: 22px 24px 20px; border-bottom: 1px solid color-mix(in srgb, var(--primary) 12%, var(--border)); border-radius: var(--r-lg) var(--r-lg) 0 0;
  background:
    radial-gradient(120% 150% at 100% 0%, color-mix(in srgb, var(--primary) 12%, transparent) 0%, transparent 46%),
    linear-gradient(180deg, color-mix(in srgb, var(--primary) 5%, var(--surface)) 0%, var(--surface) 100%); }
.myc-card > .myc-head::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: linear-gradient(90deg, var(--primary), color-mix(in srgb, var(--primary) 40%, var(--surface))); }
.myc-card > .myc-head::after { content: ""; position: absolute; top: 0; right: 0; width: 44%; height: 150px; z-index: -1; pointer-events: none;
  background-image: radial-gradient(color-mix(in srgb, var(--primary) 26%, transparent) 1.2px, transparent 1.5px); background-size: 16px 16px;
  -webkit-mask-image: linear-gradient(215deg, #000 0%, transparent 62%); mask-image: linear-gradient(215deg, #000 0%, transparent 62%); }
.myc-card { overflow: hidden; border-radius: 20px; border-color: color-mix(in srgb, var(--primary) 14%, var(--border)); box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 18px 40px -28px color-mix(in srgb, var(--primary) 55%, transparent); }
.myc-head > .tm-al-ico { width: 56px; height: 56px; border-radius: 16px; background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 62%, #000)); color: #fff; box-shadow: 0 10px 22px -10px var(--primary); }
.myc-head > .tm-al-ico .icon { width: 26px; height: 26px; }
.myc-title { font-size: 24px; letter-spacing: -.015em; }
.myc-sum > div { background: color-mix(in srgb, var(--surface) 92%, transparent); border: 1px solid color-mix(in srgb, var(--primary) 12%, var(--border)); box-shadow: 0 1px 2px rgba(15, 23, 42, .04); }
@media (max-width: 720px) {
  .myc-card > .myc-head { margin: calc(-1 * var(--sp-4)) calc(-1 * var(--sp-4)) 0; padding: 18px 16px 16px; }
  .myc-head > .tm-al-ico { width: 46px; height: 46px; }
  .myc-title { font-size: 20px; }
}
.myc-card > .myc-head .myc-title { font-size: 24px; font-weight: 800; letter-spacing: -.015em; }
@media (max-width: 720px) { .myc-card > .myc-head .myc-title { font-size: 20px; } }


/* ══ Team guide, 24 Nov 2026 redesign (team/guide/team-guide.js): story player, who's who, rules, tiles ══════════ */
.tg-page { max-width: none; width: 100%; gap: var(--sp-12); }
main.page:has(> .tg-page) { max-width: 1440px; margin: 0; }
.tg-head { display: flex; flex-direction: column; gap: 2px; }
.tg-head-row { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; }
.tg-sec-t { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.tg-sec-sub { font-size: var(--fs-15, 15px); }

/* hero: stronger wash, a floating picture and the "Shown for" switch */
.tg-hero { background: radial-gradient(120% 140% at 100% 0%, var(--primary-soft) 0%, transparent 55%), linear-gradient(160deg, var(--primary-softer), var(--surface) 70%); border-color: color-mix(in srgb, var(--primary) 18%, var(--border)); box-shadow: 0 18px 50px -30px color-mix(in srgb, var(--primary) 60%, transparent); }
.tg-hero::before { content: ""; position: absolute; inset: 0; z-index: 0; background-image: radial-gradient(color-mix(in srgb, var(--primary) 22%, transparent) 1px, transparent 1.2px); background-size: 18px 18px; mask-image: linear-gradient(90deg, transparent 40%, #000); opacity: .6; pointer-events: none; }
.tg-h1 { font-size: 40px; font-weight: 800; letter-spacing: -.025em; }
.tg-hero-art { display: grid; place-items: center; }
.tg-hero-art .tm-art { width: 100%; animation: tg-float 6s ease-in-out infinite; }
@keyframes tg-float { 50% { transform: translateY(-8px); } }
.tg-kindbtn { margin-top: var(--sp-5); display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 6px 8px 6px 14px; border-radius: var(--r-pill); border: 1px dashed color-mix(in srgb, var(--primary) 45%, var(--border)); background: color-mix(in srgb, var(--surface) 80%, transparent); font: inherit; color: var(--text); cursor: pointer; align-self: flex-start; transition: border-color .2s, background .2s; }
.tg-kindbtn:hover { border-style: solid; border-color: var(--primary); background: var(--surface); }
.tg-kindbtn-l { font-size: var(--fs-13); color: var(--text-muted); }
.tg-kindbtn-v { display: inline-flex; gap: 6px; font-weight: 700; color: var(--text-strong); }
.tg-kindbtn-c { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: var(--r-pill); background: var(--primary-soft); color: var(--primary); font-size: var(--fs-12); font-weight: 700; }
.tg-kindbtn-c .icon { width: 14px; height: 14px; transition: transform .2s; }
.tg-kindbtn[aria-expanded="true"] .tg-kindbtn-c .icon { transform: rotate(180deg); }
.tg-hero-text { display: flex; flex-direction: column; }
.tg-hero-text > .tg-eyebrow { align-self: flex-start; }
.tg-kinds[hidden] { display: none; }
.tg-kinds { animation: tm-open .25s ease; }
.tg-kinds-top { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--sp-3); }

/* how it works: tabs on the left, the stage on the right */
.tg-story { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: var(--sp-5); padding: var(--sp-4); }
.tg-stabs { display: flex; flex-direction: column; gap: 6px; }
.tg-stab { position: relative; overflow: hidden; display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 12px; align-items: center; text-align: left; padding: 12px 14px; border-radius: 14px; border: 1px solid transparent; background: transparent; font: inherit; color: var(--text); cursor: pointer; transition: background .25s, border-color .25s, box-shadow .25s; }
.tg-stab:hover { background: var(--surface-subtle); }
.tg-stab:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.tg-stab-n { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; font-size: var(--fs-15, 15px); background: var(--surface-subtle); color: var(--text-muted); border: 1px solid var(--border); transition: all .25s; }
.tg-stab-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tg-stab-t { font-weight: 700; color: var(--text-strong); }
.tg-stab-b { font-size: var(--fs-13); color: var(--text-muted); line-height: 1.4; }
.tg-stab.is-done .tg-stab-n { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.tg-stab[aria-selected="true"] { background: var(--surface); border-color: color-mix(in srgb, var(--primary) 35%, var(--border)); box-shadow: 0 8px 22px -14px color-mix(in srgb, var(--primary) 70%, transparent); }
.tg-stab[aria-selected="true"] .tg-stab-n { background: var(--primary); color: var(--text-on-primary); border-color: var(--primary); box-shadow: 0 6px 14px -6px var(--primary); }
.tg-stab-bar { position: absolute; left: 0; bottom: 0; height: 3px; width: 0; background: var(--primary); border-radius: 3px; }
.tg-stab.is-run .tg-stab-bar { animation: tg-run var(--step-ms, 5s) linear forwards; }
@keyframes tg-run { to { width: 100%; } }
.tg-stage { display: flex; flex-direction: column; gap: var(--sp-4); padding: var(--sp-5); border-radius: 16px; background: linear-gradient(160deg, var(--primary-softer), var(--surface-subtle)); min-height: 380px; }
.tg-stage.is-in > * { animation: tm-open .45s ease backwards; }
.tg-stage.is-in > :nth-child(2) { animation-delay: .1s; }
.tg-stage-art { position: relative; border-radius: 14px; background: var(--surface); box-shadow: 0 12px 30px -20px rgba(17, 28, 45, .35); padding: var(--sp-3); }
.tg-stage-art .tm-art { background: transparent; }
.tg-stage-art .tm-art svg { max-height: 170px; }
.tg-stage-badge { position: absolute; top: 12px; left: 12px; display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--r-pill); background: var(--primary); color: var(--text-on-primary); font-size: var(--fs-12); font-weight: 700; z-index: 1; }
.tg-stage-badge .icon { width: 14px; height: 14px; }
.tg-stage-text { display: flex; flex-direction: column; gap: var(--sp-2); }
.tg-stage-text h3 { margin: 0; font-size: 22px; font-weight: 800; color: var(--text-strong); letter-spacing: -.01em; }
.tg-stage-text p { margin: 0; color: var(--text); font-size: 15px; }
.tg-ticks, .tg-crosses { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.tg-ticks li, .tg-crosses li { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; line-height: 1.45; color: var(--text); }
.tg-ticks .icon, .tg-crosses .icon { flex: none; width: 20px; height: 20px; padding: 3px; border-radius: 50%; margin-top: 1px; }
.tg-ticks .icon { background: var(--success-bg); color: var(--success); }
.tg-crosses .icon { background: var(--surface-subtle); color: var(--text-muted); }
.tg-crosses li { color: var(--text-muted); }

/* who's who */
.tg-who { gap: var(--sp-5); }
.tg-roles6 { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.tg-roles6 .tg-role { flex-direction: column; justify-content: center; gap: 8px; padding: 14px 8px; border-radius: 14px; font-size: var(--fs-13); text-align: center; }
.tg-role-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--primary-soft); transition: background .2s; }
.tg-roles6 .tg-role .icon { width: 20px; height: 20px; }
.tg-roles6 .tg-role[aria-selected="true"] .tg-role-ico { background: color-mix(in srgb, #fff 22%, transparent); }
.tg-roles6 .tg-role:hover:not([aria-selected="true"]) { border-color: var(--primary); transform: translateY(-2px); }
.tg-who-body { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: var(--sp-6); align-items: center; }
.tg-who-text { display: flex; flex-direction: column; gap: var(--sp-4); }
.tg-who-text.is-in > * { animation: tm-open .35s ease backwards; }
.tg-who-text .tg-role-t { font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.tg-cancols { display: flex; flex-direction: column; gap: var(--sp-4); }
.tg-canh { display: block; font-size: var(--fs-12); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 6px; }
.tg-cancol.is-can .tg-canh { color: var(--success); }
.tg-tree[data-role="class_admin"] .tg-branch.is-mine { opacity: 1; }
.tg-tree[data-role="class_admin"] .tg-classcol.is-mine .tg-node { opacity: 1; transform: none; box-shadow: 0 0 0 2px var(--primary); }
.tg-tree[data-role="teacher"] .tg-classcol.is-mine .tg-node.is-class { box-shadow: none; }
.tg-tree[data-role="reviewer"] .tg-node, .tg-tree[data-role="reviewer"] .tg-branch { opacity: .9; transform: none; }
.tg-tree[data-role="reviewer"] .tg-node:not(.is-group) { border: 1px dashed var(--primary); background: var(--surface); }
.tg-matrix { border-top: 1px solid var(--border); padding-top: var(--sp-3); }
.tg-matrix summary { list-style: none; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 700; color: var(--primary); padding: 6px 2px; }
.tg-matrix summary::-webkit-details-marker { display: none; }
.tg-matrix summary .icon { width: 16px; height: 16px; transition: transform .2s; }
.tg-matrix[open] summary .icon:last-child { transform: rotate(180deg); }
.tg-matrix .tm-table-wrap { margin-top: var(--sp-3); animation: tm-open .25s ease; }
.tg-matrix .tg-rowh { min-width: 170px; }
.tg-matrix th.tm-num, .tg-matrix td.tm-num { text-align: center; }
.tg-cellpill { display: inline-block; padding: 3px 9px; border-radius: var(--r-pill); background: var(--success-bg); color: var(--success); font-size: var(--fs-12); font-weight: 700; white-space: nowrap; }
.tg-cellpill.is-if { background: var(--warning-bg, #fff4d6); color: var(--warning, #92400e); }

/* you make the rules */
.tg-rules-list { display: flex; flex-direction: column; gap: var(--sp-3); }
.tg-rules .tm-rp-group { margin: 0; }
.tg-rsum { position: sticky; top: 72px; }

/* if someone leaves */
.tg-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-3); }
.tg-tile { display: flex; flex-direction: column; gap: var(--sp-3); padding: var(--sp-4); border-radius: 16px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-card); }
.tg-reveal.is-in .tg-tile { animation: tm-open .5s ease backwards; animation-delay: calc(var(--i) * 90ms); }
.tg-tile-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.tg-tile-ico .icon { width: 20px; height: 20px; }
.tg-tile p { margin: 0; font-size: var(--fs-14); line-height: 1.5; color: var(--text); }
.tg-faq summary .icon { transform: none; }
.tg-faq details[open] summary .icon { transform: rotate(180deg); }

@media (max-width: 900px) {
  .tg-story { grid-template-columns: minmax(0, 1fr); }
  .tg-stabs { flex-direction: row; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .tg-stabs::-webkit-scrollbar { display: none; }
  .tg-stab { flex: none; grid-template-columns: 30px auto; gap: 8px; padding: 8px 12px 10px; }
  .tg-stab-n { width: 30px; height: 30px; border-radius: 10px; font-size: var(--fs-13); }
  .tg-stab-b { display: none; }
  .tg-stage { min-height: 0; }
  .tg-roles6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tg-who-body { grid-template-columns: minmax(0, 1fr); }
  .tg-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tg-rsum { position: static; }
}
@media (max-width: 720px) {
  .tg-page { gap: var(--sp-10); }
  .tg-h1 { font-size: 30px; }
  .tg-sec-t { font-size: 22px; }
  .tg-hero::before { display: none; }
  .tg-hero-art { display: none; }
  .tg-story { padding: var(--sp-3); }
  .tg-stage { padding: var(--sp-4); }
  .tg-stage-art { padding-top: 44px; }
  .tg-stage-text h3 { font-size: 19px; }
  .tg-roles6 .tg-role { padding: 10px 4px; font-size: var(--fs-12); }
  .tg-who .tg-classes { flex-direction: column; gap: 8px; }
  .tg-who .tg-branches { justify-content: center; }
  .tg-role-ico { width: 34px; height: 34px; }
}
@media (max-width: 420px) {
  .tg-tiles { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .tg-hero-art .tm-art, .tg-stage.is-in > *, .tg-who-text.is-in > *, .tg-reveal.is-in .tg-tile, .tg-stab.is-run .tg-stab-bar { animation: none !important; }
}

/* The invite form for who runs a class (team-invite-admin.js), and "name@x · invited" beside its button on the class page */
.tm-adminv-dlg { max-width: 560px; }
.tm-adminv-role { display: flex; align-items: center; gap: 14px; margin: 0 0 var(--sp-4); padding: 14px 16px; border: 1.5px solid var(--primary); border-radius: 14px; background: var(--primary-softer, var(--surface)); }
.tm-adminv-ico { display: grid; place-items: center; flex: none; width: 42px; height: 42px; border-radius: 12px; background: var(--surface); color: var(--primary); }
.tm-adminv-ico .icon { width: 20px; height: 20px; }
.tm-adminv-role > span:last-child { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
.tm-adminv-role b { font-size: 16px; }
.tm-adminv-role .tm-sub { margin: 0; }
.tm-adminv-dlg .tm-rsum { margin: var(--sp-4) 0 0; }
.tm-clsp-wait { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 4px 12px 4px 10px; border-radius: 999px; background: var(--surface-2, #f3f0e8); color: var(--text-muted); font-size: 13px; font-weight: 600; }
button.tm-clsp-wait { appearance: none; border: 0; font-family: inherit; cursor: pointer; text-align: start; }
button.tm-clsp-wait:hover { color: var(--text-strong, var(--text)); }
button.tm-clsp-wait:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
#tm-class-people .tm-ei-list { margin-top: 16px; }
.tm-rm-choice { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; }
.tm-rm-choice:has(input:checked) { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); background: var(--danger-bg); }
.tm-rm-choice input { margin-top: 3px; flex: none; width: 18px; height: 18px; accent-color: var(--danger); }
.tm-rm-choice b { display: block; color: var(--text-strong, var(--text)); }
.tm-rm-choice small { display: block; margin-top: 2px; color: var(--text-muted); font-size: var(--fs-13); line-height: 1.45; }
.tm-rm-gone { color: var(--danger); font-weight: 600; }
.tm-clsp-wait .icon { width: 14px; height: 14px; flex: none; }
.tm-clsp-wait span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Add a level (team-structure.js): what the team will look like; and a level's heading with its action */
.tm-lv-prev { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: var(--sp-3); padding: 12px 14px; border-radius: 12px; background: var(--surface-subtle, var(--surface)); }
.tm-lv-chip { padding: 5px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font-size: 13.5px; font-weight: 700; overflow-wrap: anywhere; }
.tm-lv-chip.is-new { border: 1.5px dashed var(--primary); color: var(--primary); }
.tm-lv-arrow { display: grid; color: var(--text-muted); }
.tm-lv-arrow .icon { width: 16px; height: 16px; }
.tm-struct-lhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
/* Team structure: one slim row per level; dragged by the handle or moved with the arrows while nobody was invited */
.tm-lv-table { display: grid; gap: 6px; }
.tm-lv-list { display: grid; gap: 6px; }
.tm-lv-row { display: grid; grid-template-columns: 32px 30px minmax(0, 1fr) minmax(0, 1fr) 76px; align-items: center; gap: 8px; padding: 7px 8px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.tm-lv-row.is-head { padding-block: 0; border-color: transparent; background: none; font-size: 12px; font-weight: 700; color: var(--text-muted); }
.tm-lv-row.is-top { background: var(--surface-subtle, var(--surface)); }
.tm-lv-row .input { min-width: 0; width: 100%; }
.tm-lv-topnote { font-size: 13px; color: var(--text-muted); }
.tm-lv-n { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; background: var(--primary-softer, var(--surface-subtle)); color: var(--primary); font-size: 13px; font-weight: 800; }
.tm-lv-n .icon { width: 16px; height: 16px; }
.tm-lv-arrows { display: flex; justify-content: flex-end; }
.tm-struct-level.is-movable { transition: transform .16s ease, box-shadow .16s ease; }
.tm-struct-level.is-dragging { position: relative; z-index: 3; border-color: var(--primary); transition: box-shadow .16s ease; box-shadow: 0 10px 30px rgba(0, 0, 0, .18); }
.tm-lv-grip, .tm-lv-mv { display: grid; place-items: center; flex: none; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 10px; background: none; color: var(--text-muted); cursor: pointer; }
.tm-lv-grip { cursor: grab; touch-action: none; margin-left: -4px; }
.tm-lv-grip:active { cursor: grabbing; }
.tm-lv-grip:hover, .tm-lv-mv:hover:not(:disabled) { background: var(--primary-softer, var(--surface-subtle)); color: var(--primary); }
.tm-lv-mv:focus-visible { outline: 3px solid var(--primary-ring); outline-offset: 1px; }
.tm-lv-mv:disabled { opacity: .3; cursor: default; }
.tm-lv-hint { display: flex; align-items: center; gap: 8px; margin: 0; }
.tm-lv-hint .icon { width: 16px; height: 16px; flex: none; }
.tm-lv-people { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); padding-top: var(--sp-2); border-top: 1px solid var(--border); }
@media (max-width: 620px) {
  .tm-lv-row { grid-template-columns: 32px 28px minmax(0, 1fr) auto; gap: 6px; }
  .tm-lv-row.is-head { display: none; }
  .tm-lv-row > :nth-child(1) { grid-area: 1 / 1; } .tm-lv-row > :nth-child(2) { grid-area: 1 / 2; } .tm-lv-row > :nth-child(3) { grid-area: 1 / 3; }
  .tm-lv-row > :nth-child(5) { grid-area: 1 / 4; } .tm-lv-row > :nth-child(4) { grid-area: 2 / 3 / 3 / 5; }
  .tm-lv-arrows .tm-lv-mv { width: 34px; }
  .tm-lv-people { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .tm-struct-level.is-movable { transition: none; } }
