:root {
  color-scheme: light;
  --ink: #202b38;
  --ink-soft: #536171;
  --muted: #788391;
  --navy: #1d2d42;
  --navy-soft: #2b3e56;
  --wine: #773f49;
  --wine-dark: #60323a;
  --brass: #b28a4a;
  --paper: #f5f5f2;
  --surface: #ffffff;
  --line: #dfe3e5;
  --line-dark: #cbd1d5;
  --success: #2e684a;
  --success-bg: #edf5ef;
  --error: #9a3535;
  --error-bg: #fbefed;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

html { min-width: 320px; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  line-height: 1.55;
}

a { color: var(--wine); }
a:hover { color: var(--wine-dark); }

:focus-visible {
  outline: 3px solid #b28a4a;
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  top: -60px;
  left: 16px;
  z-index: 10;
  padding: 9px 13px;
  color: #fff;
  background: var(--navy);
}
.skip-link:focus { top: 12px; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-header { background: var(--surface); }
.masthead {
  width: min(1200px, calc(100% - 48px));
  min-height: 82px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand {
  min-width: 220px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--navy);
  text-decoration: none;
}
.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--brass);
  color: var(--brass);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .04em;
}
.brand-copy { display: grid; line-height: 1.25; }
.brand-copy strong { font-family: Georgia, "Times New Roman", serif; font-size: 20px; font-weight: 700; }
.brand-copy small { margin-top: 3px; color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.portal-label { color: var(--muted); font-size: 13px; }
.account-controls { display: flex; align-items: center; gap: 18px; }
.user-label { display: grid; line-height: 1.3; text-align: right; }
.user-label small { color: var(--muted); font-size: 11px; }
.user-label strong { color: var(--navy); font-size: 13px; font-weight: 650; }
.inline-form { display: inline; margin: 0; }
.signout-button {
  padding: 8px 12px;
  border: 1px solid var(--line-dark);
  border-radius: 3px;
  color: var(--navy);
  background: #fff;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.signout-button:hover { border-color: var(--wine); color: var(--wine); }

.nav-band { background: var(--navy); }
.primary-nav {
  width: min(1200px, calc(100% - 48px));
  min-height: 48px;
  margin: 0 auto;
  display: flex;
  align-items: stretch;
  gap: 3px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.primary-nav a {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  padding: 0 15px;
  border-bottom: 3px solid transparent;
  color: #e9edf1;
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
}
.primary-nav a:hover { color: #fff; background: #ffffff0b; }
.primary-nav a[aria-current="page"] { border-bottom-color: var(--brass); color: #fff; }

.container {
  width: min(1120px, calc(100% - 48px));
  margin: 40px auto 68px;
  flex: 1 0 auto;
}
.public-layout .container { width: min(1000px, calc(100% - 40px)); }
.narrow { width: min(920px, calc(100% - 40px)); }
.eyebrow {
  margin: 0 0 8px;
  color: var(--wine);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
}
h1, h2, h3 { color: var(--navy); }
h1 {
  margin: 0 0 10px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(29px, 4vw, 38px);
  font-weight: 700;
  letter-spacing: -.025em;
  line-height: 1.18;
}
h2 { margin: 0 0 12px; font-size: 18px; line-height: 1.35; }
h3 { margin: 0 0 8px; font-size: 15px; }
p { margin-top: 0; }
.muted { color: var(--ink-soft); line-height: 1.65; }
.page-intro { margin-bottom: 24px; }
.page-intro .muted { max-width: 760px; margin-bottom: 0; }
.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin: 4px 0 22px;
}
.page-heading .muted { margin: 4px 0 0; }

.login-shell {
  display: grid;
  grid-template-columns: minmax(240px, .85fr) minmax(340px, 1.15fr);
  max-width: 850px;
  margin: 5vh auto 0;
  border: 1px solid var(--line);
  background: var(--surface);
}
.login-aside {
  min-height: 410px;
  padding: 34px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--navy);
  color: #fff;
}
.login-aside .eyebrow { color: #d7bd8c; }
.login-aside h2 {
  max-width: 290px;
  margin: 18px 0;
  color: #fff;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 29px;
  line-height: 1.24;
}
.login-aside p { color: #d8dfe6; font-size: 14px; }
.login-aside-rule { width: 54px; height: 2px; margin: 22px 0; background: var(--brass); }
.login-card { padding: 40px 42px; }
.login-card h1 { font-size: 30px; }
.login-card .muted { margin-bottom: 0; }

.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 25px 0;
}
.cards.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stat-card, .panel {
  border: 1px solid var(--line);
  background: var(--surface);
}
.stat-card {
  min-height: 150px;
  padding: 20px 22px;
  display: grid;
  align-content: start;
  gap: 6px;
  border-top: 3px solid var(--navy-soft);
  color: var(--ink);
  text-decoration: none;
  transition: border-color .15s ease, background-color .15s ease;
}
.stat-card:hover { border-top-color: var(--brass); background: #fdfdfb; color: var(--ink); }
.stat-card span, .profile-grid span { color: var(--muted); font-size: 12px; }
.stat-card strong { color: var(--navy); font-family: Georgia, "Times New Roman", serif; font-size: 33px; line-height: 1.2; }
.stat-card small { margin-top: 3px; color: var(--ink-soft); font-size: 13px; }
.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin: 36px 0 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line-dark);
}
.section-heading .eyebrow { margin-bottom: 3px; }
.section-heading h2 { margin: 0; }
.quick-actions { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 14px; }
.quick-actions .stat-card { min-height: 118px; border-top-width: 1px; border-left: 3px solid var(--brass); }
.quick-actions .stat-card span { color: var(--navy); font-size: 14px; font-weight: 700; }
.quick-actions .stat-card small { color: var(--muted); }

.panel { margin-top: 20px; padding: 22px; }
.panel > :last-child { margin-bottom: 0; }
.profile-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; padding: 0; }
.profile-grid div { min-width: 0; padding: 20px 22px; border-right: 1px solid var(--line); }
.profile-grid div:last-child { border-right: 0; }
.profile-grid span, .profile-grid strong { display: block; }
.profile-grid strong { margin-top: 5px; color: var(--navy); font-size: 16px; overflow-wrap: anywhere; }

.search-bar { display: flex; align-items: center; gap: 10px; margin: 20px 0; }
.search-bar input { max-width: 480px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 12px 13px; border-bottom: 1px solid #e9ecee; text-align: left; vertical-align: top; }
th {
  color: #425063;
  background: #f1f3f3;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .055em;
  text-transform: uppercase;
  white-space: nowrap;
}
td { color: #354253; }
tbody tr:nth-child(even) { background: #fbfbfa; }
tbody tr:hover { background: #f7f5f0; }
tr:last-child td { border-bottom: 0; }
.empty { padding: 30px 18px; color: var(--muted); text-align: center; }
.actions { display: flex; align-items: center; gap: 12px; white-space: nowrap; }
.actions a { font-weight: 650; }
.danger { color: #a33131 !important; }

.stack { display: grid; gap: 17px; margin-top: 23px; }
label { display: grid; gap: 7px; color: #344254; font-size: 13px; font-weight: 650; }
input, select, textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line-dark);
  border-radius: 3px;
  background: #fff;
  padding: 9px 11px;
  color: var(--ink);
  font: inherit;
  font-weight: 400;
}
input::placeholder, textarea::placeholder { color: #9aa2a9; }
input:focus, select:focus, textarea:focus { border-color: var(--wine); outline: 2px solid #773f4925; }
textarea { min-height: 92px; resize: vertical; }
button { font: inherit; cursor: pointer; }
.button, button.primary, button.secondary {
  min-height: 40px;
  padding: 9px 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 3px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}
.primary { color: #fff; background: var(--wine); }
.primary:hover { color: #fff; background: var(--wine-dark); }
.secondary { border-color: var(--line-dark) !important; color: var(--navy); background: #fff; }
.secondary:hover { border-color: var(--navy) !important; background: #f7f8f8; }
.link-button { padding: 0; border: 0; color: var(--wine); background: none; font: inherit; cursor: pointer; }
.link-button:hover { color: var(--wine-dark); text-decoration: underline; }
.notice { margin: 0 0 16px; padding: 11px 14px; border-left: 3px solid; font-size: 13px; }
.notice.success { border-color: var(--success); color: var(--success); background: var(--success-bg); }
.notice.error { border-color: var(--error); color: var(--error); background: var(--error-bg); }

.form-panel { padding: clamp(20px, 4vw, 34px); }
.form-panel hr { margin: 30px 0; border: 0; border-top: 1px solid var(--line); }
.form-panel h2 { margin-bottom: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .wide { grid-column: 1 / -1; }
.required { color: var(--wine); }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 25px; }
.account-grid { max-width: 760px; }
.section-rule { margin: 32px 0 18px; border: 0; border-top: 1px solid var(--line); }
.date-filter { display: flex; align-items: end; gap: 12px; margin: 20px 0; }
.date-filter label { width: min(260px, 100%); }
.save-button { margin-top: 17px; }
.fee-cards { align-items: start; }
.fee-cards .panel { margin-top: 0; }
.compact-form { margin: 16px 0 24px; }
.compact-form .form-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.check-row { display: flex; align-items: center; gap: 9px; font-weight: 550; }
.check-row input { width: 17px; min-height: 17px; height: 17px; margin: 0; accent-color: var(--wine); }
.month-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 11px; }
.password-panel { max-width: 600px; }
.assignment-panel { max-width: 680px; }
.assignment-panel form { max-width: 420px; }
.assignment-panel p { margin-bottom: 18px; }
.term-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin: 22px 0 30px;
  border: 1px solid var(--line);
  background: #fff;
}
.term-strip div { min-width: 170px; padding: 14px 20px; border-right: 1px solid var(--line); }
.term-strip div:last-child { border-right: 0; }
.term-strip span, .term-strip strong { display: block; }
.term-strip span { color: var(--muted); font-size: 12px; }
.term-strip strong { margin-top: 3px; color: var(--navy); font-size: 16px; }
.course-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.course-card { display: grid; align-content: start; gap: 12px; margin: 0; }
.course-card h2 { margin: -5px 0 0; }
.course-card p { margin: 0; }
.course-card .primary { justify-self: start; }
.course-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 10px 0; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: 12px; }
.button-row { display: flex; flex-wrap: wrap; gap: 9px; }
.status-pill { display: inline-flex; align-items: center; padding: 3px 8px; border: 1px solid var(--line-dark); border-radius: 99px; color: var(--ink-soft); background: #f8f8f6; font-size: 11px; font-weight: 700; }
.status-pill.approved { border-color: #b9d6c2; color: var(--success); background: var(--success-bg); }
.status-pill.pending { border-color: #e2d3aa; color: #765915; background: #faf6e8; }
.status-pill.rejected { border-color: #e0baba; color: var(--error); background: var(--error-bg); }
.notice-list { display: grid; gap: 12px; }
.notice-card { margin-top: 0; }
.notice-card h2, .notice-card h3 { margin: 9px 0; }
.notice-card p { margin: 0; white-space: pre-line; }
.notice-meta { color: var(--muted); font-size: 11px; }
.notice-card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.schedule-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.schedule-day { margin: 0; }
.schedule-day h2 { padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.schedule-entry { display: grid; gap: 3px; padding: 12px 0; border-bottom: 1px solid #edf0f1; }
.schedule-entry:last-child { border-bottom: 0; }
.schedule-entry time { color: var(--wine); font-size: 12px; font-weight: 700; }
.schedule-entry strong { color: var(--navy); font-size: 14px; }
.schedule-entry span { color: var(--muted); font-size: 12px; }
.filter-tabs { display: flex; gap: 6px; margin: 18px 0; border-bottom: 1px solid var(--line-dark); }
.filter-tabs a { padding: 9px 12px; color: var(--ink-soft); text-decoration: none; }
.filter-tabs a.active { border-bottom: 2px solid var(--wine); color: var(--navy); font-weight: 700; }
.inline-action { display: flex; align-items: center; gap: 6px; min-width: 180px; }
.inline-action select { min-width: 100px; min-height: 34px; padding: 4px 7px; }
.inline-action button { min-height: 34px; padding: 6px 9px; }
.grade-input { width: 90px; min-width: 75px; }
.attendance-choice select { min-width: 120px; }
.small-note { margin-top: 15px; font-size: 12px; }
.button-row .button { min-height: 38px; }
.error-panel { max-width: 680px; margin: 8vh auto 0; padding: clamp(24px, 5vw, 42px); }
.error-panel h1 { max-width: 560px; }
.error-panel p:not(.eyebrow) { margin: 16px 0 24px; color: var(--ink-soft); }
.footer {
  width: 100%;
  padding: 19px 24px 22px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  background: #fff;
  font-size: 11px;
  text-align: center;
}

@media (max-width: 900px) {
  .quick-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .course-grid, .schedule-grid { grid-template-columns: 1fr; }
  .profile-grid div:nth-child(2) { border-right: 0; }
  .profile-grid div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}

@media (max-width: 640px) {
  .masthead, .primary-nav { width: calc(100% - 32px); }
  .masthead { min-height: 72px; gap: 12px; }
  .brand { min-width: 0; }
  .brand-mark { width: 37px; height: 37px; }
  .brand-copy strong { font-size: 17px; }
  .brand-copy small { font-size: 9px; }
  .portal-label { display: none; }
  .account-controls { gap: 10px; }
  .user-label small { display: none; }
  .signout-button { padding: 7px 9px; }
  .primary-nav { min-height: 44px; }
  .primary-nav a { padding: 0 11px; font-size: 12px; }
  .container, .public-layout .container, .narrow { width: calc(100% - 32px); margin-top: 27px; margin-bottom: 42px; }
  .page-heading { align-items: flex-start; flex-direction: column; gap: 12px; }
  .cards, .cards.two, .quick-actions { grid-template-columns: 1fr; gap: 11px; }
  .stat-card { min-height: 0; padding: 17px; }
  .quick-actions .stat-card { min-height: 0; }
  .profile-grid { grid-template-columns: 1fr 1fr; }
  .profile-grid div { padding: 15px; }
  .login-shell { grid-template-columns: 1fr; margin-top: 0; }
  .login-aside { min-height: 0; padding: 24px; }
  .login-aside h2 { max-width: none; margin: 10px 0; font-size: 24px; }
  .login-aside-rule { margin: 14px 0; }
  .login-card { padding: 26px 24px; }
  .panel { padding: 17px; }
  .form-grid, .compact-form .form-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: auto; }
  .search-bar { align-items: stretch; flex-wrap: wrap; }
  .search-bar input { max-width: none; }
  .date-filter { align-items: stretch; flex-direction: column; }
  .date-filter label { width: 100%; }
  .month-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .term-strip div { flex: 1 1 50%; border-bottom: 1px solid var(--line); }
  .term-strip div:nth-child(even) { border-right: 0; }
  .filter-tabs { overflow-x: auto; }
  .inline-action { min-width: 160px; }
  th, td { padding: 10px 11px; }
  .footer { padding-inline: 16px; }
}

@media print {
  .site-header, .footer, .skip-link, .button-row, button, a.button { display: none !important; }
  body { background: #fff !important; color: #000 !important; font-size: 12pt; }
  .container { max-width: 100% !important; margin: 0 !important; padding: 0 !important; }
  .panel { border: none !important; box-shadow: none !important; padding: 0 !important; }
  table { width: 100% !important; border-collapse: collapse !important; }
  th, td { border-bottom: 1px solid #ddd !important; padding: 6px 8px !important; }
}
