:root {
  color-scheme: light;
  --navy-950: #071b2d;
  --navy-900: #0d263d;
  --navy-800: #153a58;
  --navy-700: #245372;
  --ink: #172634;
  --muted: #647587;
  --line: #dbe3e9;
  --canvas: #f3f6f8;
  --paper: #ffffff;
  --green: #14785a;
  --green-soft: #e6f4ee;
  --amber: #a55c07;
  --amber-soft: #fff2d9;
  --red: #a83c3c;
  --red-soft: #fdeaea;
  --blue: #1f65a5;
  --blue-soft: #e9f2fb;
  --shadow: 0 10px 30px rgba(21, 43, 61, 0.08);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-size: 16px;
}

.learner-picker {
  border: 1px solid #cad8e5;
  border-radius: 12px;
  background: #f7fbff;
  padding: 16px;
}

.learner-picker .card-head {
  margin-bottom: 14px;
}

.learner-picker h3 {
  margin: 2px 0 0;
  color: var(--navy);
}

@media print {
  .learner-picker {
    border-color: #777;
    background: #fff;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
}

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

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 276px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 16px 18px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  color: #eef6fb;
  background:
    linear-gradient(150deg, rgba(32, 95, 116, 0.35), transparent 32%),
    var(--navy-950);
}

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

.brand-mark,
.school-logo,
.receipt-mark {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 10px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

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

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

.brand span {
  margin-top: 2px;
  color: #9fb6c6;
  font-size: 0.8rem;
}

.school-card {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px;
  margin-bottom: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
}

.school-logo {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  color: var(--navy-950);
  background: #e7b95a;
}

.school-card div:last-child {
  min-width: 0;
}

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

.school-card small {
  color: #90a8b8;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
}

.school-card strong {
  margin: 3px 0;
  overflow: hidden;
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.school-card span {
  color: #a9bdca;
  font-size: 0.72rem;
}

nav {
  display: grid;
  gap: 3px;
}

.nav-section {
  padding: 14px 10px 5px;
  color: #718c9d;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.nav-button {
  width: 100%;
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 9px;
  padding: 10px 11px;
  border: 0;
  border-radius: 8px;
  color: #afc1cd;
  background: transparent;
  font-size: 0.82rem;
  text-align: left;
}

.nav-button:hover,
.nav-button.active {
  color: white;
  background: rgba(255, 255, 255, 0.1);
}

.nav-button.active {
  box-shadow: inset 3px 0 #e7b95a;
}

.nav-icon {
  font-size: 1rem;
  text-align: center;
}

.nav-count {
  min-width: 22px;
  padding: 3px 6px;
  border-radius: 10px;
  color: var(--navy-950);
  background: #e7b95a;
  font-size: 0.68rem;
  font-weight: 800;
  text-align: center;
}

.sidebar-foot {
  margin-top: auto;
  padding-top: 18px;
  display: grid;
  gap: 7px;
}

.side-action {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  color: #d9e6ed;
  background: transparent;
  font-size: 0.76rem;
  text-align: left;
}

.module-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.module-disabled {
  cursor: default;
  opacity: 0.82;
}

.coming-soon,
.version-label {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.4;
}

.coming-soon {
  color: #614000;
  background: #f7cf79;
}

.version-label {
  margin-left: 6px;
  color: #e5f3ff;
  background: rgba(255, 255, 255, 0.14);
  vertical-align: middle;
}

.module-coming-soon {
  display: block;
  margin-top: 5px;
  color: #c2d5e2;
  font-size: 0.82rem;
}

.module-directory > a,
.module-directory > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 15px 0;
  border-top: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
}

.module-directory small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.feedback-button {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 90;
  display: inline-flex;
  align-items: center;
  min-height: 46px;
  padding: 11px 17px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 999px;
  color: #ffffff;
  background: #167b55;
  box-shadow: 0 10px 26px rgba(7, 27, 45, 0.22);
  font-size: 0.9rem;
  font-weight: 800;
  text-decoration: none;
}

.feedback-button:hover {
  background: #106646;
}

.feedback-button:focus-visible {
  outline: 3px solid #3481c4;
  outline-offset: 3px;
}

@media (max-width: 600px) {
  .feedback-button {
    right: 12px;
    bottom: 12px;
    min-height: 44px;
    padding: 10px 14px;
    font-size: 0.82rem;
  }
}

@media print {
  .feedback-button {
    display: none !important;
  }
}

.sidebar-foot span {
  padding: 7px 4px 0;
  color: #7590a2;
  font-size: 0.68rem;
}

main {
  min-width: 0;
}

.topbar {
  min-height: 72px;
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 12px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
}

.topbar-left,
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-left div span,
.topbar-left div strong {
  display: block;
}

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

#page-crumb {
  margin-top: 2px;
  font-size: 0.92rem;
}

.topbar-actions label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.75rem;
}

select,
input,
textarea {
  border: 1px solid #cad5dd;
  border-radius: 8px;
  color: var(--ink);
  background: white;
}

select,
input {
  min-height: 40px;
  padding: 8px 10px;
}

textarea {
  min-height: 86px;
  padding: 10px;
  resize: vertical;
}

.role-pill,
.status,
.tag {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  font-weight: 700;
}

.role-pill {
  padding: 7px 10px;
  color: var(--navy-800);
  background: #eaf0f4;
  font-size: 0.72rem;
}

.avatar,
.icon-button {
  display: grid;
  place-items: center;
  border: 0;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: white;
  background: var(--navy-800);
  font-size: 0.75rem;
  font-weight: 800;
}

.icon-button {
  min-width: 36px;
  min-height: 36px;
  border-radius: 8px;
  color: var(--navy-800);
  background: #edf2f5;
}

.content {
  max-width: 1580px;
  margin: 0 auto;
  padding: 28px;
}

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

.eyebrow {
  color: var(--navy-700);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.page-head h1 {
  margin: 5px 0 5px;
  color: var(--navy-950);
  font-size: clamp(1.55rem, 2.2vw, 2.15rem);
  line-height: 1.15;
}

.page-head p {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.page-actions,
.toolbar,
.inline-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
}

.button {
  min-height: 40px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 750;
}

.button.primary {
  color: white;
  background: var(--navy-800);
}

.button.primary:hover {
  background: var(--navy-700);
}

.button.secondary {
  border-color: #cdd8df;
  color: var(--navy-800);
  background: white;
}

.button.warning {
  color: #6e4109;
  background: #f9dfac;
}

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

.button.small {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 0.72rem;
}

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

.card,
.kpi {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.kpi {
  position: relative;
  overflow: hidden;
  padding: 18px;
}

.kpi::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--kpi-color, var(--green));
}

.kpi span,
.kpi small,
.kpi strong {
  display: block;
}

.kpi span {
  color: var(--muted);
  font-size: 0.78rem;
}

.kpi strong {
  margin: 8px 0 5px;
  color: var(--navy-950);
  font-size: 1.65rem;
  line-height: 1;
}

.kpi small {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.4;
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.75fr);
  gap: 14px;
}

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

.card {
  padding: 19px;
}

.card.flush {
  padding: 0;
  overflow: hidden;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 16px;
}

.card-head h2 {
  margin: 4px 0 0;
  color: var(--navy-950);
  font-size: 1rem;
}

.card-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

th,
td {
  padding: 11px 14px;
  border-bottom: 1px solid #e8edf0;
  text-align: left;
  vertical-align: middle;
}

th {
  color: #657788;
  background: #f5f8fa;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

tbody tr:hover {
  background: #f9fbfc;
}

.num {
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.status,
.tag {
  padding: 5px 8px;
  font-size: 0.7rem;
}

.status.good,
.tag.green {
  color: var(--green);
  background: var(--green-soft);
}

.status.warn,
.tag.amber {
  color: var(--amber);
  background: var(--amber-soft);
}

.status.bad,
.tag.red {
  color: var(--red);
  background: var(--red-soft);
}

.status.info,
.tag.blue {
  color: var(--blue);
  background: var(--blue-soft);
}

.progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eef2;
}

.progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.budget-row,
.check-row,
.activity-item,
.detail-row {
  display: grid;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid #e7ecef;
}

.activity-item {
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.detail-row {
  grid-template-columns: minmax(160px, 0.7fr) minmax(260px, 1.8fr) auto;
}

.budget-row {
  grid-template-columns: minmax(150px, 1.4fr) 1fr 95px;
}

.budget-row:first-of-type,
.check-row:first-of-type,
.activity-item:first-of-type,
.detail-row:first-of-type {
  border-top: 0;
}

.budget-row b,
.budget-row span,
.activity-item b,
.activity-item span {
  display: block;
}

.budget-row span,
.activity-item span,
.detail-row span {
  color: var(--muted);
  font-size: 0.76rem;
}

.check-row {
  grid-template-columns: 28px minmax(0, 1fr) auto;
}

.check-icon {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--green);
  font-size: 0.75rem;
  font-weight: 800;
}

.check-icon.warn {
  background: var(--amber);
}

.check-row b,
.check-row small {
  display: block;
}

.check-row b {
  font-size: 0.82rem;
}

.check-row small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.4;
}

.cash-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.cash-summary div {
  padding: 13px;
  border-radius: 9px;
  background: #f4f7f9;
}

.cash-summary span,
.cash-summary b {
  display: block;
}

.cash-summary span {
  color: var(--muted);
  font-size: 0.72rem;
}

.cash-summary b {
  margin-top: 5px;
  font-size: 1rem;
}

.notice {
  padding: 12px 14px;
  margin-bottom: 14px;
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  color: #1f4d76;
  background: var(--blue-soft);
  font-size: 0.8rem;
  line-height: 1.55;
}

.notice.warning {
  border-color: var(--amber);
  color: #70440d;
  background: var(--amber-soft);
}

.notice.danger {
  border-color: var(--red);
  color: #7e3030;
  background: var(--red-soft);
}

.toolbar {
  margin-bottom: 14px;
}

.toolbar .search-field {
  min-width: 220px;
  flex: 1;
}

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

.form-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
}

.form-grid .full {
  grid-column: 1 / -1;
}

.form-grid input,
.form-grid select,
.form-grid textarea {
  width: 100%;
}

.field-note {
  margin-top: -2px;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.4;
}

.warning-box {
  grid-column: 1 / -1;
  padding: 11px 12px;
  border-radius: 8px;
  color: #70440d;
  background: var(--amber-soft);
  font-size: 0.76rem;
  line-height: 1.45;
}

dialog {
  width: min(680px, calc(100vw - 30px));
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 0;
  border-radius: 14px;
  box-shadow: 0 24px 80px rgba(4, 25, 42, 0.35);
}

dialog::backdrop {
  background: rgba(4, 19, 31, 0.62);
  backdrop-filter: blur(3px);
}

dialog form {
  padding: 22px;
  overflow-y: auto;
}

.dialog-head,
.dialog-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.dialog-head {
  margin-bottom: 18px;
}

.dialog-head h2 {
  margin: 4px 0 0;
  color: var(--navy-950);
  font-size: 1.25rem;
}

.dialog-actions {
  justify-content: flex-end;
  margin-top: 19px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  max-width: 380px;
  padding: 12px 16px;
  border-radius: 9px;
  color: white;
  background: var(--navy-950);
  box-shadow: var(--shadow);
  font-size: 0.8rem;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: 180ms ease;
}

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

.policy-grid,
.report-grid,
.account-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 13px;
}

.policy-card,
.report-card,
.account-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
}

.policy-card h3,
.report-card h3,
.account-card h3 {
  margin: 0 0 7px;
  font-size: 0.9rem;
}

.policy-card p,
.report-card p,
.account-card p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.55;
}

.policy-card a {
  color: var(--blue);
  font-size: 0.76rem;
  font-weight: 750;
}

.account-card .amount {
  display: block;
  margin: 8px 0;
  color: var(--navy-950);
  font-size: 1.35rem;
  font-weight: 800;
}

.donut {
  width: 150px;
  height: 150px;
  margin: 8px auto 16px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--green) 0 74%, #e5ebef 74% 100%);
}

.donut::after {
  content: "74%";
  width: 108px;
  height: 108px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--navy-950);
  background: white;
  font-size: 1.5rem;
  font-weight: 800;
}

.audit-timeline {
  position: relative;
  display: grid;
  gap: 12px;
}

.audit-item {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.audit-dot {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border: 2px solid white;
  border-radius: 50%;
  background: var(--navy-700);
  box-shadow: 0 0 0 2px #b8c8d2;
}

.audit-item b,
.audit-item span {
  display: block;
}

.audit-item b {
  font-size: 0.8rem;
}

.audit-item span,
.audit-item time {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.7rem;
}

.receipt-preview {
  max-width: 620px;
  margin: 0 auto;
  padding: 26px;
  border: 1px solid #bcc9d1;
  background: white;
}

.receipt-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--navy-900);
}

.receipt-mark {
  width: 54px;
  height: 54px;
  border-radius: 10px;
  color: white;
  background: var(--navy-800);
}

.receipt-lines {
  display: grid;
  gap: 10px;
  padding: 18px 0;
}

.receipt-lines div {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 8px;
  border-bottom: 1px dotted #aebbc4;
  font-size: 0.82rem;
}

.empty-state {
  padding: 36px 20px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 86px minmax(0, 1fr);
  }

  .brand > div:last-child,
  .school-card > div:last-child,
  .nav-button span:not(.nav-icon),
  .nav-section,
  .sidebar-foot span {
    display: none;
  }

  .brand,
  .school-card {
    justify-content: center;
    padding-inline: 4px;
  }

  .nav-button {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .nav-count {
    position: absolute;
    transform: translate(18px, -10px);
  }

  .two-column,
  .balanced-columns {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 760px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 12;
    width: min(290px, 88vw);
    transform: translateX(-100%);
    transition: transform 180ms ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .brand > div:last-child,
  .school-card > div:last-child,
  .nav-button span:not(.nav-icon),
  .nav-section,
  .sidebar-foot span {
    display: block;
  }

  .brand,
  .school-card {
    justify-content: flex-start;
    padding-inline: 8px;
  }

  .nav-button {
    grid-template-columns: 24px 1fr auto;
    justify-items: start;
  }

  .nav-count {
    position: static;
    transform: none;
  }

  .topbar,
  .page-head {
    align-items: flex-start;
  }

  .topbar {
    padding: 10px 15px;
  }

  .topbar-actions .role-pill,
  .topbar-actions label {
    display: none;
  }

  .content {
    padding: 18px 14px;
  }

  .page-head {
    display: grid;
  }

  .kpi-grid,
  .policy-grid,
  .report-grid,
  .account-grid,
  .cash-summary {
    grid-template-columns: 1fr;
  }

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

  .detail-row,
  .activity-item,
  .budget-row {
    grid-template-columns: 1fr;
  }

  .form-grid .full {
    grid-column: auto;
  }
}

@media print {
  @page {
    size: A4 landscape;
    margin: 10mm;
  }

  body {
    background: white;
  }

  .app-shell {
    display: block;
  }

  .sidebar,
  .topbar,
  .page-actions,
  .toolbar,
  .toast,
  dialog,
  button {
    display: none !important;
  }

  .content {
    max-width: none;
    padding: 0;
  }

  .card,
  .kpi {
    box-shadow: none;
    break-inside: avoid;
  }

  table {
    font-size: 10pt;
  }

  th,
  td {
    padding: 7px 8px;
  }

  .page-head h1 {
    font-size: 20pt;
  }

  .page-head p,
  .notice,
  .detail-row,
  .check-row b {
    font-size: 10pt;
  }
}

@media print {
  .sidebar,
  .topbar,
  .page-head .page-actions,
  .toolbar,
  .no-print,
  .toast {
    display: none !important;
  }

  .app-shell {
    display: block;
  }

  .content {
    max-width: none;
    padding: 0;
  }

  .card,
  .kpi {
    box-shadow: none;
    break-inside: avoid;
  }

  body,
  table {
    font-size: 11pt;
  }

  th,
  td {
    padding: 8px;
  }

  @page {
    size: A4 landscape;
    margin: 10mm;
  }
}
