:root {
  color-scheme: light;
  --navy-950: #07142f;
  --navy-900: #0b1c46;
  --navy-800: #142e63;
  --gold: #d89b1d;
  --gold-soft: #f7e8c4;
  --ink: #17233d;
  --muted: #6e778a;
  --paper: #f5f3ee;
  --white: #fffefa;
  --line: #ded9cf;
  --success: #187c57;
  --danger: #b53a3a;
  --shadow: 0 22px 60px rgba(12, 27, 60, 0.14);
  --serif: Georgia, "Times New Roman", serif;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--navy-950); }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  background: var(--paper);
}

button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }

.boot-screen,
.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 18px;
  background:
    radial-gradient(circle at 78% 18%, rgba(216, 155, 29, 0.13), transparent 26%),
    linear-gradient(145deg, #07142f 0%, #102858 100%);
}

.boot-screen { color: rgba(255, 255, 255, 0.72); text-align: center; }
.boot-logo { display: block; width: min(280px, 68vw); max-height: 150px; margin: 0 auto 18px; }

.auth-card {
  width: min(440px, 100%);
  padding: 38px 36px 34px;
  border: 1px solid rgba(216, 155, 29, 0.32);
  border-radius: 24px;
  color: #fff;
  background: #080808;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.42);
}

.auth-logo {
  display: block;
  width: min(318px, 100%);
  height: 140px;
  margin: -8px auto 20px;
  object-fit: contain;
}

.auth-card h1 { margin: 0 0 8px; font-family: var(--serif); font-size: 2rem; }
.auth-card .lead { margin: 0 0 24px; color: #aaa; line-height: 1.6; }
.setup-badge { display: inline-flex; margin-bottom: 14px; color: var(--gold); font-size: .73rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }

.field { display: grid; gap: 8px; margin-bottom: 17px; }
.field label { font-size: .84rem; font-weight: 750; }
.field small { color: #8a8a8a; line-height: 1.4; }
.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid #4a4a4a;
  border-radius: 12px;
  color: #fff;
  background: #151515;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}

.field input:focus,
.field select:focus,
.field textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(216, 155, 29, .18); }

.btn {
  min-height: 45px;
  padding: 11px 18px;
  border: 1px solid transparent;
  border-radius: 11px;
  font-weight: 800;
  transition: transform .14s, opacity .14s, background .14s;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { cursor: wait; opacity: .62; transform: none; }
.btn-primary { color: #0b1020; background: var(--gold); }
.btn-secondary { color: var(--ink); border-color: var(--line); background: var(--white); }
.btn-dark { color: #fff; border-color: #3c3c3c; background: #191919; }
.btn-block { width: 100%; }

.form-error {
  margin: 0 0 16px;
  padding: 11px 13px;
  border-left: 3px solid #e65a5a;
  border-radius: 7px;
  color: #ffd7d7;
  background: rgba(181, 58, 58, .16);
  line-height: 1.4;
}

.shell { min-height: 100vh; display: grid; grid-template-columns: 248px 1fr; }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 24px 15px 18px;
  color: white;
  background: linear-gradient(180deg, var(--navy-900), var(--navy-950));
}
.brand { padding: 2px 10px 20px; border-bottom: 1px solid rgba(255,255,255,.1); }
.brand img { width: 174px; height: 78px; object-fit: contain; object-position: left center; }
.brand strong { display: block; margin-top: 3px; font-family: var(--serif); font-size: 1.05rem; line-height: 1.25; }

.nav { display: grid; gap: 4px; padding: 18px 0; overflow-y: auto; }
.nav-button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 45px;
  padding: 10px 12px;
  border: 0;
  border-left: 3px solid transparent;
  border-radius: 10px;
  color: #d9e2f7;
  background: transparent;
  text-align: left;
  font-weight: 700;
}
.nav-button:hover { background: rgba(255,255,255,.07); }
.nav-button.active { border-left-color: var(--gold); color: white; background: rgba(255,255,255,.12); }
.nav-icon { width: 21px; text-align: center; color: var(--gold); }

.sidebar-user { margin-top: auto; padding: 16px 10px 4px; border-top: 1px solid rgba(255,255,255,.1); }
.sidebar-user strong { display: block; font-size: .85rem; }
.sidebar-user span { display: block; margin-top: 4px; color: #aebbd8; font-size: .72rem; word-break: break-word; }

.workspace { min-width: 0; }
.topbar {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 30px;
  border-bottom: 1px solid #e2ded5;
  background: rgba(245, 243, 238, .94);
  backdrop-filter: blur(12px);
}
.topbar h1 { margin: 2px 0 0; font-family: var(--serif); font-size: clamp(1.65rem, 3vw, 2.15rem); }
.eyebrow { color: var(--gold); font-size: .68rem; font-weight: 850; letter-spacing: .14em; text-transform: uppercase; }
.top-actions { display: flex; gap: 10px; }
.menu-button { display: none; }

.content { padding: 28px 30px 52px; }
.hero {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  min-height: 188px;
  padding: 34px 36px;
  border-radius: 23px;
  color: white;
  background: linear-gradient(125deg, var(--navy-950), var(--navy-800));
  box-shadow: var(--shadow);
}
.hero::after { content: ""; position: absolute; right: -50px; top: -70px; width: 220px; height: 220px; border: 1px solid rgba(216,155,29,.42); border-radius: 50%; }
.hero-copy { position: relative; z-index: 1; }
.hero h2 { margin: 12px 0 7px; font-family: var(--serif); font-size: clamp(1.8rem, 4vw, 2.6rem); }
.hero p { margin: 0; color: #d5def1; line-height: 1.55; }

.score-orb {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  width: 128px;
  height: 128px;
  display: grid;
  place-items: center;
  border: 9px solid rgba(255,255,255,.15);
  border-top-color: var(--gold);
  border-radius: 50%;
  text-align: center;
}
.score-orb strong { display: block; font-family: var(--serif); font-size: 2.1rem; }
.score-orb span { display: block; color: #d5def1; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; }

.grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 18px; margin-top: 20px; }
.card { padding: 23px; border: 1px solid var(--line); border-radius: 17px; background: var(--white); box-shadow: 0 12px 34px rgba(13,30,65,.06); }
.card h3 { margin: 6px 0 16px; font-family: var(--serif); font-size: 1.35rem; }
.card p { color: var(--muted); line-height: 1.6; }
.card-main { grid-column: span 8; }
.card-side { grid-column: span 4; }
.module-card { grid-column: span 4; min-height: 168px; }
.module-card .module-icon { color: var(--gold); font-size: 1.35rem; }
.module-card strong { display: block; margin: 14px 0 7px; font-family: var(--serif); font-size: 1.23rem; }
.module-card p { margin: 0; font-size: .9rem; }

.empty-state { padding: 32px 18px; border-radius: 12px; color: var(--muted); background: #f4f1eb; text-align: center; }
.notice { padding: 15px; border-radius: 12px; color: #765510; background: var(--gold-soft); line-height: 1.55; }
.notification-list { display: grid; gap: 10px; }
.notification-item {
  width: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: #fff;
  text-align: left;
}
.notification-item:hover { border-color: #c6b98e; background: #fffdf8; }
.notification-item strong, .notification-item small { display: block; }
.notification-item strong { font-size: .86rem; line-height: 1.35; }
.notification-item small { margin-top: 4px; color: var(--muted); font-size: .76rem; line-height: 1.45; }
.notification-dot { width: 9px; height: 9px; margin-top: 5px; border-radius: 50%; background: #3d79b8; }
.notification-item.warning .notification-dot { background: var(--gold); }
.notification-item.danger .notification-dot { background: var(--danger); }
.notification-arrow { color: var(--muted); font-size: 1.25rem; line-height: 1; }
.notification-empty { display: grid; gap: 5px; padding: 16px; border-radius: 12px; color: #0b6846; background: #e6f5ee; }
.notification-empty span { color: #3d7361; font-size: .78rem; line-height: 1.45; }
.notification-footnote { margin: 14px 0 0 !important; font-size: .72rem; }
.email-digest-status { display: grid; gap: 4px; margin-bottom: 18px; padding: 14px 16px; border-radius: 13px; }
.email-digest-status.configured { color: #0b6846; background: #e1f4eb; }
.email-digest-status.pending { color: #7a5814; background: var(--gold-soft); }
.email-digest-status span { font-size: .8rem; line-height: 1.45; }
.fixed-setting { display: grid; gap: 4px; margin-bottom: 17px; padding: 13px 15px; border: 1px dashed #cbbd99; border-radius: 12px; background: #fffdf8; }
.fixed-setting span { color: var(--gold); font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.fixed-setting small { color: var(--muted); line-height: 1.45; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.section-heading h3 { margin-bottom: 0; }
.light-form .field input,
.light-form .field select,
.light-form .field textarea {
  color: var(--ink);
  border-color: var(--line);
  background: #fff;
}
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 16px; }
.form-span { grid-column: 1 / -1; }
.modal-wide { width: min(760px, 100%); }
.date-control { min-height: 42px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: #fff; }
.staff-list, .location-list { display: grid; gap: 10px; }
.staff-row { display: grid; grid-template-columns: auto minmax(180px, 1fr) auto auto; align-items: center; gap: 14px; padding: 15px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.avatar { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; color: var(--navy-950); background: var(--gold-soft); font-family: var(--serif); font-weight: 800; }
.staff-copy strong, .staff-copy span, .staff-copy small { display: block; }
.staff-copy span { margin-top: 3px; color: var(--muted); font-size: .82rem; }
.staff-copy small { margin-top: 4px; color: #9298a5; }
.row-actions { display: flex; gap: 7px; }
.pill { display: inline-flex; width: fit-content; padding: 5px 8px; border-radius: 99px; color: #5d6678; background: #eceef2; font-size: .72rem; font-weight: 800; white-space: nowrap; }
.pill.active { color: #0b6846; background: #dff5eb; }
.pill.inactive { color: #9b2929; background: #f9dddd; }
.pill.warning { color: #8a5d08; background: #fbefcf; }
.location-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px; border: 1px solid var(--line); border-radius: 12px; }
.location-item strong, .location-item span { display: block; }
.location-item span { margin-top: 4px; color: var(--muted); font-size: .78rem; }
.qr-modal { text-align: center; }
.qr-modal img { display: block; width: min(360px, 100%); margin: 12px auto; border: 1px solid var(--line); border-radius: 14px; }
.qr-modal .modal-actions { justify-content: center; }
.qr-modal a { display: inline-flex; align-items: center; text-decoration: none; }
.attendance-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; padding: 15px; border-radius: 13px; background: var(--gold-soft); }
.attendance-actions span { flex: 1 1 220px; color: #765510; font-size: .82rem; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 11px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; font-size: .86rem; }
th { color: var(--muted); font-size: .72rem; letter-spacing: .05em; text-transform: uppercase; }
.summary-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.summary-tile { padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.summary-tile span, .summary-tile strong, .summary-tile small { display: block; }
.summary-tile span { color: var(--muted); font-size: .76rem; }
.summary-tile strong { margin: 8px 0; font-family: var(--serif); font-size: 1.25rem; }
.summary-tile small { color: #858d9d; line-height: 1.45; }
.request-list { display: grid; gap: 12px; }
.request-card { padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.request-card p { margin: 12px 0 8px; color: var(--ink); }
.request-card small { display: block; margin-bottom: 10px; color: var(--muted); }
.request-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.request-top strong, .request-top span { display: block; }
.request-top div > span { margin-top: 5px; color: var(--muted); font-size: .78rem; }
.report-section { margin-bottom: 24px; padding-bottom: 22px; border-bottom: 1px dashed var(--line); }
.report-section h4 { margin: 0 0 13px; color: var(--navy-900); font-family: var(--serif); font-size: 1.2rem; }
.report-section small { color: var(--muted); }
.task-list { display: grid; gap: 12px; }
.task-card { padding: 16px; border: 1px solid #dde2ea; border-radius: 15px; background: #f7f9fc; }
.task-check { display: flex; align-items: flex-start; gap: 11px; color: #38465f; font-weight: 750; line-height: 1.45; }
.task-check input, .confirmation input, .pupil-row input[type="checkbox"] { width: 19px; height: 19px; flex: 0 0 auto; accent-color: var(--gold); }
.task-note { width: 100%; margin-top: 12px; padding: 11px 12px; border: 1px dashed #cdd5e2 !important; border-radius: 10px !important; background: white !important; }
.confirmation { display: flex; align-items: flex-start; gap: 10px; padding: 14px; border: 1px dashed var(--gold); border-radius: 12px; color: #5f4c24; background: #fffaf0; font-size: .86rem; font-weight: 700; }
.pupil-row { display: grid; grid-template-columns: minmax(180px, 1fr) auto auto; align-items: center; gap: 10px; margin-bottom: 9px; padding: 11px; border-radius: 12px; background: #f4f6f9; }
.pupil-row .pupil-name { min-height: 42px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; }
.pupil-row label { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: .78rem; }
.submit-large { min-height: 55px; font-size: 1rem; }
.report-admin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.report-admin-card { padding: 17px; border: 1px solid var(--line); border-left: 4px solid var(--success); border-radius: 14px; background: white; }
.report-admin-card.yellow { border-left-color: var(--gold); }
.report-admin-card.red, .report-admin-card.missing { border-left-color: var(--danger); }
.incident-box { margin-top: 14px; padding: 13px; border-radius: 11px; background: #f7f8fa; }
.incident-box strong { display: block; margin-top: 7px; color: var(--muted); font-size: .7rem; letter-spacing: .05em; text-transform: uppercase; }
.incident-box p { margin: 5px 0 9px; color: var(--ink); }
.incident-box small { color: var(--danger); font-weight: 750; }
.absence-box { margin-top: 12px; padding: 11px; border-radius: 10px; color: #7a5710; background: var(--gold-soft); font-size: .82rem; }
.settings-subsection { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); }
.holiday-form { display: grid; grid-template-columns: 180px minmax(180px, 1fr) auto; align-items: end; gap: 10px; }
.holiday-form .field { margin-bottom: 0; }
.holiday-list { display: grid; gap: 8px; margin-top: 14px; }
.holiday-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 11px; }
.holiday-item strong, .holiday-item span { display: block; }
.holiday-item span { margin-top: 3px; color: var(--muted); font-size: .76rem; }
.readiness-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 13px; padding: 14px 16px; border-radius: 12px; }
.readiness-summary.ready { color: #155d43; background: #e3f4ec; }
.readiness-summary.not-ready { color: #81232b; background: #f9e2e4; }
.readiness-summary strong, .readiness-summary span { display: block; }
.readiness-summary span { font-size: .78rem; }
.readiness-checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.readiness-item { display: flex; align-items: flex-start; gap: 11px; padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.readiness-icon { display: grid; place-items: center; width: 24px; height: 24px; flex: 0 0 auto; border-radius: 50%; color: #fff; background: var(--success); font-weight: 900; }
.readiness-item.warning .readiness-icon { background: var(--gold); }
.readiness-item.fail .readiness-icon { background: var(--danger); }
.readiness-item strong, .readiness-item small { display: block; }
.readiness-item small { margin-top: 4px; color: var(--muted); line-height: 1.4; }
.backup-note { margin: 13px 0 0; color: var(--muted); font-size: .76rem; line-height: 1.5; }
.monthly-upload { display: flex; align-items: end; gap: 12px; margin-bottom: 20px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #f7f5f0; }
.monthly-upload .field { flex: 1; margin: 0; }
.monthly-upload .field input { color: var(--ink); border-color: var(--line); background: white; }
.payslip-toolbar { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 9px; }
.payslip-actions { flex-wrap: wrap; }
.payslip-modal { width: min(940px, 96vw); max-height: 94vh; }
.payslip-note { margin: 4px 0 22px; }
.payslip-item-section { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.payslip-item-section .section-heading { margin-bottom: 11px; }
.payslip-item-section h3 { margin: 5px 0 0; font-family: var(--serif); font-size: 1.1rem; }
.payslip-item-list { display: grid; gap: 8px; }
.payslip-item-row { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(150px, 210px) auto; gap: 9px; align-items: center; }
.payslip-item-row > input,
.money-input { min-height: 43px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: #fff; }
.payslip-item-row > input { width: 100%; padding: 9px 11px; }
.money-input { display: grid; grid-template-columns: auto 1fr; align-items: center; overflow: hidden; }
.money-input span { padding-left: 11px; color: var(--muted); font-size: .82rem; font-weight: 750; }
.money-input input { width: 100%; min-height: 41px; padding: 8px 10px 8px 7px; border: 0; outline: 0; color: var(--ink); background: transparent; }
.payslip-totals { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; margin-top: 24px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #f7f5f0; }
.payslip-totals > div { padding: 11px; border-radius: 10px; background: white; }
.payslip-totals span, .payslip-totals strong { display: block; }
.payslip-totals span { color: var(--muted); font-size: .72rem; }
.payslip-totals strong { margin-top: 6px; font-family: var(--serif); font-size: 1.02rem; }
.payslip-totals .net { color: var(--navy-950); background: var(--gold-soft); }
.payslip-totals.invalid .net { color: var(--danger); background: #f9dddd; }
.table-note { display: block; margin-top: 5px; color: var(--muted); font-size: .72rem; font-weight: 400; }
.pdf-modal { width: min(1120px, 96vw); height: min(860px, 94vh); display: flex; flex-direction: column; overflow: hidden; }
.pdf-frame { flex: 1; width: 100%; min-height: 520px; border: 1px solid var(--line); border-radius: 13px; background: #e9e9e9; }
.pdf-full-link { display: inline-flex; align-items: center; text-decoration: none; }
.document-list { display: grid; gap: 12px; }
.document-card { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 18px; border: 1px solid var(--line); border-radius: 15px; background: #fff; }
.document-copy { min-width: 0; }
.document-meta, .document-statuses { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.document-meta > span:not(.pill) { color: var(--muted); font-size: .76rem; }
.document-card h4 { margin: 11px 0 5px; font-family: var(--serif); font-size: 1.16rem; }
.document-card p { margin: 0 0 11px; font-size: .8rem; overflow-wrap: anywhere; }
.document-actions { display: flex; flex: 0 0 auto; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.document-target-section { margin: 18px 0; padding: 17px; border: 1px solid var(--line); border-radius: 14px; background: #f7f5f0; }
.document-target-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 12px; }
.document-target-grid > label { display: flex; align-items: flex-start; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: white; }
.document-target-grid input { width: 18px; height: 18px; flex: 0 0 auto; accent-color: var(--gold); }
.document-target-grid strong, .document-target-grid small { display: block; }
.document-target-grid small { margin-top: 3px; color: var(--muted); overflow-wrap: anywhere; }
.document-records-modal { width: min(900px, 96vw); }
.document-record-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.document-record-summary > div { padding: 14px; border-radius: 12px; background: #f4f1eb; }
.document-record-summary span, .document-record-summary strong { display: block; }
.document-record-summary span { color: var(--muted); font-size: .76rem; }
.document-record-summary strong { margin-top: 4px; font-family: var(--serif); font-size: 1.16rem; }
.kpi-heading { align-items: flex-end; }
.kpi-controls { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 9px; }
.kpi-controls #kpi-year { width: 105px; }
.kpi-layout > section > h3 { font-family: var(--serif); }
.kpi-target-list { display: grid; gap: 14px; }
.kpi-target-card { padding: 17px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.kpi-target-card > div:first-child { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.kpi-target-card strong { font-family: var(--serif); font-size: 1.08rem; }
.kpi-target-card p { margin: 7px 0 0; font-size: .84rem; }
.rating-badge { display: inline-flex; margin-top: 12px; padding: 7px 10px; border-radius: 99px; color: #72500c; background: var(--gold-soft); font-weight: 800; }
.kpi-rating-list { display: grid; gap: 9px; margin-top: 14px; }
.kpi-rating-row { display: grid; grid-template-columns: minmax(140px, 1fr) 75px minmax(160px, 1.5fr) auto; align-items: center; gap: 9px; padding-top: 9px; border-top: 1px solid var(--line); }
.kpi-rating-row > span { font-size: .86rem; font-weight: 700; }
.hr-case-list, .hr-candidate-list { display: grid; gap: 10px; }
.hr-case-card, .hr-candidate-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.hr-case-card > div, .hr-candidate-card > div { min-width: 0; }
.hr-case-card strong, .hr-case-card small, .hr-candidate-card strong, .hr-candidate-card span, .hr-candidate-card small { display: block; }
.hr-case-card strong { margin: 8px 0 5px; font-family: var(--serif); }
.hr-case-card small, .hr-candidate-card small { margin-top: 5px; color: var(--muted); }
.hr-candidate-card span { margin-top: 4px; color: var(--ink); font-size: .86rem; }
.hr-document-modal { width: min(900px, 96vw); }
.hr-meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.hr-meta span { padding: 12px; border-radius: 11px; color: var(--muted); background: #f3f1ec; font-size: .78rem; line-height: 1.45; }
.hr-meta strong { display: block; margin-bottom: 4px; color: var(--ink); }
.letter-editor { min-height: 480px; line-height: 1.65; }
.letter-paper { padding: clamp(20px, 4vw, 44px); border: 1px solid var(--line); border-radius: 14px; background: white; box-shadow: 0 12px 32px rgba(13,30,65,.06); }
.letter-paper h3 { margin: 0 0 26px; font-family: var(--serif); font-size: 1.45rem; }
.letter-body { color: var(--ink); line-height: 1.72; white-space: pre-wrap; }
.hr-document-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 14px; }
.hr-response-form, .hr-response-summary { margin-top: 22px; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: #f8f6f1; }
.hr-response-form .submit-large { width: 100%; margin-top: 14px; }
.hr-response-summary h3 { margin: 7px 0 9px; font-family: var(--serif); }
.hr-response-summary p { margin: 0 0 14px; }
.evidence-timeline { margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--line); }
.evidence-timeline > div { position: relative; display: grid; gap: 3px; margin-left: 8px; padding: 0 0 18px 20px; border-left: 2px solid var(--gold-soft); }
.evidence-timeline > div::before { content: ""; position: absolute; left: -6px; top: 3px; width: 10px; height: 10px; border-radius: 50%; background: var(--gold); }
.evidence-timeline span, .evidence-timeline small { color: var(--muted); font-size: .76rem; }
.status-list { display: grid; gap: 12px; }
.status-item { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.status-item:last-child { padding-bottom: 0; border-bottom: 0; }
.status-dot { width: 9px; height: 9px; margin-top: 6px; border-radius: 50%; background: var(--success); }
.status-copy { flex: 1; }
.status-copy strong { display: block; font-size: .9rem; }
.status-copy span { color: var(--muted); font-size: .78rem; }

.modal-backdrop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; background: rgba(6,14,33,.72); }
.modal { width: min(460px, 100%); max-height: min(780px, 90vh); overflow: auto; padding: 28px; border-radius: 20px; background: var(--white); box-shadow: 0 30px 90px rgba(0,0,0,.35); }
.modal h2 { margin: 0 0 8px; font-family: var(--serif); }
.modal p { margin: 0 0 20px; color: var(--muted); line-height: 1.5; }
.modal .field input { color: var(--ink); border-color: var(--line); background: white; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; }

.toast-region { position: fixed; z-index: 100; right: 18px; bottom: 18px; display: grid; gap: 10px; width: min(360px, calc(100vw - 36px)); }
.toast { padding: 14px 16px; border-radius: 12px; color: white; background: var(--navy-950); box-shadow: var(--shadow); line-height: 1.45; }
.toast.error { background: #811f27; }

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 40; left: 0; transform: translateX(-105%); width: min(300px, 85vw); transition: transform .22s ease; box-shadow: 18px 0 50px rgba(0,0,0,.25); }
  .sidebar.open { transform: translateX(0); }
  .menu-button { display: inline-flex; }
  .topbar { padding: 15px 18px; }
  .content { padding: 20px 18px 44px; }
  .card-main, .card-side { grid-column: span 12; }
  .module-card { grid-column: span 6; }
}

@media (max-width: 640px) {
  .auth-card { padding: 28px 22px 25px; border-radius: 18px; }
  .auth-logo { height: 112px; }
  .topbar { min-height: 72px; }
  .top-actions { gap: 6px; }
  .top-actions .btn { min-height: 40px; padding: 8px 10px; font-size: .78rem; }
  .hero { align-items: flex-start; min-height: auto; padding: 27px 23px; }
  .score-orb { width: 96px; height: 96px; border-width: 7px; }
  .score-orb strong { font-size: 1.55rem; }
  .grid { gap: 13px; }
  .module-card { grid-column: span 12; min-height: 0; }
  .card { padding: 19px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-span { grid-column: auto; }
  .staff-row { grid-template-columns: auto 1fr; }
  .staff-row .pill { grid-column: 1 / -1; }
  .row-actions { grid-column: 1 / -1; }
  .row-actions .btn { flex: 1; }
  .section-heading { align-items: flex-start; }
  .summary-tiles, .report-admin-grid { grid-template-columns: 1fr; }
  .pupil-row { grid-template-columns: 1fr; }
  .holiday-form { grid-template-columns: 1fr; align-items: stretch; }
  .system-readiness .section-heading .btn { width: 100%; }
  .readiness-summary { align-items: flex-start; flex-direction: column; }
  .readiness-checks { grid-template-columns: 1fr; }
  .monthly-upload { align-items: stretch; flex-direction: column; }
  .payslip-toolbar { width: 100%; justify-content: flex-start; }
  .payslip-toolbar .btn { flex: 1; }
  .payslip-modal { width: 100%; padding: 18px; }
  .payslip-item-row { grid-template-columns: 1fr; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
  .payslip-item-row .remove-pay-item { width: 100%; }
  .payslip-totals { grid-template-columns: 1fr 1fr; }
  .pdf-modal { width: 100%; height: 92vh; padding: 18px; }
  .pdf-frame { min-height: 0; }
  .document-card { align-items: stretch; flex-direction: column; }
  .document-actions { justify-content: stretch; }
  .document-actions .btn { flex: 1 1 130px; }
  .document-target-grid { grid-template-columns: 1fr; }
  .document-records-modal { width: 100%; padding: 18px; }
  .kpi-heading { align-items: flex-start; }
  .kpi-controls { width: 100%; justify-content: flex-start; }
  .kpi-rating-row { grid-template-columns: 1fr 72px; }
  .kpi-rating-row .kpi-note { grid-column: 1 / -1; }
  .kpi-rating-row .btn { grid-column: 1 / -1; }
  .hr-case-card, .hr-candidate-card { align-items: stretch; flex-direction: column; }
  .hr-case-card .btn, .hr-candidate-card .btn { width: 100%; }
  .hr-meta { grid-template-columns: 1fr; }
  .hr-document-modal { width: 100%; padding: 18px; }
  .letter-paper { padding: 20px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
