.crm-resources {
  --resource-navy: var(--sh-navy, #123e68);
  --resource-deep: var(--sh-deep, #092744);
  --resource-line: var(--sh-line, #cdd9e4);
  --resource-soft: var(--sh-soft, #f4f7fa);
  --resource-muted: var(--sh-muted, #526579);
  min-width: 0;
  margin: 24px 0;
  padding: clamp(14px, 2.4vw, 28px);
  border: 1px solid var(--resource-line);
  border-top: 4px solid var(--sh-red, #ef1b2d);
  border-radius: 7px;
  background: #fff;
  color: var(--resource-deep);
  scroll-margin-top: 92px;
}
.resource-workspace-header, .resource-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 18px;
}
.resource-workspace-header h2 { margin: 0; color: var(--resource-deep); font-size: 28px; line-height: 1.2; }
.resource-workspace-header p { margin: 7px 0 0; color: var(--resource-muted); font-size: 14px; }
.resource-workspace-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0 18px;
  margin: 16px 0 20px;
  padding: 0 12px;
  border: 1px solid var(--resource-line);
  border-radius: 5px;
  background: var(--resource-soft);
}
.resource-workspace-nav a {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  color: var(--resource-navy);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}
.resource-workspace-nav a:hover, .resource-workspace-nav a:focus-visible { text-decoration: underline; text-underline-offset: 4px; }
.resource-calendar-panel, .resource-history { min-width: 0; scroll-margin-top: 92px; }
.crm-resources h3 { margin: 0 0 8px; color: var(--resource-deep); font-size: 20px; line-height: 1.3; }
.resource-panel-heading h3 { margin: 0; }
.crm-resource-status:not(:empty) {
  margin: 0 0 16px;
  padding: 9px 12px;
  border-left: 3px solid var(--resource-navy);
  background: var(--resource-soft);
  font-size: 14px;
}
.crm-resource-status:empty { margin: 0; }
.crm-resource-tools { display: grid; gap: 12px; margin: 12px 0; }
.resource-calendar-filters { grid-template-columns: repeat(auto-fit, minmax(min(100%, 174px), 1fr)); }
.crm-resource-tools label { display: grid; min-width: 0; gap: 5px; font-size: 13px; font-weight: 700; }
.crm-resource-tools input:not([type=checkbox]), .crm-resource-tools select { width: 100%; }
.crm-resources label.resource-check, .crm-resource-dialog label.crm-check {
  display: flex;
  align-items: center;
  gap: 8px;
  align-self: end;
  font-size: 14px;
  font-weight: 400;
  min-height: 32px;
}
.resource-check input, .crm-resource-dialog .crm-check input { width: 16px; height: 16px; margin: 0; flex: none; }
.crm-resource-legend { display: flex; flex-wrap: wrap; gap: 8px 14px; color: var(--resource-muted); font-size: 12px; }
.crm-resource-legend span { display: flex; align-items: center; gap: 6px; }
.crm-resource-legend i, .resource-person-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.crm-resource-calendar-scroll { max-width: 100%; overflow-x: auto; margin: 14px 0 18px; }
.crm-resource-calendar-scroll > div { min-width: 680px; }
.crm-resources .fc {
  --fc-border-color: #d5dfe8;
  --fc-button-bg-color: var(--resource-navy);
  --fc-button-border-color: var(--resource-navy);
  --fc-button-hover-bg-color: #194f80;
  --fc-button-active-bg-color: #175da8;
  --fc-today-bg-color: #edf5fa;
  font-size: 14px;
}
.crm-resources .fc .fc-toolbar-title { font-size: 22px; }
.crm-resources .fc-event { cursor: pointer; border-left-width: 4px; }
.crm-resources .fc-daygrid-event { white-space: normal; }
.crm-resources .fc-list-event-dot { border-color: var(--resource-event-colour, #62717d); }
.resource-calendar-details { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; align-items: start; }
.resource-calendar-details > *, .resource-roster-details {
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--resource-line);
  border-radius: 6px;
  background: var(--resource-soft);
}
.resource-calendar-sync { grid-row: span 2; }
.resource-calendar-sync h3 { font-size: 18px; }
.resource-calendar-sync [role=status] { font-size: 14px; margin: 8px 0; }
.resource-calendar-sync ul, .crm-resource-roster { padding: 0; margin: 10px 0 0; list-style: none; }
.resource-calendar-sync li, .crm-resource-roster li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 0;
  border-top: 1px solid var(--resource-line);
  font-size: 14px;
}
.resource-calendar-sync li span { text-transform: capitalize; }
.crm-resources details > summary { cursor: pointer; color: var(--resource-navy); font-weight: 700; }
.crm-resources .crm-help { max-width: 850px; color: var(--resource-muted); font-size: 14px; line-height: 1.45; }
.crm-resource-summary { display: flex; flex-wrap: wrap; gap: 8px 22px; padding: 14px 0; margin: 16px 0; border-block: 1px solid var(--resource-line); }
.crm-resource-summary p { margin: 0; font-size: 14px; }
.crm-resource-roster li div { flex: 1; min-width: 0; }
.crm-resource-roster span:not(.resource-person-dot) { display: block; font-size: 13px; overflow-wrap: anywhere; }
.resource-history { margin-top: 24px; }
.resource-history .crm-resource-tools { grid-template-columns: minmax(0, 380px) auto; justify-content: start; }
.crm-resource-list { list-style: none; padding: 0; margin: 0; }
.crm-resource-list li { display: flex; justify-content: space-between; align-items: start; gap: 16px; border-top: 1px solid var(--resource-line); padding: 14px 0; }
.crm-resource-list b, .crm-resource-list span { display: block; overflow-wrap: anywhere; }
.crm-resource-list span { margin-top: 5px; font-size: 14px; }
.crm-resource-list [data-status] { font-weight: 700; text-transform: capitalize; }
.crm-resource-record-actions { display: flex; flex-direction: column; gap: 8px; }
.crm-resource-list details { font-size: 13px; margin-top: 12px; }
.resource-outlook-event { border-style: dashed; }
.resource-sync-record { color: var(--resource-muted); font-size: 13px; overflow-wrap: anywhere; }
.resource-help-link { margin: 18px 0 0; font-size: 14px; }
.crm-resource-dialog {
  box-sizing: border-box;
  width: min(670px, calc(100% - 24px));
  max-height: min(90vh, 860px);
  margin: auto;
  padding: 0;
  overflow: auto;
  scroll-padding-block: 70px;
  border: 1px solid var(--sh-line, #cdd9e4);
  border-top: 4px solid var(--sh-red, #ef1b2d);
  border-radius: 8px;
  background: #fff;
}
.crm-resource-dialog > header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--sh-line, #cdd9e4);
  background: #fff;
}
.crm-resource-dialog > header h2 { margin: 0; color: var(--sh-deep, #092744); }
.crm-resource-dialog > header button { flex: none; min-width: 44px; padding: 6px; font-size: 22px; }
.crm-resource-dialog > .crm-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 12px 16px;
  padding: 16px 20px 0;
  margin: 0;
}
.crm-resource-dialog .crm-form label:not(.crm-check) { display: block; min-width: 0; font-size: 13px; font-weight: 700; }
.crm-resource-dialog .crm-form label small { display: inline; margin-left: 3px; }
.crm-resource-dialog .crm-form input:not([type=checkbox]), .crm-resource-dialog .crm-form select, .crm-resource-dialog .crm-form textarea { display: block; width: 100%; margin-top: 5px; }
.crm-resource-dialog .crm-form input[type=color] { height: 44px; }
.crm-resource-dialog .crm-form > p { margin: 0; }
.crm-resource-dialog .crm-form > [role=status]:empty { display: none; }
.crm-resource-dialog .crm-form .crm-wide { grid-column: 1/-1; }
.crm-resource-dialog .crm-form-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  grid-column: 1/-1;
  gap: 8px;
}
.crm-resource-dialog > .crm-form .crm-form-actions {
  position: sticky;
  bottom: 0;
  z-index: 1;
  margin-inline: -20px;
  padding: 10px 20px;
  border-top: 1px solid var(--sh-line, #cdd9e4);
  background: #fff;
}
.resource-profile-list button { border: 1px solid var(--resource-line); border-radius: 5px; background: #fff; color: var(--resource-navy); padding: 9px 12px; cursor: pointer; }
.resource-profile-list button:hover { border-color: var(--sh-field, #8da4ba); background: var(--resource-soft); }
@media (max-width: 650px) {
  .resource-calendar-details, .resource-history .crm-resource-tools, .crm-resource-dialog > .crm-form { grid-template-columns: minmax(0,1fr); }
  .resource-calendar-sync { grid-row: auto; }
  .crm-resource-list li { flex-direction: column; gap: 10px; }
  .crm-resource-record-actions { flex-direction: row; flex-wrap: wrap; }
}

/* Shared training dates use the course register, with a usable list on small screens. */
.resource-training-list{list-style:none;padding:0;display:grid;gap:10px;max-height:30rem;overflow:auto}.resource-training-list li{display:flex;justify-content:space-between;align-items:start;gap:16px;background:#fff;border:1px solid #cbd9e7;border-left:4px solid #123e68;border-radius:6px;padding:14px}.resource-training-list li div{min-width:0}.resource-training-list span{display:block;overflow-wrap:anywhere}.resource-training-list a{flex-shrink:0}.resource-training-schedule{margin:16px 0}.resource-training-schedule summary{font-weight:700;cursor:pointer}@media(max-width:600px){.resource-training-list li{flex-direction:column;gap:8px}.resource-training-list{max-height:26rem}}

/* Keep the month in one grid. Week and day retain their readable time columns. */
[data-resource-calendar] { scroll-margin-top: 92px; }
.crm-resource-calendar-scroll > [data-calendar-view="dayGridMonth"] { min-width: 0; }
.crm-resources .fc .fc-header-toolbar { flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.crm-resources .fc .fc-daygrid-event { min-height: 18px; }
.crm-resources .fc .fc-daygrid-day-number { padding: 2px 5px; }
.crm-resources .fc .fc-daygrid-event .fc-event-time { font-weight: 700; }
.crm-resources .fc .fc-event:focus-visible { outline: 2px solid #123e68; outline-offset: 2px; }
.crm-resources .fc .fc-list-event-dot { border-color: var(--resource-event-colour, #62717d); }
.crm-resource-tooltip { position: fixed; z-index: 9500; pointer-events: none; width: max-content; max-width: min(340px, calc(100vw - 16px)); max-height: 65vh; overflow: hidden; padding: 12px 15px; background: #092744; color: #fff; border-radius: 6px; box-shadow: 0 4px 16px #09274444; font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.crm-resource-tooltip strong, .crm-resource-tooltip span { display: block; }
.crm-resource-tooltip span { margin-top: 4px; white-space: pre-wrap; }
.resource-event-details, .resource-profile-body { padding: 16px 22px; }
.resource-event-details p { white-space: pre-wrap; overflow-wrap: anywhere; }
.resource-profiles { margin: 22px 0; scroll-margin-top: 96px; }
.resource-profile-list { list-style: none; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fit,minmax(min(190px,100%),1fr)); }
.resource-profile-list button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; text-align: start; }
.resource-profile-list small, .resource-profile-docs small { display: block; font-weight: normal; font-size: 13px; }
.resource-profile-dialog h2 .resource-person-dot { display: inline-block; vertical-align: middle; width: .8em; height: .8em; }
.resource-profile-body section + section { margin-top: 18px; border-top: 1px solid #d4e0eb; }
.resource-profile-body h3 { margin: 14px 0 6px; }
.resource-profile-body summary { cursor: pointer; padding: 6px 0; font-weight: 700; }
.resource-offer-options { max-height: 300px; overflow: auto; border: 1px solid #cbd8e4; padding: 8px 12px; margin: 8px 0; }
.resource-offer-options label { display: flex; align-items: start; gap: 8px; padding: 6px 0; }
.resource-profile-docs, .resource-profile-capabilities { padding-inline-start: 16px; }
.resource-profile-docs li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; overflow-wrap: anywhere; }
.resource-profile-docs li + li { border-top: 1px solid #e2eaf2; }
.resource-matrix {
  --matrix-line: #ccdbe7;
  --matrix-navy: #103454;
  min-width: 0;
  margin-bottom: 24px;
  padding: clamp(12px, 2vw, 22px);
  border: 1px solid var(--matrix-line);
  border-top: 4px solid #e61937;
  border-radius: 8px;
  background: #f4f8fb;
  scroll-margin-top: 96px;
}
.crm-resources .resource-matrix h3 { margin: 0 0 6px; font-size: 24px; color: var(--matrix-navy); }
.resource-matrix > p { margin: 0 0 14px; }
.resource-matrix-tools, .resource-matrix-meta { display: flex; flex-wrap: wrap; gap: 12px 20px; }
.resource-matrix-tools label { display: grid; min-width: 0; gap: 4px; font-size: 14px; font-weight: 700; }
.resource-matrix-tools label:first-child { flex: 1 1 270px; }
.resource-matrix-tools label:last-child { flex: 0 1 270px; }
.resource-matrix-tools input, .resource-matrix-tools select {
  box-sizing: border-box;
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid #8fa9c0;
  border-radius: 5px;
  background: #fff;
  color: var(--matrix-navy);
  font: inherit;
  font-weight: 400;
}
.resource-matrix-meta { align-items: center; justify-content: space-between; margin: 14px 0 10px; font-size: 13px; }
.resource-matrix-meta p { margin: 0; }
.resource-matrix-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.resource-matrix-scroll { max-height: min(33rem, 64vh); overflow: auto; border: 1px solid var(--matrix-line); border-radius: 6px; }
.resource-matrix table { width: 100%; margin: 0; border-spacing: 0; border-collapse: separate; background: #fff; font-size: 14px; }
.resource-matrix th, .resource-matrix td { padding: 9px 10px; border-bottom: 1px solid var(--matrix-line); }
.resource-matrix thead th { position: sticky; top: 0; z-index: 2; min-width: 106px; background: var(--matrix-navy); color: #fff; }
.resource-matrix thead th:first-child, .resource-matrix th[scope="row"] {
  position: sticky;
  left: 0;
  min-width: clamp(135px, 27vw, 245px);
  text-align: left;
}
.resource-matrix thead th:first-child { z-index: 3; }
.resource-matrix thead button {
  display: inline-flex;
  align-items: center;
  text-align: left;
  gap: 6px;
  padding: 3px 0;
  border: 0;
  background: transparent;
  color: #fff;
  font: inherit;
  cursor: pointer;
}
.resource-matrix thead button:hover { text-decoration: underline; }
.resource-matrix thead .resource-person-dot { border: 1px solid #dce9f5; }
.resource-matrix thead button:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.resource-matrix th[scope="row"] { z-index: 1; border-right: 1px solid var(--matrix-line); background: #fff; }
.resource-matrix tbody tr:nth-child(odd):not(.resource-matrix-group) > * { background: #f6f9fc; }
.resource-matrix-group th { background: #e5eef6; color: var(--matrix-navy); text-align: left; }
.resource-matrix td { text-align: center; }
.resource-matrix-confirmed {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  padding: 2px 8px;
  border: 1px solid #acd2b7;
  border-radius: 4px;
  background: #e2f3e7;
  color: #17482b;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 700;
}
.resource-matrix-unrecorded, .resource-matrix-online { color: #526b80; }
.resource-matrix td.resource-matrix-online { text-align: left; font-size: 13px; }
.resource-matrix-sr { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#resource-profile-list-heading { scroll-margin-top: 96px; }
@media (max-width: 580px) {
  .crm-resources { padding: 12px; }
  .crm-resources .fc .fc-toolbar-title { font-size: 1rem; }
  .crm-resources .fc .fc-toolbar button { font-size: .72rem; padding: .28rem .4rem; }
  .crm-resources .fc .fc-daygrid-event { font-size: .66rem; }
  .crm-resources .fc .fc-daygrid-day-number { padding: 1px 3px; }
  .crm-resources .fc-daygrid-day .fc-event-time { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
}
.crm-resources .fc .fc-daygrid-dot-event { display:grid; grid-template-columns:auto minmax(0,1fr); column-gap:4px; align-items:start; }
.crm-resources .fc .fc-daygrid-dot-event .fc-daygrid-event-dot { grid-column:1; grid-row:1; margin:4px 0 0; }
.crm-resources .fc .fc-daygrid-dot-event .fc-event-time { grid-column:2; grid-row:1; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; margin:0; }
.crm-resources .fc .fc-daygrid-dot-event .fc-event-title { grid-column:2; grid-row:2; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.crm-resources .fc .resource-outlook-event { border-color:var(--resource-event-colour,#62717d); }

/* Constrain the matrix intrinsically; its own horizontal scroller stays usable. */
.resource-matrix-scroll{max-width:100%;min-width:0;contain:inline-size layout paint}
