:root {
  --navy: #14213d;
  --navy-soft: #203254;
  --blue: #2f67f6;
  --blue-dark: #2555d7;
  --blue-light: #edf3ff;
  --green: #138a62;
  --green-light: #e9f8f2;
  --amber: #c87a11;
  --amber-light: #fff5e6;
  --violet: #7157d9;
  --violet-light: #f1edff;
  --red: #c93f55;
  --red-light: #fff0f2;
  --ink: #1f2937;
  --muted: #667085;
  --line: #e5e9f0;
  --surface: #ffffff;
  --background: #f4f6fa;
  --shadow: 0 18px 45px rgba(20, 33, 61, 0.12);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--background);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.login-view {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 1.05fr 0.95fr;
  align-items: center;
  padding: 64px 8vw;
  background:
    radial-gradient(circle at 15% 20%, rgba(47, 103, 246, 0.22), transparent 32%),
    linear-gradient(125deg, #101c34 0 49%, #f4f6fa 49% 100%);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  color: white;
  align-self: start;
}

.login-brand strong,
.sidebar-brand strong {
  display: block;
  line-height: 1.15;
  letter-spacing: 0.02em;
}

.login-brand strong {
  font-size: 22px;
}

.sidebar-brand strong {
  max-width: 145px;
  font-size: 13px;
}

.login-brand span,
.sidebar-brand span {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  opacity: 0.72;
}

.login-brand .brand-motto {
  display: block;
  margin-top: 8px;
  font-size: 13px;
  font-style: italic;
  opacity: 0.9;
}

.brand-mark {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: 15px;
  color: white;
  background: var(--blue);
  box-shadow: 0 10px 25px rgba(47, 103, 246, 0.35);
  font-size: 25px;
  font-weight: 800;
}

.brand-mark.small {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  font-size: 19px;
}

.brand-logo {
  display: block;
  flex: 0 0 auto;
  object-fit: contain;
}

.login-logo {
  width: 96px;
  height: 96px;
}

.sidebar-logo {
  width: 46px;
  height: 46px;
}

.login-card {
  width: min(460px, 100%);
  justify-self: end;
  padding: 42px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.login-heading {
  margin-bottom: 28px;
}

.login-heading h1 {
  margin: 7px 0 10px;
  color: var(--navy);
  font-size: 30px;
  line-height: 1.2;
}

.login-heading p,
.panel-heading p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.eyebrow {
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.eyebrow.light {
  color: #b9d0ff;
}

.stack-form,
.stack-form label {
  display: grid;
  gap: 8px;
}

.stack-form {
  gap: 18px;
}

label > span {
  color: #344054;
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #d8dee8;
  border-radius: 10px;
  outline: none;
  color: var(--ink);
  background: white;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input,
select {
  min-height: 44px;
  padding: 0 12px;
}

textarea {
  padding: 12px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(47, 103, 246, 0.12);
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 68px;
}

.icon-button {
  position: absolute;
  top: 50%;
  right: 8px;
  border: 0;
  color: var(--blue);
  background: transparent;
  transform: translateY(-50%);
  font-size: 12px;
  font-weight: 700;
}

.primary-button,
.secondary-button {
  min-height: 42px;
  padding: 0 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 750;
}

.primary-button {
  border: 1px solid var(--blue);
  color: white;
  background: var(--blue);
  box-shadow: 0 7px 18px rgba(47, 103, 246, 0.18);
}

.primary-button:hover {
  border-color: var(--blue-dark);
  background: var(--blue-dark);
}

.secondary-button {
  border: 1px solid #d7dde7;
  color: #344054;
  background: white;
}

.secondary-button.light {
  border-color: rgba(255, 255, 255, 0.7);
  color: var(--navy);
}

.full-width {
  width: 100%;
  margin-top: 2px;
}

.demo-note {
  display: grid;
  gap: 4px;
  margin-top: 22px;
  padding: 13px 15px;
  border-radius: 10px;
  color: #42526b;
  background: #f1f5fb;
  font-size: 12px;
}

.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 248px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  height: 100vh;
  flex-direction: column;
  padding: 24px 18px;
  color: white;
  background: var(--navy);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 28px;
}

.nav-list {
  display: grid;
  gap: 7px;
}

.nav-item {
  display: flex;
  min-height: 46px;
  align-items: center;
  gap: 12px;
  padding: 0 13px;
  border: 0;
  border-radius: 10px;
  color: #b9c2d2;
  background: transparent;
  text-align: left;
  font-size: 14px;
  font-weight: 650;
}

.nav-item:hover,
.nav-item.active {
  color: white;
  background: var(--navy-soft);
}

.nav-icon {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 12px;
  font-weight: 800;
}

.nav-item.active .nav-icon {
  background: var(--blue);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.current-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.current-user > div:last-child {
  min-width: 0;
}

.current-user strong,
.current-user span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.current-user strong {
  font-size: 13px;
}

.current-user span {
  margin-top: 3px;
  color: #aeb9ca;
  font-size: 11px;
}

.avatar {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.logout-button {
  width: 100%;
  margin-top: 14px;
  padding: 9px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9px;
  color: #c7cfdb;
  background: transparent;
  font-size: 12px;
}

.main-content {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  min-height: 82px;
  align-items: center;
  gap: 18px;
  padding: 14px 34px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
}

.topbar h1 {
  margin: 3px 0 0;
  color: var(--navy);
  font-size: 22px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: auto;
}

.sector-switcher {
  display: flex;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #f4f6fa;
}

.sector-switch {
  min-height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font-size: 11px;
  font-weight: 750;
}

.sector-switch.active {
  color: white;
  background: var(--blue);
  box-shadow: 0 4px 10px rgba(47, 103, 246, 0.2);
}

.school-level-filter {
  width: auto;
  min-width: 155px;
  min-height: 40px;
  font-size: 11px;
}

.date-label {
  color: var(--muted);
  font-size: 12px;
}

.menu-button {
  display: none;
  border: 0;
  background: transparent;
  font-size: 22px;
}

.page {
  display: none;
  padding: 28px 34px 42px;
}

.page.active {
  display: block;
}

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

.sector-card {
  position: relative;
  display: grid;
  min-height: 190px;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 26px;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 20px;
  color: var(--ink);
  background: white;
  box-shadow: 0 10px 28px rgba(20, 33, 61, 0.08);
  text-align: left;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.sector-card::after {
  position: absolute;
  right: -55px;
  bottom: -75px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: rgba(47, 103, 246, 0.06);
  content: "";
}

.sector-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(20, 33, 61, 0.12);
}

.sector-card.active {
  border-color: var(--blue);
}

.sector-card.courses.active {
  border-color: var(--violet);
}

.sector-card-icon {
  display: grid;
  width: 62px;
  height: 62px;
  place-items: center;
  border-radius: 17px;
  color: white;
  background: linear-gradient(145deg, #244fae, var(--blue));
  font-size: 15px;
  font-weight: 850;
}

.sector-card.courses .sector-card-icon {
  background: linear-gradient(145deg, #5840b7, var(--violet));
}

.sector-card-content {
  min-width: 0;
}

.sector-card-content h2 {
  margin: 5px 0 7px;
  color: var(--navy);
  font-size: 24px;
}

.sector-card-content p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.sector-levels {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 13px;
}

.sector-levels span {
  padding: 5px 7px;
  border-radius: 7px;
  color: #52637e;
  background: #f1f4f8;
  font-size: 9px;
  font-weight: 700;
}

.sector-card-count {
  z-index: 1;
  min-width: 58px;
  text-align: center;
}

.sector-card-count strong,
.sector-card-count span {
  display: block;
}

.sector-card-count strong {
  color: var(--navy);
  font-size: 30px;
}

.sector-card-count span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
}

.welcome-banner {
  display: flex;
  min-height: 176px;
  align-items: center;
  justify-content: space-between;
  padding: 34px 38px;
  overflow: hidden;
  border-radius: 20px;
  color: white;
  background:
    radial-gradient(circle at 85% 20%, rgba(255, 255, 255, 0.18), transparent 24%),
    linear-gradient(120deg, #234fae, #2f67f6);
  box-shadow: 0 16px 35px rgba(47, 103, 246, 0.2);
}

.welcome-banner h2 {
  margin: 8px 0;
  font-size: 28px;
}

.welcome-banner p {
  margin: 0;
  color: #dce7ff;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin: 20px 0;
}

.stat-card {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 14px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.stat-icon {
  display: grid;
  width: 43px;
  height: 43px;
  flex: 0 0 43px;
  place-items: center;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 850;
}

.stat-icon.blue {
  color: var(--blue);
  background: var(--blue-light);
}

.stat-icon.green {
  color: var(--green);
  background: var(--green-light);
}

.stat-icon.violet {
  color: var(--violet);
  background: var(--violet-light);
}

.stat-icon.amber {
  color: var(--amber);
  background: var(--amber-light);
}

.stat-icon.teal {
  color: #087f8c;
  background: #e8f8fa;
}

.stat-card span,
.stat-card strong {
  display: block;
}

.stat-card span {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-card strong {
  margin-top: 5px;
  color: var(--navy);
  font-size: 25px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.8fr);
  gap: 20px;
}

.panel-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.admin-contract-types {
  margin-top: 20px;
}

.template-upload-box {
  margin-top: 18px;
  padding: 15px;
  border: 1px solid #cfd9e8;
  border-radius: 12px;
  background: #f8faff;
}

.template-upload-heading,
.template-upload-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.template-upload-heading {
  justify-content: space-between;
}

.template-upload-heading strong,
.template-upload-heading small,
.template-file-label span,
.template-file-label small {
  display: block;
}

.template-upload-heading strong,
.template-file-label span {
  color: var(--navy);
  font-size: 12px;
  font-weight: 750;
}

.template-upload-heading small,
.template-file-label small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.template-file-label {
  display: grid;
  gap: 7px;
  margin-top: 14px;
}

.template-file-label input {
  padding: 9px;
  border: 1px dashed #9cafd0;
  background: white;
}

.template-status {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  color: #12664a;
  background: var(--green-light);
  font-size: 10px;
  font-weight: 750;
}

.initial-payment-box {
  padding: 15px;
  border: 1px solid #b8e4d3;
  border-radius: 12px;
  background: var(--green-light);
}

.initial-payment-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.initial-payment-heading strong,
.initial-payment-heading small {
  display: block;
}

.initial-payment-heading strong {
  color: #12664a;
  font-size: 13px;
}

.initial-payment-heading small {
  margin-top: 4px;
  color: #386452;
  font-size: 10px;
}

.initial-payment-heading > span {
  padding: 6px 10px;
  border-radius: 999px;
  color: white;
  background: var(--green);
  font-size: 11px;
  font-weight: 800;
}

.initial-payment-box.free-contract-payment {
  border-color: #b9c9f2;
  background: #eef3ff;
}

.initial-payment-box.free-contract-payment .initial-payment-heading strong {
  color: #294a82;
}

.initial-payment-box.free-contract-payment .initial-payment-heading small {
  color: #536b91;
}

.initial-payment-box.free-contract-payment .initial-payment-heading > span {
  background: var(--blue);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
}

.panel-heading h3 {
  margin: 0 0 4px;
  color: var(--navy);
  font-size: 16px;
}

.panel-heading p {
  font-size: 12px;
}

.text-button {
  padding: 4px;
  border: 0;
  color: var(--blue);
  background: transparent;
  font-size: 12px;
  font-weight: 750;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

th,
td {
  padding: 14px 18px;
  border-bottom: 1px solid #eef1f5;
  text-align: left;
  font-size: 12px;
}

th {
  color: #697386;
  background: #fafbfc;
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

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

tbody tr:hover {
  background: #fbfcfe;
}

.table-primary {
  display: block;
  color: var(--navy);
  font-weight: 750;
}

.table-secondary {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.align-right {
  text-align: right;
}

.admin-config-table th:last-child,
.admin-config-table td:last-child {
  position: sticky;
  right: 0;
  z-index: 1;
  min-width: 190px;
  background: white;
  box-shadow: -8px 0 14px -14px rgba(16, 24, 40, 0.55);
}

.admin-config-table th:last-child {
  z-index: 2;
  background: #fafbfc;
}

.status-badge,
.permission-chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 750;
}

.status-badge.active {
  color: var(--green);
  background: var(--green-light);
}

.status-badge.pending {
  color: var(--amber);
  background: var(--amber-light);
}

.status-badge.inactive,
.status-badge.cancelled {
  color: var(--red);
  background: var(--red-light);
}

.status-badge.completed {
  color: var(--violet);
  background: var(--violet-light);
}

.permission-chip {
  margin: 2px 3px 2px 0;
  color: #4b5d7b;
  background: #eff2f7;
}

.quick-actions {
  display: grid;
  gap: 10px;
  padding: 18px;
}

.quick-action {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: white;
  text-align: left;
}

.quick-action:hover {
  border-color: #b7c9f8;
  background: #f8faff;
}

.quick-action > span {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 9px;
  color: var(--blue);
  background: var(--blue-light);
  font-size: 20px;
}

.quick-action strong,
.quick-action small {
  display: block;
}

.quick-action strong {
  font-size: 12px;
}

.quick-action small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.page-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.search-box {
  position: relative;
  width: min(390px, 100%);
}

.search-box span {
  position: absolute;
  top: 50%;
  left: 13px;
  color: #8a94a6;
  transform: translateY(-50%);
}

.search-box input {
  padding-left: 37px;
  background: white;
}

.filter-group {
  display: flex;
  gap: 10px;
}

.filter-group select {
  min-width: 170px;
}

.month-filter,
.period-mode-filter {
  display: flex;
  align-items: center;
  gap: 9px;
  padding-left: 12px;
  border: 1px solid #d8dee8;
  border-radius: 10px;
  background: white;
}

.period-mode-toggle {
  display: flex;
  gap: 3px;
  padding: 3px;
  border-radius: 8px;
  background: #eef1f6;
}

.period-mode-toggle button {
  min-height: 30px;
  padding: 5px 10px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-size: 10px;
  font-weight: 800;
}

.period-mode-toggle button.active {
  color: var(--blue);
  background: white;
  box-shadow: 0 1px 4px rgba(16, 35, 63, 0.12);
}

.month-filter input {
  min-width: 145px;
  border: 0;
  box-shadow: none;
}

#financeTodayButton {
  min-height: 42px;
  padding-inline: 14px;
}

#paymentContractSearchHelp {
  color: var(--muted);
  font-size: 9px;
}

.finance-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.finance-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--blue);
  border-radius: 14px;
  background: white;
}

.finance-card.paid {
  border-top-color: var(--green);
}

.finance-card.due {
  border-top-color: var(--red);
}

.finance-card span,
.finance-card strong,
.finance-card small {
  display: block;
}

.finance-card span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.finance-card strong {
  margin-top: 8px;
  color: var(--navy);
  font-size: 23px;
}

.finance-card small {
  margin-top: 6px;
  color: #8a94a6;
  font-size: 10px;
}

.finance-payments {
  margin-top: 18px;
}

.amount-paid {
  color: var(--green);
  font-weight: 750;
}

.amount-due {
  color: var(--red) !important;
  font-weight: 750;
}

.action-button {
  padding: 6px 9px;
  border: 1px solid #dbe1e9;
  border-radius: 8px;
  color: #42526b;
  background: white;
  font-size: 10px;
  font-weight: 750;
}

.action-button:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.action-button.danger:hover {
  border-color: var(--red);
  color: var(--red);
}

.action-button.delete-action {
  border-color: #fecdca;
  color: #b42318;
  background: #fffafa;
}

.action-button.delete-action:hover {
  border-color: #b42318;
  color: #8f1d14;
  background: #fff1f0;
}

.maintenance-card {
  border: 1px solid #fecdca;
  background: #fffafa;
}

.maintenance-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.danger-zone-button {
  padding: 10px 14px;
  border: 1px solid #fda29b;
  border-radius: 10px;
  color: #b42318;
  background: white;
  font-size: 11px;
  font-weight: 800;
}

.danger-zone-button:hover {
  border-color: #b42318;
  color: white;
  background: #b42318;
}

.empty-row {
  padding: 38px 18px;
  color: var(--muted);
  text-align: center;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(13, 24, 45, 0.62);
  backdrop-filter: blur(3px);
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 60;
  width: min(640px, calc(100vw - 32px));
  max-height: calc(100vh - 34px);
  overflow: hidden;
  border-radius: 18px;
  background: white;
  box-shadow: 0 28px 70px rgba(10, 20, 38, 0.28);
  transform: translate(-50%, -50%);
}

.modal.large {
  width: min(1040px, calc(100vw - 32px));
}

.modal.pdf-viewer-modal {
  width: min(1180px, calc(100vw - 24px));
  height: calc(100vh - 24px);
  max-height: calc(100vh - 24px);
}

.modal-header,
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
}

.modal-header {
  border-bottom: 1px solid var(--line);
}

.modal-header h2 {
  margin: 4px 0 0;
  color: var(--navy);
  font-size: 20px;
}

.modal-close {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: #667085;
  background: white;
  font-size: 22px;
}

.modal-body {
  max-height: calc(100vh - 185px);
  padding: 24px;
  overflow-y: auto;
}

.modal-footer {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  background: #fafbfc;
}

.pdf-viewer-body {
  position: relative;
  height: calc(100vh - 157px);
  padding: 12px;
  background: #e8edf5;
}

.pdf-viewer-body iframe {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 10px;
  background: white;
}

.pdf-viewer-fallback {
  position: absolute;
  inset: 12px;
  display: grid;
  place-content: center;
  gap: 8px;
  border-radius: 10px;
  color: var(--navy);
  background: white;
  text-align: center;
}

.pdf-viewer-fallback span {
  color: var(--muted);
  font-size: 12px;
}

.form-grid {
  display: grid;
  gap: 16px;
}

.form-grid label {
  display: grid;
  align-content: start;
  gap: 7px;
}

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

.three-columns {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.span-two {
  grid-column: span 2;
}

.span-three {
  grid-column: span 3;
}

.span-four {
  grid-column: 1 / -1;
}

.permissions-box,
.form-section {
  min-width: 0;
  margin: 22px 0 0;
  padding: 0;
  border: 0;
}

.permissions-box legend {
  margin-bottom: 10px;
  color: #344054;
  font-size: 13px;
  font-weight: 750;
}

.check-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.check-card + .check-card {
  margin-top: 9px;
}

.check-card input {
  width: 16px;
  min-height: 16px;
  margin-top: 2px;
}

.check-card strong,
.check-card small,
.switch-row strong,
.switch-row small {
  display: block;
}

.check-card strong,
.switch-row strong {
  font-size: 12px;
}

.check-card small,
.switch-row small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 18px;
  padding: 13px;
  border-radius: 10px;
  background: #f7f8fa;
}

.switch-row input {
  width: 18px;
  min-height: 18px;
}

.free-contract-switch {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  margin-top: 0;
  border: 1px solid #cbd7f0;
  background: #f4f7ff;
}

.free-contract-switch strong {
  color: var(--navy);
}

.free-contract-switch input {
  accent-color: var(--blue);
}

.contract-form-body {
  background: #f8f9fb;
}

.form-section {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: white;
}

.form-section:first-of-type {
  margin-top: 0;
}

.form-section legend {
  padding: 0 8px 0 0;
  color: var(--navy);
  font-size: 13px;
  font-weight: 800;
}

.form-section legend span {
  display: inline-grid;
  width: 23px;
  height: 23px;
  margin-right: 6px;
  place-items: center;
  border-radius: 7px;
  color: white;
  background: var(--blue);
  font-size: 10px;
}

.info-notice {
  margin-bottom: 16px;
  padding: 11px 14px;
  border: 1px solid #b8e4d3;
  border-radius: 10px;
  color: #12664a;
  background: var(--green-light);
  font-size: 12px;
  font-weight: 650;
}

.parent-form-grid {
  display: grid;
  gap: 14px;
}

.parent-form-card,
.signing-parent-section {
  padding: 16px;
  border: 1px solid #dce4f1;
  border-radius: 12px;
  background: #fbfcff;
}

.parent-form-title {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 14px;
}

.parent-form-title > span {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  place-items: center;
  border-radius: 9px;
  color: white;
  background: var(--blue);
  font-size: 12px;
  font-weight: 850;
}

.parent-form-title strong,
.parent-form-title small,
.subsection-heading strong,
.subsection-heading small {
  display: block;
}

.parent-form-title strong,
.subsection-heading strong {
  color: var(--navy);
  font-size: 13px;
}

.parent-form-title small,
.subsection-heading small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.signing-parent-section {
  margin-top: 14px;
}

.subsection-heading {
  margin-bottom: 14px;
}

#otherGuardianFields {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.parent-extra-fields {
  margin-top: 16px;
}

.installment-section {
  margin-top: 20px;
  overflow: hidden;
  border: 1px solid #dce4f1;
  border-radius: 12px;
  background: #fbfcff;
}

.installment-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid #e4e9f1;
}

.installment-heading strong,
.installment-heading small {
  display: block;
}

.installment-heading strong {
  color: var(--navy);
  font-size: 13px;
}

.installment-heading small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.installment-heading > span {
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--green);
  background: var(--green-light);
  font-size: 12px;
  font-weight: 800;
}

.installment-table input {
  min-width: 145px;
  min-height: 38px;
  font-size: 11px;
}

.installment-table .installment-amount {
  color: var(--navy);
  background: #f2f5fa;
  font-weight: 750;
}

.payment-balance-info {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 20px;
  padding: 14px;
  border-radius: 12px;
  background: #f2f5fa;
}

.payment-balance-info div {
  padding: 10px;
  border-radius: 9px;
  background: white;
}

.payment-balance-info span,
.payment-balance-info strong {
  display: block;
}

.payment-balance-info span {
  color: var(--muted);
  font-size: 10px;
}

.payment-balance-info strong {
  margin-top: 5px;
  color: var(--navy);
  font-size: 12px;
}

.details-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px;
  border-radius: 14px;
  color: white;
  background: linear-gradient(120deg, var(--navy), #294a82);
}

.finance-history-header .history-total {
  text-align: right;
}

.details-header .history-total strong {
  display: block;
  margin-top: 6px;
  color: white;
  font-size: 22px;
}

.history-table {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.history-table.compact {
  margin-top: 12px;
}

.details-header h3 {
  margin: 6px 0 0;
  font-size: 24px;
}

.details-header span {
  color: #c6d4ea;
  font-size: 11px;
}

.student-profile-identity,
.student-profile-actions,
.student-documents-heading,
.student-document-row,
.student-document-info,
.student-document-actions {
  display: flex;
  align-items: center;
}

.student-profile-identity {
  gap: 16px;
}

.student-profile-identity small {
  display: block;
  margin-top: 6px;
  color: #dbe6f7;
  font-size: 11px;
  font-weight: 750;
}

.student-profile-photo {
  display: grid;
  width: 82px;
  height: 102px;
  flex: 0 0 82px;
  overflow: hidden;
  place-items: center;
  border: 3px solid rgba(255, 255, 255, 0.7);
  border-radius: 12px;
  color: white;
  background: rgba(255, 255, 255, 0.14);
  font-size: 22px;
  font-weight: 850;
}

.student-profile-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.student-profile-actions {
  align-items: stretch;
  flex-direction: column;
  gap: 8px;
}

.profile-button {
  min-height: 34px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 9px;
  color: var(--navy);
  background: white;
  font-size: 10px;
  font-weight: 800;
}

.profile-button.subtle {
  color: white;
  background: transparent;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.detail-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.detail-card span,
.detail-card strong {
  display: block;
}

.detail-card span {
  color: var(--muted);
  font-size: 10px;
}

.detail-card strong {
  margin-top: 6px;
  color: var(--navy);
  font-size: 12px;
}

.detail-card.due-detail-card {
  border-color: #fecdca;
  background: #fffafa;
}

.detail-card.due-detail-card strong {
  color: var(--red);
}

.detail-section-title {
  margin: 24px 0 10px;
  color: var(--navy);
  font-size: 14px;
}

.student-notes-card {
  margin-top: 20px;
  padding: 16px;
  border: 1px solid #dce4f1;
  border-radius: 12px;
  background: #fbfcff;
}

.student-notes-card textarea {
  width: 100%;
  margin-top: 12px;
  resize: vertical;
  background: white;
}

.student-note-attachment-field {
  display: grid;
  gap: 7px;
  margin-top: 12px;
  padding: 12px;
  border: 1px dashed #cbd5e4;
  border-radius: 10px;
  background: white;
}

.student-note-attachment-field > span {
  color: var(--navy);
  font-size: 10px;
  font-weight: 800;
}

.student-note-attachment-field input {
  min-height: 38px;
  padding: 7px 9px;
  font-size: 10px;
}

.student-note-attachment-field small {
  color: var(--muted);
  font-size: 9px;
}

.student-profile-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 24px;
}

.student-notes-card .student-profile-section-heading {
  margin-top: 0;
}

.student-profile-section-heading h3,
.student-profile-section-heading p {
  margin: 0;
}

.student-profile-section-heading h3 {
  color: var(--navy);
  font-size: 14px;
}

.student-profile-section-heading p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
}

.student-profile-section-heading > strong {
  color: var(--navy);
  font-size: 16px;
  white-space: nowrap;
}

.compact-button {
  min-height: 34px;
  padding: 8px 13px;
  font-size: 10px;
  white-space: nowrap;
}

.student-profile-table {
  margin-top: 10px;
}

.student-profile-table th,
.student-profile-table td {
  white-space: nowrap;
}

.student-profile-table td:nth-child(2),
.student-profile-table td:nth-child(3) {
  white-space: normal;
}

.student-note-history-heading {
  padding-top: 4px;
  border-top: 1px solid var(--line);
}

.student-note-history-list {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.student-note-history-item {
  padding: 16px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 11px;
  background: #fbfcff;
}

.student-note-history-meta,
.student-note-file,
.student-note-file > div {
  display: flex;
  align-items: center;
}

.student-note-history-meta,
.student-note-file {
  justify-content: space-between;
  gap: 16px;
}

.student-note-history-meta strong,
.student-note-history-meta span,
.student-note-file strong,
.student-note-file small {
  display: block;
}

.student-note-history-meta strong {
  color: var(--navy);
  font-size: 11px;
}

.student-note-history-meta span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
}

.student-note-history-item > p {
  margin: 14px 0 0;
  color: #344054;
  font-size: 12px;
  line-height: 1.65;
}

.student-note-file {
  margin-top: 14px;
  padding: 11px 12px;
  border-radius: 9px;
  background: #eef3fa;
}

.student-note-file > div {
  gap: 6px;
}

.student-note-file > div:first-child {
  display: block;
  min-width: 0;
}

.student-note-file strong {
  overflow: hidden;
  color: var(--navy);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.student-note-file small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 8px;
}

.student-note-history-empty {
  margin-top: 12px;
  padding: 20px;
  border: 1px dashed var(--line);
  border-radius: 11px;
  color: var(--muted);
  background: #fbfcff;
  text-align: center;
  font-size: 11px;
}

.student-documents-heading {
  justify-content: space-between;
  gap: 20px;
  margin-top: 24px;
}

.student-documents-heading .detail-section-title {
  margin: 0;
}

.student-documents-heading p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.document-completion {
  min-width: 96px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--green);
  background: var(--green-light);
  text-align: center;
}

.document-completion span,
.document-completion strong {
  display: block;
}

.document-completion span {
  font-size: 9px;
}

.document-completion strong {
  margin-top: 3px;
  font-size: 17px;
}

.student-document-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.student-document-row {
  justify-content: space-between;
  gap: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fbfcff;
}

.student-document-info {
  min-width: 0;
  gap: 12px;
}

.student-document-icon {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  border-radius: 10px;
  color: var(--blue);
  background: var(--blue-light);
  font-size: 11px;
  font-weight: 850;
}

.student-document-info strong,
.student-document-info small {
  display: block;
}

.student-document-info strong {
  color: var(--navy);
  font-size: 12px;
}

.student-document-info small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
}

.student-document-programs {
  margin-top: 6px;
}

.student-document-programs span {
  display: inline-block;
  margin: 0 4px 3px 0;
  padding: 3px 6px;
  border-radius: 5px;
  color: #49617f;
  background: #eef3fa;
  font-size: 8px;
  font-weight: 750;
}

.student-document-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.student-documents-empty {
  margin-top: 12px;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 11px;
  color: var(--muted);
  text-align: center;
  font-size: 11px;
}

.student-file-viewer-body {
  display: grid;
  height: calc(100vh - 157px);
  padding: 12px;
  overflow: auto;
  place-items: center;
  background: #e8edf5;
}

.student-file-viewer-body iframe {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 10px;
  background: white;
}

.student-file-viewer-body img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(16, 35, 63, 0.16);
}

.word-ready-card {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
  padding: 15px 16px;
  border: 1px solid #b8e4d3;
  border-radius: 12px;
  background: var(--green-light);
}

.word-ready-icon {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  border-radius: 9px;
  color: white;
  background: #185abd;
  font-size: 17px;
  font-weight: 850;
}

.word-ready-card strong,
.word-ready-card span {
  display: block;
}

.word-ready-card strong {
  color: var(--navy);
  font-size: 13px;
}

.word-ready-card span {
  margin-top: 4px;
  color: #386452;
  font-size: 11px;
}

.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 100;
  max-width: 360px;
  padding: 13px 17px;
  border-radius: 10px;
  color: white;
  background: var(--navy);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-12px);
  transition: opacity 0.2s, transform 0.2s;
  font-size: 12px;
  font-weight: 650;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.toast.error {
  background: #9f2f41;
}

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

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

  .finance-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topbar-actions {
    gap: 8px;
  }

  .date-label {
    display: none;
  }
}

@media (max-width: 780px) {
  .login-view {
    grid-template-columns: 1fr;
    padding: 24px;
    background: linear-gradient(165deg, #101c34 0 28%, #f4f6fa 28% 100%);
  }

  .login-brand {
    margin-bottom: 50px;
  }

  .login-card {
    justify-self: center;
    padding: 28px 22px;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    left: -270px;
    width: 248px;
    transition: left 0.22s;
  }

  .sidebar.open {
    left: 0;
    box-shadow: 15px 0 40px rgba(10, 20, 38, 0.28);
  }

  .menu-button {
    display: block;
  }

  .topbar {
    padding: 12px 18px;
  }

  .topbar-actions {
    max-width: 58%;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .sector-switch {
    padding: 0 8px;
  }

  .school-level-filter {
    min-width: 142px;
    min-height: 34px;
  }

  .topbar-actions .primary-button {
    display: none;
  }

  .page {
    padding: 20px 16px 34px;
  }

  .welcome-banner {
    align-items: flex-start;
    flex-direction: column;
    gap: 24px;
    padding: 28px 24px;
  }

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

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

  .sector-card {
    min-height: 170px;
    grid-template-columns: auto 1fr;
    padding: 20px;
  }

  .sector-card-count {
    position: absolute;
    top: 16px;
    right: 18px;
  }

  .sector-card-content {
    padding-right: 35px;
  }

  .page-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .search-box {
    width: 100%;
  }

  .filter-group {
    align-items: stretch;
    flex-direction: column;
  }

  .month-filter {
    justify-content: space-between;
  }

  .finance-summary,
  .payment-balance-info {
    grid-template-columns: 1fr;
  }

  .installment-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .installment-section .table-wrap {
    overflow: visible;
  }

  .installment-table,
  .installment-table tbody,
  .installment-table tr,
  .installment-table td {
    display: block;
    width: 100%;
  }

  .installment-table thead {
    display: none;
  }

  .installment-table tr {
    padding: 12px 14px;
    border-bottom: 1px solid #e4e9f1;
  }

  .installment-table tr:last-child {
    border-bottom: 0;
  }

  .installment-table td {
    display: grid;
    grid-template-columns: 82px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    border: 0;
  }

  .installment-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .installment-table input {
    width: 100%;
    min-width: 0;
  }

  .two-columns,
  .three-columns,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .student-profile-header,
  .student-document-row,
  .student-documents-heading,
  .student-profile-section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .student-profile-actions,
  .student-document-actions {
    width: 100%;
  }

  .student-document-actions {
    justify-content: flex-start;
  }

  .student-profile-section-heading > strong {
    align-self: flex-start;
  }

  .student-notes-card .compact-button {
    align-self: flex-start;
  }

  .student-note-history-meta,
  .student-note-file {
    align-items: flex-start;
    flex-direction: column;
  }

  .student-note-file > div:last-child {
    flex-wrap: wrap;
  }

  .span-two,
  .span-three {
    grid-column: span 1;
  }

  .modal {
    width: calc(100vw - 18px);
    max-height: calc(100vh - 18px);
  }

  .modal-body {
    max-height: calc(100vh - 170px);
    padding: 18px;
  }

  .modal-header,
  .modal-footer {
    padding: 15px 18px;
  }
}

@media print {
  body * {
    visibility: hidden;
  }

  #contractDetailsModal,
  #contractDetailsModal * {
    visibility: visible;
  }

  #contractDetailsModal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    max-height: none;
    box-shadow: none;
    transform: none;
  }

  #contractDetailsModal .modal-header,
  #contractDetailsModal .modal-footer {
    display: none;
  }

  #contractDetailsModal .modal-body {
    max-height: none;
    overflow: visible;
  }
}
