/* AUST teacher portal — 5 Nov 2026 redesign.
   The frame is the admin panel's (assets/admin-shell.css: module sidebar,
   drawer on phones). Everything here is built on the site skin's tokens
   (assets/skin.css: --paper, --ink, --line, --tb-primary …), so every
   theme, Midnight included, applies. This file is linked in <body>, after
   the skin: rules that restyle the skin's own classes start with
   `html body` to outrank its `html …` rules. New pieces are tp-*. */

/* ---- page ---------------------------------------------------------------- */
html body .side-body > main.wrap { padding: 22px 28px 48px; }
html body main.wrap { box-sizing: border-box; }
html body h1 { letter-spacing: -.01em; }

/* ---- sidebar: the account row is a link to My profile -------------------- */
html body .tp-side-account {
  display: flex; align-items: center; gap: 9px; padding: 6px 8px; margin: 0 -8px;
  border-radius: 8px; color: inherit; text-decoration: none;
}
html body .tp-side-account:hover { background: var(--row); }
html body .tp-side .side-badge { background: var(--warn, #a15c07); }

/* ---- page header ---------------------------------------------------------- */
.tp-head {
  display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap;
  gap: 14px 24px; margin: 0 0 18px;
}
.tp-head-main { flex: 1 1 420px; min-width: 0; }
html body .tp-back {
  display: inline-flex; align-items: center; gap: 6px; margin: 0 0 8px;
  font-size: 13px; font-weight: 500; color: var(--muted); text-decoration: none;
}
html body .tp-back:hover { color: var(--tb-primary); }
.tp-back svg { width: 16px; height: 16px; }
.tp-eyebrow {
  font-size: 11.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--muted);
}
html body .tp-head h1 { margin: 3px 0 4px; font-size: 24px; line-height: 1.25; color: var(--ink); }
.tp-sub { margin: 0; font-size: 13.5px; color: var(--muted); }
.tp-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tp-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* ---- chips ---------------------------------------------------------------- */
.tp-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  background: var(--paper); border: 1px solid var(--line); color: var(--ink-2);
  font-size: 12.5px; font-weight: 500; line-height: 1.5; white-space: nowrap;
}
.tp-chip svg { width: 14px; height: 14px; color: var(--muted); flex: none; }
.tp-chip.is-primary { background: var(--tb-primary-lt); border-color: transparent; color: var(--tb-primary); font-weight: 600; }
.tp-chip.is-primary svg { color: var(--tb-primary); }
.tp-chip.is-ok { background: var(--ok-soft); border-color: var(--ok-line); color: color-mix(in srgb, var(--tb-primary) 80%, var(--ink)); }
.tp-chip.is-ok svg { color: inherit; }
.tp-chip.is-warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.tp-chip.is-warn svg { color: inherit; }
.tp-chip.is-bad { background: var(--bad-soft); border-color: var(--bad-line); color: var(--bad); }
.tp-chip.is-bad svg { color: inherit; }
.tp-chip.is-muted { background: var(--row); color: var(--muted); }

/* ---- buttons with icons ---------------------------------------------------- */
html body .tp-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; text-decoration: none; }
html body .tp-btn svg { width: 16px; height: 16px; flex: none; }

/* ---- figure tiles ---------------------------------------------------------- */
.tp-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(178px, 1fr)); gap: 12px; margin: 0 0 18px; }
html body .tp-kpi {
  display: flex; align-items: center; gap: 12px; min-width: 0; padding: 13px 15px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
  color: inherit; text-decoration: none;
}
html body a.tp-kpi:hover { border-color: var(--tb-line-strong); box-shadow: var(--tb-shadow-lg); }
.tp-kpi-ico {
  flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px;
  background: var(--tb-primary-lt); color: var(--tb-primary);
}
.tp-kpi-ico svg { width: 20px; height: 20px; }
.tp-kpi-text { min-width: 0; }
.tp-kpi-text b {
  display: block; font-size: 22px; font-weight: 700; line-height: 1.15; color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.tp-kpi-text span { display: block; font-size: 12.5px; line-height: 1.3; color: var(--muted); }
.tp-kpi.is-warn .tp-kpi-ico { background: var(--warn-soft); color: var(--warn); }
.tp-kpi.is-bad .tp-kpi-ico { background: var(--bad-soft); color: var(--bad); }
.tp-kpi.is-bad .tp-kpi-text b { color: var(--bad); }

/* ---- cards ------------------------------------------------------------------ */
html body .tp-card {
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px !important;
  box-shadow: var(--shadow) !important; margin: 0 0 16px; padding: 0; min-width: 0;
}
.tp-card-h {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 16px;
  padding: 13px 18px; border-bottom: 1px solid var(--line-2);
}
html body .tp-card-h h2 {
  display: flex; align-items: center; gap: 8px; margin: 0; font-size: 15px; font-weight: 650; color: var(--ink);
}
.tp-card-h h2 svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.tp-card-h .tp-hint { font-size: 12.5px; color: var(--muted); }
.tp-count {
  display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--row); color: var(--muted); font-size: 11.5px; font-weight: 700;
}
.tp-card-b { padding: 16px 18px; }
.tp-card-b.is-flush { padding: 0; }
.tp-card-b > p:first-child { margin-top: 0; }
.tp-card-b > p:last-child { margin-bottom: 0; }
details > summary.tp-card-f { color: var(--ink-2); font-weight: 600; list-style: none; }
details > summary.tp-card-f::-webkit-details-marker { display: none; }
.tp-card-f svg { width: 16px; height: 16px; vertical-align: -3px; color: var(--muted); }
.tp-card-f {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  padding: 11px 18px; border-top: 1px solid var(--line-2); background: var(--paper-2); border-radius: 0 0 12px 12px;
  font-size: 13px;
}
html body .tp-card-f a:not(.btn) { font-weight: 600; text-decoration: none; }
.tp-split { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.tp-split > * { min-width: 0; }
.tp-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }

/* A collapsible card. */
html body details.tp-card > summary {
  display: flex; align-items: center; gap: 10px; padding: 13px 18px; cursor: pointer; list-style: none;
  font-size: 15px; font-weight: 650; color: var(--ink);
}
html body details.tp-card > summary::-webkit-details-marker { display: none; }
details.tp-card > summary > svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
details.tp-card > summary .tp-chev { margin-left: auto; transition: transform .15s; }
details.tp-card[open] > summary .tp-chev { transform: rotate(90deg); }
details.tp-card[open] > summary { border-bottom: 1px solid var(--line-2); }
details.tp-card > .tp-card-b h2 { font-size: 14px; margin: 16px 0 8px; }

/* ---- alerts ------------------------------------------------------------------ */
.tp-alert {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; margin: 0 0 16px; padding: 12px 16px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
}
.tp-alert-ico {
  flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px;
  background: var(--tb-primary-lt); color: var(--tb-primary);
}
.tp-alert-ico svg { width: 18px; height: 18px; }
.tp-alert-text { flex: 1 1 260px; min-width: 0; font-size: 13.5px; color: var(--ink-2); }
.tp-alert-text b { display: block; color: var(--ink); font-size: 14px; }
.tp-alert.is-warn { background: var(--note-bg); border-color: var(--note-line); }
.tp-alert.is-warn .tp-alert-ico { background: var(--warn-soft); color: var(--warn); }
.tp-alert.is-warn .tp-alert-text { color: var(--note-ink); }
.tp-alert.is-warn .tp-alert-text b { color: var(--note-ink); }
.tp-alert.is-quiet { box-shadow: none; background: var(--paper-2); padding: 8px 14px; }
.tp-alert.is-quiet .tp-alert-ico { width: 28px; height: 28px; border-radius: 8px; }
.tp-alert.is-quiet .tp-alert-ico svg { width: 15px; height: 15px; }
.tp-alert.is-quiet .tp-alert-text b { display: inline; font-size: 13.5px; }
html body .tp-alert .btn { padding: 6px 12px; font-size: 13px; }

/* ---- dashboard welcome -------------------------------------------------------- */
.tp-welcome {
  position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 16px 24px; margin: 0 0 18px; padding: 20px 22px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
}
.tp-welcome::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, var(--tb-primary-lt) 0%, transparent 62%);
}
.tp-welcome > * { position: relative; }
.tp-welcome-who { display: flex; align-items: center; gap: 16px; min-width: 0; flex: 1 1 420px; }
.tp-avatar {
  flex: none; display: grid; place-items: center; width: 54px; height: 54px; border-radius: 50%;
  background: var(--tb-primary); color: var(--on-primary, #fff); font-size: 19px; font-weight: 700; letter-spacing: .02em;
}
html body .tp-welcome h1 { margin: 2px 0 3px; font-size: 22px; line-height: 1.25; color: var(--ink); }
.tp-welcome p { margin: 0; color: var(--ink-2); font-size: 13.5px; }

/* ---- today's lectures ---------------------------------------------------------- */
.tp-lecs { margin: 0; padding: 0; list-style: none; }
html body a.tp-lec {
  display: grid; grid-template-columns: 104px 16px minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 11px 18px; border-top: 1px solid var(--line-2); color: inherit; text-decoration: none;
}
.tp-lecs li:first-child a.tp-lec { border-top: 0; }
html body a.tp-lec:hover { background: var(--row); }
.tp-lec-time b { display: block; font-size: 14px; color: var(--ink); font-variant-numeric: tabular-nums; }
.tp-lec-time small { font-size: 12px; color: var(--muted); }
.tp-dot { width: 12px; height: 12px; border-radius: 50%; border: 3px solid var(--tb-line-strong); background: var(--paper); box-sizing: border-box; }
.is-done .tp-dot { border-color: var(--tb-primary); background: var(--tb-primary); }
.is-due .tp-dot { border-color: var(--bad); }
.tp-lec-what { min-width: 0; }
.tp-lec-what b { display: block; font-size: 14px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-lec-what small { display: block; font-size: 12.5px; color: var(--muted); }
.tp-lec-state { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.tp-lec-state svg.tp-go { width: 16px; height: 16px; color: var(--muted); }

/* ---- class cards ------------------------------------------------------------------ */
.tp-section { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 16px; margin: 24px 0 12px; }
html body .tp-section h2 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 16px; color: var(--ink); }
.tp-classes { display: grid; grid-template-columns: repeat(auto-fill, minmax(272px, 1fr)); gap: 14px; }
.tp-class {
  display: flex; flex-direction: column; min-width: 0; overflow: hidden;
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
  transition: border-color .15s, box-shadow .15s;
}
.tp-class:hover { border-color: var(--tb-line-strong); box-shadow: var(--tb-shadow-lg); }
.tp-class[hidden] { display: none; }
.tp-class-top { flex: 1; padding: 14px 16px 12px; }
.tp-class-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 9px; }
html body .tp-class h3 { margin: 0 0 3px; font-size: 15.5px; font-weight: 650; line-height: 1.3; }
html body .tp-class h3 a { color: var(--ink); text-decoration: none; }
html body .tp-class h3 a:hover { color: var(--tb-primary); }
.tp-class-meta { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 12.5px; color: var(--muted); }
.tp-class-note { margin: 8px 0 0; font-size: 12.5px; color: var(--ink-2); }
.tp-when { display: grid; gap: 3px; margin: 10px 0 0; padding: 0; list-style: none; font-size: 12.5px; color: var(--ink-2); }
.tp-when li { display: flex; align-items: center; gap: 6px; }
.tp-when svg { width: 14px; height: 14px; color: var(--muted); flex: none; }
.tp-figs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--line-2); }
.tp-fig { padding: 10px 12px 11px; border-left: 1px solid var(--line-2); min-width: 0; }
.tp-fig:first-child { border-left: 0; }
.tp-fig b { display: block; font-size: 17px; font-weight: 700; line-height: 1.2; color: var(--ink); font-variant-numeric: tabular-nums; }
.tp-fig span { display: block; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tp-fig.is-bad b { color: var(--bad); }
.tp-meter { height: 4px; margin-top: 6px; border-radius: 4px; background: var(--line-2); overflow: hidden; }
.tp-meter i { display: block; height: 100%; border-radius: 4px; background: var(--tb-primary); }
.tp-meter.is-low i { background: var(--bad); }
.tp-class-warn {
  display: inline-flex; align-items: center; gap: 6px; margin: 10px 0 0; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; color: var(--warn); background: var(--warn-soft);
}
.tp-class-warn svg { width: 14px; height: 14px; flex: none; }
.tp-class-acts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line-2); }
.tp-class-acts .is-main { grid-column: 1 / -1; }
html body .tp-class-acts .btn { padding: 7px 10px; font-size: 13px; }

/* ---- search ------------------------------------------------------------------------ */
html body label.tp-search { position: relative; display: block; flex: 0 1 300px; min-width: 190px; margin: 0; }
.tp-card-h .tp-actions { flex-wrap: nowrap; }
html body label.tp-chip { margin: 0; cursor: pointer; }
.tp-search svg { position: absolute; left: 11px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
html body .tp-search input { width: 100%; margin: 0; padding-left: 34px !important; box-sizing: border-box; }
.tp-none { padding: 22px 16px; text-align: center; color: var(--muted); font-size: 13.5px; }
.tp-none svg { display: block; width: 28px; height: 28px; margin: 0 auto 8px; color: var(--tb-line-strong); }
.tp-none[hidden] { display: none; }

/* ---- tables inside cards -------------------------------------------------------------- */
html body .tp-table { width: 100%; margin: 0; border: 0 !important; border-radius: 0; background: transparent; }
html body .tp-table th { padding: 9px 14px; position: sticky; top: 0; z-index: 1; border-radius: 0 !important; }
html body .tp-table td { padding: 9px 14px !important; vertical-align: middle; }
html body .tp-table tr:last-child > td { border-bottom: 0; }
html body .tp-table tr[hidden] { display: none; }
.tp-scroll { overflow: auto; max-height: 620px; border-radius: 0 0 12px 12px; }
.tp-roll { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
.tp-pct { display: flex; align-items: center; gap: 9px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tp-pct .tp-meter { width: 84px; margin: 0; flex: none; }
.tp-pct small { color: var(--muted); }
html body tr.is-short > td { background: color-mix(in srgb, var(--bad-soft) 70%, transparent); }
.tp-num { text-align: right; font-variant-numeric: tabular-nums; }
.tp-sub-line { display: block; font-size: 12px; color: var(--muted); }

/* ---- segmented filter (lecture list) -------------------------------------------------- */
html body #lecture-filters { display: inline-flex; flex-wrap: wrap; gap: 2px !important; margin: 0 !important; padding: 3px; border-radius: 9px; background: var(--row); border: 1px solid var(--line); }
html body #lecture-filters button {
  padding: 5px 12px; font-size: 12.5px; border-radius: 6px; box-shadow: none; border: 0;
  background: transparent; color: var(--ink-2);
}
html body #lecture-filters button[aria-pressed="true"] { background: var(--paper); color: var(--ink); box-shadow: 0 1px 2px rgba(15, 23, 42, .12); }

/* ---- lecture rows (lecture list, class page) ------------------------------------------- */
.tp-rows { margin: 0; padding: 0; list-style: none; }
.tp-row {
  display: grid; grid-template-columns: 54px minmax(0, 1fr) auto; align-items: center; gap: 14px;
  padding: 7px 18px; border-top: 1px solid var(--line-2);
}
.tp-month {
  padding: 7px 18px; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); background: var(--paper-2); border-top: 1px solid var(--line-2);
}
.tp-rows > .tp-month:first-child { border-top: 0; }
.tp-month[hidden] { display: none; }
.tp-rows > .tp-row:first-child { border-top: 0; }
.tp-row[hidden] { display: none; }
.tp-row:hover { background: var(--row); }
.tp-row.is-today { background: color-mix(in srgb, var(--tb-primary-lt) 70%, transparent); }
.tp-row.is-upcoming .tp-date, .tp-row.is-upcoming .tp-row-what { opacity: .6; }
.tp-date {
  display: grid; place-items: center; width: 46px; padding: 3px 0; border-radius: 9px;
  background: var(--row); border: 1px solid var(--line-2); line-height: 1.1;
}
.tp-date b { font-size: 16px; color: var(--ink); font-variant-numeric: tabular-nums; }
.tp-date small { font-size: 10.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.is-today .tp-date { background: var(--tb-primary); border-color: transparent; }
.is-today .tp-date b, .is-today .tp-date small { color: var(--on-primary, #fff); }
.tp-row-what { min-width: 0; }
.tp-row-what b { display: block; font-size: 13.5px; color: var(--ink); }
.tp-row-what small { display: block; font-size: 12px; color: var(--muted); }
.tp-row-end { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
html body .tp-row-end .btn, html body .tp-row-end button { padding: 5px 11px; font-size: 12.5px; }
html body .tp-row-end form { display: inline; margin: 0; }
.tp-row-end .hint { font-size: 12px; }

/* ---- tabs ----------------------------------------------------------------------------- */
.tp-tabs { display: flex; gap: 2px; margin: 0 0 16px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: thin; }
html body .tp-tabs a {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px; margin-bottom: -1px; white-space: nowrap;
  border-bottom: 2px solid transparent; color: var(--muted); font-size: 13.5px; font-weight: 600; text-decoration: none;
}
html body .tp-tabs a:hover { color: var(--ink); }
html body .tp-tabs a[aria-selected="true"] { color: var(--tb-primary); border-bottom-color: var(--tb-primary); }
.tp-tabs svg { width: 16px; height: 16px; }

/* ---- forms in cards ---------------------------------------------------------------------- */
.tp-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.tp-form .is-wide { grid-column: 1 / -1; }
html body .tp-form label { display: block; margin: 0 0 6px; }
html body .tp-form :is(input, select, textarea) { width: 100%; box-sizing: border-box; margin: 0; }
.tp-form-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.tp-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; }
.tp-filters > div { min-width: 170px; flex: 1 1 170px; }
html body .tp-filters label { display: block; margin: 0 0 6px; }
html body .tp-filters select { width: 100%; margin: 0; }

/* ---- people (FYP members) and documents ----------------------------------------------- */
.tp-people { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; padding: 0; list-style: none; }
.tp-person {
  display: inline-flex; align-items: center; gap: 7px; padding: 3px 10px 3px 3px; border-radius: 999px;
  background: var(--row); border: 1px solid var(--line-2); font-size: 12.5px; color: var(--ink-2);
}
.tp-person i {
  display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font-style: normal;
  background: var(--tb-primary-lt); color: var(--tb-primary); font-size: 10.5px; font-weight: 700;
}
.tp-person .tp-roll { font-size: 11.5px; }
.tp-docs { margin: 0; padding: 0; list-style: none; }
.tp-docs > li { border-top: 1px solid var(--line-2); }
.tp-docs > li:first-child { border-top: 0; }
html body .tp-docs details > summary {
  display: flex; align-items: center; gap: 10px; padding: 10px 18px; cursor: pointer; list-style: none;
  font-weight: 600; font-size: 13.5px; color: var(--ink);
}
html body .tp-docs details > summary::-webkit-details-marker { display: none; }
.tp-docs details > summary svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.tp-docs details > summary small { margin-left: auto; color: var(--muted); font-weight: 500; white-space: nowrap; }
.tp-docs dl { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 6px 14px; margin: 0; padding: 4px 18px 14px 44px; font-size: 13px; }
.tp-docs dt { color: var(--muted); font-weight: 600; }
.tp-docs dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }
.tp-group-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
html body .tp-group-foot form { margin: 0; }

/* ---- people lists (admin Teachers page) ------------------------------------------------- */
html body a.tp-who { display: flex; align-items: center; gap: 10px; min-width: 0; color: inherit; text-decoration: none; }
.tp-ava {
  flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: var(--tb-primary-lt); color: var(--tb-primary); font-size: 12px; font-weight: 700;
}
.tp-who b { display: block; font-size: 13.5px; color: var(--ink); }
html body a.tp-who:hover b { color: var(--tb-primary); }
.tp-who small { display: block; font-size: 12px; line-height: 1.35; color: var(--muted); }
.tp-table td .tp-chip { margin-top: 3px; }
.tp-rowacts { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.tp-table td:last-child:has(.tp-rowacts) { width: 1%; min-width: 280px; }
html body .tp-rowacts a.btn.is-icon { padding: 5px 8px; }
html body .tp-rowacts a.btn.is-icon span:empty { display: none; }
html body label.tp-search input[name=q] { min-width: 230px; }
html body .tp-rowacts a.btn, html body .tp-rowacts button.tp-btn { padding: 5px 10px; font-size: 12.5px; white-space: nowrap; }
html body .tp-rowacts form { display: inline; margin: 0; }
.tp-scroll.is-wide { max-height: none; overflow-x: auto; }
.tp-seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: 9px; background: var(--row); border: 1px solid var(--line); }
html body .tp-seg a {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 6px;
  font-size: 12.5px; font-weight: 600; color: var(--ink-2); text-decoration: none; white-space: nowrap;
}
html body .tp-seg a:hover { color: var(--ink); }
html body .tp-seg a[aria-current="page"] { background: var(--paper); color: var(--ink); box-shadow: 0 1px 2px rgba(15, 23, 42, .12); }
.tp-seg b { color: var(--muted); font-variant-numeric: tabular-nums; }
.tp-searchform { display: flex; align-items: center; gap: 8px; margin: 0; }
.tp-links { margin: 0; padding: 0; list-style: none; }
html body .tp-links a {
  display: flex; align-items: center; gap: 12px; padding: 10px 18px; border-top: 1px solid var(--line-2);
  color: var(--ink); text-decoration: none; font-size: 13.5px; font-weight: 600;
}
.tp-links li:first-child a { border-top: 0; }
html body .tp-links a:hover { background: var(--row); }
.tp-links svg { width: 18px; height: 18px; flex: none; color: var(--muted); }
.tp-links small { display: block; font-size: 12px; font-weight: 400; color: var(--muted); }
.tp-links .tp-go { margin-left: auto; width: 16px; height: 16px; }
details.tp-card > .tp-card-b > form > h2 { font-size: 14px; margin: 18px 0 6px; }

/* ---- sign in ------------------------------------------------------------------------------- */
.tp-login { max-width: 420px; margin: 28px auto 12px; }
.tp-login-card { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--tb-shadow-lg); padding: 26px 26px 22px; }
.tp-login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.tp-login-brand img { width: 40px; height: auto; }
html body .tp-login h1 { margin: 0; font-size: 21px; color: var(--ink); }
.tp-login-brand p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
html body .tp-login label { display: block; margin: 14px 0 6px; }
html body .tp-login :is(input:not([type=checkbox])) { width: 100%; box-sizing: border-box; }
html body .tp-login button[type=submit] { width: 100%; margin-top: 18px; padding: 10px 15px; font-size: 14px; }
.tp-login-help { margin: 16px 0 0; padding-top: 14px; border-top: 1px solid var(--line-2); font-size: 12.5px; color: var(--muted); }
.tp-login-back { margin: 14px 0 0; text-align: center; font-size: 13px; }
.tp-narrow { max-width: 560px; }

/* ---- older pieces still drawn by the attendance sheet and the shared helpers --------------- */
html body .portal-search { max-width: 450px; width: 100%; margin: 4px 0 10px; padding: 8px 12px !important; border-radius: 8px !important; }
.lecture-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: -4px 0 14px; color: var(--ink-2); }
.pct-bar { display: inline-block; width: 70px; height: 7px; border-radius: 9px; background: var(--sage, #e3ebe7); vertical-align: middle; overflow: hidden; }
.pct-bar i { display: block; height: 100%; background: var(--tb-primary); }
tr.short .pct-bar i { background: var(--bad); }
html body details > summary { cursor: pointer; }
html body #sheet .att-body { min-height: 44px; padding-top: 7px; padding-bottom: 7px; }
html body .att-bar { border-radius: 12px; }

/* ---- narrow screens ------------------------------------------------------------------------ */
@media (max-width: 1100px) {
  .tp-split, .tp-grid2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1000px) {
  html body .side-body > main.wrap { padding: 16px 16px 40px; }
}
@media (max-width: 640px) {
  html body .tp-head h1 { font-size: 20px; }
  .tp-head { align-items: stretch; }
  .tp-actions { width: 100%; }
  .tp-actions > .btn { flex: 1 1 auto; }
  .tp-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  html body .tp-kpi { padding: 10px 11px; gap: 9px; }
  .tp-kpi-ico { width: 32px; height: 32px; border-radius: 8px; }
  .tp-kpi-ico svg { width: 17px; height: 17px; }
  .tp-kpi-text b { font-size: 18px; }
  .tp-kpi-text span { font-size: 11.5px; }
  .tp-welcome { padding: 16px; }
  .tp-avatar { width: 44px; height: 44px; font-size: 16px; }
  html body .tp-welcome h1 { font-size: 18px; }
  .tp-welcome .tp-actions > .btn { flex: 1 1 40%; }
  html body a.tp-lec { grid-template-columns: 70px 12px minmax(0, 1fr); padding: 10px 14px; gap: 10px; }
  .tp-lec-state { grid-column: 3; justify-content: flex-start; }
  .tp-classes { grid-template-columns: minmax(0, 1fr); }
  .tp-row { grid-template-columns: 46px minmax(0, 1fr); padding: 9px 14px; gap: 10px; }
  .tp-row-end { grid-column: 2; justify-content: flex-start; }
  .tp-form { grid-template-columns: minmax(0, 1fr); }
  .tp-docs dl { grid-template-columns: minmax(0, 1fr); padding-left: 18px; }
  html body label.tp-search { flex: 1 1 100%; }
  .tp-card-h .tp-actions { flex-wrap: wrap; }
  .tp-searchform { width: 100%; }
  .tp-seg { width: 100%; }
  html body .tp-seg a { flex: 1 1 auto; justify-content: center; }
  .tp-rowacts { justify-content: flex-start; }
  /* A long admin list becomes one small card per person. */
  .tp-table.is-cards thead { display: none; }
  .tp-table.is-cards, .tp-table.is-cards tbody { display: block; }
  .tp-table.is-cards tr { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 12px 14px; border-top: 1px solid var(--line-2); }
  .tp-table.is-cards tbody tr:first-child { border-top: 0; }
  html body .tp-table.is-cards td { display: block; padding: 0 !important; border: 0; background: none; }
  html body .tp-table.is-cards td:first-child, html body .tp-table.is-cards td:last-child { flex: 1 1 100%; width: auto; min-width: 0; }
  .tp-table.is-cards .tp-roll + br { display: none; }
  .tp-table.is-cards td .tp-chip { margin-top: 0; }
  .tp-section { margin-top: 20px; }
  .tp-card-h, .tp-card-b { padding-left: 14px; padding-right: 14px; }
  .tp-hide-sm { display: none; }
  html body .tp-table th, html body .tp-table td { padding-left: 10px !important; padding-right: 10px !important; }
  .tp-pct { gap: 6px; }
  .tp-pct .tp-meter { width: 40px; }
  .tp-pct small { display: none; }
  html body a.tp-lec { grid-template-columns: 84px 12px minmax(0, 1fr); }
  .tp-lec-time b { font-size: 13px; }
}

/* ---- Midnight ------------------------------------------------------------------------------ */
html[data-theme="midnight"] .tp-welcome::before { background: linear-gradient(115deg, color-mix(in srgb, var(--tb-primary) 22%, transparent) 0%, transparent 62%); }
html[data-theme="midnight"] table th { background: var(--sage-2); color: var(--ink-2); }
html[data-theme="midnight"] body .side-logout { background: var(--bad-soft); border-color: var(--bad-line); color: var(--bad); }
html[data-theme="midnight"] body .side-logout:hover { background: color-mix(in srgb, var(--bad-soft) 70%, var(--bad)); color: #fff; }

@media print {
  .tp-actions, .tp-tabs, .tp-search, #lecture-filters { display: none !important; }
  html body .tp-card, .tp-class, html body .tp-kpi { box-shadow: none !important; }
}
