/* 61-attendance-hub-tables-and-settings.css
   Attendance Hub: navigation, responsive tables, printing and the discipline workspace.
   Files in css/ load in filename order and the cascade depends on it: see docs/CSS.md. */

/* Attendance navigation, activity search, and app settings */
.attendance-scoreboard-actions label {
  display: none !important;
}

/* Match the FOH Weather Tracker settings shell exactly at the host level. */
.attendance-modal-wrap.attendance-settings-host {
  box-sizing: border-box;
  padding: 24px;
  background: rgba(7, 9, 16, 0.78);
}
.attendance-settings-host .attendance-modal {
  width: min(920px, 100%);
  height: min(700px, 100%);
  border-radius: 12px;
}
.attendance-settings-host .settings-header {
  min-height: 68px;
  padding: 13px 20px;
}
.attendance-settings-host .settings-layout {
  grid-template-columns: 220px minmax(0, 1fr);
}
.attendance-settings-host .settings-nav {
  padding: 20px 10px 20px 16px;
}
.attendance-settings-host .settings-content {
  padding: 26px 30px 34px;
}
.attendance-settings-host .settings-footer {
  min-height: 64px;
  padding: 11px 20px;
}

/* Balanced overview metrics: four equal cards and a wider latest-activity card. */
@media (max-width: 800px) {
}

/* Attendance never requires sideways scrolling outside the overview metrics. */
@media (max-width: 700px) {
  .attendance-tabs {
    flex-wrap: wrap;
    width: auto;
    overflow: visible;
  }
  .attendance-tabs button {
    flex: 1 1 auto;
  }
  .attendance-table-wrap,
  .attendance-activity-table-wrap,
  .attendance-record-table-wrap {
    overflow-x: hidden;
  }
  .attendance-scoreboard table,
  .attendance-activity-table,
  .attendance-member-record table {
    min-width: 0;
  }
  .attendance-scoreboard table,
  .attendance-scoreboard tbody,
  .attendance-activity-table,
  .attendance-activity-table tbody,
  .attendance-member-record table,
  .attendance-member-record tbody {
    display: block;
    width: 100%;
  }
  .attendance-scoreboard thead,
  .attendance-activity-table thead,
  .attendance-member-record thead {
    display: none;
  }
  .attendance-scoreboard tbody tr,
  .attendance-activity-table tbody tr,
  .attendance-member-record tbody tr {
    display: block;
    margin: 10px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--bg);
    overflow: hidden;
  }
  .attendance-scoreboard td,
  .attendance-activity-table td,
  .attendance-member-record td {
    box-sizing: border-box;
    display: grid !important;
    grid-template-columns: 92px minmax(0, 1fr);
    align-items: start;
    gap: 10px;
    width: 100%;
    min-width: 0 !important;
    padding: 8px 10px !important;
    border-bottom: 1px solid var(--line) !important;
    text-align: left !important;
    white-space: normal !important;
    overflow-wrap: anywhere;
  }
  .attendance-scoreboard td:last-child,
  .attendance-activity-table td:last-child,
  .attendance-member-record td:last-child {
    border-bottom: 0 !important;
  }
  .attendance-scoreboard td::before,
  .attendance-activity-table td::before,
  .attendance-member-record td::before {
    color: var(--muted);
    font-size: 8px;
    font-weight: 850;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }
  .attendance-scoreboard td:nth-child(1)::before {
    content: "Team member";
  }
  .attendance-scoreboard td:nth-child(2)::before {
    content: "Points";
  }
  .attendance-scoreboard td:nth-child(3)::before {
    content: "Current level";
  }
  .attendance-scoreboard td:nth-child(4)::before {
    content: "Latest event";
  }
  .attendance-scoreboard td:nth-child(5) {
    display: none !important;
  }
  .attendance-activity-table td:nth-child(1)::before {
    content: "Date";
  }
  .attendance-activity-table td:nth-child(2)::before {
    content: "Team member";
  }
  .attendance-activity-table td:nth-child(3)::before {
    content: "Activity";
  }
  .attendance-activity-table td:nth-child(4)::before {
    content: "Points";
  }
  .attendance-activity-table td:nth-child(5)::before {
    content: "Notes";
  }
  .attendance-activity-table td:nth-child(6)::before {
    content: "Recorded by";
  }
  .attendance-activity-table td:nth-child(7)::before {
    content: "Action";
  }
  .attendance-excused-table td:nth-child(1)::before {
    content: "Date";
  }
  .attendance-excused-table td:nth-child(2)::before {
    content: "Team member";
  }
  .attendance-excused-table td:nth-child(3)::before {
    content: "Details";
  }
  .attendance-excused-table td:nth-child(4)::before {
    content: "Reported by";
  }
  .attendance-excused-table td:nth-child(5)::before {
    content: "Attachment";
  }
  .attendance-excused-table td:nth-child(6)::before {
    content: "Action";
  }
  .attendance-excused-table td:nth-child(7) {
    display: none !important;
  }
  .attendance-record-table-wrap {
    border: 0;
  }
  .attendance-member-record tbody tr {
    margin: 8px 0;
  }
  .attendance-member-record td::before {
    content: "Record detail";
  }
  .attendance-settings-host .settings-layout {
    grid-template-columns: 1fr;
  }
  .attendance-settings-host .settings-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: 10px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .attendance-settings-host .settings-nav::before {
    grid-column: 1/-1;
  }
  .attendance-settings-host .settings-nav button {
    margin: 0;
    text-align: center;
  }
  .attendance-settings-host .settings-content {
    padding: 18px 16px 26px;
  }
  .attendance-settings-host .attendance-settings-grid,
  .attendance-settings-host .attendance-policy-groups {
    grid-template-columns: 1fr;
  }
  .attendance-settings-host .attendance-settings form > fieldset {
    width: 100%;
  }
}
.attendance-tabs button.active {
  box-shadow: none !important;
  filter: none !important;
}
.attendance-scoreboard > header p,
.attendance-scoreboard-actions label {
  display: none;
}
.attendance-activity-actions {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.attendance-activity-actions label {
  display: grid;
  gap: 5px;
  min-width: 210px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}
.attendance-activity-no-results {
  margin: 0;
  padding: 24px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}
.attendance-corner-actions {
  position: fixed;
  right: 22px;
  bottom: 20px;
  z-index: 20;
  display: flex;
  gap: 7px;
}
.attendance-corner-actions .attendance-tools {
  position: static;
}
.attendance-leader-needed {
  margin: 0;
  padding: 10px;
  border: 1px solid #e4a72b55;
  border-radius: 8px;
  background: #e4a72b12;
  color: var(--muted);
  font-size: 10px;
}
.attendance-settings-host .attendance-modal {
  width: min(920px, 100%);
  height: min(700px, 100%);
  max-height: 100%;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: transparent;
  box-shadow: none;
}
.attendance-settings-host .settings-shell {
  width: 100%;
  height: 100%;
}
.attendance-settings-nav::before {
  content: "APP SETTINGS";
}
.attendance-settings-nav button[data-attendance-settings-tab="policy"]::before {
  content: "≡";
}
.attendance-settings-nav button[data-attendance-settings-tab="leadership"]::before {
  content: "♟";
}
.attendance-settings-content {
  min-width: 0;
  overflow: auto;
}
.attendance-settings-content .attendance-settings {
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}
.attendance-leadership-settings > header h3 {
  margin: 0;
  font-size: 20px;
}
.attendance-leadership-settings > header p {
  margin: 5px 0 20px;
  color: var(--muted);
  font-size: 12px;
}
.attendance-leader-add {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}
.attendance-leader-add select {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
.attendance-leader-add button {
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}
.attendance-leader-list {
  display: grid;
  gap: 7px;
  margin: 16px 0;
}
.attendance-leader-list > p {
  padding: 22px;
  border: 1px dashed var(--line);
  border-radius: 9px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}
.attendance-leader-list > div {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 32px;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg);
}
.attendance-leader-list .attendance-avatar {
  width: 34px;
  height: 34px;
}
.attendance-leader-list strong {
  font-size: 11px;
}
.attendance-leader-list button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  color: #ed8179;
  font: inherit;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}
.attendance-leader-list button span {
  display: block;
  line-height: 1;
  transform: translateY(-1px);
}
@media (max-width: 700px) {
  .attendance-activity-actions {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }
  .attendance-activity-actions label {
    min-width: 0;
  }
  .attendance-settings-host .attendance-modal {
    width: 100%;
    height: 100%;
  }
  .attendance-leader-add {
    grid-template-columns: 1fr;
  }
  .attendance-corner-actions {
    right: 15px;
    bottom: 15px;
  }
}

/* Attendance scoreboard responsive table */
.attendance-scoreboard table {
  min-width: 720px;
}
.attendance-scoreboard td:first-child {
  display: table-cell;
}
.attendance-scoreboard-member {
  display: flex;
  align-items: center;
  gap: 10px;
}
@media (max-width: 760px) {
  .attendance-scoreboard > header,
  .attendance-scoreboard-header {
    align-items: stretch;
    flex-direction: column;
  }
  .attendance-scoreboard-actions {
    align-items: end;
    width: 100%;
  }
  .attendance-scoreboard-actions label {
    flex: 1;
    min-width: 0;
  }
  .attendance-scoreboard-header > div {
    flex-wrap: wrap;
  }
  .attendance-table-wrap {
    overscroll-behavior-x: contain;
  }
}

/* Attendance modal layering and member search */
.attendance-modal-wrap {
  z-index: 2147483000;
}
.attendance-member-picker {
  position: relative;
}
.attendance-member-results {
  display: grid;
  gap: 5px;
  text-transform: none;
  letter-spacing: 0;
}
.attendance-member-search-help {
  margin: 0;
  padding: 7px 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}
.attendance-member-results > button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.attendance-member-results > button:hover {
  border-color: #e4a72b80;
  background: #e4a72b0d;
}
.attendance-member-results > button strong {
  font-size: 11px;
}
.attendance-member-results > button span {
  color: #e4a72b;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}
.attendance-member-selected {
  padding: 9px 10px;
  border: 1px solid #e4a72b66;
  border-radius: 7px;
  background: #e4a72b12;
}
.attendance-member-selected span {
  display: block;
  color: #e4a72b;
  font-size: 8px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.attendance-member-selected strong {
  display: block;
  margin-top: 2px;
  color: var(--text);
  font-size: 11px;
  text-transform: none;
}
.attendance-member-no-results {
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--bg);
}
.attendance-member-no-results p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}
.attendance-member-no-results button {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #e4a72b66;
  border-radius: 7px;
  background: #e4a72b14;
  color: #e9b84f;
  font: inherit;
  font-size: 10px;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}
.attendance-member-no-results button:disabled {
  opacity: 0.55;
  cursor: wait;
}

/* Current-cycle attendance highlighting */
.attendance-member-record tr.attendance-current-cycle td {
  background: #e4a72b12;
}
.attendance-member-record tr.attendance-current-cycle td:first-child {
  box-shadow: inset 3px 0 #e4a72b;
}
.attendance-current-badge {
  display: block;
  width: max-content;
  margin-top: 4px;
  padding: 2px 5px;
  border-radius: 999px;
  background: #e4a72b26;
  color: #e8b74f;
  font-size: 7px;
  font-weight: 850;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
@media print {
  .attendance-print-record tr.attendance-current-cycle td {
    background: #fff4d8 !important;
  }
  .attendance-print-record tr.attendance-current-cycle td:first-child {
    border-left: 3px solid #d39a1f;
  }
  .attendance-print-record .attendance-current-badge {
    background: #f2e3bd !important;
    color: #6d4c0d;
  }
}

/* Full team member record printing */
.attendance-print-record {
  display: none;
}
@media print {
  @page {
    margin: 0.55in;
  }
  body.attendance-printing {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    background: #fff !important;
  }
  body.attendance-printing > *:not(.attendance-print-record) {
    display: none !important;
  }
  .attendance-print-record {
    display: block !important;
    color: #17202a;
    font-family: Arial, sans-serif;
    font-size: 11px;
    line-height: 1.4;
  }
  .attendance-print-record * {
    box-sizing: border-box;
  }
  .attendance-print-record .print-header {
    display: flex;
    justify-content: space-between;
    align-items: end;
    padding-bottom: 15px;
    border-bottom: 3px solid #d71920;
  }
  .attendance-print-record .print-header span {
    color: #d71920;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
  }
  .attendance-print-record .print-header h1 {
    margin: 3px 0 0;
    font-size: 24px;
  }
  .attendance-print-record .print-header p {
    margin: 0;
    color: #68727d;
  }
  .attendance-print-record .print-member {
    margin: 18px 0 22px;
    padding: 15px;
    border: 1px solid #ccd2d8;
    border-radius: 8px;
    background: #f7f8f9;
  }
  .attendance-print-record .print-member h2 {
    margin: 0 0 12px;
    font-size: 20px;
  }
  .attendance-print-record .print-member > div {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
  }
  .attendance-print-record .print-member span {
    display: block;
  }
  .attendance-print-record .print-member small {
    display: block;
    color: #68727d;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
  }
  .attendance-print-record .print-member b {
    display: block;
    margin-top: 3px;
    font-size: 13px;
  }
  .attendance-print-record h3 {
    margin: 22px 0 7px;
    font-size: 14px;
  }
  .attendance-print-record h3 em {
    display: inline-grid;
    place-items: center;
    min-width: 19px;
    height: 19px;
    margin-left: 4px;
    border-radius: 10px;
    background: #f2e3bd;
    color: #7a5812;
    font-size: 9px;
    font-style: normal;
  }
  .attendance-print-record table {
    width: 100%;
    border-collapse: collapse;
    page-break-inside: auto;
  }
  .attendance-print-record thead {
    display: table-header-group;
  }
  .attendance-print-record tr {
    page-break-inside: avoid;
  }
  .attendance-print-record th,
  .attendance-print-record td {
    padding: 7px 8px;
    border: 1px solid #d8dde2;
    text-align: left;
    vertical-align: top;
  }
  .attendance-print-record th {
    background: #f1f3f5;
    color: #59636e;
    font-size: 9px;
    text-transform: uppercase;
  }
  .attendance-print-record .empty {
    padding: 10px;
    border: 1px dashed #cbd1d7;
    color: #68727d;
  }
}

@media (max-width: 700px) {
  .attendance-table-wrap {
    overflow-x: hidden !important;
  }
  .attendance-scoreboard table {
    min-width: 0 !important;
  }
}

/* Compact overview metrics with intentional wrapped headings. */
.attendance-overview-summary-title span,
.attendance-summary-card span {
  line-height: 1.25;
  white-space: normal;
}
@media (max-width: 800px) {
  .attendance-overview-summary-title,
  .attendance-summary-card,
  .attendance-summary-card.warning {
    flex-basis: 108px;
  }
  .attendance-summary-latest {
    flex-basis: 240px;
  }
}

.attendance-overview-summary {
  grid-template-columns: 160px repeat(3, 110px) minmax(0, 260px);
}
@media (max-width: 800px) {
  .attendance-overview-summary-title {
    flex-basis: 160px;
  }
}

.attendance-summary-card:not(.attendance-summary-latest) > small {
  display: none;
}

@media (max-width: 800px) {
  .attendance-overview-summary {
    margin-top: -3px;
    padding-top: 3px;
  }
}

.attendance-tabs button,
.attendance-tabs button:hover,
.attendance-tabs button:focus,
.attendance-tabs button:focus-visible,
.attendance-tabs button.active {
  outline: 0 !important;
  filter: none !important;
  box-shadow: none !important;
}
.attendance-tabs button.active {
  background: var(--card) !important;
  color: var(--text) !important;
}
.attendance-activity-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
}
.attendance-activity-footer button {
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}
.attendance-activity-footer button[hidden] {
  display: none;
}
@media (max-width: 520px) {
  .attendance-activity-footer {
    align-items: stretch;
    flex-direction: column;
  }
  .attendance-activity-footer button {
    width: 100%;
  }
}

/* Readable long logs: alternating rows and pinned identifying columns. */
.attendance-activity-table tbody tr:nth-child(even):not(:hover):not(:focus) td,
.attendance-scoreboard tbody tr:nth-child(even):not(:hover):not(:focus) td {
  background: color-mix(in srgb, var(--bg) 52%, var(--card));
}
.attendance-activity-table th:first-child,
.attendance-activity-table td:first-child {
  position: sticky;
  z-index: 3;
  left: 0;
  width: 78px;
  background: var(--card);
}
.attendance-activity-table th:nth-child(2),
.attendance-activity-table td:nth-child(2) {
  position: sticky;
  z-index: 3;
  left: 78px;
  background: var(--card);
}
.attendance-activity-table tbody tr:nth-child(even):not(:hover):not(:focus) td:first-child,
.attendance-activity-table tbody tr:nth-child(even):not(:hover):not(:focus) td:nth-child(2) {
  background: color-mix(in srgb, var(--bg) 52%, var(--card));
}
.attendance-activity-table th:first-child,
.attendance-activity-table th:nth-child(2) {
  z-index: 4;
  background: var(--card);
}

@media (min-width: 701px) and (max-width: 1040px) {
  .attendance-activity-table tbody {
    width: 100%;
  }
  .attendance-activity-table td {
    box-sizing: border-box;
    position: static !important;
    grid-template-columns: 110px minmax(0, 1fr);
    align-items: start;
    gap: 10px;
    min-width: 0 !important;
    overflow-wrap: anywhere;
  }
  .attendance-activity-table td:last-child {
    border-bottom: 0 !important;
  }
  .attendance-activity-table td::before {
    color: var(--muted);
    font-size: 8px;
    font-weight: 850;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }
  .attendance-activity-table td:nth-child(1)::before {
    content: "Date";
  }
  .attendance-activity-table td:nth-child(2)::before {
    content: "Team member";
  }
  .attendance-activity-table td:nth-child(3)::before {
    content: "Activity";
  }
  .attendance-activity-table td:nth-child(4)::before {
    content: "Points";
  }
  .attendance-activity-table td:nth-child(5)::before {
    content: "Notes";
  }
  .attendance-activity-table td:nth-child(6)::before {
    content: "Recorded by";
  }
  .attendance-activity-table td:nth-child(7)::before {
    content: "Action";
  }
  .attendance-excused-table td:nth-child(1)::before {
    content: "Date";
  }
  .attendance-excused-table td:nth-child(2)::before {
    content: "Team member";
  }
  .attendance-excused-table td:nth-child(3)::before {
    content: "Details";
  }
  .attendance-excused-table td:nth-child(4)::before {
    content: "Reported by";
  }
  .attendance-excused-table td:nth-child(5)::before {
    content: "Attachment";
  }
  .attendance-excused-table td:nth-child(6)::before {
    content: "Action";
  }
  .attendance-excused-table td:nth-child(7) {
    display: none !important;
  }
  .attendance-activity-table tbody tr:nth-child(even) {
    background: color-mix(in srgb, var(--bg) 52%, var(--card));
  }
}

/* Preserve continuous tables on laptops and tablets. */
@media (min-width: 701px) and (max-width: 1040px) {
  .attendance-activity-table-wrap {
    overflow-x: auto;
  }
  .attendance-activity-table {
    display: table;
    width: 100%;
    min-width: 900px;
  }
  .attendance-excused-table {
    min-width: 760px;
  }
  .attendance-activity-table thead {
    display: table-header-group;
  }
  .attendance-activity-table tbody {
    display: table-row-group;
  }
  .attendance-activity-table tbody tr {
    display: table-row;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    overflow: visible;
  }
  .attendance-activity-table td {
    display: table-cell !important;
    width: auto !important;
    min-width: 0;
    padding: 10px 12px !important;
    border-bottom: 1px solid var(--line) !important;
    background: var(--card) !important;
    text-align: left !important;
    white-space: normal !important;
  }
  .attendance-activity-table tbody tr:nth-child(even) td {
    background: color-mix(in srgb, var(--bg) 52%, var(--card)) !important;
  }
  .attendance-activity-table td::before {
    display: none;
  }
  .attendance-activity-table th:first-child,
  .attendance-activity-table td:first-child {
    position: sticky !important;
    left: 0;
    width: 78px !important;
    z-index: 3;
  }
  .attendance-activity-table th:nth-child(2),
  .attendance-activity-table td:nth-child(2) {
    position: sticky !important;
    left: 78px;
    z-index: 3;
  }
  .attendance-activity-table th:first-child,
  .attendance-activity-table th:nth-child(2) {
    z-index: 4;
  }
}

/* Excused absence columns sized by their actual content. */
.attendance-excused-table th:nth-child(1),
.attendance-excused-table td:nth-child(1) {
  width: 72px !important;
}
.attendance-excused-table th:nth-child(2),
.attendance-excused-table td:nth-child(2),
.attendance-excused-table th:nth-child(4),
.attendance-excused-table td:nth-child(4) {
  width: 185px !important;
}
.attendance-excused-table th:nth-child(5),
.attendance-excused-table td:nth-child(5) {
  width: 62px !important;
}
.attendance-excused-table th:nth-child(6),
.attendance-excused-table td:nth-child(6) {
  width: 82px !important;
}
.attendance-excused-table {
  table-layout: fixed;
  min-width: 850px;
}
.attendance-excused-table th:nth-child(1),
.attendance-excused-table td:nth-child(1) {
  width: 72px;
}
.attendance-excused-table th:nth-child(2),
.attendance-excused-table td:nth-child(2),
.attendance-excused-table th:nth-child(4),
.attendance-excused-table td:nth-child(4) {
  width: 185px;
}
.attendance-excused-table th:nth-child(5),
.attendance-excused-table td:nth-child(5) {
  width: 62px;
  min-width: 62px;
}
.attendance-excused-table th:nth-child(6),
.attendance-excused-table td:nth-child(6) {
  width: 82px;
}
.attendance-excused-table th:nth-child(2),
.attendance-excused-table td:nth-child(2),
.attendance-excused-table th:nth-child(4),
.attendance-excused-table td:nth-child(4) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attendance-excused-table th:nth-child(2),
.attendance-excused-table td:nth-child(2) {
  left: 72px !important;
}

/* Activity columns use the same content-based sizing system. */
body .attendance-excused-table th:nth-child(2),
body .attendance-excused-table td:nth-child(2),
body .attendance-excused-table th:nth-child(4),
body .attendance-excused-table td:nth-child(4),
body .attendance-activity-table:not(.attendance-excused-table) th:nth-child(2),
body .attendance-activity-table:not(.attendance-excused-table) td:nth-child(2),
body .attendance-activity-table:not(.attendance-excused-table) th:nth-child(6),
body .attendance-activity-table:not(.attendance-excused-table) td:nth-child(6) {
  width: 139px !important;
  overflow: visible !important;
  text-overflow: clip !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
}
.attendance-activity-table:not(.attendance-excused-table) {
  table-layout: fixed;
  min-width: 1000px;
}
.attendance-activity-table:not(.attendance-excused-table) th:nth-child(1),
.attendance-activity-table:not(.attendance-excused-table) td:nth-child(1) {
  width: 72px !important;
}
.attendance-activity-table:not(.attendance-excused-table) th:nth-child(2),
.attendance-activity-table:not(.attendance-excused-table) td:nth-child(2),
.attendance-activity-table:not(.attendance-excused-table) th:nth-child(6),
.attendance-activity-table:not(.attendance-excused-table) td:nth-child(6) {
  width: 185px !important;
}
.attendance-activity-table:not(.attendance-excused-table) th:nth-child(3),
.attendance-activity-table:not(.attendance-excused-table) td:nth-child(3) {
  width: 230px !important;
}
.attendance-activity-table:not(.attendance-excused-table) th:nth-child(4),
.attendance-activity-table:not(.attendance-excused-table) td:nth-child(4) {
  width: 68px !important;
}
.attendance-activity-table:not(.attendance-excused-table) th:nth-child(7),
.attendance-activity-table:not(.attendance-excused-table) td:nth-child(7) {
  width: 82px !important;
}
.attendance-activity-table:not(.attendance-excused-table) th:nth-child(2),
.attendance-activity-table:not(.attendance-excused-table) td:nth-child(2),
.attendance-activity-table:not(.attendance-excused-table) th:nth-child(6),
.attendance-activity-table:not(.attendance-excused-table) td:nth-child(6) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attendance-activity-table:not(.attendance-excused-table) th:nth-child(2),
.attendance-activity-table:not(.attendance-excused-table) td:nth-child(2) {
  left: 72px !important;
}

/* Team members are created only from the attendance-event search flow. */
.attendance-app [data-attendance-member] {
  display: none !important;
}

/* The overview context already explains this scoreboard; start directly with its rows. */
.attendance-scoreboard > header {
  display: none !important;
}

/* Keep every Attendance tab on the same neutral canvas and top-right haze as Overview. */
.attendance-app main > .attendance-record,
.attendance-app main > .attendance-discipline {
  border: 0;
  background: transparent;
  padding: 0;
}

/* A uniform canvas prevents the active tab position from appearing to change the page tint. */
.tool-workspace-screen[data-tool="attendance-hub"] .attendance-app {
  background: var(--bg) !important;
}

/* Discipline workspace: actionable alerts first, vertical policy scale alongside. */
.attendance-discipline > header {
  grid-area: heading;
}
.attendance-discipline > .attendance-alert-list {
  grid-area: alerts;
  margin-top: 0;
}
.attendance-discipline > .attendance-thresholds {
  grid-area: scale;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin: 0;
}
.attendance-discipline > .attendance-thresholds span {
  position: relative;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 10px 12px;
}
.attendance-discipline > .attendance-thresholds b {
  margin: 0;
  font-size: 19px;
  text-align: center;
}
.attendance-discipline > .attendance-action-history {
  grid-area: history;
  margin-top: 4px;
}
@media (max-width: 700px) {
  .attendance-discipline > .attendance-thresholds {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 440px) {
  .attendance-discipline > .attendance-thresholds {
    grid-template-columns: 1fr;
  }
}

.attendance-alert-card {
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "identity action" "facts action";
}
.attendance-alert-identity {
  grid-area: identity;
  min-width: 0;
}
.attendance-alert-identity strong,
.attendance-alert-identity span {
  display: block;
}
.attendance-alert-identity strong {
  overflow-wrap: anywhere;
}
.attendance-alert-identity span {
  margin-top: 3px;
  font-size: 10px;
  font-weight: 800;
}
.attendance-alert-card dl {
  grid-area: facts;
  display: flex;
  gap: 22px;
  margin: 0;
}
.attendance-alert-card dl > div {
  display: grid;
  gap: 2px;
}
.attendance-alert-card dt {
  color: var(--muted);
  font-size: 8px;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.attendance-alert-card dd {
  margin: 0;
  color: var(--text);
  font-size: 11px;
  font-weight: 800;
}
.attendance-alert-card > .attendance-primary {
  grid-area: action;
}
@media (max-width: 480px) {
  .attendance-alert-card {
    grid-template-columns: 1fr;
    grid-template-areas: "identity" "facts" "action";
  }
  .attendance-alert-card > .attendance-primary {
    width: 100%;
  }
}

/* Frozen-chicken bag palette: purposeful color roles, with yellow reserved for caution. */
.attendance-app,
.attendance-modal {
  --at-blue: #4f91d8;
  --at-coral: #df626c;
  --at-green: #55ad83;
  --at-orange: #e89443;
  --at-purple: #9874cf;
  --at-yellow: #d9ae45;
  --at-accent: var(--at-blue);
}
.attendance-app .attendance-primary,
.attendance-modal .attendance-primary {
  background: var(--at-blue);
  color: #07121e;
}
.attendance-header > div > span,
.attendance-app a {
  color: var(--at-blue);
}
.attendance-tabs b {
  color: var(--at-coral);
}
.attendance-overview-summary-title {
  background: linear-gradient(135deg, color-mix(in srgb, var(--at-blue) 15%, transparent), transparent 72%), var(--card);
}
.attendance-overview-summary-title strong {
  color: var(--at-blue);
}
.attendance-summary-card[data-attendance-scroll-points] {
  border-color: color-mix(in srgb, var(--at-green) 30%, var(--line));
  background: linear-gradient(135deg, color-mix(in srgb, var(--at-green) 10%, transparent), transparent 75%), var(--card);
}
.attendance-summary-card[data-attendance-scroll-points] strong {
  color: var(--at-green);
}
.attendance-summary-card[data-attendance-view="record"] {
  border-color: color-mix(in srgb, var(--at-orange) 28%, var(--line));
  background: linear-gradient(135deg, color-mix(in srgb, var(--at-orange) 9%, transparent), transparent 75%), var(--card);
}
.attendance-summary-card[data-attendance-view="record"] strong {
  color: var(--at-orange);
}
.attendance-summary-latest {
  border-color: color-mix(in srgb, var(--at-purple) 28%, var(--line));
  background: linear-gradient(135deg, color-mix(in srgb, var(--at-purple) 9%, transparent), transparent 75%), var(--card);
}
.attendance-summary-latest strong {
  color: var(--at-purple);
}
.attendance-summary-card.warning {
  border-color: color-mix(in srgb, var(--at-coral) 38%, var(--line));
  background: linear-gradient(135deg, color-mix(in srgb, var(--at-coral) 11%, transparent), transparent 75%), var(--card);
}
.attendance-summary-card.warning strong {
  color: var(--at-coral);
}
.attendance-alert-identity span {
  color: var(--at-coral);
}
.attendance-discipline > .attendance-thresholds span:nth-child(1) b {
  color: var(--at-yellow);
}
.attendance-discipline > .attendance-thresholds span:nth-child(2) b {
  color: var(--at-orange);
}
.attendance-discipline > .attendance-thresholds span:nth-child(3) b {
  color: var(--at-coral);
}
.attendance-discipline > .attendance-thresholds span:nth-child(4) b {
  color: var(--at-purple);
}
.attendance-avatar {
  background: color-mix(in srgb, var(--avatar-color, var(--at-blue)) 18%, transparent);
  color: var(--avatar-color, var(--at-blue));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--avatar-color, var(--at-blue)) 28%, transparent);
}
.attendance-scoreboard tbody tr:nth-child(5n + 1),
.attendance-member-grid > *:nth-child(5n + 1),
.attendance-leader-list > div:nth-child(5n + 1) {
  --avatar-color: var(--at-blue);
}
.attendance-scoreboard tbody tr:nth-child(5n + 2),
.attendance-member-grid > *:nth-child(5n + 2),
.attendance-leader-list > div:nth-child(5n + 2) {
  --avatar-color: var(--at-coral);
}
.attendance-scoreboard tbody tr:nth-child(5n + 3),
.attendance-member-grid > *:nth-child(5n + 3),
.attendance-leader-list > div:nth-child(5n + 3) {
  --avatar-color: var(--at-green);
}
.attendance-scoreboard tbody tr:nth-child(5n + 4),
.attendance-member-grid > *:nth-child(5n + 4),
.attendance-leader-list > div:nth-child(5n + 4) {
  --avatar-color: var(--at-orange);
}
.attendance-scoreboard tbody tr:nth-child(5n),
.attendance-member-grid > *:nth-child(5n),
.attendance-leader-list > div:nth-child(5n) {
  --avatar-color: var(--at-purple);
}
.attendance-avatar[data-avatar-tone="0"] {
  --avatar-color: var(--at-blue);
}
.attendance-avatar[data-avatar-tone="1"] {
  --avatar-color: var(--at-coral);
}
.attendance-avatar[data-avatar-tone="2"] {
  --avatar-color: var(--at-green);
}
.attendance-avatar[data-avatar-tone="3"] {
  --avatar-color: var(--at-orange);
}
.attendance-avatar[data-avatar-tone="4"] {
  --avatar-color: var(--at-purple);
}
.attendance-avatar {
  box-sizing: border-box;
  flex: 0 0 38px;
  aspect-ratio: 1/1;
  min-width: 38px;
  min-height: 38px;
  border-radius: 50%;
}
.attendance-leader-list .attendance-avatar {
  flex-basis: 34px;
  min-width: 34px;
  min-height: 34px;
}
.attendance-activity-actions > .attendance-primary {
  display: none;
}
.attendance-member-link {
  display: inline;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 800;
  line-height: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.attendance-member-link:hover {
  color: var(--at-blue);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.attendance-member-link:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--at-blue) 70%, transparent);
  outline-offset: 3px;
  border-radius: 2px;
}
.attendance-alert-identity > .attendance-member-link {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: 13px;
}
.attendance-activity-table .attendance-member-link {
  white-space: normal;
  overflow-wrap: anywhere;
}
.attendance-leader-needed [data-attendance-configure-leaders] {
  display: block;
  width: max-content;
  margin-top: 9px;
  padding: 8px 11px;
  border: 1px solid color-mix(in srgb, var(--at-blue) 55%, var(--line));
  border-radius: 7px;
  background: color-mix(in srgb, var(--at-blue) 13%, var(--card));
  color: var(--at-blue);
  font: inherit;
  font-size: 10px;
  font-weight: 850;
  cursor: pointer;
}
.attendance-leader-needed [data-attendance-configure-leaders]:hover {
  background: color-mix(in srgb, var(--at-blue) 20%, var(--card));
}
.attendance-leader-needed [data-attendance-configure-leaders]:focus-visible {
  outline: 2px solid var(--at-blue);
  outline-offset: 2px;
}
.attendance-leader-picker {
  margin-top: 16px;
}
.attendance-leader-picker > label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}
.attendance-leader-picker .modal-input {
  width: 100%;
}
.attendance-leader-results {
  display: grid;
  gap: 5px;
  margin-top: 7px;
}
.attendance-leader-results > p {
  margin: 0;
  padding: 10px;
  color: var(--muted);
  font-size: 10px;
}
.attendance-leader-results > button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 11px;
  text-align: left;
  cursor: pointer;
}
.attendance-leader-results > button:hover,
.attendance-leader-results > button:focus-visible {
  border-color: color-mix(in srgb, var(--at-blue) 55%, var(--line));
  background: color-mix(in srgb, var(--at-blue) 9%, var(--bg));
  outline: none;
}
.attendance-leader-results > button strong {
  color: var(--at-blue);
  font-size: 9px;
  text-transform: uppercase;
}
.attendance-header p {
  display: none;
}
.attendance-cycle-toggle {
  display: flex;
  align-items: center;
  width: max-content;
  margin: 0 0 8px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--card);
}
.attendance-cycle-toggle button {
  padding: 6px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 10px;
  font-weight: 800;
  text-transform: capitalize;
  cursor: pointer;
}
.attendance-cycle-toggle button.active {
  background: color-mix(in srgb, var(--at-blue) 15%, var(--bg));
  color: var(--at-blue);
}
.attendance-dashboard:has([data-attendance-cycle="previous"].active) .attendance-summary-latest {
  display: none;
}
.attendance-dashboard:has([data-attendance-cycle="previous"].active) .attendance-overview-summary {
  grid-template-columns: 160px repeat(3, 110px);
}

/* Keep primary app workspaces readable on wide displays. */
body[data-layout="default"] #weather-row,
body[data-layout="default"] #app {
  box-sizing: border-box;
  width: min(1180px, 100%);
  margin-right: auto;
  margin-left: auto;
}
.training-app {
  box-sizing: border-box;
  width: min(1180px, 100%);
  margin-right: auto;
  margin-left: auto;
}
.team-hub-app {
  box-sizing: border-box;
  width: min(1180px, 100%);
  margin-right: auto;
  margin-left: auto;
}
@media (min-width: 900px) {
  .team-hub-app .team-live-preview {
    right: max(28px, calc((100vw - 1180px) / 2 + 28px));
  }
}
