:root { color-scheme: light dark; }
* { box-sizing: border-box; }
body { font-family: 'Avenir Next', system-ui, sans-serif; font-size: 18px;
       margin: 0; padding: 0; background: #f6f6fa; color: #1A1A2E; }
header { padding: 16px; background: #1A1A2E; color: #fff; }
header h1 { font-size: 20px; margin: 0; }
main { padding: 16px; max-width: 960px; margin: 0 auto; }

.cohort-title { font-size: 18px; margin: 0 0 12px; color: #1A1A2E; }

section.metric-group { background: #fff; border-radius: 8px; padding: 16px; margin-bottom: 16px;
                       box-shadow: 0 1px 2px rgba(0,0,0,.06); }
section.metric-group h4 { font-size: 14px; margin: 0 0 12px; color: #555; text-transform: uppercase; letter-spacing: .04em; display: flex; align-items: center; }
.field { display: flex; align-items: center; justify-content: space-between; padding: 10px 0;
         border-bottom: 1px solid #eee; }
.field:last-child { border-bottom: 0; }
.field label { flex: 1; font-size: 18px; }
.field input { width: 110px; padding: 10px 12px; font-size: 18px; text-align: right;
               border: 1px solid #ddd; border-radius: 6px; background: #fff; color: #1A1A2E; }
.field input[readonly] { background: #f0f0f5; color: #6b6b80; cursor: not-allowed; }

.save-pill { font-size: 13px; color: #1A6B1A; margin-left: 8px; opacity: 0; transition: opacity .2s; }
.save-pill.show { opacity: 1; }
.save-pill.error { color: #B00020; }

/* Tab strip */
.tab-strip { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 4px;
             border-bottom: 1px solid #ddd; margin-bottom: 16px; -webkit-overflow-scrolling: touch; }
.tab { flex: 0 0 auto; padding: 10px 14px; font-size: 16px; background: #fff; color: #1A1A2E;
       border: 1px solid #ddd; border-bottom: none; border-radius: 6px 6px 0 0; cursor: pointer;
       display: flex; flex-direction: column; align-items: center; min-width: 56px; }
.tab .tab-date { font-size: 11px; opacity: .6; margin-top: 2px; }
.tab.active { background: #CDFF96; border-color: #1A1A2E; font-weight: 600; }

/* Tab panels */
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.day-title { font-size: 18px; margin: 0 0 12px; color: #1A1A2E; }

/* Pipeline accordion */
details.pipeline { background: #fff; border-radius: 8px; margin-bottom: 16px;
                   box-shadow: 0 1px 2px rgba(0,0,0,.06); overflow: hidden; }
details.pipeline summary { list-style: none; cursor: pointer;
                           font-size: 16px; font-weight: 600; color: #1A1A2E;
                           background: #f0f0f5; padding: 14px 16px;
                           display: flex; align-items: center; gap: 8px;
                           border-left: 4px solid #1A1A2E; }
details.pipeline summary::-webkit-details-marker { display: none; }
details.pipeline summary::before { content: '▶'; font-size: 12px; color: #1A1A2E;
                                   transition: transform .15s ease; display: inline-block; }
details.pipeline[open] summary::before { transform: rotate(90deg); }
details.pipeline summary:hover { background: #e5e5ee; }
details.pipeline summary .save-pill { margin-left: auto; font-weight: 400; text-transform: none; }
.pipeline-form { padding: 12px 16px 4px; }

/* Matrix table */
.matrix-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; background: #fff;
                 border-radius: 8px; box-shadow: 0 1px 2px rgba(0,0,0,.06); margin-bottom: 16px; }
table.matrix { border-collapse: collapse; width: 100%; min-width: 720px; font-size: 15px; }
table.matrix th, table.matrix td { padding: 8px 12px; border-bottom: 1px solid #eee; text-align: right; }
table.matrix thead th { background: #1A1A2E; color: #fff; font-weight: 600; position: sticky; top: 0; }
table.matrix th.sticky { position: sticky; left: 0; background: #fff; z-index: 1; text-align: left;
                         box-shadow: 1px 0 0 #eee; min-width: 200px; }
table.matrix thead th.sticky { background: #1A1A2E; color: #fff; }
table.matrix td.total { font-weight: 700; background: #f6f6fa; }
/* Session Totals: the "Totals" column stands out from the weekly columns. */
table.matrix thead th.totals-col { background: #2E7D32; color: #fff; }
table.matrix td.totals-col { background: #EAF6EA; color: #1A1A2E; font-weight: 700; }
/* Session Totals grid: tighter so 12 weeks + Totals fit with no horizontal scroll. */
table.matrix.session-matrix { font-size: 14px; min-width: 0; }
table.matrix.session-matrix th, table.matrix.session-matrix td { padding: 6px 6px; }
table.matrix.session-matrix th.sticky { min-width: 150px; }

/* Ratio pills */
.ratio-list { list-style: none; padding: 0; margin: 0; }
.ratio-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0;
                 border-bottom: 1px solid #eee; flex-wrap: wrap; }
.ratio-label { flex: 1; min-width: 200px; font-size: 16px; }
.ratio-bench { font-size: 13px; color: #6b6b80; }
.pill { display: inline-block; padding: 4px 12px; border-radius: 999px; font-weight: 600; font-size: 14px; min-width: 64px; text-align: center; }
.pill-green  { background: #CDFF96; color: #1A1A2E; }
.pill-yellow { background: #FFE08A; color: #1A1A2E; }
.pill-red    { background: #FF8A8A; color: #1A1A2E; }
.pill-gray   { background: #E5E5EE; color: #1A1A2E; }

/* Locked banner */
.locked-banner { background: #FFE08A; color: #1A1A2E; padding: 10px 14px; border-radius: 6px;
                 margin-bottom: 12px; font-size: 15px; }
.locked-banner a { color: #1A1A2E; font-weight: 600; }

/* PDF CTA */
.pdf-cta { display: inline-block; background: #1A1A2E; color: #fff; padding: 10px 16px;
           border-radius: 6px; text-decoration: none; }

/* Admin dashboard */
.admin-header { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:8px 16px; padding:16px; background:#1A1A2E; color:#fff; }
.admin-header h1 { font-size:18px; margin:0; }
.admin-header button { background:#333; color:#fff; border:0; padding:8px 14px; min-height:44px; border-radius:6px; cursor:pointer; }
.admin-nav { display:flex; flex-wrap:wrap; gap:4px; flex:1 1 auto; }
.admin-nav[hidden] { display:none; }
.admin-nav a { display:inline-flex; align-items:center; min-height:44px; padding:0 14px; color:#fff; text-decoration:none;
               border-radius:6px; font-size:16px; }
.admin-nav a:hover { background:#333; }
.admin-nav a[aria-current="page"] { background:#CDFF96; color:#1A1A2E; font-weight:600; }
.admin-layout { display:grid; grid-template-columns:240px 1fr; gap:16px; padding:16px; max-width:1200px; margin:0 auto; }
.admin-layout aside { background:#fff; padding:16px; border-radius:8px; }
.admin-layout aside button { width:100%; padding:10px; min-height:44px; font-size:16px; background:#CDFF96; color:#1A1A2E; border:0; border-radius:6px; cursor:pointer; font-weight:600; }
.admin-layout aside label { display:block; font-size:14px; margin-top:12px; }
.admin-layout aside select { width:100%; padding:8px; min-height:44px; font-size:16px; margin-top:4px; }
.admin-layout main.admin-main { background:#fff; padding:16px; border-radius:8px; min-height:60vh; }
.admin-table { width:100%; border-collapse:collapse; font-size:14px; }
.admin-table th { text-align:left; padding:8px; border-bottom:2px solid #ddd; }
.admin-table td { padding:8px; border-bottom:1px solid #eee; }
.admin-table tr.row-clickable:hover { background:#f6f6fa; cursor:pointer; }
.modal-backdrop { position:fixed; inset:0; background:rgba(0,0,0,.35); display:flex; align-items:center; justify-content:center; z-index:100; }
.modal { background:#fff; padding:24px; border-radius:8px; min-width:320px; max-width:480px; }
.modal h2 { margin:0 0 16px; }
.modal .field { display:block; padding:8px 0; }
.modal .field label { display:block; font-size:14px; margin-bottom:4px; }
.modal .field input, .modal .field select, .modal .field textarea { width:100%; padding:10px; font-size:16px; box-sizing:border-box; }
.modal .actions { margin-top:16px; display:flex; gap:8px; justify-content:flex-end; }
.modal .actions button { padding:10px 16px; font-size:16px; border:0; border-radius:6px; cursor:pointer; }
.modal .actions button.primary { background:#CDFF96; color:#1A1A2E; font-weight:600; }
.modal .actions button.cancel  { background:#eee; }
@media (max-width:720px) { .admin-layout { grid-template-columns:1fr; } }
.admin-layout.full { grid-template-columns:1fr; }

/* Admin panels: buttons, inline forms, messages, pills (every tap target is 44px tall) */
.admin-main button, .admin-main select, .admin-main input:not([type=checkbox]) { min-height:44px; font-size:16px; font-family:inherit; }
.admin-main a { display:inline-flex; align-items:center; min-height:44px; }
.btn { padding:8px 14px; background:#eee; color:#1A1A2E; border:0; border-radius:6px; cursor:pointer; }
.btn.primary { background:#CDFF96; font-weight:600; }
.btn.danger { background:#FFD6D6; }
.btn[aria-pressed="true"] { background:#1A1A2E; color:#fff; }
.sub-tabs { display:flex; gap:8px; margin:12px 0; }
.inline-row { display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.inline-row input { flex:1 1 260px; padding:8px 10px; border:1px solid #ddd; border-radius:6px; }
.cell-actions { display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.cell-actions select { max-width:260px; padding:6px 8px; border:1px solid #ddd; border-radius:6px; }
.session-form { display:grid; gap:8px; padding:12px; background:#f6f6fa; border-radius:8px; max-width:480px; }
.session-form label { display:grid; gap:4px; font-size:14px; }
.session-form input { padding:8px 10px; border:1px solid #ddd; border-radius:6px; width:100%; }
.form-hint, .row-note { margin:0; font-size:13px; color:#555; }
.notify-error { font-size:13px; color:#B00020; }
.panel-msg { margin:8px 0; font-size:15px; min-height:1.4em; }
.panel-msg.is-bad { color:#B00020; }
.pill-ok   { background:#CDFF96; color:#1A1A2E; }
.pill-warn { background:#FFE08A; color:#1A1A2E; }
.pill-bad  { background:#FF8A8A; color:#1A1A2E; }

/* Under 600px a .cards table reads as a stack of cards: each cell shows its data-label first */
@media (max-width:600px) {
  .admin-table.cards, .admin-table.cards tbody, .admin-table.cards tr, .admin-table.cards td { display:block; width:100%; }
  .admin-table.cards thead { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; }
  .admin-table.cards tr { border:1px solid #ddd; border-radius:8px; padding:6px 12px; margin-bottom:12px; background:#fff; }
  .admin-table.cards td { display:flex; gap:12px; align-items:center; justify-content:space-between; flex-wrap:wrap;
                          padding:8px 0; border-bottom:1px solid #eee; text-align:right; }
  .admin-table.cards td:last-child { border-bottom:0; }
  .admin-table.cards td::before { content:attr(data-label); flex:0 0 36%; font-weight:600; color:#555; text-align:left; }
  .admin-table.cards td:not([data-label])::before { content:none; }
  .admin-table.cards td .cell-actions { justify-content:flex-end; }
}

/* Lab settings */
.lab-pick { display:grid; gap:4px; font-size:14px; max-width:360px; margin:12px 0; }
.lab-pick select { padding:6px 8px; border:1px solid #ddd; border-radius:6px; }
.lab-section { margin-top:24px; }
.lab-section textarea, .tool-editor textarea { width:100%; padding:10px; font-size:16px; font-family:inherit; border:1px solid #ddd; border-radius:6px; margin-bottom:8px; }
.tool-editor { padding:16px; background:#f6f6fa; border-radius:8px; }
.tool-fields { display:grid; grid-template-columns:repeat(auto-fit, minmax(240px, 1fr)); gap:12px; margin-bottom:12px; }
.tool-fields label, .te-body-label { display:grid; gap:4px; font-size:14px; }
.tool-fields input { padding:8px 10px; border:1px solid #ddd; border-radius:6px; width:100%; }
.md-preview { margin:8px 0; padding:12px 16px; background:#fff; border:1px solid #ddd; border-radius:8px; overflow-wrap:anywhere; }
.md-preview:empty { display:none; }
.md-preview a { display:inline; min-height:0; }
.md-preview img { max-width:100%; height:auto; }
.link-list { display:grid; gap:8px; margin-bottom:8px; }
.link-row { display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.link-row input { flex:1 1 200px; padding:8px 10px; border:1px solid #ddd; border-radius:6px; min-width:0; }
.file-chip { flex:1 1 200px; display:inline-flex; align-items:center; min-height:44px; padding:0 12px; background:#E5E5EE;
             border-radius:999px; font-size:14px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; min-width:0; }
.btn:disabled { opacity:.5; cursor:not-allowed; }
.tool-actions { margin-top:12px; }

/* Field Report */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
           clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
header.report-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.hdr-link { color: #CDFF96; font-weight: 600; text-decoration: none; font-size: 16px; white-space: nowrap; }
.trainer-link { margin: 0 0 12px; font-size: 15px; }
.trainer-link a { color: #1A1A2E; font-weight: 600; }
.report-notice { background: #fff; border-radius: 8px; padding: 16px; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.cohort-pick { display: block; width: 100%; text-align: left; background: #fff; color: #1A1A2E;
               border: 1px solid #ddd; border-radius: 8px; padding: 14px 16px; margin-bottom: 12px;
               font-size: 18px; font-family: inherit; cursor: pointer; }
.cohort-pick .cohort-lab { display: block; font-size: 14px; color: #555; margin-top: 2px; }
.cohort-pick:disabled { cursor: default; opacity: .55; }
.cohort-pick[aria-busy="true"] { opacity: 1; border-color: #1A1A2E; }
.link-btn:disabled { cursor: default; text-decoration: none; opacity: .7; }
.cohort-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 0 0 12px; }
.cohort-bar .cohort-title { margin: 0; }
.link-btn { background: none; border: 0; padding: 0; color: #1A1A2E; font: inherit; font-size: 15px;
            font-weight: 600; text-decoration: underline; cursor: pointer; white-space: nowrap; }
.report-tabs .tab { flex: 1 1 0; min-width: 0; }
.report-card { background: #fff; border-radius: 8px; padding: 16px; margin-bottom: 16px;
               box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.report-form .field { display: block; padding: 0; border-bottom: 0; margin-bottom: 16px; }
.report-form .field[hidden] { display: none; }
.report-form .field label { display: block; font-size: 14px; color: #555; text-transform: uppercase;
                            letter-spacing: .04em; margin-bottom: 6px; }
.report-form .req { color: #B00020; }
.report-form select, .report-form input, .report-form textarea {
  width: 100%; font-size: 18px; font-family: inherit; padding: 10px 12px; border: 1px solid #ddd;
  border-radius: 6px; background: #fff; color: #1A1A2E; text-align: left; }
.report-form select:disabled { background: #f0f0f5; color: #6b6b80; }
.report-form textarea { min-height: 110px; resize: vertical; }
.report-form .actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.report-form button.primary { flex: 1 1 100%; padding: 14px; font-size: 18px; font-family: inherit;
                              background: #CDFF96; color: #1A1A2E; border: 0; border-radius: 6px;
                              font-weight: 600; cursor: pointer; }
.report-form button.primary:disabled { background: #E5E5EE; color: #6b6b80; cursor: not-allowed; }
.report-form .save-pill { font-size: 15px; margin-left: 0; min-height: 1.4em; }
.report-list { list-style: none; margin: 0; padding: 0; }
.report-row { display: block; width: 100%; text-align: left; background: #fff; color: #1A1A2E;
              border: 1px solid #ddd; border-radius: 8px; padding: 14px 16px; margin-bottom: 10px;
              font-size: 18px; font-family: inherit; cursor: pointer; }
.report-row .row-meta { display: block; font-size: 14px; color: #555; margin-top: 2px; }
.report-form .form-note { margin: 0 0 16px; padding: 12px 14px; border-radius: 8px; background: #FFF6DB;
  color: #1A1A2E; font-size: 16px; line-height: 1.4; }
.report-read:focus:not(:focus-visible) { outline: none; }   /* programmatic focus after a tap: no ring */
.report-read dl { margin: 0; }
.report-read dt { font-size: 14px; color: #555; text-transform: uppercase; letter-spacing: .04em; }
.report-read dd { white-space: pre-wrap; margin: 4px 0 16px; overflow-wrap: anywhere; }
.report-read dd.empty { color: #6b6b80; }
.report-read .actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.report-read button.primary { padding: 12px 20px; font-size: 18px; font-family: inherit; background: #CDFF96;
                              color: #1A1A2E; border: 0; border-radius: 6px; font-weight: 600; cursor: pointer; }
.back-link { color: #1A1A2E; font-weight: 600; text-decoration: none; }
.status-line { margin: -8px 0 12px; font-size: 15px; min-height: 1.4em; }
.load-error { color: #B00020; font-size: 16px; margin: 0 0 12px; }
/* 44px tap targets for the text-style buttons/links on a phone */
.link-btn, .back-link, .hdr-link, .trainer-link a { display: inline-flex; align-items: center; min-height: 44px; }
/* Dark-mode popups: color-scheme is light dark, so force the option list legible on white */
.report-form option { background: #fff; color: #1A1A2E; }
