/* Training portal (src/training/), on the M3 theme (docs/theme.md). Tokens
   only; .trn-* prefix. It sits in the same fixed overlay as the Handbook (.hb). */
body.trn-open { overflow: hidden; }
.trn { gap: var(--m3-space-3); }
.trn-tabs { position: sticky; top: calc(56px + env(safe-area-inset-top)); z-index: 19; padding: var(--m3-space-2) var(--m3-space-4);
  background: color-mix(in srgb, var(--md-sys-color-card) 95%, transparent); }
.trn-filters .m3-chip-set { margin: 0; }
.trn-badges { flex-wrap: wrap; gap: var(--m3-space-1); margin-top: var(--m3-space-1); }
.trn-person.trn-gone .m3-list-item-headline { color: var(--md-sys-color-on-surface-variant); text-decoration: line-through; }
.trn .m3-list-item-trailing.m3-row { gap: var(--m3-space-2); }
.trn .m3-list-item-trailing .m3-select { max-width: 12rem; }
.trn-x { border: 0; background: transparent; color: inherit; font: inherit; cursor: pointer; padding: 0 0 0 4px; line-height: 1; }
@media (max-width: 599px) {
  .trn .m3-list-item { flex-wrap: wrap; }
  .trn .m3-list-item-trailing { width: 100%; }
  .trn .m3-list-item-trailing .m3-select { max-width: none; flex: 1; }
}
/* Tabs scroll sideways on a phone rather than squeeze. */
.trn-seg { overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.trn-seg::-webkit-scrollbar { display: none; }
.trn-seg > button { white-space: nowrap; }
.trn-toolbar { justify-content: flex-end; }
/* Assign stepper */
.trn-steps { display: flex; gap: var(--m3-space-2); list-style: none; margin: 0; padding: 0; flex-wrap: wrap;
  font: var(--md-sys-typescale-label-medium); color: var(--md-sys-color-on-surface-variant); }
.trn-steps li { padding: 2px 10px; border-radius: var(--md-sys-shape-corner-full); background: var(--md-sys-color-surface-container); }
.trn-steps li.is-current { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.trn-steps li.is-done { color: var(--md-sys-color-on-surface); }
.trn-pick { max-height: 50vh; overflow-y: auto; }
.trn-done > summary { cursor: pointer; padding: var(--m3-space-2) 0; }
.trn-done > .m3-card { margin-top: var(--m3-space-3); }
.trn-ruleform { flex-wrap: wrap; gap: var(--m3-space-2); align-items: flex-end; }
.trn-ruleform .m3-field { width: 9rem; }
/* My training */
.trn-todo .m3-card-header { gap: var(--m3-space-2); flex-wrap: wrap; }
.trn-todo.is-late { box-shadow: inset 3px 0 0 var(--md-sys-color-error); }
.lms-sign { margin-top: var(--m3-space-2); }
/* Printing a progress sheet from the portal: only the overlay goes on paper. */
@media print {
  body.trn-open > *:not(#training) { display: none !important; }
  html:has(body.trn-open), body.trn-open { height: auto; overflow: visible; background: #fff; }
  .trn-tabs, #training .m3-top-app-bar { display: none !important; }
}
/* Dashboard */
.trn-stats { grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); }
.trn-stat { padding: var(--m3-space-3) var(--m3-space-4); display: flex; flex-direction: column; gap: var(--m3-space-1); }
.trn-stat.is-late .m3-stat-value, .trn-late { color: var(--md-sys-color-error); }
.trn-table-wrap { overflow-x: auto; }
.trn-table { width: 100%; border-collapse: collapse; font: var(--md-sys-typescale-body-medium); }
.trn-table th, .trn-table td { text-align: left; padding: var(--m3-space-2) var(--m3-space-3); border-bottom: 1px solid var(--md-sys-color-outline-variant); white-space: nowrap; }
.trn-table thead th { font: var(--md-sys-typescale-label-medium); color: var(--md-sys-color-on-surface-variant); }
.trn-head-actions { gap: var(--m3-space-1); }
.trn-tab-badge { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: var(--md-sys-shape-corner-full);
  background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); font-size: 11px; line-height: 18px; text-align: center; }
.trn-tab-badge.is-late { background: var(--md-sys-color-error); color: var(--md-sys-color-on-error); }
/* A page's own buttons in the app bar (a record's Progress sheet, Withdraw…)
   drop to a second row on a phone so the title keeps its room. */
#training .m3-top-app-bar:has(.trn-head-actions) { flex-wrap: wrap; height: auto; min-height: calc(56px + env(safe-area-inset-top)); }
@media (max-width: 599px) {
  #training .trn-head-actions { order: 3; flex-basis: 100%; justify-content: flex-end; padding-bottom: var(--m3-space-2); }
}
/* More tabs than fit: a fade on the right edge says there's more to scroll. */
@media (max-width: 599px) {
  .trn-seg { -webkit-mask-image: linear-gradient(to right, #000 85%, transparent); mask-image: linear-gradient(to right, #000 85%, transparent); }
}
