:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #18202a;
  --muted: #667085;
  --line: #d8dee8;
  --brand: #145c63;
  --brand-2: #703b8f;
  --danger: #a43131;
  --ok: #237a4b;
  --warn: #946200;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 22px;
}

h2 {
  font-size: 18px;
}

h3 {
  font-size: 15px;
}

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  gap: 18px;
}

section,
form,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 1px 2px rgba(24, 32, 42, 0.06);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

form {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

input,
select,
textarea,
button {
  font: inherit;
  border-radius: 6px;
}

input,
select,
textarea {
  border: 1px solid var(--line);
  padding: 10px 11px;
  min-width: 0;
}

textarea {
  resize: vertical;
  min-height: 72px;
}

button {
  border: 1px solid transparent;
  padding: 10px 12px;
  background: var(--brand);
  color: white;
  cursor: pointer;
  font-size: 13px;
}

button.secondary {
  background: #eef3f4;
  color: var(--brand);
  border-color: #b9ced2;
}

button.danger {
  background: var(--danger);
}

button:disabled {
  opacity: .55;
  cursor: not-allowed;
}

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

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

.status {
  color: var(--muted);
  font-size: 13px;
  min-height: 22px;
}

.error {
  color: var(--danger);
}

.ok {
  color: var(--ok);
}

.warn {
  color: var(--warn);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  text-align: left;
  padding: 9px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 650;
}

.hidden {
  display: none !important;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef3f4;
  color: var(--brand);
  white-space: nowrap;
}

.pill.full {
  background: #e5f5ed;
  color: var(--ok);
}

.pill.reduced {
  background: #fff4d8;
  color: var(--warn);
}

.pill.absent {
  background: #fbe9e9;
  color: var(--danger);
}

.student-dashboard {
  display: grid;
  gap: 22px;
  background: transparent;
  border: 0;
  padding: 0;
}

.student-hero {
  display: grid;
  gap: 18px;
}

.student-hero-main,
.student-availability-form {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
}

.student-hero-main {
  display: grid;
  gap: 18px;
}

.eyebrow,
.summary-label {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.student-profile-line {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.profile-item {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  min-height: 30px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fbfcfd;
  font-size: 13px;
}

.profile-label {
  color: var(--muted);
}

.student-billing-panel {
  display: grid;
  gap: 14px;
  padding: 20px;
}

.billing-heading,
.billing-month-heading,
.billing-item-heading,
.billing-previous-month summary {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.billing-heading p {
  max-width: 680px;
  margin: 7px 0 0;
  color: var(--muted);
}

.billing-month {
  display: grid;
  gap: 12px;
}

.billing-month-heading {
  align-items: center;
}

.billing-month-heading h4,
.billing-item-heading h5 {
  margin: 0;
}

.billing-item-heading h5 {
  font-size: 14px;
}

.billing-count {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.billing-timeline {
  display: grid;
  gap: 12px;
  padding-left: 17px;
  border-left: 2px solid #dce7e9;
}

.billing-timeline-item {
  position: relative;
  display: grid;
  gap: 13px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.billing-timeline-item::before {
  position: absolute;
  top: 21px;
  left: -24px;
  width: 12px;
  height: 12px;
  border: 3px solid var(--panel);
  border-radius: 999px;
  background: var(--brand);
  box-shadow: 0 0 0 1px #b9ced2;
  content: "";
}

.billing-date {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.billing-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.billing-status-badge.accepted,
.billing-status-badge.submitted {
  background: #eef3f4;
  color: var(--brand);
}

.billing-status-badge.processing {
  background: #fff4d8;
  color: var(--warn);
}

.billing-status-badge.dunning,
.billing-status-badge.unsuccessful {
  background: #fbe9e9;
  color: var(--danger);
}

.billing-status-badge.settled {
  background: #e5f5ed;
  color: var(--ok);
}

.billing-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  margin: 0;
}

.billing-meta-item {
  min-width: 0;
  padding: 9px 10px;
  border-radius: 7px;
  background: var(--panel);
}

.billing-meta-item dt {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 11px;
}

.billing-meta-item dd {
  overflow-wrap: anywhere;
  margin: 0;
  font-size: 13px;
  font-weight: 650;
}

.billing-progress {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  padding: 0;
  margin: 0;
  list-style: none;
}

.billing-progress.with-acceptance {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.billing-progress li {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 5px;
  color: #8a94a3;
  font-size: 11px;
  text-align: center;
}

.billing-progress li:not(:last-child)::after {
  position: absolute;
  z-index: 0;
  top: 5px;
  left: calc(50% + 7px);
  width: calc(100% - 14px);
  height: 2px;
  background: #d8dee8;
  content: "";
}

.billing-progress li.complete:not(:last-child)::after {
  background: var(--ok);
}

.billing-progress-dot {
  z-index: 1;
  width: 12px;
  height: 12px;
  border: 2px solid #c7ced8;
  border-radius: 999px;
  background: var(--panel);
}

.billing-progress li.complete,
.billing-progress li.current {
  color: var(--text);
  font-weight: 700;
}

.billing-progress li.stopped {
  color: #a4aab3;
}

.billing-progress li.complete .billing-progress-dot {
  border-color: var(--ok);
  background: var(--ok);
}

.billing-progress li.current .billing-progress-dot {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(20, 92, 99, .12);
}

.billing-progress.terminal li.current .billing-progress-dot {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(180, 43, 43, .12);
}

.billing-status-copy {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 14px;
}

.billing-status-detail,
.billing-credit-number {
  margin: 0;
  font-size: 12px;
}

.billing-status-detail {
  color: var(--muted);
}

.billing-credit-number {
  color: var(--ok);
  font-weight: 700;
}

.billing-empty {
  display: grid;
  gap: 3px;
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fbfcfd;
}

.billing-empty strong {
  color: var(--text);
}

.billing-previous-month {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.billing-previous-month summary {
  align-items: center;
  cursor: pointer;
  color: var(--text);
  font-weight: 700;
  list-style: none;
}

.billing-previous-month summary::-webkit-details-marker {
  display: none;
}

.billing-previous-month summary .billing-count {
  margin-left: auto;
}

.billing-previous-month summary::after {
  color: var(--brand);
  content: "⌄";
  font-size: 18px;
  line-height: 1;
  transition: transform .16s ease;
}

.billing-previous-month[open] summary::after {
  transform: rotate(180deg);
}

.billing-previous-month[open] summary {
  margin-bottom: 12px;
}

.student-current-status {
  min-height: 42px;
}

.student-status-inline {
  display: flex;
  align-items: center;
  gap: 18px;
  padding-top: 4px;
}

.student-monthly-summary {
  display: grid;
  gap: 12px;
  padding-top: 2px;
}

.student-monthly-summary h3 {
  margin-top: 3px;
}

.student-monthly-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.student-monthly-metric {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.student-monthly-metric-value {
  margin: 0 0 5px;
  color: var(--brand);
  font-size: 22px;
  font-weight: 750;
  line-height: 1;
}

.student-monthly-metric-label {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.student-performance-summary {
  display: grid;
  gap: 12px;
  margin-top: 6px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.student-performance-summary h3 {
  margin-top: 3px;
}

.student-performance-period {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.student-performance-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.student-performance-metric {
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 8px;
  background: #fbfcfd;
}

.student-performance-metric.good {
  border-color: #8bc7a5;
  border-left-color: var(--ok);
  background: #f2faf5;
}

.student-performance-metric.info {
  border-color: #dbc481;
  border-left-color: var(--warn);
  background: #fffaf0;
}

.student-performance-metric.warning {
  border-color: #d9a2a2;
  border-left-color: var(--danger);
  background: #fff5f5;
}

.student-performance-metric-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.student-performance-metric-label,
.student-performance-metric-value,
.student-performance-metric-percent,
.student-performance-metric-detail,
.student-performance-metric-status {
  margin: 0;
}

.student-performance-metric-label {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.student-performance-metric-symbol {
  min-width: 24px;
  color: var(--muted);
  font-size: 17px;
  font-weight: 800;
  line-height: 1;
  text-align: right;
}

.student-performance-metric.good .student-performance-metric-symbol,
.student-performance-metric.good .student-performance-metric-percent,
.student-performance-metric.good .student-performance-metric-status {
  color: var(--ok);
}

.student-performance-metric.info .student-performance-metric-symbol,
.student-performance-metric.info .student-performance-metric-percent,
.student-performance-metric.info .student-performance-metric-status {
  color: var(--warn);
}

.student-performance-metric.warning .student-performance-metric-symbol,
.student-performance-metric.warning .student-performance-metric-percent,
.student-performance-metric.warning .student-performance-metric-status {
  color: var(--danger);
}

.student-performance-metric-value {
  margin-top: 12px;
  color: var(--brand);
  font-size: 22px;
  font-weight: 750;
  line-height: 1;
}

.student-performance-metric-percent {
  margin-top: 4px;
  color: var(--muted);
  font-size: 16px;
  font-weight: 750;
}

.student-performance-metric-detail {
  margin-top: 9px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.student-performance-metric-status {
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 5px 10px;
  border-radius: 999px;
  background: #eef3f4;
  color: var(--brand);
  font-weight: 650;
  white-space: nowrap;
  max-width: 100%;
}

.status-badge.large {
  min-height: 42px;
  padding: 8px 13px;
  font-size: 16px;
}

.status-badge.full {
  background: #e5f5ed;
  color: var(--ok);
}

.status-badge.reduced {
  background: #fff4d8;
  color: var(--warn);
}

.status-badge.absent {
  background: #fbe9e9;
  color: var(--danger);
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: currentColor;
  flex: 0 0 auto;
}

.form-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.form-heading p {
  margin: 7px 0 0;
  color: var(--muted);
  max-width: 720px;
}

.student-calendar-panel {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.calendar-toolbar {
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  align-items: center;
  gap: 10px;
}

.calendar-toolbar h4 {
  margin: 0;
  text-align: center;
  font-size: 16px;
}

.availability-lock-notice {
  margin: 0;
  padding: 10px 12px;
  border-left: 3px solid var(--warn);
  border-radius: 6px;
  background: #fff8e8;
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
}

.icon-button {
  width: 42px;
  min-height: 42px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
}

.student-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.calendar-weekday {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.calendar-blank,
.calendar-day {
  min-height: 72px;
}

.calendar-day {
  display: grid;
  align-content: space-between;
  gap: 4px;
  min-width: 0;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  text-align: left;
}

.calendar-day:hover:not(:disabled) {
  border-color: var(--brand);
}

.calendar-day:disabled {
  opacity: .48;
  cursor: not-allowed;
}

.calendar-day.selected {
  border-color: var(--brand);
  box-shadow: inset 0 0 0 2px rgba(20, 92, 99, .28);
}

.calendar-day.full {
  background: #f2fbf6;
}

.calendar-day.reduced {
  background: #fff9e8;
}

.calendar-day.absent {
  background: #fff1f1;
}

.calendar-day.weekend {
  border-style: dashed;
}

.calendar-day-number {
  min-width: 0;
  font-weight: 750;
}

.calendar-day-status {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-range-text {
  margin: 0;
  color: var(--muted);
  min-height: 20px;
}

.status-choice-group {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 0;
  border: 0;
  margin: 0;
}

.status-choice-group legend {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 2px;
}

.status-choice {
  position: relative;
  display: block;
  cursor: pointer;
}

.status-choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.status-choice span {
  display: grid;
  gap: 4px;
  min-height: 84px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.status-choice input:checked + span {
  border-color: var(--brand);
  box-shadow: inset 0 0 0 2px rgba(20, 92, 99, .16);
}

.status-choice strong {
  font-size: 13px;
}

.status-choice small {
  color: var(--muted);
  font-size: 12px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--brand);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .04em;
  text-transform: uppercase;
}

@media (max-width: 760px) {
  header {
    align-items: flex-start;
    flex-direction: column;
  }

  main {
    padding: 14px;
  }

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

  .status-choice-group {
    grid-template-columns: 1fr;
  }

  .student-status-inline {
    align-items: stretch;
    flex-direction: column;
  }

  .student-monthly-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .student-performance-metrics {
    grid-template-columns: 1fr;
  }

  .form-heading {
    flex-direction: column;
  }

  .billing-heading,
  .billing-item-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .billing-status-badge {
    align-self: flex-start;
  }

  .billing-meta-grid {
    grid-template-columns: 1fr;
  }

  .billing-progress li {
    font-size: 10px;
  }

  .student-calendar-grid {
    gap: 4px;
  }

  .calendar-blank,
  .calendar-day {
    min-height: 58px;
  }

  .calendar-day {
    padding: 6px;
  }

  .calendar-day-status {
    display: none;
  }

  table {
    display: block;
    overflow-x: auto;
  }
}
