/* TPMS lists: overrides on top of the table demo's app.css / layouts.css (copied as they are).
   "Set up" / "Grade" sat on a line of its own above ⋯ and ↗ (display: block, 38px tall);
   here it is a compact button on the same line, as tall as the icons beside it. */
#demo #recordsTable .action-cell { width: auto; min-width: 92px; white-space: nowrap; }
#demo #recordsTable .action-cell > * { vertical-align: middle; }
#demo #recordsTable .source-primary { display: inline-flex; align-items: center; min-height: 0; height: 30px; margin: 0 4px 0 0; padding: 0 10px; font-size: 12px; }

/* No filters, search or count above the table: the status tabs, search, Columns, type chips,
   sort and the record count are not shown; the table follows the header directly. Sorting
   by the column headers, the row menus and the record details stay. */
#demo .toolbar, #demo .list-context { display: none !important; }

/* Full width, as the product's own lists: on desktop the table runs edge to edge under the
   toolbar (no side padding, no maximum width, no card border or rounded corners). Phones
   keep the demo's card layout. */
@media (min-width: 601px) {
  #demo #mainContent { max-width: none; padding: 0 0 110px; }
  #demo .table-surface { border: 0; border-bottom: 1px solid #e0e6eb; border-radius: 0; }
}

/* Modern table: less pale – larger, darker text, clear status and result pills, visible
   touch-sized row and person buttons. Flat colours, light rows. */
#demo #recordsTable { font-variant-numeric: tabular-nums; }

/* header: firmer, and it stays while scrolling */
#demo #recordsTable thead th { position: sticky; top: 0; z-index: 2; background: #f5f7fa; border-bottom: 1px solid #dbe2e8; }
#demo #recordsTable th button { min-height: 46px; font-size: 12px; font-weight: 600; color: #475569; letter-spacing: .01em; }
#demo #recordsTable th button span { opacity: .45; }
#demo #recordsTable th[aria-sort="ascending"] button, #demo #recordsTable th[aria-sort="descending"] button { color: #0b6fa4; }

/* rows: readable size, visible dividers and hover */
#demo #recordsTable td { padding: 14px 14px; font-size: 13.5px; border-bottom: 1px solid #e6ebf0; }
#demo #recordsTable tbody tr { transition: background-color .1s; }
#demo #recordsTable tbody tr:hover { background: #f3f7fb; }
#demo #recordsTable tbody tr:hover .record-link { color: #0b6fa4; }

/* identity: name dark and a size up, type icon saturated, sub-line readable */
#demo .record-link { font-size: 14px; font-weight: 600; color: #0f172a; }
#demo .identity-meta { font-size: 12px; color: #64748b; margin-top: 2px; }
#demo .identity-icon { width: 38px; height: 38px; border-radius: 9px; background: #e3f0fa; color: #0b6fa4; }
#demo .identity-icon.flight { background: #e2f3ea; color: #1c7a52; }
#demo .identity-icon.classroom { background: #efe9f8; color: #6b4fa0; }

/* values: dark main text, muted second line */
#demo .cell-main { color: #1e293b; }
#demo .cell-sub { font-size: 12px; color: #64748b; margin-top: 2px; }
#demo .person-link, #demo .person-name { font-size: 13.5px; font-weight: 500; color: #1e293b; }
#demo .person-link:hover { color: #0b6fa4; }
#demo .person-meta { font-size: 12px; color: #64748b; }

/* status: proper pills, clear colours */
#demo .status-badge { gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #eef2f6; color: #475569; }
#demo .status-badge i { width: 6px; height: 6px; }
#demo .status-badge.overdue { background: #fdecea; color: #b42318; }
#demo .status-badge.today { background: #e3f0fa; color: #0b6fa4; }
#demo .status-badge.upcoming { background: #eef2f6; color: #475569; }
#demo .status-badge.completed, #demo .status-badge.acknowledged, #demo .status-badge.active { background: #e3f4ea; color: #157347; }
#demo .status-badge.inactive, #demo .status-badge.undated { background: #f1f5f9; color: #64748b; }

/* result: coloured by its own value (classes added by lists.js) */
#demo .result-pill { font-size: 13px; font-weight: 600; color: #475569; }
#demo .result-pill.pass, #demo .result-pill.x-pass { color: #157347; }
#demo .result-pill.x-fail { color: #b42318; }
#demo .result-pill.x-incomplete { color: #b54708; }
#demo .result-pill.x-empty { color: #94a3b8; font-weight: 400; }

/* row actions: visible, accent on hover */
#demo .context-trigger { color: #64748b; }
#demo .context-trigger:hover { color: #0b6fa4; background: #e3f0fa; }
#demo .row-open { color: #64748b; }
#demo .row-open:hover { color: #0b6fa4; background: #e3f0fa; }
#demo #recordsTable .source-primary { background: #0b6fa4; border-color: #0b6fa4; color: #fff; }
#demo #recordsTable .source-primary:hover { background: #095c88; }


/* header: small caps, calm */
#demo #recordsTable thead th { background: #fbfcfd; border-bottom: 1px solid #e2e8f0; }
#demo #recordsTable th button { min-height: 42px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #64748b; }

/* rows: a little more air, a clear but light hover; no status stripes */
#demo #recordsTable td { padding: 15px 14px; }
#demo #recordsTable tbody tr:hover { background: #f4f8fb; }

/* type icon: light tint, as round 1 */
#demo .identity { gap: 13px; }

/* date: day and month on one line, time under it, plain */
#demo #recordsTable td .cell-main.nowrap { font-weight: 600; color: #0f172a; }

/* result: soft pills */
#demo .result-pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #f1f5f9; color: #475569; }
#demo .result-pill.pass, #demo .result-pill.x-pass { background: #e3f4ea; color: #157347; }
#demo .result-pill.x-fail { background: #fdecea; color: #b42318; }
#demo .result-pill.x-incomplete { background: #fef3e2; color: #a15c07; }
#demo .result-pill.x-empty { background: none; padding: 0; color: #94a3b8; font-weight: 400; }

/* people: name, then the staff ID and note as plain muted text */
#demo .person-meta { display: block; margin-top: 2px; font-size: 12px; color: #64748b; }

/* Set up / Grade: quiet outline, the accent only on hover */
#demo #recordsTable .source-primary { background: #fff; border: 1px solid #cfdbe5; color: #0b6fa4; font-weight: 600; }
#demo #recordsTable .source-primary:hover { background: #e3f0fa; border-color: #9cc3df; }

/* status: the pill only; the line under it only when it says something else (lists.js) */
#demo .x-same { display: none !important; }

/* events without a type have no icon: indent them so every name lines up with the ones that
   have one (table only; a list without icons, e.g. people, is not indented) */
#demo [data-layout="table"] #recordsTable:has(.identity-icon) .identity:not(:has(.identity-icon)) { padding-left: 51px; }

/* a person's ⋯: next to the person, a visible, touch-sized button (36px, light fill),
   centred on the name and staff ID; not at the far edge of the column */
#demo #recordsTable .person-entry { justify-content: flex-start; align-items: center; gap: 10px; }
#demo #recordsTable .person-entry .context-trigger {
  flex: none; width: 36px; min-width: 36px; height: 36px; border-radius: 10px;
  background: #f1f5f9; color: #475569; font-size: 18px; line-height: 1;
}
#demo #recordsTable .person-entry .context-trigger:hover { background: #e3f0fa; color: #0b6fa4; }
#demo #recordsTable .person-entry .context-trigger:active { background: #cfe5f5; }
#demo #recordsTable .people-list { gap: 10px; }
/* the row's own ⋯ and ↗: the same visible, touch-sized buttons */
#demo #recordsTable .action-cell .context-trigger,
#demo #recordsTable .action-cell .row-open {
  width: 36px; min-width: 36px; height: 36px; border-radius: 10px; margin-left: 6px;
  background: #f1f5f9; color: #475569; font-size: 18px; line-height: 1;
}
#demo #recordsTable .action-cell .context-trigger:hover,
#demo #recordsTable .action-cell .row-open:hover { background: #e3f0fa; color: #0b6fa4; }

/* What can be clicked looks clickable: the record's name (opens the record) and a person's
   name (opens the profile) are in the TPMS blue, underlined on hover; values that are not
   links stay dark. The whole row opens the record too (lists.js), so the row shows a
   pointer. */
#demo .record-link, #demo .person-link { color: #0b6fa4; cursor: pointer; text-decoration: none; }
#demo .record-link:hover, #demo .person-link:hover { color: #08557e; text-decoration: underline; text-underline-offset: 3px; }
#demo #recordsTable tbody tr:hover .record-link { color: #08557e; }
#demo #recordsTable tbody tr[data-id] { cursor: pointer; }

/* The configured columns (see build.py): a wide table that reads from the left – it scrolls
   sideways, the record's name and the row's buttons stay pinned, every cell is one line
   (long text ends in "…"; the full text on hover and in the record's details). */
@media (min-width: 601px) {
  #demo .table-surface { overflow-x: auto; }
  #demo #recordsTable { width: max-content; min-width: 100%; }

  /* every cell on one line; long text ends in "…" (full text on hover and in details) */
  #demo #recordsTable td, #demo #recordsTable th { white-space: nowrap; }
  #demo #recordsTable td .cell-main { display: block !important; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; -webkit-line-clamp: unset !important; }
  #demo #recordsTable td .cell-sub { white-space: nowrap; }
  #demo .record-link { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* name + row buttons pinned at the left */
  #demo #recordsTable thead th:first-child, #demo #recordsTable tbody td:first-child { position: sticky; left: 0; z-index: 2; background: #fff; }
  #demo #recordsTable .action-cell { position: sticky; left: var(--x-pin2, 300px); z-index: 2; background: #fff; width: auto; min-width: 0; padding: 0 12px 0 0; text-align: left;
    box-shadow: 1px 0 0 #e2e8f0, 8px 0 12px -8px rgba(15, 23, 42, .2); }
  #demo #recordsTable thead th:first-child, #demo #recordsTable thead .action-cell { z-index: 4; background: #fbfcfd; }
  #demo #recordsTable tbody tr:hover td:first-child, #demo #recordsTable tbody tr:hover .action-cell { background: #f4f8fb; }
  #demo #recordsTable .action-cell .context-trigger, #demo #recordsTable .action-cell .row-open { margin: 0 4px 0 0; width: 32px; min-width: 32px; height: 32px; }

  /* a person's ⋯: always visible, right after the name, no box around it */
  #demo #recordsTable .people-list { flex-direction: row; flex-wrap: nowrap; gap: 14px; }
  #demo #recordsTable .person-entry { display: inline-flex; align-items: center; gap: 8px; }
  #demo #recordsTable .person-entry .person-meta { margin-top: 0; font-size: 11.5px; }
  #demo #recordsTable .person-entry .context-trigger {
    visibility: visible !important; width: 30px; min-width: 30px; height: 30px; border-radius: 8px; font-size: 16px;
  }
}

/* side panel: collapsible people lists */
#demo #detailPeople h2 { margin: 0; }
#demo #detailPeople .x-section { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 8px;
  min-height: 44px; padding: 0; border: 0; background: none; color: #0f172a; font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; text-align: left; }
#demo #detailPeople .x-section small { color: #64748b; font-weight: 500; }
#demo #detailPeople .x-section .x-caret { color: #64748b; font-size: 13px; }
#demo #detailPeople .people-list.x-short > .person-entry:nth-child(n+6) { display: none; }
#demo #detailPeople .x-show-all { margin: 8px 0 4px; min-height: 36px; padding: 0 14px; border: 1px solid #d5dee6; border-radius: 999px;
  background: #fff; color: #0b6fa4; font-size: 13px; font-weight: 600; cursor: pointer; }
#demo #detailPeople .x-show-all:hover { background: #e3f0fa; }
