/* Trang chủ Sups (M13) and Bảng trực (M12), P1-6: the canvas boards Trang-Chu-Sups and Bang-Truc, on the kit's tokens.
   assets/sups-home.js draws the markup. Everything is under `.sh-*` and the two sections #sups-home / #duty-board, so nothing
   here reaches the inbox, the rail (UI-1d, #464) or another screen. Numbers are tabular; bars and the heatmap are divs with
   their number written beside or inside them. */

#sups-home, #duty-board {
  /* The canvas page: a light grey under white cards. The kit has no such grey (its pages went white), so it is mixed from two
     of its tokens rather than written as a hex. */
  --sh-page: color-mix(in srgb, var(--gemboss-active-bg) 60%, var(--gemboss-surface));
  /* "Thanh cam = đủ tải": orange, mixed from the kit's danger and warning border (the kit has no orange). */
  --sh-full: color-mix(in srgb, var(--gemboss-danger) 50%, var(--gemboss-warning-border));
  overflow-y: auto; min-width: 0; background: var(--sh-page); color: var(--gemboss-text);
  font-size: 13px; line-height: 1.45;
}
.sh-page { display: flex; flex-direction: column; gap: 20px; padding: 24px; box-sizing: border-box; max-width: 1400px; }

.sh-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.sh-head__text { display: flex; flex-direction: column; gap: 4px; margin-right: auto; min-width: 0; }
.sh-head__tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.sh-h1 { margin: 0; font-size: 22px; font-weight: 700; line-height: 1.25; color: var(--gemboss-text-strong); }
.sh-h2 { margin: 0; font-size: 15px; font-weight: 600; color: var(--gemboss-text-strong); }
.sh-h2__sub { color: var(--gemboss-text-muted); font-weight: 500; }
.sh-muted { color: var(--gemboss-text-muted); }
.sh-small { font-size: var(--gemboss-fs-caption); }
.sh-note { margin: 0; font-size: var(--gemboss-fs-caption); color: var(--gemboss-text-muted); }
.sh-num { font-variant-numeric: tabular-nums; }
.sh-ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.sh-link { color: var(--gemboss-accent-strong); white-space: nowrap; }
.sh-link:hover { color: var(--gemboss-accent-strong); text-decoration: underline; }
.sh-back { text-decoration: none; }
.sh-team { width: auto; min-width: 140px; }
/* A button that cannot act here stays focusable and says why (aria-describedby): it only looks quieter. */
#sups-home .ui-btn[aria-disabled="true"], #duty-board .ui-btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }

/* Cards: white, hairline, 12px corners (the canvas). */
.sh-card {
  background: var(--gemboss-surface); border: 1px solid var(--gemboss-divider); border-radius: var(--gemboss-radius-lg);
  padding: 16px; display: flex; flex-direction: column; gap: 8px; min-width: 0; box-sizing: border-box;
}
.sh-card__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.sh-row { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }

/* ── Trang chủ Sups ── */
.sh-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.sh-tile {
  background: var(--gemboss-surface); border: 1px solid var(--gemboss-divider); border-radius: var(--gemboss-radius-lg);
  padding: 12px 16px; display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--gemboss-text);
  transition: border-color var(--gemboss-transition-fast);
}
.sh-tile:hover { border-color: var(--gemboss-accent-mid); }
.sh-tile:focus-visible { outline: 2px solid var(--gemboss-accent); outline-offset: 2px; }
.sh-tile__label, .sh-tile__hint { color: var(--gemboss-text-muted); }
.sh-tile__hint { font-size: var(--gemboss-fs-caption); }
.sh-tile__row { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.sh-tile__value { font-size: 28px; line-height: 1.15; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--gemboss-text-strong); }
.sh-delta { font-size: var(--gemboss-fs-caption); font-weight: 600; font-variant-numeric: tabular-nums; }
/* More waiting is worse: up is red, down is green, flat is grey (the canvas). */
.sh-delta.is-up { color: var(--gemboss-danger-strong); }
.sh-delta.is-down { color: var(--gemboss-success); }
.sh-delta.is-flat { color: var(--gemboss-text-muted); font-weight: 400; }

.sh-flags { flex: 999 1 460px; }
.sh-coaching { flex: 1 1 320px; }
.sh-topics, .sh-handover { flex: 1 1 380px; }
.sh-flag {
  display: grid; grid-template-columns: 70px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 8px 0;
  border-bottom: 1px solid var(--gemboss-divider-soft); text-decoration: none; color: var(--gemboss-text);
}
.sh-flag:hover b { text-decoration: underline; }
.sh-flag__who { display: flex; flex-direction: column; min-width: 0; }
.sh-sev {
  font-size: var(--gemboss-fs-caption); font-weight: 700; padding: 2px 8px; border-radius: var(--gemboss-radius-full);
  background: var(--gemboss-danger-soft); color: var(--gemboss-danger-strong); text-align: center;
}

.sh-coach { display: flex; flex-direction: column; gap: 6px; padding: 8px 12px; border-radius: var(--gemboss-radius-md); background: var(--sh-page); }
.sh-coach__head { display: flex; justify-content: space-between; gap: 8px; }
.sh-coach__why { color: var(--gemboss-text); }
.sh-coach__actions { display: flex; flex-wrap: wrap; gap: 8px; }
/* The canvas's two small buttons on one line: caption size, regular weight. */
.sh-coach__actions .ui-btn { font-size: var(--gemboss-fs-caption); font-weight: 500; padding: 0 8px; }
.sh-evidence { display: flex; flex-wrap: wrap; gap: 4px; }

.sh-topic { display: grid; grid-template-columns: minmax(0, 1fr) 150px 54px; gap: 12px; align-items: center; padding: 2px 0; }
.sh-topic__name { display: flex; min-width: 0; gap: 4px; }
.sh-topic__delta { font-size: var(--gemboss-fs-caption); font-weight: 600; text-align: right; color: var(--gemboss-text-muted); }
.sh-topic__delta.is-hot { color: var(--gemboss-danger-strong); }
.sh-bar { height: 8px; border-radius: var(--gemboss-radius-xs); background: var(--gemboss-hover); display: flex; overflow: hidden; min-width: 0; }
.sh-bar__fill { border-radius: var(--gemboss-radius-xs); background: var(--gemboss-accent-mid); }
.sh-bar__fill.is-hot { background: var(--gemboss-accent); }

.sh-received { margin: 0; padding: 8px 12px; border-left: 2px solid var(--gemboss-accent-mid); background: var(--gemboss-accent-wash); display: flex; flex-direction: column; gap: 2px; }
.sh-received__body { white-space: pre-wrap; }
.sh-field { display: flex; flex-direction: column; gap: 6px; }
.sh-note-box { resize: vertical; min-height: 96px; font: inherit; white-space: pre-wrap; }
.sh-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ── Bảng trực ── */
.sh-team-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.sh-team-tile {
  background: var(--gemboss-surface); border: 1px solid var(--gemboss-divider); border-radius: var(--gemboss-radius-lg);
  padding: 12px 16px; display: flex; flex-direction: column; gap: 6px;
}
.sh-team-tile__head { display: flex; justify-content: space-between; gap: 8px; }
.sh-stats { display: flex; gap: 16px; flex-wrap: wrap; }
.sh-stat { display: flex; flex-direction: column; }
.sh-stat__value { font-size: 22px; line-height: 1.2; font-weight: 700; color: var(--gemboss-text-strong); }
.sh-stat__value.is-full { color: var(--gemboss-danger-strong); }
.sh-stat__label { font-size: var(--gemboss-fs-caption); color: var(--gemboss-text-muted); }

.sh-people-card { flex: 999 1 520px; gap: 4px; }
.sh-heat-card { flex: 1 1 420px; gap: 12px; }
.sh-people { width: 100%; border-collapse: collapse; table-layout: fixed; }
.sh-people thead th {
  font-size: var(--gemboss-fs-caption); font-weight: 400; color: var(--gemboss-text-muted); text-align: left;
  padding: 0 12px 8px 0; border-bottom: 1px solid var(--gemboss-divider);
}
.sh-people thead th:nth-child(1) { width: 26%; }
.sh-people thead th:nth-child(2) { width: 130px; }
.sh-people thead th:nth-child(4) { width: 112px; }
.sh-people thead th:nth-child(5) { width: 84px; }
.sh-people td, .sh-people tbody th { padding: 8px 12px 8px 0; border-bottom: 1px solid var(--gemboss-divider-soft); vertical-align: middle; text-align: left; font-weight: 400; }
.sh-person__who { display: flex; align-items: center; gap: 8px; min-width: 0; }
.sh-person__team { color: var(--gemboss-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sh-person__load { display: flex; align-items: center; gap: 8px; }
.sh-person__load .sh-bar { flex: 1; }
.sh-held { width: 40px; text-align: right; }
.sh-bar__fill.is-full { background: var(--sh-full); }
.sh-person__load .sh-bar__fill:not(.is-full) { background: var(--gemboss-accent); }
.sh-person__act { padding-right: 0 !important; text-align: right !important; }
.sh-dot { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; background: var(--gemboss-text-muted); }
.sh-dot.is-on { background: var(--gemboss-success); }
.sh-dot.is-away { background: var(--gemboss-warning); }

/* The heatmap: a label column, then one column per hour; six steps of the kit's iris. */
.sh-heat { display: grid; grid-template-columns: 34px repeat(var(--sh-hours, 14), minmax(0, 1fr)); gap: 2px; font-size: 11px; font-variant-numeric: tabular-nums; }
.sh-heat__hour { text-align: center; color: var(--gemboss-text-muted); }
.sh-heat__day { display: flex; align-items: center; color: var(--gemboss-text-muted); }
.sh-heat__cell { height: 24px; border-radius: 2px; display: flex; align-items: center; justify-content: center; color: var(--gemboss-text); min-width: 0; overflow: hidden; }
.s0 { background: var(--gemboss-accent-wash); }
.s1 { background: var(--gemboss-accent-tint); }
.s2 { background: var(--gemboss-accent-mid); }
.s3 { background: color-mix(in srgb, var(--gemboss-accent-mid) 45%, var(--gemboss-accent)); }
.s4 { background: var(--gemboss-accent); color: var(--gemboss-on-primary); }
.s5 { background: var(--gemboss-accent-strong); color: var(--gemboss-on-primary); }
.sh-legend { display: flex; align-items: center; gap: 6px; font-size: var(--gemboss-fs-caption); color: var(--gemboss-text-muted); }
.sh-legend__swatch { width: 18px; height: 10px; border-radius: 2px; border: 1px solid var(--gemboss-divider); }
.sh-hint { padding: 8px 12px; border-radius: var(--gemboss-radius-md); background: var(--gemboss-accent-wash); border: 1px solid var(--gemboss-accent-tint); display: flex; flex-direction: column; gap: 2px; }
.sh-hint__title { color: var(--gemboss-accent-strong); }

/* Narrow (a phone, a split window): the people table becomes one card per person; the heatmap keeps its grid. */
@media (max-width: 760px) {
  .sh-page { padding: 16px; gap: 16px; }
  .sh-h1 { font-size: 20px; }
  .sh-head__tools { width: 100%; }
  .sh-head__tools > * { flex: 1 1 auto; }
  .sh-topic { grid-template-columns: minmax(0, 1fr) 80px 48px; gap: 8px; }
  .sh-people thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .sh-people, .sh-people tbody { display: block; }
  .sh-people tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 8px 0; border-bottom: 1px solid var(--gemboss-divider-soft); }
  .sh-people td, .sh-people tbody th { border: 0; padding: 0; }
  .sh-person__team { grid-column: 1; }
  .sh-person__held { grid-column: 1 / -1; }
  .sh-person__act { grid-row: 1; grid-column: 2; }
  .sh-people td[data-label]:not(.sh-person__held):not(.sh-person__team)::before { content: attr(data-label) ": "; }
  .sh-heat { grid-template-columns: 24px repeat(var(--sh-hours, 14), minmax(0, 1fr)); gap: 1px; font-size: 10px; }
  .sh-heat__cell { height: 20px; }
}
