:root {
  --gold: #c9a84c;
  --gold-light: #e8c97a;
  --gold-pale: #fff8e7;
  --navy: #1a2744;
  --navy-mid: #243257;
  --navy-light: #2e3f6e;
  --cream: #fdfaf4;
  --surface: #ffffff;
  --text: #1a2744;
  --muted: #6b7a9e;
  --border: #e5eaf3;
  --present: #2d7d46;
  --present-bg: #e8f5ed;
  --absent: #c0392b;
  --absent-bg: #fdecea;
  --justified: #1a6fa8;
  --justified-bg: #e3f1fb;
  --pending: #7b879d;
  --pending-bg: #eef1f6;
  --shadow: 0 4px 24px rgba(26, 39, 68, 0.1);
  --shadow-lg: 0 8px 40px rgba(26, 39, 68, 0.16);
  --radius: 14px;
  --radius-sm: 8px;
}

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

html {
  min-width: 320px;
  background: var(--cream);
}

body {
  min-height: 100vh;
  background: var(--cream);
  color: var(--text);
  font-family: "DM Sans", sans-serif;
  font-size: 16px;
}

button,
input,
select {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: linear-gradient(135deg, var(--navy), var(--navy-light));
  color: #fff;
  box-shadow: 0 2px 20px rgba(26, 39, 68, 0.25);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: min(1200px, 100%);
  margin: 0 auto;
  padding: 17px 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  color: var(--navy);
  font-size: 1.7rem;
  font-weight: 600;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-family: "Playfair Display", serif;
  font-size: 1.2rem;
  line-height: 1.2;
}

.brand small {
  margin-top: 3px;
  color: var(--gold-light);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 39px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.2s, border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.button:hover {
  transform: translateY(-1px);
}

.button:focus-visible,
.field input:focus-visible,
.field select:focus-visible,
.summary-count:focus-visible {
  outline: 3px solid rgba(232, 201, 122, 0.8);
  outline-offset: 2px;
}

.button-primary {
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  color: var(--navy);
}

.button-primary:hover {
  box-shadow: 0 4px 16px rgba(201, 168, 76, 0.4);
}

.button-secondary {
  border-color: rgba(255, 255, 255, 0.35);
  background: transparent;
  color: #fff;
}

.button-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

.container {
  width: min(1200px, 100%);
  margin: 0 auto;
  padding: 30px 16px 56px;
}

.page-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.eyebrow {
  margin-bottom: 6px;
  color: var(--gold);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

h1,
h2 {
  font-family: "Playfair Display", serif;
  line-height: 1.15;
}

h1 {
  font-size: clamp(2rem, 4vw, 3rem);
}

h2 {
  font-size: 1.18rem;
}

.intro-copy {
  max-width: 590px;
  margin-top: 9px;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.55;
}

.read-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 7px;
  padding-bottom: 3px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--present-bg);
  color: var(--present);
  font-size: 0.74rem;
  font-weight: 600;
}

.status-pill.is-error {
  background: var(--absent-bg);
  color: var(--absent);
}

.read-time {
  color: var(--muted);
  font-size: 0.75rem;
}

.notice {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
  padding: 14px 17px;
  border: 1px solid;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  line-height: 1.45;
}

.notice-error {
  border-color: #f0b7b0;
  background: var(--absent-bg);
  color: #8f2b21;
}

.toolbar {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  margin-bottom: 22px;
  padding: 15px 17px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.field {
  display: flex;
  flex: 0 0 245px;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.field select,
.field input {
  width: 100%;
  min-height: 39px;
  padding: 8px 11px;
  border: 1.5px solid #dce3ef;
  border-radius: var(--radius-sm);
  background: var(--cream);
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
}

.search-field {
  flex-basis: 260px;
}

.toolbar-note {
  max-width: 300px;
  margin-left: auto;
  padding-bottom: 9px;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.4;
  text-align: right;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 13px;
  margin-bottom: 22px;
}

.kpi-card {
  display: flex;
  min-height: 126px;
  flex-direction: column;
  gap: 6px;
  padding: 17px 16px;
  border: 1px solid rgba(229, 234, 243, 0.7);
  border-top: 3px solid var(--gold);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.kpi-accent {
  border-top-color: var(--present);
}

.kpi-label,
.kpi-detail {
  color: var(--muted);
  font-size: 0.72rem;
}

.kpi-label {
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.kpi-value {
  color: var(--navy);
  font-family: "Playfair Display", serif;
  font-size: 2rem;
  line-height: 1.05;
}

.kpi-detail {
  margin-top: auto;
  line-height: 1.3;
}

.dashboard-grid,
.lower-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.9fr);
  gap: 22px;
  margin-bottom: 22px;
}

.panel {
  min-width: 0;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 72px;
  padding: 16px 20px;
  background: linear-gradient(90deg, var(--navy), var(--navy-mid));
  color: #fff;
}

.panel-header .eyebrow {
  margin-bottom: 4px;
  color: var(--gold-light);
}

.panel-caption {
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.74rem;
  text-align: right;
}

.chart-wrap {
  min-height: 300px;
  padding: 15px 17px 12px;
}

.chart-svg {
  display: block;
  width: 100%;
  height: auto;
  min-height: 260px;
  overflow: visible;
}

.chart-grid {
  stroke: #e8ecf3;
  stroke-width: 1;
}

.chart-axis-label {
  fill: #8995aa;
  font-family: "DM Sans", sans-serif;
  font-size: 11px;
}

.chart-bar {
  fill: var(--present);
  transition: opacity 0.2s;
}

.chart-bar:hover {
  opacity: 0.78;
}

.chart-bar-empty {
  fill: #dfe5ef;
}

.chart-label {
  fill: #6b7a9e;
  font-family: "DM Sans", sans-serif;
  font-size: 10px;
}

.chart-empty,
.empty-state {
  display: grid;
  min-height: 170px;
  place-items: center;
  padding: 30px 20px;
  color: var(--muted);
  font-size: 0.86rem;
  text-align: center;
}

.distribution-panel {
  display: flex;
  flex-direction: column;
}

.distribution-list {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  gap: 17px;
  padding: 24px 20px 18px;
}

.distribution-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 12px;
  align-items: center;
}

.distribution-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 0.83rem;
}

.distribution-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.distribution-value {
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 600;
}

.distribution-track {
  grid-column: 1 / -1;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf0f5;
}

.distribution-fill {
  height: 100%;
  min-width: 0;
  border-radius: inherit;
  transition: width 0.3s;
}

.panel-footnote {
  margin: 0 20px 19px;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.45;
}

.table-panel {
  margin-bottom: 22px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
}

thead {
  background: #f4f6fa;
}

th {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

td {
  padding: 13px 16px;
  border-bottom: 1px solid #eef1f6;
  color: var(--text);
  font-size: 0.83rem;
  vertical-align: middle;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: #fffbf2;
}

.number-cell {
  text-align: center;
}

.student-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 170px;
}

.student-avatar {
  display: grid;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--navy), var(--navy-light));
  color: var(--gold-light);
  font-size: 0.78rem;
  font-weight: 600;
}

.student-name {
  overflow: hidden;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.percent-cell {
  min-width: 150px;
}

.percent-line {
  display: flex;
  align-items: center;
  gap: 9px;
}

.mini-track {
  flex: 1;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9edf4;
}

.mini-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--present);
}

.percent-value {
  min-width: 39px;
  color: var(--navy);
  font-size: 0.82rem;
  font-weight: 600;
  text-align: right;
}

.compact-table table {
  min-width: 590px;
}

.date-cell {
  white-space: nowrap;
}

.day-status {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--present-bg);
  color: var(--present);
  font-size: 0.7rem;
  font-weight: 600;
}

.day-status.empty {
  background: var(--pending-bg);
  color: var(--pending);
}

.no-class-list {
  display: flex;
  max-height: 330px;
  flex-direction: column;
  gap: 9px;
  overflow-y: auto;
  padding: 17px 20px 20px;
}

.no-class-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid #f0d9d5;
  border-radius: var(--radius-sm);
  background: #fff8f6;
  color: var(--absent);
  font-size: 0.82rem;
}

.no-class-item span:last-child {
  color: var(--muted);
  font-size: 0.72rem;
}

.observations-panel {
  margin-bottom: 22px;
}

.observations-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 17px 20px;
  cursor: pointer;
  list-style: none;
}

.observations-panel summary::-webkit-details-marker {
  display: none;
}

.observations-panel summary::after {
  width: 0;
  height: 0;
  margin-left: auto;
  border-top: 6px solid var(--muted);
  border-right: 6px solid transparent;
  border-left: 6px solid transparent;
  content: "";
  transition: transform 0.2s;
}

.observations-panel[open] summary::after {
  transform: rotate(180deg);
}

.observations-panel summary strong {
  display: block;
  font-family: "Playfair Display", serif;
  font-size: 1.05rem;
}

.summary-count {
  display: inline-grid;
  min-width: 28px;
  height: 28px;
  margin-left: auto;
  place-items: center;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--gold-pale);
  color: var(--navy);
  font-size: 0.75rem;
  font-weight: 600;
}

.observations-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 0 20px 20px;
}

.observation-item {
  display: grid;
  grid-template-columns: 125px minmax(130px, 0.35fr) 1fr;
  gap: 12px;
  align-items: baseline;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--cream);
  font-size: 0.79rem;
  line-height: 1.45;
}

.observation-date {
  color: var(--muted);
  font-size: 0.72rem;
}

.observation-name {
  color: var(--navy);
  font-weight: 600;
}

.observation-text {
  min-width: 0;
  color: var(--text);
  overflow-wrap: anywhere;
}

.page-footer {
  padding: 5px 3px 0;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.5;
  text-align: center;
}

[hidden] {
  display: none !important;
}

@media (max-width: 1050px) {
  .kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dashboard-grid,
  .lower-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .header-inner,
  .page-intro,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .header-inner {
    padding: 14px 16px;
  }

  .header-actions {
    width: 100%;
  }

  .header-actions .button {
    flex: 1;
  }

  .container {
    padding: 24px 12px 42px;
  }

  .page-intro {
    gap: 15px;
  }

  .read-meta {
    align-items: flex-start;
  }

  .toolbar {
    gap: 12px;
  }

  .field,
  .search-field {
    flex-basis: auto;
  }

  .toolbar-note {
    max-width: none;
    margin-left: 0;
    padding-bottom: 0;
    text-align: left;
  }

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

  .kpi-card {
    min-height: 112px;
    padding: 14px 13px;
  }

  .kpi-value {
    font-size: 1.75rem;
  }

  .panel-header {
    min-height: 66px;
    padding: 13px 15px;
  }

  .panel-caption {
    max-width: 100px;
  }

  .chart-wrap {
    min-height: 245px;
    padding: 12px 9px 8px;
    overflow-x: auto;
  }

  .chart-svg {
    min-width: 580px;
  }

  .distribution-list {
    padding: 20px 15px 15px;
  }

  .panel-footnote {
    margin-right: 15px;
    margin-left: 15px;
  }

  th,
  td {
    padding: 11px 12px;
  }

  .observation-item {
    grid-template-columns: 1fr;
    gap: 3px;
  }
}

@media (max-width: 400px) {
  .brand-mark {
    flex-basis: 38px;
    width: 38px;
    height: 38px;
  }

  .brand strong {
    font-size: 1.05rem;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
  }
}
