@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Libre+Baskerville:wght@700&display=swap');

:root {
  font-family: 'DM Sans', 'Segoe UI', sans-serif;
  color: #172d46;
  background: #f3f6f7;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --navy: #102c56;
  --navy-2: #173b70;
  --blue: #2866a0;
  --gold: #efb323;
  --green: #237b5a;
  --green-bg: #e5f3ed;
  --amber: #a86610;
  --amber-bg: #fff2d9;
  --red: #b63e3e;
  --red-bg: #fae9e7;
  --ink: #172d46;
  --muted: #778797;
  --line: #e2e8eb;
  --surface: #fff;
  --canvas: #f3f6f7;
  --radius: 6px;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--canvas); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid #84b6d8; outline-offset: 2px; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

.application { min-height: 100vh; }
.sidebar { position: fixed; z-index: 20; inset: 0 auto 0 0; display: flex; flex-direction: column; width: 248px; padding: 24px 16px 15px; color: #d8e1ee; background: var(--navy); }
.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 0 7px 28px; color: #fff; }
.brand-mark { display: block; width: 36px; height: 36px; flex: 0 0 36px; object-fit: contain; }
.sidebar-brand .brand-mark { width: 42px; height: 42px; flex-basis: 42px; }
.sidebar-brand strong { display: block; font-size: 15px; letter-spacing: 1px; }
.sidebar-brand small { display: block; margin-top: 3px; color: #9fb1c8; font-size: 9px; font-weight: 600; }
.sidebar-label { padding: 0 10px 11px; color: #92a7bf; font-size: 10px; font-weight: 700; }
.main-navigation { display: grid; gap: 4px; }
.nav-link { display: flex; align-items: center; gap: 12px; min-height: 41px; padding: 0 11px; border-left: 3px solid transparent; color: #c1cedd; font-size: 13px; transition: background .15s ease, color .15s ease; }
.nav-link:hover { color: #fff; background: #1b3b66; }
.nav-link.active { border-left-color: var(--gold); color: #fff; background: #1d406f; }
.nav-icon { display: inline-grid; width: 18px; height: 18px; place-items: center; color: #a7bad0; font-size: 14px; }
.nav-link.active .nav-icon { color: #f1bf39; }
.sidebar-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding: 15px 4px 2px; border-top: 1px solid #2d4a6c; }
.sidebar-user { display: flex; align-items: center; gap: 9px; min-width: 0; }
.sidebar-user strong, .sidebar-user small { display: block; max-width: 142px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user strong { color: #fff; font-size: 12px; }
.sidebar-user small { margin-top: 3px; color: #a8b8ca; font-size: 10px; }
.avatar { display: grid; width: 30px; height: 30px; place-items: center; flex: 0 0 30px; border-radius: 50%; color: var(--navy); background: #f1c448; font-size: 12px; font-weight: 700; }
.logout-button { width: 31px; height: 31px; border: 0; color: #bdcadd; background: transparent; font-size: 19px; }
.logout-button:hover { color: #fff; }

.main-area { min-height: 100vh; margin-left: 248px; }
.topbar { position: sticky; z-index: 10; top: 0; display: flex; height: 62px; align-items: center; justify-content: space-between; padding: 0 34px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); }
.breadcrumbs { display: flex; align-items: center; gap: 10px; color: #82909e; font-size: 12px; }
.breadcrumbs strong { color: var(--ink); font-weight: 600; }
.crumb-divider { color: #c3cbd1; }
.topbar-right { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.topbar-dot { width: 7px; height: 7px; border-radius: 50%; background: #3f9b71; }
.topbar-user { color: #30455b; font-weight: 600; }
.menu-toggle { display: none !important; }
.page-content { width: min(1440px, 100%); margin: 0 auto; padding: 30px 34px 54px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 25px; }
.page-heading h1 { margin: 0; color: var(--ink); font-family: 'Libre Baskerville', Georgia, serif; font-size: 25px; font-weight: 700; line-height: 1.3; }
.page-heading p { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.eyebrow { margin: 0 0 7px; color: #66839c; font-size: 10px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; }
.muted { color: var(--muted); }

.button { display: inline-flex; min-height: 37px; align-items: center; justify-content: center; gap: 9px; padding: 0 14px; border: 1px solid transparent; border-radius: 4px; font-size: 12px; font-weight: 700; transition: background .15s ease, border-color .15s ease; }
.button-primary { color: #fff; background: var(--navy-2); }
.button-primary:hover { background: #22518d; }
.button-secondary { border-color: #d7e0e5; color: #354d63; background: #fff; }
.button-secondary:hover { border-color: #9eb0be; background: #f8fafb; }
.button-danger { border-color: #f0cdca; color: var(--red); background: #fff; }
.button-danger:hover { background: var(--red-bg); }
.button-small { min-height: 30px; padding: 0 10px; font-size: 11px; }
.button-wide { width: 100%; min-height: 44px; }
.text-button { padding: 3px 0; border: 0; color: var(--blue); background: none; font-size: 12px; font-weight: 700; }
.text-button:hover { text-decoration: underline; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin-bottom: 19px; }
.metric-card { min-height: 112px; padding: 15px 16px 13px; border: 1px solid var(--line); border-top: 3px solid #6e9bb8; border-radius: var(--radius); background: var(--surface); }
.metric-card.gold { border-top-color: var(--gold); }
.metric-card.green { border-top-color: #51a77b; }
.metric-card.red { border-top-color: #c65a51; }
.metric-card .metric-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: #758493; font-size: 11px; }
.metric-card .metric-value { display: block; margin: 11px 0 3px; color: var(--ink); font-size: 27px; font-weight: 700; line-height: 1; }
.metric-card .metric-note { color: #8996a2; font-size: 10px; }
.metric-mark { color: #6792aa; font-size: 17px; }

.content-grid { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(280px, 1fr); gap: 16px; margin-bottom: 17px; }
.panel { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 55px; padding: 0 17px; border-bottom: 1px solid #edf0f2; }
.panel-header h2, .panel-header h3 { margin: 0; color: var(--ink); font-size: 13px; font-weight: 700; }
.panel-body { padding: 15px 17px; }
.panel-body.flush { padding: 0; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 22px 0 11px; }
.section-title h2 { margin: 0; color: var(--ink); font-size: 14px; }
.section-title .muted { font-size: 11px; }

.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { height: 39px; padding: 0 13px; color: #83909a; background: #fafbfb; font-size: 10px; font-weight: 700; white-space: nowrap; }
td { height: 49px; padding: 7px 13px; border-top: 1px solid #edf0f2; color: #344b60; font-size: 11px; vertical-align: middle; }
.lab-summary-table { min-width: 980px; }
.lab-summary-table td:first-child { width: 170px; min-width: 170px; }
.lab-summary-table td:nth-child(n+2):nth-child(-n+7) { white-space: nowrap; }
tbody tr:hover { background: #fafcfd; }
.table-primary { color: #203b55; font-weight: 700; }
.table-secondary { display: block; margin-top: 3px; color: #84919d; font-size: 10px; font-weight: 400; }
.table-link { padding: 0; border: 0; color: var(--blue); background: none; font-size: inherit; font-weight: 700; text-align: left; }
.table-link:hover { text-decoration: underline; }
.number-cell { font-variant-numeric: tabular-nums; font-weight: 600; }
.nowrap { white-space: nowrap; }
.empty-state { padding: 34px 18px; color: #7f8b96; font-size: 12px; text-align: center; }

.badge { display: inline-flex; min-height: 22px; align-items: center; gap: 5px; padding: 0 8px; border-radius: 3px; color: #516276; background: #eef2f4; font-size: 9px; font-weight: 700; white-space: nowrap; }
.badge::before { width: 5px; height: 5px; border-radius: 50%; background: currentColor; content: ''; }
.badge-good { color: var(--green); background: var(--green-bg); }
.badge-watch { color: var(--amber); background: var(--amber-bg); }
.badge-bad { color: var(--red); background: var(--red-bg); }
.badge-info { color: #246394; background: #e8f1f8; }
.badge-neutral { color: #637385; background: #edf1f4; }
.availability { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.availability-track { width: 47px; height: 5px; overflow: hidden; border-radius: 3px; background: #e9edf0; }
.availability-fill { display: block; height: 100%; border-radius: inherit; background: #4f9a74; }
.availability-fill.low { background: #cc6156; }

.alert-list { display: grid; gap: 0; }
.alert-row { display: grid; grid-template-columns: 7px minmax(0, 1fr) auto; align-items: start; gap: 10px; padding: 11px 0; border-bottom: 1px solid #eef1f2; }
.alert-row:last-child { border-bottom: 0; }
.alert-indicator { width: 7px; height: 7px; margin-top: 4px; border-radius: 50%; background: #d59a24; }
.alert-indicator.critical { background: #bf4e48; }
.alert-copy { min-width: 0; color: #40566a; font-size: 11px; line-height: 1.55; }
.alert-copy strong { color: #273f56; }
.alert-age { color: #8995a0; font-size: 10px; white-space: nowrap; }
.qualitative { padding: 17px 19px; border-left: 3px solid var(--gold); color: #586d7d; background: #fff; font-size: 12px; line-height: 1.7; }
.qualitative strong { color: var(--ink); }
.bar-list { display: grid; gap: 14px; }
.bar-row { display: grid; grid-template-columns: minmax(92px, 1fr) minmax(100px, 2fr) 28px; align-items: center; gap: 10px; color: #637485; font-size: 10px; }
.bar-track { height: 7px; overflow: hidden; border-radius: 4px; background: #edf1f3; }
.bar-fill { height: 100%; border-radius: inherit; background: #4e81a2; }
.bar-value { color: #34495e; font-weight: 700; text-align: right; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin-bottom: 15px; }
.toolbar-spacer { flex: 1; }
.field, .field select, .field input, .field textarea { width: 100%; }
.field label, .form-stack label { display: grid; gap: 6px; color: #455a6c; font-size: 11px; font-weight: 700; }
.field input, .field select, .field textarea, .form-stack input, .form-stack select, .form-stack textarea, .toolbar input, .toolbar select { min-height: 37px; padding: 8px 10px; border: 1px solid #d8e0e5; border-radius: 4px; color: #263d52; background: #fff; font-size: 12px; }
.field textarea, .form-stack textarea { min-height: 88px; resize: vertical; }
.toolbar input, .toolbar select { width: auto; min-width: 138px; }
.toolbar .search-input { min-width: min(230px, 100%); }
.form-stack { display: grid; gap: 15px; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-help { margin: 0; color: #81909b; font-size: 10px; line-height: 1.5; }
.form-error { min-height: 14px; margin: 0; color: var(--red); font-size: 11px; }
.check-row { display: flex !important; align-items: center; gap: 8px !important; font-size: 11px; }
.check-row input { width: 15px; min-height: 15px; }

.detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; }
.detail-pair { padding: 12px; border: 1px solid #e9eef1; border-radius: 4px; background: #fbfcfc; }
.detail-pair span { display: block; color: #83909a; font-size: 10px; }
.detail-pair strong { display: block; margin-top: 5px; color: #273e55; font-size: 12px; overflow-wrap: anywhere; }
.divider { height: 1px; margin: 17px 0; background: #edf0f2; }
.callout { padding: 12px 14px; border: 1px solid #dce9f1; border-radius: 4px; color: #47677e; background: #f3f8fb; font-size: 11px; line-height: 1.6; }
.callout.warning { border-color: #f1dfb6; color: #855e21; background: #fff9ec; }
.callout.danger { border-color: #efd1ce; color: #91413e; background: #fff5f4; }

.wizard-progress { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 5px; margin: 0 0 16px; }
.wizard-step { position: relative; padding-top: 15px; color: #8896a1; font-size: 9px; text-align: center; }
.wizard-step::before { position: absolute; top: 0; left: 0; width: 100%; height: 3px; background: #dfe5e8; content: ''; }
.wizard-step:first-child::before { border-radius: 3px 0 0 3px; }
.wizard-step:last-child::before { border-radius: 0 3px 3px 0; }
.wizard-step.active { color: var(--navy-2); font-weight: 700; }
.wizard-step.active::before { background: #d9aa2b; }
.wizard-step.done::before { background: #529476; }
.checklist { display: grid; gap: 9px; }
.check-item { padding: 12px 13px; border: 1px solid #e7ecee; border-radius: 4px; background: #fff; }
.check-item-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.check-item-name { color: #31485d; font-size: 11px; font-weight: 700; }
.state-options { display: flex; flex-wrap: wrap; gap: 5px; }
.state-option { min-height: 26px; padding: 0 8px; border: 1px solid #e1e7ea; border-radius: 3px; color: #71808c; background: #fff; font-size: 9px; }
.state-option.selected { border-color: #8baec2; color: #21587f; background: #edf5f9; font-weight: 700; }
.conditional-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 10px; }
.conditional-fields .wide { grid-column: 1 / -1; }
.equipment-issue { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: start; padding: 11px; border-bottom: 1px solid #edf0f2; }
.equipment-issue:last-child { border-bottom: 0; }
.equipment-issue > input { margin-top: 2px; }
.equipment-issue strong { color: #304a60; font-size: 11px; }
.wizard-footer { position: sticky; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 16px -17px -15px; padding: 12px 17px; border-top: 1px solid var(--line); background: rgba(255,255,255,.97); }
.wizard-footer .footer-actions { display: flex; gap: 8px; }

.modal-backdrop { position: fixed; z-index: 60; inset: 0; display: grid; place-items: center; padding: 18px; background: rgba(13, 31, 51, .48); }
.modal { width: min(650px, 100%); max-height: min(88vh, 900px); overflow: auto; border-radius: 6px; background: #fff; box-shadow: 0 18px 60px rgba(12, 32, 53, .2); }
.modal.wide { width: min(900px, 100%); }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.modal-header h2 { margin: 0; color: var(--ink); font-size: 16px; }
.modal-header p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.modal-close { width: 29px; height: 29px; border: 0; border-radius: 3px; color: #657788; background: #f1f4f5; font-size: 18px; }
.modal-body { padding: 18px 20px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); }
.toast-region { position: fixed; z-index: 100; right: 20px; bottom: 20px; display: grid; gap: 8px; width: min(360px, calc(100vw - 40px)); }
.toast { padding: 12px 15px; border: 1px solid #dce8e1; border-left: 3px solid #4e9871; border-radius: 4px; color: #2e5542; background: #fff; box-shadow: 0 8px 24px rgba(20, 46, 68, .12); font-size: 12px; animation: toast-in .2s ease-out; }
.toast.error { border-left-color: #be524c; color: #8c3c38; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.login-screen { display: grid; min-height: 100vh; grid-template-columns: minmax(340px, .88fr) 1.12fr; background: #fff; }
.login-brand { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px; color: #fff; background: var(--navy); text-align: center; }
.brand-crest { display: block; width: 144px; height: 144px; margin-bottom: 20px; object-fit: contain; }
.institution-name { max-width: 330px; margin: 0; font-size: 11px; font-weight: 700; letter-spacing: .7px; line-height: 1.7; }
.institution-subtitle { margin: 5px 0; color: #c3d0df; font-family: Georgia, serif; font-size: 12px; font-style: italic; }
.brand-rule { width: 38px; height: 2px; margin: 21px 0; background: var(--gold); }
.login-caption { margin: 0; color: #d9e2ec; font-family: 'Libre Baskerville', Georgia, serif; font-size: 17px; line-height: 1.7; }
.login-panel { display: grid; place-items: center; padding: 45px 25px; }
.login-panel-inner { width: min(380px, 100%); }
.brand-lockup { display: flex; align-items: center; gap: 10px; margin-bottom: 48px; color: var(--navy); font-size: 14px; font-weight: 700; letter-spacing: 1px; }
.login-panel .eyebrow { margin-bottom: 8px; }
.login-panel h1 { margin: 0; color: var(--ink); font-family: 'Libre Baskerville', Georgia, serif; font-size: 29px; }
.login-panel > p, .login-panel-inner > p.muted { margin: 10px 0 25px; font-size: 13px; }
.login-note { margin: 32px 0 0 !important; padding-top: 14px; border-top: 1px solid var(--line); color: #82909b; font-size: 10px !important; }

@media (max-width: 1080px) {
  .sidebar { width: 220px; }
  .main-area { margin-left: 220px; }
  .page-content { padding-right: 22px; padding-left: 22px; }
  .topbar { padding: 0 22px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .content-grid { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .sidebar { width: min(280px, 84vw); transform: translateX(-100%); transition: transform .2s ease; box-shadow: 10px 0 30px rgba(10, 32, 56, .15); }
  .sidebar.open { transform: translateX(0); }
  .main-area { margin-left: 0; }
  .topbar { height: 56px; gap: 10px; padding: 0 14px; }
  .menu-toggle { display: inline-grid !important; flex: 0 0 30px; }
  .breadcrumbs { flex: 1; gap: 6px; font-size: 10px; }
  .topbar-right { gap: 6px; font-size: 10px; }
  .topbar-user { display: none; }
  .page-content { padding: 22px 14px 40px; }
  .page-heading { align-items: flex-start; flex-direction: column; margin-bottom: 19px; }
  .page-heading h1 { font-size: 21px; }
  .metric-grid { gap: 8px; }
  .metric-card { min-height: 100px; padding: 12px; }
  .metric-card .metric-value { font-size: 23px; }
  .panel-header { padding: 0 12px; }
  .panel-body { padding: 12px; }
  th, td { padding-right: 10px; padding-left: 10px; }
  .toolbar { align-items: stretch; }
  .toolbar input, .toolbar select, .toolbar .search-input { min-width: 0; flex: 1 1 135px; }
  .toolbar-spacer { display: none; }
  .form-row, .detail-grid { grid-template-columns: 1fr; }
  .check-item-head { align-items: flex-start; flex-direction: column; }
  .conditional-fields { grid-template-columns: 1fr; }
  .conditional-fields .wide { grid-column: auto; }
  .wizard-progress { grid-template-columns: repeat(4, minmax(0, 1fr)); row-gap: 10px; }
  .wizard-step { font-size: 8px; }
  .wizard-footer { margin-right: -12px; margin-left: -12px; padding-right: 12px; padding-left: 12px; }
  .login-screen { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .login-panel { min-height: 100vh; padding: 32px 22px; }
  .brand-lockup { margin-bottom: 42px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }
td .button-small { margin: 2px 4px 2px 0; white-space: nowrap; }
