:root {
  --ink: #0f172a;
  --muted: #64748b;
  --line: #dbe3ee;
  --brand: #1e3a8a;
  --brand2: #0369a1;
  --bg: #eef2f7;
  --card: #ffffff;
  --danger: #dc2626;
  --ok: #15803d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

a {
  color: inherit;
}

.shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 16px;
}

.topbar {
  background: var(--brand);
  color: white;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.portal-topbar {
  position: relative;
  flex-wrap: wrap;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  gap: 8px;
  padding: 10px 14px;
}

.portal-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  min-width: 0;
  text-align: center;
}

.portal-brand img {
  position: absolute;
  left: 14px;
  top: 10px;
  width: 30px;
  height: 30px;
  object-fit: contain;
  padding: 1px;
  border-radius: 4px;
  background: white;
}

.portal-brand-copy {
  width: calc(100% - 58px);
  min-width: 0;
}

.portal-brand .brand {
  font-size: 18px;
  line-height: 1.15;
  text-align: center;
}

.portal-brand .brand-subtitle {
  font-size: 12px;
  line-height: 1.15;
  text-align: center;
}

.portal-user {
  font-size: 12px;
  margin-top: 2px;
  opacity: .9;
}

.portal-topbar .nav a {
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .28);
}

.portal-topbar .nav a:hover,
.portal-topbar .nav a:focus-visible {
  background: white;
  color: var(--brand);
}

.portal-topbar .nav form {
  margin: 0;
}

.portal-topbar .nav {
  justify-content: center;
  width: 100%;
}

.brand {
  font-weight: 800;
  letter-spacing: .2px;
}

.nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.nav a,
.button {
  text-decoration: none;
  border: 0;
  background: var(--brand2);
  color: white;
  padding: 10px 13px;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
}

.button.secondary {
  background: #475569;
}

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

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, .06);
}

.dashboard-hero {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 14px;
}

.dashboard-hero p:last-child {
  grid-column: 1 / -1;
  margin: 0;
}

.dashboard-logo {
  width: 66px;
  height: 66px;
  object-fit: contain;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: white;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.dashboard-card {
  display: block;
  min-height: 150px;
  padding: 18px;
  text-decoration: none;
  background: white;
  border: 1.5px solid var(--brand);
  border-radius: 8px;
  color: inherit;
  box-shadow: 0 10px 24px rgba(15, 23, 42, .08);
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.dashboard-card:hover {
  transform: translateY(-2px);
  border-color: var(--brand);
  box-shadow: 0 16px 30px rgba(15, 23, 42, .14);
}

.report-tile-icon {
  display: block;
  min-height: 42px;
  font-size: 34px;
  font-weight: 900;
  line-height: 1;
  color: #2563eb;
}

.report-tile-icon.green {
  color: #10b981;
}

.report-tile-icon.teal {
  color: #0f766e;
}

.report-tile-icon.purple {
  color: #7c3aed;
}

.report-tile-title,
.report-tile-subtitle {
  display: block;
}

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

.payslip-filter {
  display: flex;
  align-items: end;
  gap: 12px;
  margin: 18px 0;
}

.payslip-filter label {
  margin: 0;
  flex: 1;
}

.payslip-filter .button {
  white-space: nowrap;
}

.payslip-paper {
  border: 1px solid var(--line);
  border-top: 4px solid var(--brand);
  padding: 18px;
  margin-top: 16px;
  background: #fff;
}

.payslip-paper table {
  margin-top: 16px;
}

@media (max-width: 620px) {
  .payslip-heading,
  .payslip-filter {
    display: grid;
  }
}

@media print {
  .topbar,
  .payslip-filter,
  .payslip-heading .button,
  .notice {
    display: none !important;
  }

  body,
  .shell {
    background: white;
    padding: 0;
    margin: 0;
  }

  .payslip-card,
  .payslip-paper {
    border: 0;
    box-shadow: none;
  }
}

.report-tile-title {
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
  margin-top: 10px;
}

.report-tile-subtitle {
  color: var(--muted);
  margin-top: 2px;
}

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

@media (max-width: 520px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
}

.login-card {
  width: min(420px, 100%);
}

.login-brand-block {
  display: grid;
  justify-items: center;
  gap: 10px;
  text-align: center;
  margin-bottom: 8px;
}

.login-logo {
  width: 92px;
  height: 92px;
  object-fit: contain;
  border-radius: 18px;
  background: white;
  border: 1px solid var(--line);
  box-shadow: 0 10px 24px rgba(15, 23, 42, .12);
}

.portal-school-name {
  color: #0f172a;
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.25;
  margin-top: -2px;
}

.brand-subtitle {
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .04em;
  opacity: .9;
}

h1,
h2,
h3 {
  margin: 0 0 12px;
}

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

label {
  display: block;
  font-weight: 700;
  margin: 12px 0 6px;
}

input,
select,
textarea {
  width: 100%;
  border: 1.5px solid var(--brand);
  border-radius: 6px;
  padding: 10px;
  font: inherit;
  background: white;
}

.password-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.eye-button {
  border: 0;
  background: #475569;
  color: white;
  border-radius: 6px;
  padding: 10px 12px;
  font-weight: 700;
  cursor: pointer;
}

.muted-link {
  display: inline-block;
  margin-top: 14px;
  color: var(--muted);
  font-weight: 700;
  text-decoration: none;
}

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

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

th {
  color: var(--muted);
  font-size: 13px;
}

.status-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.status-group label {
  margin: 0;
  font-weight: 600;
}

.status-group input {
  width: auto;
}

.notice {
  background: #dbeafe;
  border: 1px solid #93c5fd;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 14px;
}

.error {
  background: #fee2e2;
  border-color: #fecaca;
}

@media (max-width: 720px) {
  .topbar:not(.portal-topbar) {
    align-items: flex-start;
    flex-direction: column;
  }

  table {
    font-size: 13px;
  }

  th,
  td {
    padding: 7px;
  }
}
