* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: #f1f5f9; color: #0f172a; font: 16px/1.6 system-ui, sans-serif; }
main { width: min(1100px, calc(100% - 32px)); margin: 24px auto; }
h2 { margin: 0 0 8px; font-size: 1.55rem; }
h3 { margin: 16px 0 8px; font-size: 1.1rem; }
h4 { margin: 0 0 6px; font-size: 1.02rem; }
p { margin: 8px 0 16px; }
button, input, select, textarea { font: inherit; }
button, .file-label { min-height: 44px; padding: 9px 16px; border: 1px solid #94a3b8; border-radius: 8px; background: #fff; color: #172554; font-weight: 650; cursor: pointer; }
button:hover { background: #eff6ff; }
button:disabled { opacity: .5; cursor: not-allowed; }
button[aria-pressed="true"], .primary { color: #fff; background: #172554; border-color: #172554; }
.primary:hover, button[aria-pressed="true"]:hover { background: #1e40af; }
.secondary { background: #f8fafc; }
.danger { color: #b91c1c; border-color: #b91c1c; }
:focus-visible { outline: 3px solid #d97706; outline-offset: 3px; }
.switcher, .chips, .actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.switcher { margin: 16px 0; }
.settings-toolbar { background: #f8fafc; padding: 10px; border: 1px solid #cbd5e1; border-radius: 10px; margin-bottom: 20px; }
.section-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 8px; }
.divider { border: 0; border-top: 1px solid #cbd5e1; margin: 28px 0; }
.panel { background: #fff; border: 1px solid #cbd5e1; border-radius: 14px; padding: 24px; margin: 16px 0; box-shadow: 0 3px 12px #0f172a08; }
.privacy { border-left: 4px solid #0f766e; background: #f0fdfa; padding: 14px 18px; font-size: .9rem; }
.muted { color: #475569; font-weight: 400; font-size: .92rem; }
label { display: flex; flex-direction: column; gap: 5px; font-weight: 650; margin: 12px 0; }
input, select, textarea { width: 100%; padding: 10px; border: 1px solid #94a3b8; border-radius: 7px; background: #fff; color: #0f172a; min-width: 0; }
textarea { resize: vertical; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.filters { grid-template-columns: repeat(4, minmax(0, 1fr)); }
fieldset { border: 0; padding: 0; margin: 20px 0; }
legend { font-weight: 700; }
.chips button { font-size: .92rem; }
.chips label { display: block; margin: 0; cursor: pointer; }
.chips input[type="radio"] { width: auto; margin-right: 5px; }
.phase { border: 1px solid #94a3b8; border-radius: 24px; padding: 8px 12px; }
.phase:has(input:checked) { background: #dbeafe; border-color: #1e40af; }
.actions { margin: 20px 0 12px; }
details, .builder { background: #f8fafc; padding: 14px; border: 1px solid #e2e8f0; border-radius: 8px; margin: 16px 0; }
summary { cursor: pointer; font-weight: 650; }

/* Modern Tally Counter Stepper */
.tally-stepper {
  display: inline-flex;
  align-items: center;
  background: #fff;
  border: 1px solid #94a3b8;
  border-radius: 999px;
  padding: 3px;
  box-shadow: 0 1px 2px #0f172a0d;
}
.tally-btn {
  width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: #f1f5f9;
  color: #172554;
  font-size: 1.25rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.tally-btn:hover { background: #dbeafe; color: #1e40af; }
.tally-input {
  width: 72px;
  border: 0;
  background: transparent;
  text-align: center;
  font-weight: 700;
  font-size: 1.08rem;
  padding: 4px 6px;
  -moz-appearance: textfield;
}
.tally-input::-webkit-outer-spin-button,
.tally-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* Single-Line Condensed Manage Building Look-For Row */
#settingsItems.feed { gap: 8px; }
.lookfor-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
}
.lookfor-row.is-archived { opacity: .72; background: #f1f5f9; }
.lookfor-row__assignment { display: flex; align-items: center; gap: 6px; font-size: .86rem; }
.lookfor-row__assignment input { width: auto; }
.status-pill {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.status-pill.active { background: #dcfce7; color: #166534; }
.status-pill.archived { background: #e2e8f0; color: #475569; }
.lookfor-row__input { flex: 1 1 200px; min-height: 36px; padding: 6px 10px; font-size: .92rem; }
.lookfor-row__select { flex: 0 1 190px; min-height: 36px; padding: 6px 10px; font-size: .92rem; }
.lookfor-row__actions { display: flex; gap: 6px; align-items: center; margin-left: auto; }
.btn-compact { min-height: 36px; padding: 5px 12px; font-size: .86rem; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 20px 0; }
.stat { background: #eff6ff; padding: 16px; border-radius: 10px; }
.stat strong { display: block; font-size: 1.5rem; color: #172554; overflow-wrap: anywhere; }
.stat span { color: #475569; }
.feed { display: grid; gap: 16px; margin: 20px 0; }
.cohort-drawer summary { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.cohort-drawer .chips { margin: 12px 0; }
.trajectory-card { min-width: 0; margin: 16px 0; padding: 16px; border: 1px solid #cbd5e1; border-radius: 10px; }
.digest-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 12px; margin-top: 16px; }
.digest-grid > p { grid-column: 1 / -1; }
.digest-box { min-width: 0; padding: 12px; background: #f8fafc; border: 1px solid #cbd5e1; border-radius: 8px; overflow-wrap: anywhere; }
.digest-box h5 { margin: 0 0 8px; font-size: .95rem; }
.digest-box ul { padding-left: 20px; }
.digest-box details { padding: 8px; }
.matrix-scroll { max-width: 100%; overflow-x: auto; margin: 12px 0; border: 1px solid #cbd5e1; border-radius: 8px; }
.heatmap-table { width: 100%; border-collapse: collapse; font-size: .85rem; background: #fff; }
.heatmap-table caption { padding: 8px 12px; text-align: left; font-weight: 650; color: #334155; background: #f8fafc; }
.heatmap-table th, .heatmap-table td { padding: 8px; border: 1px solid #e2e8f0; vertical-align: top; text-align: left; min-width: 110px; white-space: pre-line; overflow-wrap: anywhere; }
.heatmap-table thead th { background: #eff6ff; }
.heatmap-table tbody th { background: #f8fafc; }
.recorded-rate { display: inline-block; padding: 4px 6px; border-radius: 4px; color: #172554; }
.recorded-bar { height: 100%; background: #2563eb; }
#walkthroughAnalyticsSection, #walkthroughMacroGrid > *, #walkthroughCohortSection, #walkthroughMatrixSection { min-width: 0; }
@media print {
  .matrix-scroll { overflow: visible; border: 0; }
  .heatmap-table { table-layout: fixed; font-size: 8pt; }
  .heatmap-table th, .heatmap-table td { min-width: 0; padding: 3px; }
  .trajectory-card { break-inside: auto; }
  .digest-grid { display: block; }
  .digest-box { break-inside: avoid; margin-bottom: 8px; }
}
.log-card { border: 1px solid #cbd5e1; border-radius: 10px; padding: 18px; break-inside: avoid; overflow-wrap: anywhere; }
.log-card h3, .log-card h4 { margin-top: 0; }
.badge { display: inline-block; background: #e0f2fe; color: #075985; border-radius: 20px; padding: 3px 10px; margin: 4px 6px 4px 0; font-size: .88rem; }
.notes { white-space: pre-wrap; }
.file-label { display: flex; gap: 6px; margin: 0; font-size: .95rem; }
.file-label input { border: 0; padding: 0; font-size: .85rem; max-width: 220px; }
.danger-zone { border-color: #fecaca; }
#status { border-radius: 8px; padding: 0; }
#status:not(:empty) { position: sticky; top: 8px; z-index: 5; padding: 12px 16px; background: #dcfce7; border: 1px solid #86efac; box-shadow: 0 3px 10px #0f172a12; }
#status.error { background: #fef2f2; color: #991b1b; border-color: #fca5a5; }
footer { text-align: center; margin: 28px 0; }
a { color: #1e40af; }
.tool-back { display: inline-block; margin-bottom: 8px; font-size: .9rem; }
.workspace-shell:has(#homePanel:not([hidden])) { width: 100%; max-width: 1100px; margin: 40px auto; padding: 0 20px; }
body:has(.workspace-shell) { background: #f8fafc; }
#workspaceNav { gap: 8px; align-items: stretch; margin: 0 0 24px; padding: 0; border: 0; background: none; }
#workspaceNav button { min-height: 44px; padding: 12px 20px; border: 1px solid #94a3b8; border-radius: 9px; background: #fff; color: #172554; font-size: 1rem; line-height: 1.5; font-weight: 700; box-shadow: none; }
#workspaceNav button:hover { background: #eff6ff; }
#workspaceNav button[aria-pressed="true"] { background: #172554; color: #fff; border-color: #172554; }
#workspaceWarnings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 30px; margin-top: 40px; padding-top: 24px; border-top: 1px solid #e2e8f0; }
#workspaceWarnings .privacy { border: 0; background: none; padding: 0; color: #475569; font-size: .85rem; line-height: 1.6; }
#workspaceWarnings strong { display: block; margin-bottom: 8px; color: #334155; }
#workspaceWarnings p { margin: 8px 0; }
#workspaceFooter { margin: 32px 0 0; padding: 20px 0; border-top: 1px solid #e2e8f0; font-size: .9rem; color: #475569; }
#homePanel { margin: 0; }
#homePanel .workspace-help { margin: 24px 0 0; }
#homePanel .tools-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 30px; }
#homePanel .tool-card { background: #fff; border-radius: 16px; padding: 25px; text-decoration: none; color: inherit; border: 1px solid #e2e8f0; transition: all .3s ease; box-shadow: 0 4px 6px -1px #0000000d, 0 2px 4px -1px #00000008; display: flex; flex-direction: column; height: 100%; }
#homePanel .tool-card:hover { transform: translateY(-5px); box-shadow: 0 20px 25px -5px #0000001a, 0 10px 10px -5px #0000000a; border-color: #cbd5e1; }
#homePanel .tool-icon { width: 60px; height: 60px; border-radius: 12px; display: flex; justify-content: center; align-items: center; font-size: 1.8rem; margin-bottom: 20px; }
#homePanel .tool-icon--walkthrough { background: #ccfbf1; color: #0f766e; }
#homePanel .tool-icon--pulse { background: #e0f2fe; color: #075985; }
#homePanel .tool-info { flex: 1; display: flex; flex-direction: column; }
#homePanel .tool-info h2 { font-size: 1.4rem; line-height: normal; color: #1e293b; margin-bottom: 10px; }
#homePanel .tool-info p { color: #475569; font-size: .95rem; line-height: 1.5; margin: 0 0 25px; flex: 1; }
#homePanel .btn-launch { display: inline-block; background: #eff6ff; color: #1d4ed8; font-weight: 600; padding: 10px 16px; border-radius: 8px; text-align: center; transition: background-color .2s; align-self: flex-start; }
#homePanel .tool-card:hover .btn-launch { background: #1d4ed8; color: #fff; }
@media (prefers-reduced-motion: reduce) {
  #homePanel .tool-card { transition: none; }
  #homePanel .tool-card:hover { transform: none; }
}
@media (max-width: 700px) {
  main { width: calc(100% - 20px); }
  .panel { padding: 16px; }
  .field-grid, .filters, .stats { grid-template-columns: 1fr; }
  .switcher button { flex: 1 1 140px; }
  #workspaceNav button { flex: 1 1 calc(50% - 4px); padding: 10px 8px; font-size: .9rem; }
  #workspaceWarnings { grid-template-columns: 1fr; gap: 24px; }
  .file-label { flex-wrap: wrap; }
}
@media print {
  body { background: #fff; color: #000; font-size: 11pt; }
  main { width: 100%; margin: 0; }
  .no-print, #adminPanel, #status, #recovery { display: none !important; }
  #feedbackPanel { display: block !important; border: 0; padding: 0; box-shadow: none; }
  .badge { border: 1px solid #cbd5e1; }
}

/* ==========================================================================
   MODERN GUI UPGRADE: WALKTHROUGH & BUILDING PULSE
   ========================================================================== */

/* 1. Modern Segmented Navigation & Tab Bars */
nav.switcher {
  background: #e2e8f0;
  padding: 5px;
  border-radius: 12px;
  gap: 6px;
  border: 1px solid #cbd5e1;
}
nav.switcher button {
  border: 0;
  background: transparent;
  color: #475569;
  border-radius: 8px;
  min-height: 40px;
  padding: 8px 16px;
  font-weight: 650;
  transition: all .16s ease;
}
nav.switcher button:hover {
  background: #ffffff88;
  color: #0f172a;
}
nav.switcher button[aria-pressed="true"] {
  background: #172554;
  color: #fff;
  box-shadow: 0 2px 6px #17255433;
}

/* 2. Modern Fieldsets & Tactile Lesson Phase Pills */
.modern-fieldset {
  margin: 24px 0;
  padding: 0;
  border: 0;
}
.modern-fieldset > legend {
  font-size: 1rem;
  font-weight: 750;
  color: #0f172a;
  margin-bottom: 10px;
}
.phase-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 10px;
}
.phase {
  display: flex !important;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 46px;
  padding: 10px 16px;
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  font-weight: 650;
  color: #334155;
  transition: all .15s ease;
  user-select: none;
}
.phase:hover {
  border-color: #64748b;
  background: #f1f5f9;
}
.phase input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  padding: 0;
}
.phase:has(input:focus-visible) {
  outline: 3px solid #d97706;
  outline-offset: 3px;
}
.phase:has(input:checked) {
  background: #eff6ff;
  border-color: #1d4ed8;
  color: #1e3a8a;
  box-shadow: 0 0 0 2px #3b82f633;
}
.phase:has(input:checked)::before {
  content: "\2713\00a0";
  font-weight: 800;
  color: #1d4ed8;
}

/* 3. Dual Observation Matrix Cards (Environment vs. Instruction) */
.matrix-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.matrix-card {
  border-radius: 12px;
  padding: 16px;
  border: 1px solid #cbd5e1;
}
.matrix-card--env {
  background: linear-gradient(180deg, #f0fdf4 0%, #ffffff 100%);
  border-color: #bbf7d0;
}
.matrix-card--inst {
  background: linear-gradient(180deg, #eff6ff 0%, #ffffff 100%);
  border-color: #bfdbfe;
}
.matrix-card__header {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e2e8f0;
}
.matrix-card__header h3 {
  margin: 0;
  font-size: 1.02rem;
  color: #0f172a;
}
.matrix-badge {
  font-size: .78rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #475569;
  transition: all .15s ease;
}
.matrix-badge.is-active {
  background: #172554;
  color: #fff;
}

/* Interactive Matrix Tag Chips with Checkmark */
.matrix-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tag-chip {
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1.5px solid #cbd5e1;
  background: #fff;
  color: #1e293b;
  font-size: .9rem;
  font-weight: 600;
  transition: all .15s ease;
  box-shadow: 0 1px 2px #0f172a08;
}
.tag-chip:hover {
  border-color: #64748b;
  transform: translateY(-1px);
}
.tag-chip[aria-pressed="true"] {
  background: #172554;
  border-color: #172554;
  color: #fff;
  box-shadow: 0 3px 8px #17255426;
}
.tag-chip[aria-pressed="true"]::before {
  content: "\2713\00a0";
  font-weight: 800;
}

/* 4. Glow & Grow Coaching Snippet Chips */
.snippet-chips { gap: 8px; }
.snippet-chip {
  border-radius: 20px;
  font-size: .88rem;
  padding: 7px 13px;
  min-height: 38px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  color: #334155;
  text-align: left;
  transition: all .15s ease;
}
.snippet-chip.snippet-glow {
  background: #f0fdf4;
  border-color: #86efac;
  color: #14532d;
}
.snippet-chip.snippet-glow:hover { background: #dcfce7; }
.snippet-chip.snippet-grow {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1e3a8a;
}
.snippet-chip.snippet-grow:hover { background: #dbeafe; }

/* 5. Modern Building Pulse Checklist Cards & Live State Borders */
.pulse-checklist-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 22px 0 10px;
}
.pulse-checklist-header h3 { margin: 0; }
.pulse-grid {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}
/* 6. Polished Form Inputs & Action Footer Bar */
input:focus, select:focus, textarea:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px #2563eb22;
  outline: none;
}
#classroomForm > .actions,
#buildingForm > .actions {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 16px;
  margin-top: 20px;
}

@media (max-width: 760px) {
  .matrix-grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   BUILDING PULSE VISUAL ANALYTICS REPORT & FILTER GRID OVERRIDES
   ========================================================================== */

.filters { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.pulse-report {
  margin: 24px 0;
  padding: 20px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
}
.trend-metric-label {
  margin: 0;
  min-width: 0;
  width: 260px;
  max-width: 100%;
  font-size: .88rem;
}
.trend-card {
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 16px;
  margin: 12px 0 20px;
}
.trend-card__header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.trend-svg {
  width: 100%;
  height: auto;
  max-height: 300px;
  display: block;
}
.trend-table { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: .9rem; }
.trend-table th, .trend-table td { padding: 8px; border-bottom: 1px solid #cbd5e1; text-align: left; overflow-wrap: anywhere; }
.trend-table caption { text-align: left; font-weight: 650; margin-bottom: 8px; }

/* Per-Zone Comprehensive Cards */
.zone-analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}
.zone-card {
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.zone-card__header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e2e8f0;
}
.zone-card__header p { margin: 2px 0 0; }
.zone-card__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  max-width: 100%;
}
.zone-card__badges .status-pill { white-space: normal; overflow-wrap: anywhere; }
.zone-items-list { display: grid; gap: 12px; }
.zone-item-metric {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 12px;
}
.zone-item-metric__top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 6px;
  font-size: .92rem;
}

/* 100% Stacked Horizontal Bar for Yes / No / N/A */
.stacked-bar {
  display: flex;
  height: 12px;
  width: 100%;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}
.stacked-bar__yes { background: #15803d; height: 100%; }
.stacked-bar__no { background: #b91c1c; height: 100%; }
.stacked-bar__na { background: #94a3b8; height: 100%; }
.stacked-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 6px;
  font-size: .8rem;
  font-weight: 600;
}
.leg-yes { color: #15803d; }
.leg-no { color: #b91c1c; }
.leg-na { color: #64748b; }

/* Cumulative Tally Mini Bars */
.tally-summary-pill {
  font-size: .82rem;
  font-weight: 650;
  color: #1e40af;
  background: #dbeafe;
  padding: 2px 8px;
  border-radius: 999px;
}
.mini-tally-bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 54px;
  padding-top: 14px;
}
.mini-tally-col {
  flex: 1 1 0;
  max-width: 32px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  position: relative;
}
.mini-tally-fill {
  width: 100%;
  background: #2563eb;
  border-radius: 4px 4px 0 0;
  min-height: 0;
}
.mini-tally-val {
  font-size: .7rem;
  color: #334155;
  font-weight: 700;
  margin-top: 2px;
}

@media (max-width: 700px) {
  .filters, .stats, .zone-analytics-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ==========================================================================
   BUILDING PULSE OBSERVATION MATRIX (WALKTHROUGH MATRIX STYLE)
   ========================================================================== */

.matrix-grid--single {
  grid-template-columns: 1fr;
}

.pulse-matrix-hint {
  display: block;
  font-size: .78rem;
  font-weight: 500;
  color: #64748b;
  margin-top: 2px;
}

/* Tri-state Yes / No / Not Observed Matrix Chips */
.tag-chip.pulse-yn-chip[aria-pressed="true"]::before {
  content: ""; /* Prefix icon is already rendered in textContent */
}
.tag-chip.pulse-yn-chip.is-yes {
  background: #15803d;
  border-color: #15803d;
  color: #fff;
  box-shadow: 0 3px 8px #15803d33;
}
.tag-chip.pulse-yn-chip.is-yes:hover {
  background: #166534;
}
.tag-chip.pulse-yn-chip.is-no {
  background: #b91c1c;
  border-color: #b91c1c;
  color: #fff;
  box-shadow: 0 3px 8px #b91c1c33;
}
.tag-chip.pulse-yn-chip.is-no:hover {
  background: #991b1b;
}

/* Compact Tally Matrix Tiles inside the Instruction-styled Card */
.pulse-tally-matrix {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: 10px;
}
.pulse-tally-chip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px 8px 14px;
  background: #fff;
  border: 1.5px solid #cbd5e1;
  border-radius: 999px;
  box-shadow: 0 1px 2px #0f172a08;
  transition: all .15s ease;
}
.pulse-tally-chip.is-counted {
  background: #eff6ff;
  border-color: #1d4ed8;
  box-shadow: 0 2px 6px #1d4ed822;
}
.pulse-tally-chip__label {
  font-size: .9rem;
  font-weight: 650;
  color: #1e293b;
  overflow-wrap: anywhere;
  line-height: 1.25;
}
.pulse-tally-chip.is-counted .pulse-tally-chip__label {
  color: #1e3a8a;
  font-weight: 700;
}
.pulse-tally-chip .tally-stepper {
  border-color: #cbd5e1;
  padding: 2px;
  flex-shrink: 0;
}
.pulse-tally-chip .tally-btn {
  width: 44px;
  height: 44px;
  min-height: 44px;
  font-size: 1.1rem;
}
.pulse-tally-chip .tally-input {
  width: 72px;
  font-size: .95rem;
  padding: 2px;
}
.tally-error { flex-basis: 100%; color: #991b1b; font-size: .85rem; }

/* ==========================================================================
   MODERN EXECUTIVE REPORTS & ANALYTICS OVERHAUL
   ========================================================================== */

#reviewPanel > .filters {
  background: #f8fafc;
  padding: 16px 18px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  gap: 8px 16px;
  margin-bottom: 12px;
}
#reviewPanel > .filters label {
  margin: 4px 0;
  font-size: .86rem;
  color: #334155;
}
.cohort-drawer {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 12px 16px;
  box-shadow: 0 1px 2px #0f172a08;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin: 22px 0;
}
.stat {
  position: relative;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid #cbd5e1;
  border-top: 4px solid #2563eb;
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: 0 4px 12px -2px #0f172a0a;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
}
.stat--visits { border-top-color: #2563eb; }
.stat--coverage { border-top-color: #0d9488; }
.stat--avg { border-top-color: #4f46e5; }
.stat--top-tag { border-top-color: #d97706; }
.stat--sweeps { border-top-color: #0284c7; }
.stat--compliance { border-top-color: #16a34a; }

.stat__label {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #64748b;
  order: 1;
}
.stat__value {
  font-size: 1.55rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  order: 2;
}

.pulse-report {
  margin: 28px 0;
  padding: 24px;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid #cbd5e1;
  border-radius: 16px;
  box-shadow: inset 0 1px 0 #ffffff;
}
.pulse-report > .section-header {
  padding-bottom: 14px;
  margin-bottom: 18px;
  border-bottom: 1px solid #cbd5e1;
  align-items: center;
}
.pulse-report > .section-header h3 {
  margin: 0 0 4px;
  font-size: 1.3rem;
  color: #0f172a;
}
.trend-metric-label {
  background: #ffffff;
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  box-shadow: 0 1px 3px #0f172a0a;
  font-size: .82rem;
  color: #475569;
  width: 290px;
}
.trend-metric-label select {
  margin-top: 2px;
  padding: 6px 8px;
  font-weight: 650;
  font-size: .9rem;
}

.trend-card,
.zone-card,
.trajectory-card {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  padding: 20px;
  margin: 16px 0;
  box-shadow: 0 4px 10px -2px #0f172a08;
}
.trend-card__header,
.trajectory-card__header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid #f1f5f9;
}
.trend-card__header h4,
.zone-card__header h4,
.trajectory-card__header h4 {
  font-size: 1.08rem;
  color: #0f172a;
  margin: 0;
}
.report-footnote {
  font-size: .84rem;
  color: #64748b;
  margin: 8px 0;
}
.report-details {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 14px;
  margin-top: 12px;
}

.metric-title-group,
.metric-rate-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.cat-pill {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 2px 8px;
  border-radius: 999px;
}
.cat-pill--env {
  background: #dcfce7;
  color: #166534;
}
.cat-pill--inst {
  background: #dbeafe;
  color: #1e40af;
}
.delta-pill {
  font-size: .76rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}
.delta-pill--up {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}
.delta-pill--down {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}
.delta-pill--flat {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}
.recorded-bar--env {
  background: linear-gradient(90deg, #10b981, #059669);
  height: 100%;
  border-radius: 999px;
}
.recorded-bar--inst {
  background: linear-gradient(90deg, #3b82f6, #1d4ed8);
  height: 100%;
  border-radius: 999px;
}
.metric-subtext {
  margin: 6px 0 0;
  font-size: .8rem;
}

.phase-pill {
  display: inline-block;
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
  font-weight: 650;
  font-size: .8rem;
  padding: 2px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.location-pill {
  display: inline-block;
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
  font-weight: 600;
  font-size: .8rem;
  padding: 2px 10px;
  border-radius: 999px;
}
.phase-share-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.phase-mini-bar {
  height: 6px;
  width: 100%;
  max-width: 110px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}
.phase-mini-fill {
  height: 100%;
  background: #2563eb;
  border-radius: 999px;
}
.phase-top-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.phase-tag-chip {
  font-size: .78rem;
  font-weight: 600;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  color: #334155;
  padding: 2px 8px;
  border-radius: 6px;
}

.matrix-scroll {
  max-width: 100%;
  overflow-x: auto;
  margin: 14px 0;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  box-shadow: 0 1px 3px #0f172a08;
  background: #fff;
}
.heatmap-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: .85rem;
  background: #fff;
}
.heatmap-table caption {
  padding: 10px 14px;
  text-align: left;
  font-weight: 700;
  font-size: .9rem;
  color: #1e293b;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}
.heatmap-table th,
.heatmap-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #e2e8f0;
  border-right: 1px solid #f1f5f9;
  vertical-align: middle;
  text-align: left;
  min-width: 112px;
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.heatmap-table thead th {
  background: #f1f5f9;
  color: #334155;
  font-weight: 700;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  border-bottom: 2px solid #cbd5e1;
}
.heatmap-table tbody tr:hover td,
.heatmap-table tbody tr:hover th {
  background-color: #f8fafc;
}
.heatmap-table tbody th {
  background: #ffffff;
  color: #0f172a;
  font-weight: 700;
  position: sticky;
  left: 0;
  z-index: 1;
  border-right: 2px solid #e2e8f0;
}
.heatmap-table thead th:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  border-right: 2px solid #cbd5e1;
}

.recorded-rate {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid transparent;
  color: #1e3a8a;
  font-weight: 700;
  font-size: .8rem;
  font-variant-numeric: tabular-nums;
}
.recorded-rate.is-empty {
  background: #f8fafc;
  color: #94a3b8;
  font-weight: 500;
}
.avg-tags-pill {
  display: inline-block;
  font-weight: 700;
  color: #1e293b;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: .82rem;
}
.inline-details {
  margin: 6px 0 0;
  padding: 6px 8px;
  background: #f8fafc;
  border-radius: 6px;
  font-size: .78rem;
}
.recency-badge {
  font-weight: 600;
  color: #334155;
  font-variant-numeric: tabular-nums;
}

.visit-cell-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 700;
}
.visit-cell-pill.is-recorded {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}
.visit-cell-pill.is-unrecorded {
  background: #f8fafc;
  color: #64748b;
  border: 1px solid #e2e8f0;
  font-weight: 500;
}

.digest-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 14px;
  margin-top: 18px;
}
.digest-box {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-top: 4px solid #64748b;
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 2px 6px #0f172a06;
}
.digest-box--action { border-top-color: #4f46e5; background: linear-gradient(180deg, #eef2ff55 0%, #ffffff 40%); }
.digest-box--glow { border-top-color: #16a34a; background: linear-gradient(180deg, #f0fdf488 0%, #ffffff 40%); }
.digest-box--grow { border-top-color: #d97706; background: linear-gradient(180deg, #fffbeb88 0%, #ffffff 40%); }

.digest-box__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e2e8f0;
}
.digest-box__header h5 {
  margin: 0;
  font-size: .95rem;
  color: #0f172a;
}
.digest-count-badge {
  background: #e2e8f0;
  color: #334155;
  font-size: .75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}
.digest-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}
.digest-item {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px;
}
.digest-item__meta {
  font-size: .75rem;
  font-weight: 700;
  color: #64748b;
  margin-bottom: 4px;
}
.digest-item__quote {
  margin: 0 0 6px;
  font-size: .88rem;
  color: #1e293b;
  font-weight: 500;
}

.feedback-hero {
  background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
  border: 1px solid #bfdbfe;
  border-radius: 14px;
  padding: 20px 22px;
  margin: 18px 0;
}
.feedback-hero__top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.feedback-hero__eyebrow {
  display: block;
  font-size: .76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #1d4ed8;
  margin-bottom: 2px;
}
.feedback-hero__kpis {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.kpi-pill {
  background: #ffffff;
  border: 1px solid #93c5fd;
  color: #1e3a8a;
  font-weight: 700;
  font-size: .85rem;
  padding: 6px 12px;
  border-radius: 999px;
}

.log-card {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-left: 4px solid #2563eb;
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: 0 2px 8px -2px #0f172a08;
  transition: box-shadow .15s ease;
}
.roster-card {
  display: grid;
  grid-template-areas: "teacher groups summary actions";
  grid-template-columns: minmax(150px, 1fr) minmax(200px, 1.35fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
}
.roster-card__teacher { grid-area: teacher; }
.roster-card__groups { grid-area: groups; }
.roster-card__summary { grid-area: summary; }
.roster-card__actions { grid-area: actions; }
.roster-card > label {
  min-width: 0;
  margin: 0;
  font-size: .82rem;
  gap: 3px;
}
.roster-card input {
  min-height: 38px;
  padding: 6px 9px;
  font-size: .9rem;
}
.roster-card__summary {
  margin: 0;
  white-space: nowrap;
  font-size: .8rem;
}
.roster-card__actions {
  flex-wrap: nowrap;
  gap: 6px;
  justify-content: flex-end;
  margin: 0;
}
.roster-card__actions button {
  min-height: 38px;
  padding: 6px 10px;
  font-size: .82rem;
  white-space: nowrap;
}
.roster-card__more {
  position: relative;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}
.roster-card__more > summary {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  min-height: 44px;
  border: 1px solid #94a3b8;
  border-radius: 8px;
  background: #fff;
  color: #172554;
  font-size: 1.3rem;
  list-style: none;
}
.roster-card__more > summary::-webkit-details-marker { display: none; }
.roster-card__more > summary:hover { background: #eff6ff; }
.roster-card__menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 6;
  display: grid;
  gap: 6px;
  padding: 8px;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  box-shadow: 0 4px 12px #0f172a1a;
}
.log-card--building {
  border-left-color: #0d9488;
}
.log-card__header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid #f1f5f9;
}
.log-card__eyebrow {
  display: block;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #2563eb;
  margin-bottom: 2px;
}
.log-card__eyebrow--building {
  color: #0f766e;
}
.log-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.log-card__time {
  font-size: .84rem;
  color: #64748b;
  font-weight: 600;
}

.pulse-snapshot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
  margin: 12px 0;
}
.snapshot-pill {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  font-size: .84rem;
}
.snapshot-pill.is-yes { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.snapshot-pill.is-no { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.snapshot-pill.is-tally { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }

.notes {
  background: #f8fafc;
  border-left: 3px solid #cbd5e1;
  padding: 10px 14px;
  border-radius: 0 8px 8px 0;
  color: #1e293b;
  font-size: .92rem;
  margin: 12px 0;
}
.notes.is-empty {
  color: #94a3b8;
  font-style: italic;
}
.log-card__actions {
  margin: 12px 0 0;
  padding-top: 10px;
  border-top: 1px solid #f1f5f9;
}
.empty-state-card {
  text-align: center;
  padding: 28px 16px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
}

@media screen {
  .workspace-shell:has(#reviewPanel:not([hidden])),
  .workspace-shell:has(#feedbackPanel:not([hidden])) {
    width: calc(100% - 32px);
    max-width: 1800px;
  }
  #reviewPanel,
  #feedbackPanel {
    min-width: 0;
    padding: 16px;
  }
  #reviewPanel .pulse-report {
    min-width: 0;
    padding: 16px;
  }
  #reviewPanel .trend-card {
    min-width: 0;
    padding: 12px;
  }
  #teacherReport,
  #teacherReport .trajectory-card {
    min-width: 0;
  }
  #teacherReport .trajectory-card {
    padding: 12px;
  }
  #walkthroughCohortSection .heatmap-table,
  #walkthroughMatrixSection .heatmap-table,
  #teacherReport .heatmap-table {
    table-layout: fixed;
    min-width: 880px;
  }
  #walkthroughCohortSection .heatmap-table th,
  #walkthroughCohortSection .heatmap-table td,
  #walkthroughMatrixSection .heatmap-table th,
  #walkthroughMatrixSection .heatmap-table td,
  #teacherReport .heatmap-table th,
  #teacherReport .heatmap-table td {
    min-width: 0;
    padding: 8px 6px;
    font-size: .76rem;
  }
  #teacherReport .heatmap-table .phase-pill,
  #teacherReport .heatmap-table .visit-cell-pill {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
    padding: 3px 5px;
    font-size: inherit;
  }
  #walkthroughCohortSection .heatmap-table button,
  #walkthroughMatrixSection .heatmap-table button {
    max-width: 100%;
    padding: 6px;
    font-size: .76rem;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  #walkthroughCohortSection .inline-details,
  #walkthroughMatrixSection .inline-details {
    padding: 6px 4px;
  }
}

@media print {
  .heatmap-table tbody th,
  .heatmap-table thead th:first-child {
    position: static;
  }
  .stat, .trend-card, .zone-card, .trajectory-card, .log-card {
    box-shadow: none;
    break-inside: avoid;
  }
}

@media (max-width: 900px) {
  .roster-card {
    grid-template-areas:
      "teacher groups actions"
      "summary summary actions";
    grid-template-columns: minmax(140px, 1fr) minmax(180px, 1.4fr) auto;
  }
  .roster-card__summary {
    align-self: start;
  }
  .roster-card__actions {
    align-self: center;
    flex-wrap: wrap;
  }
}

@media (max-width: 600px) {
  .roster-card {
    grid-template-areas:
      "teacher"
      "groups"
      "summary"
      "actions";
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .roster-card__summary {
    white-space: normal;
  }
  .roster-card__actions {
    justify-content: flex-start;
  }
  .roster-card__menu {
    right: auto;
    left: 0;
  }
}