/* Dashboard additions. Analysis uses these on both local and hosted surfaces. */
.local-chart-controls, .local-section-heading, .local-change-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.local-section-heading { justify-content: space-between; }
.local-section-heading h3 { margin: 0; }
.local-chart-controls { font-size: 12px; color: #53647b; margin-top: 8px; }
.local-chart-controls label { display: inline-flex; align-items: center; gap: 6px; }
.local-chart-controls input { max-width: 150px; font: inherit; padding: 5px; border: 1px solid #ccd7e5; border-radius: 5px; }
.local-chart-controls button, .tracker-drill-button, .tracker-drill button, .local-change-toolbar button { font: inherit; border: 1px solid #bccde3; border-radius: 6px; padding: 6px 10px; color: #24578f; background: #f6faff; cursor: pointer; }
.tracker-drill-button { width: 100%; margin-top: 12px; font-size: 13px; }
.tracker-drill-button[aria-expanded=true] { background: #e6efff; border-color: #5482c9; }
.tracker-drill { padding: 14px; margin: 14px 0; border: 1px solid #c6d7ed; border-radius: 10px; background: #fff; min-width: 0; }
.tracker-drill[hidden], .local-chart-tooltip[hidden], .local-brush[hidden] { display: none; }
.local-practice { color: #b4232c; font-weight: 600; }
.local-almost { color: #976100; font-weight: 600; }
#tracker-progress { position: relative; }
.local-zoom-chart { touch-action: none; user-select: none; cursor: crosshair; }
.local-week-line { stroke: #c3ccd9; stroke-width: 1; stroke-dasharray: 2 4; }
.local-brush { fill: #2563eb22; stroke: #2563eb; pointer-events: none; }
.local-chart-point { cursor: pointer; outline: none; }
.local-chart-point:focus > circle:first-child { stroke: #142f56; stroke-width: 2; }
.local-chart-tooltip { position: absolute; top: 12px; z-index: 5; width: 220px; max-width: calc(100% - 12px); padding: 10px 12px; border: 1px solid #c1ccdc; background: #fff; box-shadow: 0 4px 16px #223a5929; border-radius: 8px; font-size: 12px; line-height: 1.6; pointer-events: none; }
.local-chart-tooltip > div { margin-top: 5px; }
.local-timeline-scroll { overflow-x: auto; max-width: 100%; }
.tracker-drill .problem-timeline { font-size: 12px; color: #263448; }
.tracker-drill .tl-row { display: grid; grid-template-columns: 120px minmax(0,1fr) 120px 320px; align-items: center; gap: 0 10px; }
.tracker-drill .tl-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 6px 0; color: #53647b; }
.tracker-drill .tl-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.tracker-drill .tl-group { margin: 8px 0; border: 1px solid #e0e6ed; border-radius: 6px; }
.tracker-drill .tl-group > summary { padding: 8px; background: #f3f6fa; cursor: pointer; display: flex; gap: 12px; align-items: center; }
.tracker-drill .tl-group-body { padding: 4px 8px; }
.tracker-drill .tl-group-title, .tracker-drill .tl-label { font-weight: 600; }
.tracker-drill .tl-problem { border-bottom: 1px solid #edf0f5; }
.tracker-drill .tl-label { display: flex; gap: 6px; align-items: center; white-space: nowrap; }
.tracker-drill .tl-status, .tracker-drill .tl-count { border-radius: 4px; padding: 2px 4px; color: #fff; font-size: 10px; }
.tracker-drill .tl-count { margin-right: 5px; }
.tracker-drill .tl-rollup { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 11px; }
.tracker-drill .tl-plot-wrap { min-width: 0; }
.tracker-drill .tl-plot { display: block; width: 100%; }
.tracker-drill .tl-sessions { display: flex; }
.tracker-drill .tl-session { display: flex; flex-direction: column; align-items: center; border-left: 1px dotted #bcc7d5; min-width: 0; font-size: 10px; }
.tracker-drill .tl-session-type { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tracker-drill .tl-header-row { background: #fff; padding: 8px 0; }
.tracker-drill .tl-empty { padding: 16px; color: #53647b; }
.local-change-toolbar { font-size: 13px; margin-bottom: 8px; }
.local-change-toolbar label { display: inline-flex; gap: 6px; align-items: center; }
.local-change-toolbar select { font: inherit; padding: 5px 8px; }
.local-session-scroll { overflow-x: auto; max-width: 100%; border: 1px solid #d6e1ef; border-radius: 8px; background: #f8fbff; }
.local-session-chart { display: block; width: 100%; min-width: 900px; height: 220px; touch-action: none; user-select: none; cursor: ew-resize; }
.local-session-chart text { fill: #53647b; font: 12px Arial, sans-serif; }
.local-session-chart .local-session-percent { fill: #204d88; font-weight: 700; font-size: 14px; }
.local-session-chart .local-session-selected { stroke: #1d4ed8; stroke-width: 3; fill: #dbeafe; }
.local-session-chart g:focus { outline: none; }
.local-session-chart g:focus circle { stroke: #152842; stroke-width: 3; }
.local-change-note { padding: 12px; border: 1px solid #c5d9f3; background: #f2f7ff; border-radius: 8px; margin: 10px 0; font-size: 13px; line-height: 1.6; }
.local-change-note h3 { margin: 0 0 4px; font-size: 16px; }
#local-change-matrix { width: 100%; height: auto; margin: 0 auto; }
.local-change-focus { font-size: 12px; margin: 6px 0; color: #1565c0; }
.local-change-focus button { border: 0; background: none; padding: 0; color: inherit; text-decoration: underline; cursor: pointer; }
.local-session-chart .local-session-shown { fill: #1d4ed8; font-weight: 700; }
#local-change-matrix .annotation .bg { rx: 6px; ry: 6px; }
.local-change-flags { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 13px; margin: 12px 0; }
.local-change-thresholds { max-width: 650px; margin: 12px 0; }
.local-change-thresholds > summary { font-size: 13px; cursor: pointer; }
@media (max-width: 500px) {
  .tracker-drill { padding: 10px; }
  .local-chart-controls { gap: 8px; }
  .local-chart-controls > span { flex-basis: 100%; }
  .local-chart-controls input { max-width: 128px; }
}

.tracker-drill .tl-status { display: inline-block; min-width: 52px; text-align: center; white-space: nowrap; border-radius: 4px; }
.tracker-drill .tl-caret { display: inline-block; transition: transform .15s; }
.tracker-drill .tl-group[open] > summary .tl-caret { transform: rotate(90deg); }
.tracker-drill .tl-metric { white-space: nowrap; }

.local-change-toolbar #local-change-end { margin-left: auto; }

/* Assessments viewer (js/local_analysis_assessments.js). Every row shares one grid template so the chart, category strips and problem rows line up by session. */
.la-scroll { overflow-x: auto; max-width: 100%; border: 1px solid #d6e1ef; border-radius: 8px; background: #fff; }
.la-grid { --la-label: 214px; --la-rollup: 470px; width: max-content; min-width: 100%; font-size: 12px; color: #263448; }
.la-row { display: grid; grid-template-columns: var(--la-label) repeat(var(--la-n), var(--la-col)) var(--la-rollup); align-items: stretch; }
.la-label { position: sticky; left: 0; z-index: 2; display: flex; align-items: center; gap: 6px; padding: 3px 8px; background: #fff; border-right: 1px solid #d6e1ef; min-width: 0; }
.la-head-row { background: #f8fbff; border-bottom: 1px solid #d6e1ef; }
.la-head-label { flex-direction: column; align-items: flex-start; justify-content: flex-end; gap: 2px; background: #f8fbff; color: #53647b; font-size: 11px; line-height: 1.35; padding-bottom: 8px; }
.la-head-label b { color: #204d88; font-size: 13px; }
.la-head-sessions { margin-top: 26px; font-weight: 600; }
.la-chart { display: block; }
.la-chart text { fill: #53647b; font: 11px Arial, sans-serif; }
.la-chart .la-chart-percent { fill: #204d88; font-weight: 700; font-size: 13px; }
.la-chart .la-chart-type { fill: #263448; font-weight: 700; }
.la-chart-compact text { font-size: 10px; }
.la-rollup { display: grid; grid-template-columns: 62px 92px 126px 190px; align-items: center; border-left: 1px solid #d6e1ef; }
.la-rollup > div { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 5px; padding: 3px 6px; min-width: 0; }
.la-rollup-head { align-items: end; color: #53647b; font-weight: 700; padding-bottom: 6px; }
.la-group > summary { list-style: none; cursor: pointer; }
.la-group > summary::-webkit-details-marker { display: none; }
.la-cat-row { background: #f3f6fa; border-top: 1px solid #d6e1ef; }
.la-cat-row .la-label { flex-direction: column; align-items: flex-start; gap: 1px; background: #f3f6fa; padding: 5px 8px; }
.la-cat-title { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 5px; font-weight: 700; font-size: 13px; white-space: nowrap; }
.la-cat-sub { color: #53647b; font-size: 11px; padding-left: 17px; line-height: 1.3; }
.la-caret { display: inline-block; width: 12px; font-size: 10px; color: #6b7280; transition: transform .15s; }
.la-group[open] > summary .la-caret { transform: rotate(90deg); }
.la-counts { display: inline-flex; gap: 3px; margin-left: 4px; }
.la-count { color: #fff; border-radius: 10px; padding: 0 6px; font-size: 10px; font-weight: 700; line-height: 15px; }
.la-fact-row { border-top: 1px solid #edf0f5; min-height: 40px; }
.la-break { flex-basis: 100%; height: 0; }
.la-stale-old { color: #b45309; }
.la-fact-row:hover, .la-fact-row:hover .la-label { background: #f8fbff; }
.la-fact-row .la-label { justify-content: space-between; padding-left: 25px; }
.la-fact { font-weight: 700; white-space: nowrap; }
.la-status { color: #fff; border-radius: 4px; font-weight: 700; font-size: 10px; line-height: 15px; width: 68px; text-align: center; white-space: nowrap; flex: none; }
.la-quiet { grid-column: 1 / -1; position: sticky; left: 0; color: #6b7280; font-style: italic; padding-left: 25px; border-right: 0; }
.la-cell { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; margin: 2px; min-height: 24px; border-radius: 4px; font-weight: 700; font-size: 11px; line-height: 1.1; }
.la-empty { background: radial-gradient(circle, #d5dce6 1.5px, transparent 2px); }
.la-fast { background: #dcfce7; color: #166534; }
.la-slow { background: #fef3c7; color: #854d0e; }
.la-wrong { background: var(--fluency-incorrect, #616161); color: #fff; }
.la-cat-cell { background: none; color: #53647b; font-weight: 600; font-size: 10px; }
.la-bar { display: flex; width: calc(100% - 8px); height: 9px; border-radius: 3px; overflow: hidden; background: #e5eaf1; }
.la-bar i { display: block; }
.la-bar .la-fast { background: #2e7d32; }
.la-bar .la-slow { background: var(--fluency-slow, #f9a825); }
.la-later { display: flex; gap: 2px; }
.la-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; border: 1px solid #fff; }
.la-dot.la-fast { background: #2e7d32; }
.la-dot.la-slow { background: var(--fluency-slow, #f9a825); }
.la-sq { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
i.la-sq.la-fast { background: #2e7d32; }
i.la-sq.la-slow { background: var(--fluency-slow, #f9a825); }
.la-squares { display: inline-flex; gap: 2px; }
.la-last { border-radius: 4px; padding: 1px 5px; font-weight: 700; }
.la-stale, .la-med, .la-none { color: #6b7280; font-size: 11px; white-space: nowrap; }
.la-frac { white-space: nowrap; }
.la-chip { border-radius: 9px; padding: 0 6px; font-size: 10px; font-weight: 700; line-height: 15px; white-space: nowrap; }
.la-chip-slow { background: #fef3c7; color: #854d0e; }
.la-chip-incorrect { background: var(--fluency-incorrect, #616161); color: #fff; }
.la-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; font-size: 12px; color: #53647b; }
.la-legend span { display: inline-flex; align-items: center; gap: 5px; }
.la-legend .la-dot { border-color: #cbd5e1; }
.la-view-control { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 9px; margin: 12px 0 8px; font-size: 14px; color: #263448; }
.mk-app .la-view-switch { display: inline-flex; align-items: center; box-sizing: border-box; flex: none; width: 50px; height: 28px; padding: 3px; border: 1px solid #71839b; border-radius: 20px; background: #dde5ef; cursor: pointer; }
.mk-app .la-view-switch span { display: block; flex: none; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px #53647b; }
.mk-app .la-view-switch[aria-checked="true"] { background: #316cad; }
.mk-app .la-view-switch[aria-checked="true"] span { margin-left: auto; }
.mk-app .la-view-switch:focus-visible { outline: 3px solid #204d88; outline-offset: 3px; }
.la-problems-grid .la-row { grid-template-columns: var(--la-label) repeat(var(--la-n), var(--la-col)); }
.la-problems-grid .la-fact-row .la-label { flex-direction: column; align-items: flex-start; justify-content: center; padding: 8px; gap: 4px; }
.la-problem-heading { background: #f3f6fa; border-top: 1px solid #d6e1ef; font-weight: 700; }
.la-problem-heading .la-label { background: #f3f6fa; padding: 10px 8px; }
.la-summary-cell { font-size: 13px; }
.la-recovery-cell { padding: 8px 4px; gap: 6px; font-size: 12px; line-height: 1.3; text-align: center; }
.la-recovery { font-weight: 400; }
.la-extra-attempts { font-weight: 700; }
.la-recurrence { font-size: 11px; line-height: 1.3; color: #53647b; }
.la-recovery-cell .la-later { flex-wrap: wrap; justify-content: center; }
@media (pointer: coarse) {
  .mk-app .la-view-switch { height: 44px; width: 64px; padding: 7px; }
  .mk-app .la-view-switch span { height: 28px; width: 28px; }
}
@media (max-width: 700px) {
  .la-grid { --la-label: 124px; }
  .la-fact-row .la-label { padding-left: 8px; flex-direction: column; align-items: flex-start; gap: 1px; }
  .la-cat-sub { padding-left: 0; }
  .la-head-label span:not(.la-head-sessions) { display: none; }
}
