/* records area styles (wave 3, records builder). Use app.css tokens; keep the restrained house style. */

/* ---------------------------------------------------------------- grades */
.rec-grade { position: relative; display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; border: 1px solid transparent; background: var(--surface-2); color: var(--ink-2); }
.rec-grade.g-d { background: var(--ok-tint); color: var(--ok); }
.rec-grade.g-m { background: var(--info-tint); color: var(--info); }
.rec-grade.g-p { background: var(--surface-2); color: var(--ink); border-color: var(--line-2); }
.rec-grade.g-r, .rec-grade.g-n { background: var(--bad-tint); color: var(--bad); }
.rec-grade.prov { background: transparent; border-style: dashed; border-color: currentColor; }
.rec-grade.none { background: transparent; color: var(--ink-3); font-weight: 500; padding: 0; }
.rec-g { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 4px; border-radius: 5px; font: 650 11px/1 var(--font-ui); letter-spacing: .02em; border: 1px solid transparent; background: var(--surface-2); color: var(--ink-2); }
.rec-g.g-d { background: var(--ok-tint); color: var(--ok); }
.rec-g.g-m { background: var(--info-tint); color: var(--info); }
.rec-g.g-p { color: var(--ink); border-color: var(--line-2); background: var(--surface); }
.rec-g.g-r, .rec-g.g-n { background: var(--bad-tint); color: var(--bad); }
.rec-g.prov { background: transparent; border-style: dashed; border-color: currentColor; }
.rec-g.none { background: transparent; color: var(--ink-3); border: 1px dashed var(--line-2); }
.rec-ok { color: var(--ok); display: inline-flex; align-items: center; gap: 3px; }

/* the worked-out grade */
.rec-explain { margin-top: 12px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface-2); }
.rec-explain summary { cursor: pointer; list-style: none; padding: 9px 12px; font-size: 13px; font-weight: 550; color: var(--ink-2); display: flex; align-items: center; gap: 7px; min-height: 24px; }
.rec-explain summary::-webkit-details-marker { display: none; }
.rec-explain summary:hover { color: var(--ink); }
.rec-explain[open] summary { border-bottom: 1px solid var(--line); }
.rec-explain ol { margin: 0; padding: 10px 14px 4px 32px; font-size: 13px; line-height: 1.55; display: grid; gap: 3px; }
.rec-explain p { padding: 4px 14px 10px; }

/* outcome coverage */
.rec-cov { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.rec-cov-row { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 13px; }
.rec-cov-row:last-child { border-bottom: 0; }
.rec-cov-row .lo { font: 650 11.5px/1 var(--font-ui); color: var(--ink-3); letter-spacing: .03em; }
.rec-cov-row.on .lo { color: var(--ink); }
.rec-cov-row .t { min-width: 0; color: var(--ink-2); }
.rec-cov-row.on .t { color: var(--ink); }

/* subject blocks */
.rec-subject-head { display: flex; align-items: center; gap: 12px; }
.rec-subject-head .grow { flex: 1; }
.rec-subject-head h3 { font-size: 16px; margin-top: 3px; }
.rec-subject-grade { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; text-align: right; }
.rec-subject-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; margin-top: 16px; }
.rec-subject-body .rec-cov { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.rec-subject-body .rec-cov-row:nth-last-child(2):nth-child(odd) { border-bottom: 0; }
.rec-subject-body .rec-cov-row:nth-child(odd) { border-right: 1px solid var(--line); }
.rec-h4 { font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin: 0 0 8px; text-transform: none; }
.rec-h2 { font-size: 15px; margin: 24px 0 10px; }
.rec-items td { vertical-align: top; }
.rec-item-title { display: block; font-weight: 550; font-size: 13.5px; }
.rec-items tr:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
@media (max-width: 760px) { .rec-subject-body .rec-cov { grid-template-columns: minmax(0, 1fr); } .rec-subject-body .rec-cov-row:nth-child(odd) { border-right: 0; } .rec-subject-body .rec-cov-row:nth-last-child(2):nth-child(odd) { border-bottom: 1px solid var(--line); } }
@media (max-width: 560px) {
  .rec-subject-head { flex-wrap: wrap; }
  .rec-subject-grade { flex-direction: row; align-items: center; width: 100%; justify-content: flex-start; text-align: left; padding-top: 4px; }
}

.rec-kpis { margin-bottom: 16px; }
.rec-kpis .kpi .v { font-size: 26px; }
@media (max-width: 560px) { .rec-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .rec-kpis .kpi { padding: 12px 14px; } .rec-kpis .kpi .v { font-size: 22px; } }
.rec-docs { margin-bottom: 16px; }
.rec-doc-ico { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); flex: none; }
.rec-jump { display: flex; gap: 6px; overflow-x: auto; min-width: 0; max-width: 100%; padding: 2px 0 12px; scrollbar-width: none; }
.rec-jump a { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 6px 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font: 600 12.5px/1 var(--font-ui); color: var(--ink-2); text-decoration: none; white-space: nowrap; flex: none; }
.rec-jump a:hover { border-color: var(--line-2); color: var(--ink); }

/* record drawer */
.drawer.rec-drawer { width: min(640px, 100%); }
.rec-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-lg); }
.rec-facts > div { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; min-width: 0; }
.rec-facts span:first-child { font-size: 12px; color: var(--ink-3); }
.rec-facts b { font-weight: 550; font-size: 13.5px; }
.rec-feedback { padding: 10px 12px; border-left: 3px solid var(--line-2); background: var(--surface-2); border-radius: 0 var(--r) var(--r) 0; }
.rec-feedback p { margin-top: 3px; font-size: 13.5px; line-height: 1.55; }
.rec-form { display: flex; flex-direction: column; gap: 12px; }
.rec-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rec-choice label { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-lg); cursor: pointer; font-size: 13.5px; min-height: 44px; }
.rec-choice label .tiny { flex-basis: 100%; padding-left: 26px; }
.rec-choice label:has(input:checked) { border-color: var(--ink); background: var(--surface-2); }
.rec-choice input { width: 17px; height: 17px; accent-color: var(--ink); }
.rec-choice.compact { grid-template-columns: repeat(2, max-content); }
.rec-choice.compact label { min-height: 36px; padding: 6px 12px; }
.rec-conv { display: flex; flex-direction: column; gap: 10px; }
.rec-conv-i { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 8px; }
.rec-conv-i .ico { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-3); }
.rec-conv-i.a-agreed .ico, .rec-conv-i.a-finalised .ico { background: var(--ok-tint); color: var(--ok); }
.rec-conv-i.a-disagreed .ico { background: var(--bad-tint); color: var(--bad); }
.rec-conv-i.a-remarked .ico, .rec-conv-i.a-justified .ico { background: var(--info-tint); color: var(--info); }
.rec-conv-i p { margin-top: 3px; line-height: 1.5; }
.rec-tl .tl-item .what { font-size: 13.5px; }
.rec-tl .tl-item.rec-a-verified::before, .rec-tl .tl-item.rec-a-agreed::before, .rec-tl .tl-item.rec-a-finalised::before, .rec-tl .tl-item.rec-a-accepted::before { border-color: var(--ok); background: var(--ok); }
.rec-tl .tl-item.rec-a-disagreed::before, .rec-tl .tl-item.rec-a-revoked::before, .rec-tl .tl-item.rec-a-moderator_disagreed::before { border-color: var(--bad); }
.rec-tl-d { color: var(--ink-2); margin-top: 3px; line-height: 1.45; overflow-wrap: anywhere; }

/* gradebook matrix */
.rec-toolbar { align-items: flex-end; gap: 10px; margin-bottom: 12px; }
.rec-toolbar .field { min-width: 180px; }
.rec-toolbar .field.grow { flex: 1; min-width: 200px; max-width: 360px; }
@media (max-width: 560px) { .rec-toolbar .field, .rec-toolbar .field.grow { min-width: 0; flex: 1 1 100%; max-width: none; } }
.rec-rule { padding: 12px 14px; margin-bottom: 12px; }
.rec-matrix td { padding: 6px 8px; }
.rec-matrix th.rec-col { white-space: normal; min-width: 92px; max-width: 150px; text-align: center; vertical-align: bottom; }
.rec-col-t { display: block; font-size: 11.5px; line-height: 1.25; color: var(--ink); max-height: 2.6em; overflow: hidden; }
.rec-col-btn { margin-top: 4px; height: 24px; font-size: 11px; padding: 0 6px; }
.rec-cell { display: inline-flex; align-items: center; gap: 4px; min-height: 28px; padding: 2px 6px; border: 1px solid transparent; border-radius: 7px; background: none; cursor: pointer; color: var(--ink-2); }
.rec-cell:hover { border-color: var(--line-2); background: var(--surface-2); }
.rec-cell:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.rec-cell .tiny { font-variant-numeric: tabular-nums; }
.rec-cell svg { color: var(--ok); }
.rec-cell.st-draft { opacity: .7; }
.rec-na { color: var(--ink-3); }
.rec-legend { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.rec-legend svg { width: 11px; height: 11px; }
.rec-subj-g { display: inline-flex; align-items: center; gap: 3px; padding: 2px 4px 2px 6px; border: 1px solid var(--line); border-radius: 6px; }

/* overview, setup, samples */
.rec-cov-bar { display: flex; flex-direction: column; gap: 4px; min-width: 110px; }
.rec-cov-bar .bar { height: 5px; }
.rec-ov td { vertical-align: top; }
.rec-samples td { vertical-align: top; }
.rec-setup .li .main span { white-space: normal; }
.rec-radio { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px; border-radius: 6px; font-size: 13px; font-weight: 500; color: var(--ink-2); cursor: pointer; }
.rec-radio:has(input:checked) { background: var(--surface); color: var(--ink); box-shadow: var(--sh-1); }
.rec-radio input { accent-color: var(--ink); }

/* audit log */
.rec-filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; padding: 16px; }
.rec-filters-go { display: flex; gap: 8px; align-items: flex-end; }
@media (max-width: 1100px) { .rec-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .rec-filters { grid-template-columns: 1fr; } }
.rec-audit td { vertical-align: top; }
.rec-audit-d { max-width: 340px; min-width: 180px; white-space: normal; overflow-wrap: anywhere; }

/* moderation */
.rec-mod-item h3 { overflow-wrap: anywhere; }
.rec-quote { margin-top: 8px; padding-left: 10px; border-left: 3px solid var(--line-2); color: var(--ink-2); }
.rec-mod-dec { margin-top: 12px; padding: 10px 12px; border-radius: var(--r); background: var(--ok-tint); }
.rec-mod-dec.disagree { background: var(--bad-tint); }
.rec-mod-dec p { margin: 4px 0; }
.rec-mod-dec .tiny { display: block; margin-top: 2px; }
.rec-mod-form { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.rec-mod-form .field { width: 100%; }
.rec-close { margin-top: 18px; }
.rec-report { margin-bottom: 16px; }

/* home cards */
.rec-home .rec-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.rec-stat { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-lg); text-decoration: none; color: var(--ink); transition: border-color .15s; }
.rec-stat:hover { border-color: var(--line-2); }
.rec-stat b { font-size: 20px; font-weight: 650; letter-spacing: -.02em; }
.rec-stat span { font-size: 12px; color: var(--ink-3); }
.rec-stat.warn b { color: var(--warn); }
.rec-stat.bad b { color: var(--bad); }
.rec-home-subjects { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.rec-home-s { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 8px; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; color: var(--ink-2); font-weight: 600; }

/* public check pages */
.rec-verify .auth-card { gap: 16px; }
.rec-verify-ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.rec-verify-ico.ok { background: var(--ok-tint); color: var(--ok); }
.rec-verify-ico.bad { background: var(--bad-tint); color: var(--bad); }
.rec-verify-t { border: 1px solid var(--line); border-radius: var(--r-lg); }
.rec-verify-t td, .rec-verify-t th { padding: 8px 12px; }

/* ---------------------------------------------------------------- transcript (A4 portrait) */
.rec-transcript { --p: #16161C; --p2: #55555C; --p3: #85858C; --pl: #DADAD4; max-width: 210mm; margin: 0 auto; background: #fff; color: var(--p); border: 1px solid var(--line); border-radius: var(--r-xl); padding: 14mm 13mm 11mm; font-size: 12.5px; line-height: 1.45; }
.rt-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; padding-bottom: 10px; border-bottom: 2px solid var(--p); flex-wrap: wrap; }
.rt-centre { font: 600 19px/1.2 var(--font-read); letter-spacing: -.01em; }
.rt-sub { color: var(--p2); font-size: 12px; margin-top: 2px; }
.rt-title { text-align: right; display: flex; flex-direction: column; gap: 2px; }
.rt-title b { font-size: 15px; letter-spacing: .01em; }
.rt-title span { font-size: 11.5px; color: var(--p2); }
.rt-dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 16px; margin: 14px 0; }
.rt-dl dt { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--p3); }
.rt-dl dd { margin: 2px 0 0; font-weight: 550; }
.rt-table { width: 100%; border-collapse: collapse; margin-top: 6px; }
.rt-table th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--p3); font-weight: 600; padding: 6px 6px; border-bottom: 1px solid var(--p); }
.rt-table td { padding: 7px 6px; border-bottom: 1px solid var(--pl); vertical-align: top; }
.rt-table td.num { font-variant-numeric: tabular-nums; }
.rt-los { display: flex; flex-wrap: wrap; gap: 3px 10px; margin-top: 3px; font-size: 10.5px; color: var(--p2); }
.rt-los b { color: var(--p); }
.rt-notes { margin-top: 12px; font-size: 10.5px; color: var(--p2); display: grid; gap: 4px; }
.rt-notes b { color: var(--p); }
.rt-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--pl); }
.rt-check { font-size: 10.5px; color: var(--p2); display: grid; gap: 4px; max-width: 70%; }
.rt-check b { color: var(--p); }
.rt-qr svg { display: block; width: 104px; height: 104px; }
@media (max-width: 680px) {
  .rec-transcript { padding: 18px 14px; font-size: 12px; }
  .rt-title { text-align: left; }
  .rt-dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rt-table th:nth-child(4), .rt-table td:nth-child(4) { display: none; }
  .rt-foot { flex-direction: column; align-items: flex-start; }
  .rt-check { max-width: none; }
}

/* ---------------------------------------------------------------- programme certificate (A4 landscape) */
.rec-cert-wrap { overflow: hidden; }
.rec-cert { position: relative; max-width: 297mm; margin: 0 auto; aspect-ratio: 297 / 210; background: #fff; color: #16161C; border: 1px solid var(--line); border-radius: var(--r-xl); padding: 6.5% 9% 5%; display: flex; flex-direction: column; align-items: center; text-align: center; container-type: inline-size; }
.rc-frame { position: absolute; inset: 3.2%; border: 1px solid #16161C; outline: 1px solid #16161C; outline-offset: 4px; pointer-events: none; }
.rc-centre { font: 600 clamp(11px, 2cqi, 18px)/1.2 var(--font-ui); letter-spacing: .14em; text-transform: uppercase; }
.rc-kicker { margin-top: 3.5%; font: 500 clamp(9px, 1.4cqi, 13px)/1 var(--font-ui); letter-spacing: .18em; text-transform: uppercase; color: #55555C; }
.rc-pre { margin-top: 5%; font: italic 400 clamp(10px, 1.8cqi, 16px)/1.3 var(--font-read); color: #55555C; }
.rc-name { margin-top: 1.5%; font: 500 clamp(20px, 5.4cqi, 50px)/1.1 var(--font-read); letter-spacing: -.01em; }
.rc-for { margin-top: 2.5%; max-width: 76%; font: 400 clamp(10px, 1.7cqi, 15px)/1.5 var(--font-read); color: #2A2A33; }
.rc-subjects { list-style: none; padding: 0; margin: 3% 0 0; display: flex; flex-wrap: wrap; justify-content: center; gap: .6em 1.6em; font-size: clamp(8px, 1.2cqi, 11.5px); color: #55555C; max-width: 86%; }
.rc-subjects li { display: inline-flex; gap: .4em; }
.rc-subjects b { color: #16161C; font-weight: 600; }
.rc-foot { margin-top: auto; width: 100%; display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; text-align: left; }
.rc-sig { display: flex; flex-direction: column; gap: 2px; font-size: clamp(7.5px, 1.05cqi, 11px); color: #55555C; }
.rc-sig b { font: 500 clamp(10px, 1.6cqi, 15px)/1.2 var(--font-read); color: #16161C; border-top: .75px solid rgba(22, 22, 28, .5); padding-top: 6px; min-width: 40%; }
.rc-check { display: flex; align-items: flex-end; gap: 10px; font-size: clamp(7px, 1cqi, 10.5px); color: #6B6A75; text-align: right; }
.rc-check b { color: #16161C; }
.rc-qr svg { display: block; width: clamp(48px, 9cqi, 96px); height: auto; }
.rc-disclaimer { margin-top: 2.2%; font-size: clamp(6.5px, .9cqi, 9.5px); color: #8B8A95; }

/* ---------------------------------------------------------------- print: only the document, on its own page size */
@page rec-a4 { size: A4 portrait; margin: 12mm; }
@page rec-a4l { size: A4 landscape; margin: 0; }
@media print {
  body:has(.rec-transcript) { page: rec-a4; }
  body:has(.rec-cert) { page: rec-a4l; }
  body:has(.rec-print) { background: #fff; }
  body:has(.rec-print) .shell, body:has(.rec-print) .main-col, body:has(.rec-print) main { min-height: 0 !important; height: auto !important; padding: 0 !important; margin: 0 !important; }
  .rec-print, .rec-print * { visibility: visible !important; }
  .rec-print-page { padding: 0 !important; margin: 0 !important; max-width: none !important; animation: none !important; }
  .rec-print-page > :not(.rec-transcript):not(.rec-cert-wrap) { display: none !important; }
  .rec-transcript { border: 0; border-radius: 0; padding: 0; max-width: none; font-size: 11px; }
  .rec-cert-wrap { overflow: visible; }
  .rec-cert { width: 297mm; height: 209mm; max-width: none; aspect-ratio: auto; border: 0; border-radius: 0; break-inside: avoid; }
  .rt-table tr, .rt-foot { break-inside: avoid; }
}
