/* Stronger contrast across the existing slate / blue / teal theme. */
:root {
  color: #172e42;
  background: #e9eef3;
  --blue: #245f88;
  --teal: #287e73;
  --muted: #536779;
  --border: #cbd6e0;
}
h1, h2 { color: #152e44; }
.sidebar { background: #243947; }
.sidebar nav a { color: #e0e9f0; }
.sidebar nav a.active { background: #365f7c; box-shadow: inset 3px 0 #82cbd2; }
.sidebar nav a:hover { background: #3a566b; }
.sidebar .nav-label, .sidebar footer small, .brand small { color: #b7cbd8; }
.sidebar footer button { border-color: #7f9bad; background: #304b5e; }
.sidebar footer button:hover { background: #3a607a; }
.panel, .stat { box-shadow: 0 2px 5px #19364c09; }
.panel-head { background: #f8fafc; border-bottom-color: #d9e2e9; }
.panel-head small, .stat-top, .stat small, .dept-name small,
.footer-note, .filter-footer, .person small, .donut-center small,
.legend, .classification-results { color: #526a7d; }
.stat-icon { background: #dcecf5; color: #26678d; }
.stat:first-child { background: linear-gradient(120deg, #d8eaf5, #edf5fa); border-color: #b8d0e0; }
.eyebrow { color: #326c85; }
button { border-color: #becedb; color: #294d68; }
button:hover { background: #e2edf4; }
button.primary:hover, .access-submit:hover { background: #194c70; color: #fff; }
.link { color: #245f88; }
input, select, textarea { border-color: #afc1d0; color: #203e56; }
input::placeholder, textarea::placeholder { color: #61778a; opacity: 1; }
input:focus, select:focus, textarea:focus { outline: 2px solid #387da6; outline-offset: 2px; }
input[type="checkbox"], input[type="radio"] { accent-color: #245f88; }
label.field { color: #3c586f; }
.check .muted { color: #536e81; }
th { color: #3e596f; background: #e9f0f5; border-bottom-color: #c5d3de; }
td { border-bottom-color: #dce5ec; }
tbody tr:hover { background: #edf4f8; }
.dept-icon, .avatar { color: #275d80; background: #dce9f2; }
.badge { color: #216d59; background: #d3ece3; }
.badge.pending, .sample { color: #805a12; background: #f8e8bc; }
.notice { color: #355c77; background: #deecf6; border-color: #c0d7e7; }
.selection { color: #274c66; background: #e4f0f6; border-color: #9dbed1; }
.type-button.selected { color: #1b557d; background: #d7eaf5; border-color: #2c6f97; box-shadow: 0 0 0 1px #2c6f97; }
.tree details { border-left-color: #b4c7d5; }
.tree summary:before { border-color: #9ebacd; color: #245f88; background: #eef5fa; }
.tree label { background: #eaf1f6; }
.node-level { color: #526e82; font-size: 9px; }
.mapping-help, .classification-path { color: #526d80; }
.mapping-toggle { color: #365e79; }
.catalogue-banner { color: #3c6b61; background: #dfefe9; border-color: #b7d7cb; }
.catalogue-banner a { color: #246578; }
.official-tree code, .selection code { color: #254f6d; background: #d8e7f1; }
.commodity-option:has(input:checked) { background: #cce5ee; box-shadow: inset 3px 0 #246c91; }
.cell-yes { color: #226f59; background: #dff0e8; }
.cell-no { color: #647c8d; background: #f1f5f8; }
.matrix-total { background: #dde9f2; }
.fill { background: #3d789f; }
.bar-row:first-child .fill { background: #2d8a7b; }
.track { background: #dde6ed; }
.access-main { background: #f4f7fa; }
.access-brand { background: linear-gradient(150deg, #243b4e, #1d3140 70%, #1d454e); }
.access-intro h1 { color: #fff; }
.access-topline, .access-footer, .access-bottom, .access-footnote,
.access-help, .login-help, .optional, .registration-steps span { color: #556d80; }
.access-role-tabs { border-color: #c6d4df; background: #e3ebf2; }
.access-role-tabs a { color: #4f687c; }
.access-role-tabs a.selected { color: #245f88; }
.password-toggle { color: #3c617c; }
.preview-account { background: #eaf1f7; border-color: #b1c7d7; }
.preview-account b, .preview-account small { color: #4b667b; }
.admin-access-note { color: #3c607b; background: #e0edf5; border-color: #bfd3e1; }
.form-section-label { color: #3d687f; border-bottom-color: #cbd9e3; }
.upload-zone { border-color: #a0bdcf; color: #375e79; background: #e6f0f6; }
.upload-zone > span, .signup-card .check { color: #536e81; }
.classification-type-picker { padding: 18px 22px 0; }
.compact-types { gap: 8px; margin: 0; }
.compact-types .type-button { padding: 11px 6px; gap: 6px; min-height: 64px; font-size: 10px; line-height: 1.4; }
.compact-types .type-button svg { width: 19px; height: 19px; }
#unspsc-picker { padding-top: 4px; }
#unspsc-picker .catalogue-banner { margin-top: 18px; padding: 10px 12px; }
.heat-legend { display: flex; flex-wrap: wrap; gap: 11px; align-items: center; font-size: 10px; }
.heat-legend > span { display: inline-flex; align-items: center; gap: 5px; }
.heat-legend b { color: #35566d; margin-right: 4px; }
.heat-swatch { width: 17px; height: 13px; border-radius: 3px; border: 1px solid #24445820; }
.heat-zero { background: #edf2f6; color: #526979; }
.heat-low { background: #c9e3d2; color: #244d32; }
.heat-moderate { background: #e3e6b5; color: #4c5023; }
.heat-medium { background: #eccb96; color: #624012; }
.heat-high { background: #dca198; color: #642b25; }
.heat-very-high { background: #b77b90; color: #3b1222; }
.matrix .cell-value { font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; }
.matrix td button { min-width: 32px; min-height: 30px; justify-content: center; }
.matrix td button:hover { outline: 1px solid currentColor; border-radius: 5px; }
.matrix .matrix-total { border-left: 2px solid #c0cdd7; font-variant-numeric: tabular-nums; }
.modal { max-height: 85vh; overflow: auto; }
.matrix td { padding: 0; }
.matrix td:first-child { padding: 15px 17px; }
.matrix td button { width: 100%; min-height: 64px; padding: 14px 10px; border-radius: 0; }
.matrix th { min-width: 66px; height: 135px; padding: 8px; }
.matrix th span { max-height: 115px; font-size: 10px; line-height: 1.4; }
.matrix th:first-child { min-width: 205px; padding: 10px 12px; }
.matrix td:first-child { padding: 8px 12px; }
.matrix td button { min-height: 40px; padding: 7px 6px; }
.matrix .cell-value { font-size: 12px; }
.matrix .dept-icon { width: 25px; height: 25px; font-size: 9px; }
.matrix .dept-name { gap: 8px; font-size: 10px; }
.matrix .dept-name small { margin-top: 3px; font-size: 9px; }
/* Diagonal official labels: taller header, with compact data cells retained. */
.matrix thead { position: sticky; top: 0; z-index: 4; background: #e9f0f5; }
.matrix thead th { position: relative; top: auto; z-index: auto; height: 215px; min-width: 82px; padding: 0; background: transparent; }
.matrix thead th > span { position: absolute; left: 30px; bottom: 12px; width: 190px; max-height: none; writing-mode: horizontal-tb; transform: rotate(-60deg); transform-origin: bottom left; white-space: normal; text-align: left; line-height: 1.35; font-size: 10px; font-weight: 600; }
.matrix thead th > span code { display: block; color: #4f6d82; font-size: 9px; font-weight: 500; margin-bottom: 4px; }
.matrix thead th:first-child { position: sticky; left: 0; z-index: 5; background: #e9f0f5; min-width: 205px; padding: 12px; vertical-align: bottom; padding-bottom: 20px; }
.matrix thead th:last-child { min-width: 150px; }
.matrix-scroll { max-height: none; }
.matrix td:first-child { padding: 4px 10px; }
.matrix td button { min-height: 31px; padding: 4px 6px; }
.matrix .dept-icon { width: 22px; height: 22px; font-size: 8px; }
.matrix .dept-name { gap: 7px; line-height: 1.15; }
.matrix .dept-name small { font-size: 8px; margin-top: 2px; }
.matrix th, .matrix td { border-right: 1px solid #b8c7d2; border-bottom: 1px solid #b8c7d2; }
.matrix th:first-child, .matrix td:first-child { border-left: 1px solid #b8c7d2; }
.matrix thead th { border-top: 1px solid #b8c7d2; }
.matrix thead { background: #304e63; }
.matrix thead th { color: #f1f6fa; border-color: #5c7587; }
.matrix thead th > span { color: #f1f6fa; }
.matrix thead th > span code { color: #c5dce9; }
.matrix thead th:first-child { background: #263f52; color: #f1f6fa; border-color: #5c7587; }
.matrix thead th.coverage-header { background: #304e63; color: #f1f6fa; border-color: #5c7587; }
.matrix thead th.coverage-header { background: transparent; overflow: visible; }
.matrix thead th.coverage-header > span { pointer-events: none; }
.matrix thead th.coverage-header:hover, .matrix thead th.coverage-header:focus-visible { outline: 2px solid #a6d4e8; outline-offset: -3px; }
.matrix-header-tooltip { position: fixed; z-index: 200; width: max-content; max-width: min(370px, calc(100vw - 24px)); padding: 15px 18px; border: 1px solid #9fb7c9; border-radius: 9px; background: #fff; color: #1c3b52; box-shadow: 0 8px 28px #122f4a40; pointer-events: none; white-space: normal; overflow-wrap: anywhere; }
.matrix-header-tooltip[hidden] { display: none; }
.matrix-header-tooltip small { display: block; font: 600 11px monospace; color: #52758d; margin-bottom: 7px; }
.matrix-header-tooltip strong { display: block; font-size: 15px; line-height: 1.6; }
.matrix-header-tooltip > span { display: block; margin-top: 9px; font-size: 12px; color: #547087; }
.matrix thead th.coverage-header > span { color: inherit; bottom: 42px; }
.matrix thead th.coverage-header > span code { color: #c5dce9; }
.column-department-count { position: absolute; bottom: 7px; left: 0; right: 0; font-size: 13px; text-align: center; font-variant-numeric: tabular-nums; }
.column-department-count small { font-weight: 500; font-size: 9px; margin-left: 4px; }
/* Two-axis table scrolling keeps labels and the key coverage measure in view. */
.matrix-scroll { max-height: max(1100px, calc(100dvh - 20px)); overflow: auto; overscroll-behavior: contain; scrollbar-gutter: stable; isolation: isolate; }
.matrix { border-collapse: separate; border-spacing: 0; }
.matrix thead { position: sticky; top: 0; z-index: 10; }
.matrix thead th.coverage-header > span { bottom: 18px; }
.matrix thead th:first-child { z-index: 12; box-shadow: 2px 0 0 #537086; }
.matrix tbody td:first-child { position: sticky; left: 0; z-index: 3; background: #fff; box-shadow: 2px 0 0 #b8c7d2; }
.matrix thead .coverage-summary-row th { height: 88px; background: #f2f7fb; color: #244b68; border-color: #b8cbd9; vertical-align: middle; padding: 10px 7px; }
.matrix thead .coverage-summary-row th:first-child { background: #e3eef6; padding: 12px; vertical-align: middle; }
.coverage-row-title { font-size: 12px; font-weight: 700; line-height: 1.6; }
.coverage-row-help { color: #56758b; font-size: 10px; line-height: 1.6; margin-top: 3px; white-space: normal; }
.coverage-numbers { display: flex; align-items: baseline; justify-content: center; gap: 4px; font-variant-numeric: tabular-nums; }
.coverage-numbers b { font-size: 23px; line-height: 1.2; color: #1d496a; }
.coverage-numbers small { font-size: 11px; font-weight: 500; color: #55758d; }
.coverage-percentage { font-size: 9px; font-weight: 500; color: #536e84; text-align: center; margin: 6px 0; }
.coverage-meter { height: 5px; background: #d7e2eb; border-radius: 5px; overflow: hidden; margin: 0 5px; }
.coverage-meter i { display: block; height: 100%; border-radius: 5px; box-shadow: inset 0 0 0 1px #193d5420; }
.matrix-details-modal { max-width: 960px; }
.matrix-details-modal > .panel-head { position: sticky; top: 0; z-index: 2; background: #f2f6fa; }
.matrix-detail-summary { display: flex; align-items: center; gap: 22px; margin-bottom: 22px; }
.detail-count { flex-shrink: 0; padding: 16px; min-width: 130px; background: #dcebf4; border: 1px solid #b7cddd; border-radius: 8px; text-align: center; }
.detail-count strong { display: block; font-size: 32px; color: #245f88; }
.detail-count span { font-size: 10px; color: #46687e; }
.matrix-department-details { padding: 18px; background: #f3f7fa; border: 1px solid #d6e1e9; border-radius: 7px; }
.detail-filter-note { font-size: 11px; color: #526b7f; overflow-wrap: anywhere; }
.detail-records-heading { display: flex; align-items: center; gap: 10px; margin: 24px 0 15px; }
.matrix-record-card { border: 1px solid #ccdbe5; border-radius: 8px; padding: 20px; margin-bottom: 15px; }
.matrix-record-heading { display: flex; align-items: center; gap: 10px; padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid #dce6ed; }
.matrix-record-heading h2 { flex: 1; line-height: 1.7; }
.record-number { background: #e2edf5; color: #3b6785; border-radius: 6px; min-width: 27px; height: 27px; display: grid; place-items: center; font-size: 11px; }
.matrix-record-card .detail-list span { overflow-wrap: anywhere; }
.matrix-record-card small { color: #5a7386; font-size: 10px; display: block; margin-bottom: 6px; }
.record-description { margin: 20px 0; }
.record-description p { margin: 0; white-space: pre-wrap; }
.record-classification { background: #eef5f9; padding: 12px; margin-top: 8px; border-radius: 5px; font-size: 12px; line-height: 1.8; }
.record-classification span, .record-classification em { display: block; color: #59758b; font-size: 10px; font-style: normal; }
/* Readable project drill-down: clear summary and expandable record list. */
.matrix-details-modal { max-width: 1050px; max-height: 90dvh; font-size: 14px; background: #f7f9fc; }
.matrix-details-modal > .panel-head { background: #fff; padding: 18px 26px; border-bottom: 1px solid #cbd8e3; }
.matrix-details-modal > .panel-head h2 { font-size: 18px; }
.matrix-details-modal > .panel-head button { width: 36px; height: 36px; padding: 8px; background: #edf3f8; border-radius: 8px; justify-content: center; }
.matrix-details-modal > .panel-body { padding: 25px 28px; }
.matrix-details-modal .matrix-detail-summary { justify-content: space-between; gap: 25px; margin-bottom: 20px; }
.detail-section-label { font-size: 11px; font-weight: 700; letter-spacing: 1px; color: #60788a; margin-bottom: 8px; }
.matrix-detail-summary h2 { font-size: 23px; line-height: 1.4; }
.detail-category { margin: 7px 0 0; font-size: 15px; color: #365e79; line-height: 1.6; }
.matrix-details-modal .detail-count { min-width: 145px; background: #dcecf5; }
.matrix-details-modal .detail-count strong { font-size: 36px; }
.matrix-details-modal .detail-count span { font-size: 12px; }
.matrix-details-modal .matrix-department-details { grid-template-columns: repeat(3,minmax(0,1fr)); background: #fff; gap: 20px; padding: 18px 20px; }
.matrix-details-modal .detail-list { font-size: 14px; line-height: 1.6; }
.matrix-details-modal .detail-list small { font-size: 12px; color: #5d7588; margin-bottom: 4px; }
.detail-explanation { font-size: 12px; line-height: 1.8; color: #607487; padding-left: 12px; border-left: 3px solid #8fb4cd; margin: 18px 0 25px; }
.detail-list-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 16px; }
.detail-list-toolbar h2 { font-size: 18px; }
.detail-list-toolbar p { margin: 6px 0 0; font-size: 12px; color: #5d7588; line-height: 1.6; }
.detail-list-toolbar button { flex-shrink: 0; font-size: 12px; background: #fff; }
.matrix-details-modal .count-pill { font-size: 12px; background: #deebf4; color: #315e7a; margin-left: 6px; }
.matrix-details-modal .detail-search { font-size: 12px; margin-bottom: 18px; }
.matrix-details-modal .detail-search input { font-size: 14px; background: #fff; padding: 12px 14px; }
.matrix-details-modal .matrix-record-card { background: #fff; padding: 0; margin-bottom: 11px; border-color: #c8d8e4; }
.matrix-record-card[open] { box-shadow: 0 3px 14px #20445e09; border-color: #94b6cc; }
.matrix-details-modal .matrix-record-heading { margin: 0; border: 0; padding: 18px; cursor: pointer; list-style: none; gap: 12px; }
.matrix-record-heading::-webkit-details-marker { display: none; }
.matrix-record-heading:hover { background: #f0f6fa; }
.record-heading-text { flex: 1; min-width: 0; }
.record-heading-text > b { display: block; font-size: 15px; line-height: 1.55; color: #1c3b53; }
.record-heading-text > span { display: block; font-size: 12px; color: #62798b; margin-top: 5px; }
.record-heading-text > .record-department { color: #315d7b; font-size: 12px; font-weight: 600; margin-top: 4px; }
.matrix-details-modal .record-number { min-width: 31px; height: 31px; font-size: 12px; }
.matrix-details-modal .badge { font-size: 11px; white-space: nowrap; }
.record-chevron { color: #4f7894; font-size: 22px; transition: transform .15s; }
.matrix-record-card[open] .record-chevron { transform: rotate(180deg); }
.record-expanded { padding: 0 22px 20px 61px; border-top: 1px solid #e0e9ef; }
.record-expanded h3 { font-size: 13px; margin: 0 0 9px; color: #3c5a70; }
.record-expanded .record-description { margin: 18px 0; }
.matrix-details-modal .record-description p { font-size: 14px; line-height: 1.9; color: #355167; }
.matrix-details-modal .record-classification { font-size: 14px; padding: 14px; }
.matrix-details-modal .record-classification span, .matrix-details-modal .record-classification em { font-size: 12px; line-height: 1.8; margin-top: 5px; }
.record-metadata { margin-top: 20px; padding-top: 16px; border-top: 1px solid #e0e9ef; }
.matrix-details-modal .record-metadata { font-size: 12px; color: #657d90; }
.matrix-details-modal .record-metadata small { font-size: 11px; }
.matrix-details-modal [hidden] { display: none !important; }
@media (max-width: 600px) {
  .matrix-details-modal > .panel-body { padding: 18px; }
  .matrix-details-modal .matrix-department-details { grid-template-columns: 1fr; gap: 12px; }
  .matrix-detail-summary h2 { font-size: 19px; }
  .matrix-details-modal .detail-count { min-width: 95px; }
  .matrix-details-modal .detail-count span { font-size: 10px; }
  .matrix-details-modal .detail-count strong { font-size: 29px; }
  .detail-list-toolbar { align-items: flex-start; }
  .record-expanded { padding: 0 16px 18px; }
  .matrix-details-modal .matrix-record-heading { padding: 14px; }
  .matrix-record-heading .badge { display: none; }
}
@media (max-width: 600px) {
  .matrix-details-modal .detail-list { grid-template-columns: 1fr; }
  .matrix-detail-summary { align-items: flex-start; gap: 12px; }
  .detail-count { min-width: 95px; padding: 10px; }
  .matrix-record-card { padding: 14px; }
  .matrix-record-heading { flex-wrap: wrap; }
}
@media (max-width: 720px) {
  .compact-types { grid-template-columns: repeat(2, 1fr); }
  .compact-types .type-button { flex-direction: row; min-height: 43px; padding: 9px; }
}
