:root {
  --blue: #004aad;
  --blue-dark: #003a88;
  --blue-light: #eaf1fb;
  --orange: #f4a259;
  --orange-light: #fdefe0;
  --orange-text: #8a4b0f;
  --ink: #0a1f3c;
  --ink-2: #36475f;
  --muted: #5b6b82;
  --line: #dbe4f0;
  --line-soft: #e7eef8;
  --bg: #f4f7fc;
  --white: #ffffff;
  --red: #bf000f;
  --red-light: #ffe2e2;
  --red-text: #a3000d;
  --green: #008138;
  --green-light: #dcfce7;
  --green-text: #006b2e;
  --nav: #0a1f3c;
  --nav-active: #13315c;
  --nav-text: #c9d6ea;
  --nav-muted: #9fb3d1;
  --display: Fraunces, Georgia, 'Times New Roman', serif;
  --sans: Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 var(--sans); }
a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-dark); text-decoration: underline; }
h1, h2, h3 { margin: 0; }
p { margin: 0; }
:focus-visible { outline: 3px solid #7aa7e8; outline-offset: 2px; border-radius: 6px; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--white); padding: 8px 12px; border-radius: 8px; }
.skip:focus { left: 8px; z-index: 10; }

/* Layout */
.app { min-height: 100vh; display: flex; flex-wrap: wrap; }
.sidebar { flex: 1 1 248px; max-width: 100%; background: var(--nav); color: var(--nav-text); padding: 28px 18px; display: flex; flex-direction: column; gap: 28px; }
.main { flex: 999 1 560px; min-width: 0; padding: 32px 40px 56px; }
.container { max-width: 1180px; margin: 0 auto; display: flex; flex-direction: column; gap: 24px; }
@media (max-width: 760px) { .main { padding: 20px 16px 40px; } .sidebar { padding: 18px 14px; gap: 16px; } }

.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; color: var(--white); }
.brand:hover { text-decoration: none; color: var(--white); }
.brand-mark { width: 38px; height: 38px; border-radius: 10px; background: var(--blue); display: grid; place-items: center; font: 600 20px var(--display); color: var(--white); }
.brand-name { display: flex; flex-direction: column; line-height: 1.3; }
.brand-name strong { font-weight: 600; font-size: 15px; }
.brand-name span { font-size: 12px; color: var(--nav-muted); }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px; color: var(--nav-text); font-weight: 500; }
.nav a:hover { background: #102a4f; color: var(--white); text-decoration: none; }
.nav a[aria-current='page'] { background: var(--nav-active); color: var(--white); }
.nav svg { flex: none; }
.nav .count { margin-left: auto; background: var(--orange); color: var(--ink); font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 99px; }
@media (max-width: 760px) {
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav a { padding: 8px 10px; }
  .who { display: none; }
  .stats { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat { padding: 16px; }
  .stat-num { font-size: 30px; }
  .page-head h1 { font-size: 28px; }
  .search { min-width: 0; width: 100%; }
}

.who { margin-top: auto; border-top: 1px solid #1d3a63; padding: 18px 8px 0; display: flex; align-items: center; gap: 10px; min-width: 0; }
.who .avatar { background: var(--orange); color: var(--ink); }
.who-text { display: flex; flex-direction: column; min-width: 0; }
.who-text strong { color: var(--white); font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-text span { font-size: 12px; color: var(--nav-muted); }

/* Headings */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.eyebrow { color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.page-head h1 { font: 600 34px/1.15 var(--display); letter-spacing: -0.01em; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.crumb { font-size: 13px; color: var(--muted); }
.crumb a { color: var(--muted); }

/* Buttons and inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 18px; border-radius: 10px; border: 1px solid var(--line); background: var(--white); color: var(--ink); font: 600 14px var(--sans); cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #b9cbe6; text-decoration: none; color: var(--ink); }
.btn-primary { background: var(--blue); border-color: var(--blue); color: var(--white); }
.btn-primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); color: var(--white); }
.btn-danger { color: var(--red-text); }
.btn-danger:hover { border-color: #f3b4b8; color: var(--red-text); }
.btn-sm { height: 36px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn-link { background: none; border: 0; padding: 0; color: var(--blue); font: 500 13px var(--sans); cursor: pointer; }
.btn-link:hover { text-decoration: underline; }

.search { display: flex; align-items: center; gap: 8px; background: var(--white); border: 1px solid var(--line); border-radius: 10px; padding: 0 14px; height: 44px; min-width: 260px; color: var(--muted); }
.search input { border: 0; outline: 0; font: inherit; background: transparent; flex: 1; color: var(--ink); min-width: 0; }

label.field { display: flex; flex-direction: column; gap: 6px; font-weight: 500; font-size: 13px; color: var(--ink-2); }
label.field .hint { font-weight: 400; color: var(--muted); font-size: 12px; }
input[type='text'], input[type='password'], input[type='search'], input[type='date'], input[type='email'], input[type='tel'], input[type='number'], input[type='file'], select, textarea {
  font: 400 14px var(--sans); color: var(--ink); background: var(--white); border: 1px solid #c9d6e8; border-radius: 9px; padding: 10px 12px; min-height: 44px; width: 100%;
}
textarea { min-height: 88px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px #004aad26; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px 18px; }
.form-grid .wide { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 600; font-size: 15px; margin-bottom: 12px; padding: 0; }
.radio-row { display: flex; gap: 6px; flex-wrap: wrap; }
.radio-row label { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 9px; padding: 0 12px; height: 40px; cursor: pointer; font-weight: 500; }
.radio-row input { accent-color: var(--blue); }

/* Cards and tables */
.card { background: var(--white); border: 1px solid var(--line); border-radius: 16px; }
.card-pad { padding: 22px 24px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 20px 24px; flex-wrap: wrap; }
.card-head h2, .card h2 { font-size: 17px; font-weight: 600; }
.card-sub { color: var(--muted); font-size: 13px; }
.split { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.split > .grow { flex: 2 1 560px; min-width: 0; }
.split > .side { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.stack { display: flex; flex-direction: column; gap: 20px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.stat { background: var(--white); border: 1px solid var(--line); border-radius: 16px; padding: 20px 22px; display: flex; flex-direction: column; gap: 10px; color: var(--ink); }
a.stat:hover { border-color: #b9cbe6; text-decoration: none; color: var(--ink); }
.stat-top { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 13px; font-weight: 500; }
.stat-num { font: 600 36px/1 var(--display); }
.stat-note { color: var(--muted); font-size: 12px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }

.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th { background: var(--bg); color: var(--muted); font-size: 12px; font-weight: 500; text-align: left; padding: 10px 12px; white-space: nowrap; }
.table td { padding: 14px 12px; border-top: 1px solid var(--line-soft); vertical-align: middle; }
.table th:first-child, .table td:first-child { padding-left: 24px; }
.table th:last-child, .table td:last-child { padding-right: 24px; }
.table .right { text-align: right; }
.table tr:hover td { background: #fafcff; }

.person { display: flex; align-items: center; gap: 12px; color: var(--ink); }
.person:hover { text-decoration: none; color: var(--ink); }
.person:hover .person-name { color: var(--blue); }
.person-text { display: flex; flex-direction: column; line-height: 1.35; }
.person-name { font-weight: 500; }
.person-role { font-size: 12px; color: var(--muted); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--blue-light); color: var(--blue-dark); display: grid; place-items: center; font-weight: 600; font-size: 12px; flex: none; }
.avatar-lg { width: 56px; height: 56px; font-size: 18px; background: var(--blue); color: var(--white); }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill-red { background: var(--red-light); color: var(--red-text); }
.pill-amber { background: var(--orange-light); color: var(--orange-text); }
.pill-green { background: var(--green-light); color: var(--green-text); }
.pill-blue { background: var(--blue-light); color: var(--blue-dark); }
.pill-grey { background: var(--bg); color: var(--muted); }
.pill .dot { width: 7px; height: 7px; }
.pill-red .dot { background: var(--red); } .pill-amber .dot { background: #e08a3c; } .pill-green .dot { background: var(--green); } .pill-grey .dot { background: #b9c6d8; } .pill-blue .dot { background: var(--blue); }

.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filters a { height: 36px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--line); background: var(--white); color: var(--ink-2); font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; }
.filters a:hover { text-decoration: none; border-color: #b9cbe6; }
.filters a[aria-current='true'] { background: var(--ink); border-color: var(--ink); color: var(--white); font-weight: 600; }

.progress { height: 6px; border-radius: 99px; background: var(--line-soft); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 99px; background: var(--blue); }

.list-row { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line-soft); }
.list-row:first-child { border-top: 0; }
.date-tile { width: 46px; flex: none; text-align: center; border-radius: 10px; background: var(--blue-light); padding: 6px 0; color: var(--blue-dark); }
.date-tile small { display: block; font-size: 11px; font-weight: 600; text-transform: uppercase; }
.date-tile strong { font: 600 18px var(--display); }

.applicant { border: 1px solid var(--line-soft); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 10px; color: var(--ink); }
a.applicant:hover { border-color: #b9cbe6; text-decoration: none; color: var(--ink); }

.notice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 12px; font-size: 13px; line-height: 1.5; }
.notice-amber { background: var(--orange-light); color: #6b3a0b; }
.notice-blue { background: var(--blue-light); color: var(--blue-dark); }
.notice-red { background: var(--red-light); color: var(--red-text); }
.notice-green { background: var(--green-light); color: var(--green-text); }
.notice svg { flex: none; margin-top: 1px; }

.flash { padding: 12px 16px; border-radius: 12px; font-weight: 500; }
.flash-ok { background: var(--green-light); color: var(--green-text); }
.flash-err { background: var(--red-light); color: var(--red-text); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; overflow-y: hidden; }
.tabs a { padding: 12px 14px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a[aria-current='page'] { color: var(--blue); border-bottom-color: var(--blue); font-weight: 600; }

.profile { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.profile h1 { font: 600 30px/1.15 var(--display); }
.profile-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }

.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px 20px; }
.facts dt { font-size: 12px; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-weight: 500; overflow-wrap: anywhere; }

.check-row { display: flex; gap: 14px; align-items: flex-start; padding: 16px 0; border-top: 1px solid var(--line-soft); }
.check-row:first-of-type { border-top: 0; }
.mark { width: 28px; height: 28px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.mark-ok { background: var(--green-light); color: var(--green-text); }
.mark-bad { background: var(--red-light); color: var(--red-text); }
.mark-wait { background: var(--orange-light); color: var(--orange-text); }
.mark-na { background: var(--bg); color: var(--muted); }

details.disclose > summary { cursor: pointer; list-style: none; color: var(--blue); font-weight: 600; font-size: 13px; }
details.disclose > summary::-webkit-details-marker { display: none; }
details.disclose[open] > summary { margin-bottom: 14px; }

.checklist { display: flex; flex-direction: column; }
.checklist label { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line-soft); cursor: pointer; }
.checklist label:first-child { border-top: 0; }
.checklist input[type='checkbox'] { width: 20px; height: 20px; accent-color: var(--blue); flex: none; }
.checklist .meta { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }
.tag-alone { font-size: 11px; font-weight: 600; color: var(--orange-text); background: var(--orange-light); border-radius: 6px; padding: 1px 6px; }

.score { display: flex; gap: 4px; }
.score label { width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 9px; display: grid; place-items: center; cursor: pointer; font-weight: 600; }
.score input { position: absolute; opacity: 0; pointer-events: none; }
.score input:checked + span { color: var(--white); }
.score label:has(input:checked) { background: var(--blue); border-color: var(--blue); color: var(--white); }
.score label:has(input:focus-visible) { outline: 3px solid #7aa7e8; outline-offset: 2px; }

.empty { padding: 28px 24px; text-align: center; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }

.matrix th.rot { vertical-align: bottom; }
.matrix td, .matrix th { padding: 10px 8px; }
.matrix td:first-child { min-width: 200px; }
.matrix .person-name { white-space: nowrap; }

/* Demo login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 400px; background: var(--white); border: 1px solid var(--line); border-radius: 16px; padding: 32px 28px; display: flex; flex-direction: column; gap: 20px; }
.login-card h1 { font: 600 28px/1.15 var(--display); }

/* Print: the CQC staff file and reference letters */
.print-page { max-width: 820px; margin: 0 auto; background: var(--white); padding: 40px 48px; }
.print-page h1 { font: 600 28px var(--display); margin-bottom: 4px; }
.print-page h2 { font-size: 16px; margin: 26px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.print-page table { width: 100%; border-collapse: collapse; font-size: 13px; }
.print-page td, .print-page th { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.print-page th { color: var(--muted); font-weight: 500; width: 34%; }
.print-bar { max-width: 820px; margin: 20px auto; display: flex; gap: 10px; justify-content: space-between; align-items: center; }
@media print {
  body { background: var(--white); font-size: 12px; }
  .print-bar, .sidebar, .no-print { display: none !important; }
  .print-page { padding: 0; max-width: none; }
  .print-page h2 { break-after: avoid; }
  tr { break-inside: avoid; }
}
