/* Public Attendance site — Risence light language, with muted rate colours
   as data visualisation only (no ranking, badges, or gamification). */

*,
*::before,
*::after {
  box-sizing: border-box;
}

body.attp {
  --att-space-2: 12px;
  --att-space-3: 16px;
  margin: 0;
  background: var(--platform-bg);
  color: var(--platform-ink);
  font-family: var(--platform-font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.attp-shell {
  width: 100%;
  max-width: calc(1400px + 2 * var(--platform-header-title-x, 60px));
  margin-inline: auto;
  padding-inline: var(--platform-header-title-x, 60px);
  padding-bottom: var(--platform-page-pad-bottom, 64px);
}

.attp-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  padding: 20px 0 4px;
}

.attp-head-print {
  margin-left: auto;
}

.attp-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  color: inherit;
  text-decoration: none;
  line-height: 0;
}

.attp-brand img {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
}

.attp-brand span {
  font-size: 15px;
  font-weight: var(--platform-fw-medium);
  letter-spacing: -0.01em;
  line-height: 1.4;
}

.attp-title,
.attp-student-name {
  margin: 0 0 10px;
  font-size: 28px;
  font-weight: var(--platform-fw-medium);
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.attp-student-name {
  margin-bottom: 14px;
}

.attp-main {
  padding-top: 18px;
}

/* Year stepper: 上一年 / 下一年 only, no dropdown. */
.attp-yearbar {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0 0 10px;
}

.attp-year {
  min-width: 4.5rem;
  font-size: 22px;
  font-weight: var(--platform-fw-medium);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  text-align: center;
}

.attp-yearnav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--platform-radius-sm);
  color: var(--platform-muted);
  font-size: 15px;
  text-decoration: none;
}

.attp-yearnav:hover {
  background: var(--platform-hover);
  color: var(--platform-ink);
}

.attp-yearnav:focus-visible,
.attp-chip:focus-visible,
.attp-back:focus-visible,
.attp-btn:focus-visible,
.attp-desc-btn:focus-visible,
.attp-name a:focus-visible,
.attp-scroll:focus-visible {
  outline: 2px solid var(--platform-ink);
  outline-offset: 2px;
}

.attp-summary {
  margin: 0 0 16px;
  color: var(--platform-muted);
  font-size: 14px;
}

.attp-summary-sep {
  padding: 0 6px;
  color: var(--platform-line);
}

.attp-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  margin: 0 0 22px;
}

.attp-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--platform-faint);
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
}

.attp-chip:hover {
  background: var(--platform-hover);
  color: var(--platform-ink);
}

.attp-chip.is-active {
  background: var(--platform-ink);
  color: #fff;
  font-weight: var(--platform-fw-medium);
}

.attp-section {
  margin: 0 0 32px;
}

.attp-h2 {
  margin: 0 0 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--platform-line);
  font-size: 15px;
  font-weight: var(--platform-fw-medium);
  letter-spacing: -0.01em;
  line-height: 1.4;
}

.attp-h3 {
  margin: 24px 0 12px;
  font-size: 14px;
  font-weight: var(--platform-fw-medium);
  letter-spacing: -0.01em;
}

/* Wide tables stay readable: scroll sideways with the first column pinned,
   rather than being squeezed into an unreadable width. */
.attp-scroll {
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}

.attp-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
}

.attp-table th,
.attp-table td {
  padding: 11px var(--att-space-3, 16px);
  text-align: left;
  font-weight: var(--platform-fw-regular);
  white-space: nowrap;
  background: var(--platform-bg);
}

.attp-table thead th {
  padding-top: 0;
  padding-bottom: 8px;
  color: var(--platform-muted);
  font-size: 11px;
  font-weight: var(--platform-fw-medium);
  letter-spacing: 0.02em;
}

.attp-table tbody th,
.attp-table tbody td {
  border-top: 1px solid var(--platform-line);
}

.attp-table tbody tr:hover th,
.attp-table tbody tr:hover td {
  background: var(--platform-hover);
}

.attp-num {
  font-variant-numeric: tabular-nums;
  min-width: 2.6rem;
  width: 2.6rem;
  padding-left: 8px;
  padding-right: 8px;
}

.attp-table thead th.attp-num,
.attp-table td.attp-num,
.attp-table tbody td.attp-num {
  text-align: center;
}

.attp-table--rates .attp-num {
  color: var(--platform-muted);
}

.attp-num--strong {
  color: var(--platform-ink) !important;
  font-weight: var(--platform-fw-medium);
}

.attp-cell {
  color: var(--platform-ink);
  font-variant-numeric: normal;
}

.attp-cell--present {
  color: #1f7a74;
}

.attp-cell--warn {
  color: #b36a12;
}

.attp-cell--absent {
  color: #c45c48;
}

.attp-cell--excluded {
  color: var(--platform-faint);
}

.attp-sticky-col,
.attp-sticky-cat,
.attp-sticky-desc {
  position: sticky;
  z-index: 1;
  background: var(--platform-bg);
  box-shadow: none;
}

.attp-sticky-col {
  left: 0;
  padding-left: 0;
  padding-right: 18px;
  min-width: 13.5rem;
}

.attp-sticky-cat {
  left: 13.5rem;
  min-width: 5.5rem;
  padding-right: 16px;
}

.attp-sticky-desc {
  left: 19rem;
  min-width: 10rem;
  max-width: 14rem;
  padding-right: 18px;
}

.attp-table thead .attp-sticky-col,
.attp-table thead .attp-sticky-cat,
.attp-table thead .attp-sticky-desc {
  z-index: 2;
}

.attp-table tbody tr:hover .attp-sticky-col,
.attp-table tbody tr:hover .attp-sticky-cat,
.attp-table tbody tr:hover .attp-sticky-desc {
  background: var(--platform-hover);
}

.attp-name {
  font-weight: var(--platform-fw-medium);
}

.attp-name a {
  color: inherit;
  text-decoration: none;
}

.attp-name a:hover {
  text-decoration: underline;
}

.attp-date {
  font-variant-numeric: tabular-nums;
}

.attp-desc {
  max-width: 22rem;
  white-space: normal;
}

.attp-desc-btn {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.attp-desc-btn:hover {
  text-decoration: underline;
}

/* Only shown when printing, where a dialog cannot be opened. */
.attp-desc-full {
  display: none;
}

.attp-note {
  margin: 10px 0 0;
  color: var(--platform-muted);
  font-size: 12px;
  line-height: 1.6;
}

.attp-empty {
  margin: 0;
  padding: 18px 0;
  border-top: 1px solid var(--platform-line);
  color: var(--platform-muted);
  font-size: 14px;
}

.attp-yearlist {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  max-width: 18rem;
}

.attp-yearlist li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-top: 1px solid var(--platform-line);
  font-variant-numeric: tabular-nums;
}

.attp-yearlist li:last-child {
  border-bottom: 1px solid var(--platform-line);
}

.attp-yearlist-year {
  color: var(--platform-muted);
  font-size: 13px;
}

.attp-backrow {
  margin: 0 0 18px;
}

.attp-back {
  color: var(--platform-ink);
  font-size: 13px;
  text-decoration: none;
}

.attp-back:hover {
  text-decoration: underline;
}

.attp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--platform-line);
  border-radius: var(--platform-radius-sm);
  background: transparent;
  color: var(--platform-ink);
  font: inherit;
  font-size: 13px;
  font-weight: var(--platform-fw-medium);
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
}

.attp-btn:hover {
  border-color: var(--platform-ink);
  background: var(--platform-hover);
}

.attp-btn--primary {
  border: none;
  background: var(--platform-ink);
  color: #fff;
}

.attp-btn--primary:hover {
  border: none;
  background: rgba(29, 29, 31, 0.82);
  color: #fff;
}

.attp-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid var(--platform-line);
}

.attp-foot-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}

.attp-updated {
  margin: 0;
  color: var(--platform-muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.attp-dialog {
  margin: auto;
  padding: 0;
  border: 1px solid var(--platform-line);
  border-radius: var(--platform-radius-sm);
  background: var(--platform-surface);
  color: var(--platform-ink);
  width: calc(100% - 32px);
  max-width: 460px;
}

.attp-dialog::backdrop {
  background: rgba(29, 29, 31, 0.28);
}

.attp-dialog-inner {
  padding: 18px 20px 16px;
}

.attp-dialog-title {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: var(--platform-fw-medium);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.attp-dialog-body {
  margin: 0 0 16px;
  font-size: 15px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.attp-dialog-foot {
  display: flex;
  justify-content: flex-end;
}

.attp-print-only {
  display: none;
}

/* Rate colour bands — visualisation only. */
.attp-band-high { --attp-band: #1f7a74; --attp-band-fill: #72e0d5; --attp-band-soft: rgba(114, 224, 213, 0.18); }
.attp-band-good { --attp-band: #2f7aa8; --attp-band-fill: #89cff0; --attp-band-soft: rgba(137, 207, 240, 0.18); }
.attp-band-mid { --attp-band: #b36a12; --attp-band-fill: #ffb347; --attp-band-soft: rgba(255, 179, 71, 0.18); }
.attp-band-low { --attp-band: #c45c48; --attp-band-fill: #f4a582; --attp-band-soft: rgba(244, 165, 130, 0.18); }
.attp-band-empty { --attp-band: var(--platform-muted); --attp-band-fill: #e5e2dc; --attp-band-soft: transparent; }

.attp-card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.attp-card,
.attp-summary-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 100%;
  padding: 16px 16px 14px;
  border: none;
  border-radius: var(--platform-radius-sm);
  background: #fff;
  box-shadow: 0 1px 3px rgba(29, 29, 31, 0.06);
}

.attp-card {
  color: inherit;
  text-decoration: none;
}

.attp-card:hover {
  background: color-mix(in srgb, var(--attp-band-soft, transparent) 70%, #fff);
  box-shadow: 0 2px 8px rgba(29, 29, 31, 0.08);
}

.attp-card:focus-visible {
  outline: 2px solid var(--platform-ink);
  outline-offset: 2px;
}

.attp-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.attp-card-name {
  margin: 0;
  font-size: 18px;
  font-weight: var(--platform-fw-medium);
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.attp-card-pct {
  margin: 0;
  color: var(--attp-band, var(--platform-ink));
  font-size: 28px;
  font-weight: var(--platform-fw-medium);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
  line-height: 1;
}

.attp-card-pct--xl {
  font-size: 40px;
  letter-spacing: -0.05em;
}

.attp-card-kicker {
  margin: 0;
  color: var(--platform-muted);
  font-size: 12px;
}

.attp-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.attp-bar--lg .attp-bar-track {
  height: 8px;
}

.attp-bar-track {
  display: block;
  overflow: hidden;
  height: 6px;
  border-radius: 999px;
  background: #efece6;
}

.attp-bar-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--attp-band-fill, var(--attp-band, var(--platform-ink)));
}

.attp-band-empty .attp-bar-fill {
  background: #e5e2dc;
}

.attp-bar-label {
  color: var(--attp-band, var(--platform-ink));
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  font-weight: var(--platform-fw-medium);
}

.attp-quarters {
  display: grid;
  gap: 8px;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
}

.attp-quarter {
  display: grid;
  grid-template-columns: minmax(7.4rem, auto) 2.6rem minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.attp-quarter-k {
  color: var(--platform-muted);
  font-size: 12px;
}

.attp-quarter-v {
  color: var(--attp-band, var(--platform-muted));
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.attp-card-life {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--platform-line);
  color: var(--platform-muted);
  font-size: 12px;
}

.attp-card-life strong {
  color: var(--platform-ink);
  font-size: 14px;
  font-weight: var(--platform-fw-medium);
  font-variant-numeric: tabular-nums;
}

.attp-summary-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
  margin-bottom: 8px;
}

.attp-summary-card {
  max-width: none;
  height: 100%;
}

.attp-cat-rates {
  display: grid;
  gap: 12px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.attp-cat-rate {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 3rem;
  grid-template-areas:
    "name pct"
    "bar bar";
  gap: 6px 12px;
  align-items: baseline;
}

.attp-cat-name {
  grid-area: name;
  min-width: 0;
  color: var(--platform-ink);
  font-size: 14px;
}

.attp-cat-pct {
  grid-area: pct;
  color: var(--attp-band, var(--platform-muted));
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  font-weight: var(--platform-fw-medium);
  text-align: right;
}

.attp-cat-rate .attp-bar-track {
  grid-area: bar;
}

.attp-cat-empty {
  margin: 8px 0 0;
  color: var(--platform-muted);
  font-size: 13px;
}

@media (min-width: 900px) {
  .attp-summary-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

@media (min-width: 720px) {
  .attp-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1100px) {
  .attp-card-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .attp-shell {
    padding-inline: max(16px, env(safe-area-inset-left, 0px)) max(16px, env(safe-area-inset-right, 0px));
  }

  .attp-desc {
    max-width: 14rem;
  }

  .attp-sticky-col,
  .attp-sticky-cat,
  .attp-sticky-desc {
    min-width: 0;
  }

  .attp-sticky-col {
    min-width: 11rem;
  }

  .attp-sticky-cat {
    left: 11rem;
    min-width: 4.5rem;
  }

  .attp-sticky-desc {
    left: 15.5rem;
    min-width: 8rem;
  }
}

/* Print / Save as PDF: keep the title, year, rates, detail, and the updated
   timestamp. Drop the year stepper, filters, buttons, and navigation. */
@media print {
  body.attp {
    background: #fff;
    font-size: 10pt;
  }

  .attp-shell {
    max-width: none;
    padding: 0;
  }

  .attp-no-print,
  .attp-filters,
  .attp-yearnav,
  .attp-backrow,
  .attp-foot-actions {
    display: none !important;
  }

  .attp-print-only {
    display: block;
  }

  .attp-head {
    padding: 0 0 4px;
  }

  .attp-brand img {
    width: 18px;
    height: 18px;
  }

  .attp-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .attp-card,
  .attp-summary-card {
    break-inside: avoid;
    box-shadow: none;
  }

  .attp-card-pct,
  .attp-card-pct--xl {
    font-size: 18pt;
  }

  .attp-main {
    padding-top: 8px;
  }

  .attp-yearbar {
    margin-bottom: 6px;
  }

  .attp-scroll {
    overflow: visible;
  }

  .attp-table {
    font-size: 9pt;
  }

  .attp-table th,
  .attp-table td {
    padding: 5px var(--att-space-2, 12px);
  }

  .attp-sticky-col,
  .attp-sticky-cat,
  .attp-sticky-desc {
    position: static;
    background: transparent;
    box-shadow: none;
    min-width: 0;
    left: auto;
  }

  .attp-table tbody tr:hover th,
  .attp-table tbody tr:hover td,
  .attp-table tbody tr:hover .attp-sticky-col,
  .attp-table tbody tr:hover .attp-sticky-cat,
  .attp-table tbody tr:hover .attp-sticky-desc {
    background: transparent;
  }

  /* Truncated descriptions print in full, since a dialog cannot be opened on paper. */
  .attp-desc-btn {
    display: none;
  }

  .attp-desc-full {
    display: inline;
  }

  .attp-desc {
    max-width: none;
    white-space: normal;
  }

  .attp-section {
    break-inside: auto;
    margin-bottom: 18px;
  }

  .attp-table thead {
    display: table-header-group;
  }

  .attp-table tbody tr {
    break-inside: avoid;
  }

  .attp-foot {
    margin-top: 16px;
  }
}
