/* The record frame (views/core/recordFrame.php): icon rail, section panel, Pinned flyout, record header and page title row.
   The frame is drawn in the page's menu column, and the row holding it becomes a grid: the rail and panel down the left, the
   header, title row and the page's own column beside them. Values come from the eSuite tokens; white on navy is the one literal. */

.container-fluid:has(> .row > * > .lr-shell), .container-fluid:has(> form > .row > * > .lr-shell) { padding: 0; }
.row:has(> * > .lr-shell) { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto auto 1fr; margin: 0; --bs-gutter-x: 0; background: var(--es-grey-50); }
.row:has(> * > .lr-shell) > * { width: auto; max-width: none; min-width: 0; margin: 0; padding: 0; }
.row > :has(> .lr-shell), .lr-shell { display: contents; }
.row:has(> * > .lr-shell) > :not(:has(> .lr-shell)) { grid-column: 2; grid-row: 4; padding: var(--space-4) var(--space-6) var(--space-6); }

/* Rail and panel stay in view below the sticky chrome while the page scrolls (es-record-frame.js measures it into --lr-top). */
.lr-nav { position: sticky; top: var(--lr-top, 0px); z-index: 20; grid-column: 1; grid-row: 1 / -1; align-self: start; display: flex;
  height: calc(100vh - var(--lr-top, 0px)); }

/* 1. Icon rail: 72px tiles, so "Programme" fits at 11px and bold, with 4px either side for the focus ring. */
.lr-rail { display: flex; flex-direction: column; align-items: center; gap: var(--space-1); flex-shrink: 0; width: 80px; padding: var(--space-3) 0;
  overflow-y: auto; background: var(--es-blue-900); }
.lr-rail-item { position: relative; display: flex; flex-direction: column; align-items: center; gap: var(--space-1); flex-shrink: 0; width: 72px;
  padding: var(--space-2) 2px; border: 0; border-radius: var(--radius-md); background: transparent; color: var(--text-on-navy-muted); font-family: inherit;
  font-size: var(--text-2xs); line-height: 1.2; text-align: center; text-decoration: none; cursor: pointer; hyphens: manual;
  transition: background-color var(--es-dur) var(--es-ease), color var(--es-dur) var(--es-ease), box-shadow var(--es-dur) var(--es-ease); }
.lr-rail-item i { font-size: 16px; }
.lr-rail-groups { display: flex; flex-direction: column; align-items: center; gap: var(--space-1); }
.lr-rail-item:hover { background: var(--es-blue-700); color: #fff; text-decoration: none; }
/* The group shown in the panel; the current page's group keeps an outline while another group is shown. */
.lr-rail-item[aria-selected="true"] { background: #fff; color: var(--es-blue-800); font-weight: 600; }
.lr-rail-item.is-current[aria-selected="false"] { box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .6); }
.lr-shell.is-flyout-open .lr-rail-item[aria-selected="true"] { background: transparent; color: #fff; font-weight: 400;
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .6); }
.lr-shell.is-flyout-open .lr-rail-pinned { background: #fff; color: var(--es-blue-800); font-weight: 600; }
.lr-rail-divider { flex-shrink: 0; width: 40px; height: 1px; margin: var(--space-1) 0; background: rgba(255, 255, 255, .25); }
.lr-count { position: absolute; top: 2px; right: 6px; min-width: 16px; height: 16px; padding: 0 var(--space-1); border-radius: var(--radius-pill);
  background: var(--es-orange-600); color: #fff; font-size: var(--text-2xs); font-weight: 600; line-height: 16px; font-variant-numeric: tabular-nums; }
.lr-count[hidden] { display: none; }

/* 2. Section panel */
.lr-panel { flex-shrink: 0; width: 228px; overflow-y: auto; background: #fff; border-right: 1px solid var(--es-grey-100); }
.lr-panel-group[hidden] { display: none; }
.lr-panel-title { padding: var(--space-4) var(--space-4) 10px; color: var(--es-text-strong); font-size: var(--text-h4); font-weight: 600; }
.lr-pages { display: flex; flex-direction: column; gap: 1px; margin: 0; padding: 0 var(--space-2) var(--space-3); list-style: none; }
.lr-page { display: flex; align-items: center; border-radius: var(--radius-sm); }
.lr-page:hover { background: var(--es-grey-50); }
.lr-page-link { display: flex; flex: 1; align-items: center; gap: var(--space-2); min-width: 0; padding: 7px 10px; border-radius: var(--radius-sm);
  color: var(--es-text-body); font-size: var(--text-sm); text-decoration: none; }
.lr-page-link:hover { color: var(--es-text-body); text-decoration: none; }
.lr-page-link[aria-current="page"] { background: var(--es-blue-tint); color: var(--es-blue-800); font-weight: 600; }
/* A course title's page that is set up. */
.lr-page-done { flex-shrink: 0; margin-left: auto; color: var(--es-green-700); font-size: var(--text-xs); }
.lr-pin, .lr-unpin { flex-shrink: 0; width: 28px; height: 28px; border: 0; border-radius: var(--radius-sm); background: none;
  color: var(--es-text-muted); font-size: var(--text-2xs); cursor: pointer; }
/* An unpinned pin is tilted, so the state is not shown by colour alone. */
.lr-pin i { transform: rotate(45deg); transition: transform var(--es-dur) var(--es-ease); }
.lr-pin:hover, .lr-unpin:hover, .lr-pin.is-pinned { color: var(--es-blue-800); }
.lr-pin.is-pinned i { transform: none; }

/* 3. Pinned flyout */
.lr-backdrop { position: fixed; inset: 0; z-index: 30; background: transparent; }
.lr-flyout { position: absolute; top: 8px; left: 92px; z-index: 31; display: flex; flex-direction: column; gap: 1px; width: 280px;
  max-height: calc(100vh - var(--lr-top, 0px) - 16px); overflow-y: auto; padding: var(--space-2); background: #fff; border: .5px solid var(--es-border-subtle);
  border-radius: var(--radius-lg); box-shadow: var(--es-shadow-lg); animation: lr-fade var(--es-dur) var(--es-ease); }
.lr-backdrop[hidden], .lr-flyout[hidden] { display: none; }
.lr-flyout:focus { outline: none; box-shadow: var(--es-shadow-lg), var(--es-focus-ring); }
.lr-flyout-eyebrow { padding: 6px 10px var(--space-2); color: var(--es-text-muted); font-size: var(--es-text-group-label); font-weight: 600; letter-spacing: .06em; }
.lr-flyout-list { display: flex; flex-direction: column; gap: 1px; margin: 0; padding: 0; list-style: none; }
.lr-flyout-item { display: flex; align-items: center; border-radius: var(--radius-sm); }
.lr-flyout-item:hover { background: var(--es-grey-50); }
.lr-flyout-link { display: flex; flex: 1; align-items: center; gap: 10px; min-width: 0; padding: 6px 10px; border-radius: var(--radius-sm);
  color: var(--es-text-body); text-decoration: none; }
.lr-flyout-link:hover { color: var(--es-text-body); text-decoration: none; }
.lr-flyout-icon { width: 14px; color: var(--es-text-muted); font-size: var(--text-xs); text-align: center; }
.lr-flyout-text { display: flex; flex-direction: column; min-width: 0; }
.lr-flyout-page { color: var(--es-text-body); font-size: var(--text-sm); }
.lr-flyout-group { color: var(--es-text-muted); font-size: var(--text-2xs); }
.lr-flyout-empty { margin: 0; padding: 6px 10px 10px; color: var(--es-text-muted); font-size: var(--text-xs); }
.lr-flyout-empty[hidden] { display: none; }

@keyframes lr-fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .lr-flyout { animation: none; }
  .lr-rail-item, .lr-pin i { transition: none; }
}

/* 4. Record header and 5. page title row */
.lr-learner { grid-column: 2; grid-row: 1; display: flex; align-items: center; gap: var(--space-3); min-width: 0; padding: var(--space-3) var(--space-6);
  background: #fff; border-bottom: 1px solid var(--es-grey-100); }
.lr-learner .es-avatar { flex-shrink: 0; background: var(--es-aqua-700); }
.lr-learner-text { display: flex; flex: 1 1 0; flex-direction: column; min-width: 0; }
.lr-learner-name { color: var(--es-text-strong); font-size: var(--text-h4); font-weight: 600; overflow-wrap: anywhere; }
.lr-learner-meta { color: var(--es-text-muted); font-size: var(--text-xs); font-variant-numeric: tabular-nums; }
.lr-learner-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-left: auto; }
.lr-title-row { grid-column: 2; grid-row: 2; display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-3); min-width: 0;
  padding: var(--space-4) var(--space-6) 0; }
.lr-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.lr-crumb { margin: 0; color: var(--es-text-muted); font-size: var(--text-xs); }
.lr-page-title { margin: 0; color: var(--es-text-strong); font-size: var(--text-h3); font-weight: 600; line-height: 1.3; }
.lr-stepper { display: flex; flex-shrink: 0; align-items: center; gap: var(--space-2); }
.lr-position { color: var(--es-text-muted); font-size: var(--text-xs); font-variant-numeric: tabular-nums; }
.lr-step { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: 1.5px solid var(--es-border-control-subtle);
  border-radius: var(--radius-sm); background: #fff; color: var(--es-text-muted); font-size: var(--text-sm); text-decoration: none; }
.lr-step-next { border-color: var(--es-blue-800); color: var(--es-blue-800); }
a.lr-step:hover { background: var(--es-blue-tint); color: var(--es-blue-800); text-decoration: none; }
.lr-step[disabled] { opacity: .5; cursor: not-allowed; }
/* A live region announces only while it is in the page, so an empty one loses its padding rather than its display. */
.lr-alerts { grid-column: 2; grid-row: 3; min-width: 0; padding: var(--space-3) var(--space-6) 0; }
.lr-alerts:empty { padding: 0; }
.lr-alerts .alert { margin: 0; }

@media (max-width: 767.98px) {
  /* The section panel waits closed and opens over the page from the rail (es-record-frame.js); headers wrap. */
  .lr-panel { display: none; }
  .lr-shell.is-panel-open .lr-panel { display: block; position: absolute; top: 0; left: 100%; z-index: 25; width: min(228px, calc(100vw - 96px)); height: 100%;
    box-shadow: var(--es-shadow-md); }
  .lr-learner, .lr-title-row { flex-wrap: wrap; padding-left: var(--space-3); padding-right: var(--space-3); }
  .lr-alerts { padding-left: var(--space-3); padding-right: var(--space-3); }
  .lr-title { flex-basis: 100%; }
  .lr-page-name, .lr-page-title { overflow-wrap: anywhere; }
  .row:has(> * > .lr-shell) > :not(:has(> .lr-shell)) { padding: var(--space-3); }
  .row:has(> * > .lr-shell) .card-header { flex-wrap: wrap; }
}

/* Record pages drawn as facts cards: two columns of cards, one on narrower screens. */
.lr-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); align-items: start; }
.lr-column { display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; }
.lr-columns .card, .lr-stack .card { margin: 0; }
.lr-stack { display: flex; flex-direction: column; gap: var(--space-4); }
.lr-lines { white-space: pre-line; }
.lr-input-short { max-width: 16rem; }
.lr-categories { display: flex; flex-direction: column; }
.lr-category { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-1) 0; border-bottom: .5px solid var(--es-grey-100); }
.lr-category:last-child { border-bottom: 0; }
.lr-category .form-check { margin: 0; }
.lr-category-main { flex-shrink: 0; }
.lr-notes-tools, .lr-list-tools { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-4); padding: var(--space-3) var(--space-4);
  border-bottom: .5px solid var(--es-grey-100); }
.lr-notes-tools[hidden], .lr-list-tools[hidden] { display: none; }
.lr-notes-count, .lr-list-count { margin: 0 0 0 auto; color: var(--es-text-muted); font-size: var(--text-xs); }
.lr-list-filter { display: flex; align-items: center; gap: var(--space-2); }
.lr-list-filter[hidden] { display: none; }
.lr-list-filter .form-select { width: auto; }
.lr-declaration { margin-bottom: var(--space-3); padding: var(--space-3); border-radius: var(--radius-md); background: var(--es-blue-tint); }
.lr-declaration[hidden] { display: none; }
.es-ofqual-results { max-height: 18rem; overflow-y: auto; border: var(--border-hairline) solid var(--es-border-subtle); border-radius: var(--radius-sm); }
.es-ofqual-results[hidden] { display: none; }
.es-ofqual-results li + li { border-top: var(--border-hairline) solid var(--es-border-subtle); }
.es-ofqual-pick { display: flex; align-items: flex-start; gap: var(--space-2); margin: 0; padding: var(--space-2) var(--space-3); cursor: pointer; }
.es-ofqual-pick:hover, .es-ofqual-pick:has(input:checked) { background: var(--es-blue-tint); }
.es-ofqual-pick .form-check-input { flex: none; margin-top: .2rem; }
.es-ofqual-pick-title { display: block; color: var(--es-text-body); }
.es-ofqual-pick-meta { display: block; font-size: var(--text-sm); color: var(--es-text-muted); }
.lr-subline { display: block; }
.lr-subline[hidden] { display: none; }
.lr-employer-results { max-height: 14rem; overflow-y: auto; }
.lr-employer-results li + li { margin-top: var(--space-1); }
.lr-employer-option { width: 100%; white-space: normal; }
@media (max-width: 1199.98px) {
  .lr-columns { grid-template-columns: minmax(0, 1fr); }
}
/* An employer's Diary: a week, a day to a row with its interactions side by side; today on the tint. */
.lr-week-nav { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.lr-week-go { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-left: auto; }
.lr-week-go .form-control { width: auto; }
.lr-week { margin: 0; padding: 0; list-style: none; }
.lr-day { display: grid; grid-template-columns: 10rem minmax(0, 1fr); gap: var(--space-2) var(--space-4); align-items: start; padding: var(--space-3) var(--space-4);
  border-bottom: .5px solid var(--es-grey-100); }
.lr-day:last-child { border-bottom: 0; }
.lr-day[aria-current="date"] { background: var(--es-blue-tint); }
.lr-day-name { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); margin: 0; padding-top: var(--space-1);
  color: var(--es-text-strong); font-size: var(--text-sm); font-weight: 600; }
.lr-day-empty { margin: 0; padding-top: var(--space-1); color: var(--es-text-muted); font-size: var(--text-xs); }
.lr-day-entries { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
.lr-entry { display: flex; flex-direction: column; gap: 2px; width: 15rem; max-width: 100%; padding: var(--space-2) var(--space-3);
  border: 1px solid var(--es-border-subtle); border-radius: var(--radius-sm); background: var(--es-white);
  color: var(--es-text-body); font-size: var(--text-sm); text-decoration: none; }
.lr-entry:hover { background: var(--es-grey-50); color: var(--es-text-body); text-decoration: none; }
.lr-entry:hover .lr-entry-title { text-decoration: underline; }
.lr-entry-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-1) var(--space-2); }
.lr-entry-head time { font-weight: 600; font-variant-numeric: tabular-nums; }
.lr-entry-title { color: var(--text-link); font-weight: 600; }
.lr-entry-meta { color: var(--es-text-muted); font-size: var(--text-xs); }
.lr-week-around { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-6); margin: 0; padding: var(--space-3) var(--space-4);
  border-top: .5px solid var(--es-grey-100); font-size: var(--text-sm); }
@media (max-width: 767.98px) {
  .lr-day { grid-template-columns: minmax(0, 1fr); }
  .lr-day-entries { flex-direction: column; }
  .lr-entry { width: 100%; }
  .lr-week-go { margin-left: 0; }
}
/* Merge employers: the search box beside its button. */
.lr-merge-search { display: flex; gap: var(--space-2); max-width: 28rem; }
/* Messages: an internal note among a conversation's messages. */
.es-timeline-item.lr-message-note { background: var(--es-surface-sunken); }
