/* ──────────────────────────────────────────────────────────────────────────
 * gradebook.css — every rule the Portal gradebook view draws itself with.
 *
 * Paired with gradebook.js and shared by both portals. The two prefixes are a
 * historical split rather than a meaningful one: .gd-* came from the Lms
 * grades dashboard and .syng-* was layered on for Portal, but the Portal
 * view uses both, so they travel together.
 *
 * Depends on theme.css for its colour tokens — load that first.
 * ────────────────────────────────────────────────────────────────────────── */

/* ── Grade-source tabs (the full app shows Lms/Portal; lite has no tabs,
 *    but .gd-container and .gd-source-content carry the scroll behaviour both
 *    need, so the group stays intact). ── */
.gd-container { display: flex; flex-direction: column; height: 100%; overflow: hidden; }
.gd-source-tabs { display: flex; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.gd-source-tab { padding: 5px 16px; border-radius: 20px; border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text-2); font-size: 0.82rem; font-weight: 600; cursor: pointer; font-family: inherit; transition: all 0.15s; }
.gd-source-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
/* The scroll container for both grade sources. Everything above it (#pretty-view,
   .gd-container) is overflow:hidden to pin the tabs in place, so if this doesn't
   scroll, nothing does — content past the fold is simply unreachable, which is
   what happens on a phone once the cards stack into two columns. */
.gd-source-content { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; min-height: 0; display: flex; flex-direction: column; }

/* ── Grades dashboard ── */
.gd-layout { display: flex; height: 100%; overflow: hidden; }
.gd-sidebar {
  width: clamp(220px, 19vw, 320px); flex-shrink: 0; border-right: 1px solid var(--border);
  overflow-y: auto; background: var(--surface);
}
/* Surface rather than transparent so the table reads as one panel down to the
   bottom of the viewport, instead of stopping dead under the last row. */
.gd-main { flex: 1; min-width: 0; background: var(--surface); overflow-y: auto; }
.gd-course-item {
  padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  transition: background var(--transition);
}
.gd-course-item:hover { background: var(--accent-4); }
.gd-course-item.selected { background: var(--accent-3); border-left: 3px solid var(--accent); }
.gd-course-name { font-size: 0.83rem; font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gd-course-grade { font-size: 0.87rem; font-weight: 800; flex-shrink: 0; }
.gd-header {
  padding: 16px 18px; border-bottom: 1px solid var(--border);
  background: var(--surface); display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap; position: sticky; top: 0; z-index: 2;
  box-shadow: 0 2px 8px rgba(100,80,200,0.06);
}
.gd-header-title { font-size: 1rem; font-weight: 600; flex: 1; min-width: 0; color: var(--text); }
.gd-grade-display { font-size: 0.82rem; padding: 5px 12px; border-radius: 99px; font-weight: 500; }
.gd-reset-btn {
  font-size: 0.73rem; padding: 4px 11px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface);
  cursor: pointer; color: var(--text-2); font-family: inherit; transition: all var(--transition);
}
.gd-reset-btn:hover { background: #fee2e2; border-color: #fca5a5; color: #dc2626; }
.gd-group-header {
  padding: 7px 18px; font-size: 0.68rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.7px;
  color: var(--accent); background: var(--accent-4);
  border-bottom: 1px solid var(--border-2);
  display: flex; justify-content: space-between;
}
.gd-row {
  display: grid; grid-template-columns: var(--gd-cols);
  align-items: center; gap: 10px; padding: 9px 18px;
  border-bottom: 1px solid var(--border); font-size: 0.83rem;
  transition: background var(--transition); background: var(--surface);
}
.gd-row:hover { background: var(--accent-4); }
.gd-row-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.gd-row-due  { font-size: 0.73rem; color: var(--text-2); }
.gd-score-wrap { display: flex; align-items: center; gap: 5px; }
.gd-score-input {
  width: 62px; padding: 4px 7px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 0.87rem; text-align: center;
  background: var(--surface-2); font-family: inherit;
  /* Without an explicit color these inherit the UA default (black), which vanishes against
     a dark surface until .simulated swaps in a light background. */
  color: var(--text);
  transition: border-color var(--transition), background var(--transition);
}
.gd-score-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(124,58,237,0.12); }
/* Fixed light amber background, so pin a dark text color rather than a themed one. */
.gd-score-input.simulated { border-color: #f59e0b; background: #fffbeb; color: #92400e; font-weight: 700; }
.gd-pts  { font-size: 0.73rem; color: var(--text-3); }
.gd-pct  { font-size: 0.78rem; font-weight: 500; text-align: right; }
.gd-col-headers {
  display: grid; grid-template-columns: var(--gd-cols);
  gap: 10px; padding: 7px 18px;
  font-size: 0.68rem; font-weight: 500; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--text-3);
  border-bottom: 1px solid var(--border); background: var(--surface);
}
.gd-empty { padding: 32px; text-align: center; color: var(--text-3); font-size: 0.88rem; }
.gd-portal-hint {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 14px 18px 0; padding: 10px 14px; border-radius: var(--radius);
  background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412;
  font-size: 0.83rem; line-height: 1.45;
}
html.dark .gd-portal-hint { background: #2a1a08; border-color: #7c3d12; color: #fdba74; }

/* Portal: term/mark switcher, grade calculator, semester projection */
.syng-grid {
  display: grid; gap: 16px; padding: 16px 18px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
/* Below ~1250px four large cards get cramped, so step down a column at a time. */
@media (max-width: 1250px) { .syng-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 950px)  { .syng-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.syng-card {
  display: flex; flex-direction: column; gap: 4px;
  padding: 20px 22px 22px; min-height: 168px; text-align: left;
  border: 1px solid var(--border-2); border-left: 5px solid var(--card-accent, var(--border-2));
  border-radius: var(--radius); background: var(--surface);
  font-family: inherit; cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.syng-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0,0,0,0.10);
  border-color: var(--card-accent, var(--accent));
}
.syng-card-top { display: flex; align-items: center; gap: 8px; }
/* Drag to reorder (drag-reorder.js). Text selection and the phone's long-press
   menu would both fight the gesture, so cards opt out of them. */
.syng-card, .course-card { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.dr-dragging { cursor: grabbing; }
.dr-lifted {
  position: relative; z-index: 20; cursor: grabbing;
  box-shadow: 0 12px 28px rgba(0,0,0,0.18) !important;
}
.syng-card-period {
  font-size: 0.74rem; font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.syng-card-proj {
  font-size: 0.68rem; font-weight: 800; color: #b45309;
  text-transform: uppercase; letter-spacing: 0.4px;
  background: #f59e0b22; padding: 2px 7px; border-radius: 12px;
}
.syng-card-title {
  font-size: 1.08rem; font-weight: 700; color: var(--text); line-height: 1.25;
  overflow: hidden; text-overflow: ellipsis; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.syng-card-teacher {
  font-size: 0.84rem; color: var(--text-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* Push the grade to the bottom so cards in a row line their numbers up. */
.syng-card-grade { display: flex; align-items: baseline; gap: 8px; margin-top: auto; padding-top: 12px; flex-wrap: wrap; }
.syng-card-pct    { font-size: 2.1rem; font-weight: 500; letter-spacing: -0.5px; }
.syng-card-letter { font-size: 1.25rem; font-weight: 500; opacity: 0.85; }
.syng-card-delta  { font-size: 0.8rem; font-weight: 500; }

.syng-backrow { padding: 12px 18px 0; }
.syng-back {
  border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text-2);
  padding: 4px 12px; border-radius: 16px;
  font-size: 0.78rem; font-weight: 600; cursor: pointer; font-family: inherit;
  transition: all var(--transition);
}
.syng-back:hover { border-color: var(--accent); color: var(--accent); }

.syng-chiprow { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 18px 8px; background: var(--surface); }
.syng-chip {
  padding: 3px 12px; border-radius: 16px; border: 1px solid var(--border-2);
  background: var(--surface-2); color: var(--text-2);
  font-size: 0.78rem; font-weight: 600; cursor: pointer; font-family: inherit;
  transition: all var(--transition);
}
.syng-chip:hover { border-color: var(--accent); color: var(--accent); }
.syng-chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.syng-calc { padding: 12px 18px; background: var(--surface); border-bottom: 1px solid var(--border); }
.syng-calc-line {
  display: flex; gap: 7px; align-items: center; flex-wrap: wrap;
  font-size: 0.82rem; color: var(--text-2);
}
.syng-input {
  padding: 5px 8px; border: 1px solid var(--border-2); border-radius: var(--radius-sm);
  font-size: 0.83rem; background: var(--surface-2); color: var(--text); font-family: inherit;
}
.syng-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(124,58,237,0.12); }
.syng-btn {
  padding: 5px 14px; border-radius: var(--radius-sm); border: none;
  background: var(--accent); color: #fff;
  font-size: 0.82rem; font-weight: 700; cursor: pointer; font-family: inherit;
}
.syng-btn:hover { filter: brightness(1.08); }
.syng-x {
  border: none; background: none; color: var(--text-3);
  font-size: 1.05rem; line-height: 1; cursor: pointer; padding: 0 4px; font-family: inherit;
}
.syng-x:hover { color: #dc2626; }
.syng-trash { width: 14px; height: 14px; vertical-align: -2px; }
.syng-link {
  border: none; background: none; color: var(--accent);
  font-size: 0.7rem; cursor: pointer; font-family: inherit; text-decoration: underline; padding: 0;
}
/* Semester projection terms: name, category chips, then the term grade. Flex rather than
   .gd-row's fixed grid, so the chips can wrap without squeezing the columns. */
.syng-term-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 9px 18px; font-size: 0.83rem;
  border-bottom: 1px solid var(--border); background: var(--surface);
  transition: background var(--transition);
}
.syng-term-row:hover { background: var(--accent-4); }
.syng-term-name { font-weight: 500; flex-shrink: 0; }
.syng-term-cats { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; min-width: 0; }
.syng-term-val  { margin-left: auto; text-align: right; flex-shrink: 0; }

.syng-hypo-row { background: color-mix(in srgb, #f59e0b 7%, var(--surface)); }
.syng-hypo-tag {
  font-size: 0.68rem; font-weight: 700; color: #b45309;
  text-transform: uppercase; letter-spacing: 0.4px;
}
/* Assignments taken out of the grade: still listed, but visibly not counting. */
.syng-removed-row .gd-row-name,
.syng-removed-row .gd-row-due { opacity: 0.55; }
.syng-removed-row .gd-row-name { text-decoration: line-through; }
.syng-removed-score { color: var(--text-3); text-decoration: line-through; font-size: 0.83rem; }
.syng-removed-tag {
  font-size: 0.68rem; font-weight: 700; color: #dc2626;
  text-transform: uppercase; letter-spacing: 0.4px;
  display: inline-block; text-decoration: none;
}
.syng-proj-note {
  font-size: 0.7rem; font-weight: 700; color: #f59e0b;
  text-transform: uppercase; letter-spacing: 0.5px; margin-top: 3px;
}
.syng-catline {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 0 16px 11px;
}
.syng-cat {
  display: inline-flex; align-items: baseline; gap: 5px;
  padding: 3px 9px; border-radius: 11px;
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: 0.75rem; white-space: nowrap;
}
.syng-cat-name { font-weight: 600; color: var(--text-2); }
.syng-cat-w { color: var(--text-3); font-size: 0.7rem; }
.syng-verdict {
  margin: 10px 18px; padding: 11px 14px;
  border: 1px solid var(--border-2); border-radius: var(--radius-sm);
  background: var(--surface-2); font-size: 0.84rem; line-height: 1.5;
}
.syng-solve { margin-top: 9px; font-size: 0.84rem; color: var(--text); line-height: 1.5; }
.gd-projected { color: #f59e0b; }
.gd-legend { padding: 8px 18px; font-size: 0.71rem; color: var(--text-3); border-top: 1px solid var(--border); background: var(--surface); }

/* Transparency is decorative here; legibility is not. Mirrors the guard in
   index.html for the surfaces this file owns, so lite.html gets it too. */
@media (prefers-reduced-transparency: reduce) {
  .gd-sidebar, .gd-header, .gd-col-headers, .gd-row,
  .syng-card, .syng-calc, .syng-chiprow, .syng-cat {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    background: var(--surface-solid) !important;
  }
}

/* ── Phones ─────────────────────────────────────────────────────────────── */
@media (max-width: 700px) {
/* Grades dashboard: course list becomes a horizontally-scrolling strip
   above the grade table instead of a side rail (there's no room for both). */
.gd-layout { flex-direction: column; }
.gd-sidebar {
  width: 100%; display: flex; overflow-x: auto; overflow-y: hidden;
  border-right: none; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.gd-course-item { border-bottom: none; border-right: 1px solid var(--border); flex-shrink: 0; min-width: 160px; }
.gd-col-headers { grid-template-columns: 1fr 70px 60px; }
.gd-col-headers span:nth-child(2) { display: none; } /* Due — cut for space */
.gd-row { grid-template-columns: 1fr 70px 60px; padding: 9px 12px; gap: 6px; }
.syng-chiprow, .syng-calc { padding-left: 12px; padding-right: 12px; }
.syng-verdict { margin-left: 12px; margin-right: 12px; }
.syng-catline { padding-left: 12px; padding-right: 12px; }
.syng-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 12px; }
.syng-card { padding: 13px 14px 15px; min-height: 132px; }
.syng-card-title { font-size: 0.92rem; }
.syng-card-teacher { font-size: 0.74rem; }
.syng-card-pct { font-size: 1.5rem; }
.syng-card-letter { font-size: 1rem; }
.syng-backrow { padding-left: 12px; padding-right: 12px; }
.syng-term-row { padding-left: 12px; padding-right: 12px; }
.syng-term-cats { flex-basis: 100%; order: 3; }
/* Stack the calculator controls instead of letting them overflow the row. */
.syng-calc-line { gap: 5px; }
.syng-calc-line .syng-input { flex: 1 1 auto; min-width: 0; }
.gd-row-due { display: none; }
.gd-score-input { width: 46px; padding: 4px; }
}

/* ── Liquid glass ────────────────────────────────────────────────────────────
 * The surfaces this file owns, given the same treatment the rest of CourseCat
 * uses. index.html restates these later in its own inline block and wins on
 * source order, so the full app is unchanged; lite.html has only this copy.
 * ─────────────────────────────────────────────────────────────────────────── */

/* Containers that float over scrolling content frost; list items (.syng-card,
   .gd-row) deliberately don't — they render in bulk and the tint tier is
   visually indistinguishable from frost at that size. */
.gd-sidebar, .gd-header, .gd-col-headers, .syng-calc, .syng-chiprow {
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
}

/* The rim. */
.gd-sidebar, .syng-card, .syng-cat {
  box-shadow:
    inset 0 1px 0 var(--glass-edge),
    inset 0 -1px 0 var(--glass-shade),
    var(--glass-shadow);
}

/* Hover is defined earlier and outranks the rule above, so it restates the rim
   to keep the edge from blinking. */
.syng-card:hover {
  box-shadow:
    inset 0 1px 0 var(--glass-edge),
    inset 0 -1px 0 var(--glass-shade),
    var(--shadow-lg);
}

/* Fields read as pressed into the glass, so the rim inverts: shade on top,
   no lit edge. */
.gd-score-input, .syng-input {
  background: var(--glass-field);
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 2px var(--glass-shade);
}

/* Pills and chips share the button's shape language. */
.syng-chip, .gd-source-tab, .gd-reset-btn, .syng-back {
  border-radius: 999px;
  box-shadow: inset 0 1px 0 var(--glass-edge);
}

/* ── Schedule / Attendance / Documents (portal-views.js) ─────────────────── */
.pv { padding: 16px 18px 24px; display: flex; flex-direction: column; gap: 14px; width: 100%; box-sizing: border-box; }
/* Flex children default to their content's width; a wide table must scroll in its card, not widen the page. */
.pv > * { min-width: 0; }
.pv-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pv-title { margin: 0; font-size: 1.15rem; font-weight: 800; color: var(--text); }
.pv-head .syng-back { margin-left: auto; }
.pv-terms { padding: 0; flex-basis: 100%; order: 3; }
.pv-card {
  border: 1px solid var(--border-2); border-radius: var(--radius); background: var(--surface);
  padding: 14px 16px; overflow-x: auto;
}
.pv-card-head {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  font-size: 0.8rem; font-weight: 800; letter-spacing: 0.5px; text-transform: uppercase;
  color: var(--text-2); margin-bottom: 10px;
}
.pv-sub { display: block; font-size: 0.78rem; font-weight: 500; color: var(--text-3); text-transform: none; letter-spacing: 0; }
.pv-card-head .pv-sub, .pv-head .pv-sub { display: inline; }
.pv-list { list-style: none; margin: 0; padding: 0; }
.pv-row {
  display: flex; align-items: center; gap: 14px; padding: 9px 0;
  border-top: 1px solid var(--border); font-size: 0.87rem; color: var(--text);
}
.pv-row:first-child { border-top: none; }
.pv-row-top { align-items: flex-start; }
/* Document rows wrap the row and its preview, so the divider moves to the wrapper. */
.pv-doc + .pv-doc { border-top: 1px solid var(--border); }
.pv-actions { display: flex; gap: 6px; flex-shrink: 0; }
.pv-preview { margin: 0 0 12px; }
.pv-preview-bar { display: flex; align-items: center; gap: 10px; justify-content: space-between; margin-bottom: 8px; }
.pv-preview-bar .pv-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pv-preview-bar .syng-chip { text-decoration: none; flex-shrink: 0; }
.pv-preview-frame {
  display: block; width: 100%; height: 80vh; min-height: 420px;
  border: 1px solid var(--border-2); border-radius: var(--radius-sm); background: #fff;
}
.pv-preview-img { display: block; max-width: 100%; height: auto; margin: 0 auto; border-radius: var(--radius-sm); }
.pv-time { flex: 0 0 110px; font-size: 0.8rem; font-weight: 700; color: var(--text-2); font-variant-numeric: tabular-nums; }
.pv-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pv-note { font-style: italic; }
/* Bell times ("10:45 AM–11:30 AM") never wrap; the column widens to fit them. */
.pv-time.pv-time-range { flex: 0 0 auto; min-width: 140px; white-space: nowrap; }
.pv-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; color: var(--text); }
.pv-table th {
  text-align: left; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px;
  color: var(--text-3); padding: 0 10px 8px 0; white-space: nowrap;
}
.pv-table td { padding: 8px 10px 8px 0; border-top: 1px solid var(--border); vertical-align: top; }
.pv-num { text-align: right; font-variant-numeric: tabular-nums; width: 1%; white-space: nowrap; }
.pv-table th.pv-num { text-align: right; }
.pv-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.pv-stat {
  display: flex; flex-direction: column; gap: 2px; padding: 12px 14px;
  border: 1px solid var(--border-2); border-radius: var(--radius); background: var(--surface);
}
.pv-stat-val { font-size: 1.6rem; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; line-height: 1.1; }
.pv-stat-label { font-size: 0.76rem; font-weight: 600; color: var(--text-2); }
.pv-msg { padding: 28px 12px; text-align: center; color: var(--text-2); font-size: 0.9rem; line-height: 1.6; }
.pv-err { color: #b91c1c; }

/* Attendance by period: one stacked bar per period on a shared scale.
   Four categorical slots, validated for colorblind separation in both themes;
   the dark steps are chosen for the dark surface, not a flipped copy. */
.pv {
  --pv-s1: #2a78d6; --pv-s2: #eb6834; --pv-s3: #1baf7a; --pv-s4: #eda100;
}
html.dark .pv {
  --pv-s1: #3987e5; --pv-s2: #d95926; --pv-s3: #199e70; --pv-s4: #c98500;
}
.pv-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 12px; font-size: 0.8rem; color: var(--text-2); }
.pv-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.pv-swatch { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.pv-chart { display: flex; flex-direction: column; gap: 4px; }
.pv-bar-row {
  display: grid; grid-template-columns: minmax(90px, 220px) 1fr; align-items: center; gap: 12px;
  padding: 5px 0; border-radius: var(--radius-sm);
}
.pv-bar-row:hover { background: var(--surface-2); }
.pv-bar-label { display: flex; align-items: baseline; gap: 8px; min-width: 0; font-size: 0.84rem; }
.pv-bar-per { flex-shrink: 0; width: 1.6em; text-align: right; font-weight: 800; color: var(--text-2); font-variant-numeric: tabular-nums; }
.pv-bar-course { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.pv-bar-track { display: flex; align-items: center; gap: 8px; min-width: 0; }
/* Width is set inline as a share of the lane less 3em, so the longest bar still leaves room for its total. */
.pv-bar { display: flex; gap: 2px; height: 16px; min-width: 6px; }
.pv-seg { position: relative; flex-basis: 0; min-width: 4px; height: 100%; }
.pv-seg:last-child { border-radius: 0 4px 4px 0; }
.pv-seg:hover { filter: brightness(1.1); }
.pv-seg:hover::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  padding: 4px 8px; border-radius: 6px; white-space: nowrap; pointer-events: none; z-index: 2;
  background: var(--text); color: var(--surface); font-size: 0.74rem; font-weight: 600;
}
.pv-bar-total { font-size: 0.8rem; font-weight: 700; color: var(--text-2); font-variant-numeric: tabular-nums; }
.pv-table-toggle { margin-top: 12px; overflow-x: auto; }
/* A record: its kind as a tag carrying the chart's color, then the class it was in. */
.pv-rec { display: flex; align-items: baseline; gap: 10px; min-width: 0; font-size: 0.86rem; color: var(--text); }
/* One line per record; a long course name is cut short rather than wrapping under the tag. */
.pv-rec-what { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-rec + .pv-rec { margin-top: 4px; }
.pv-tag {
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; min-width: 92px;
  padding: 1px 9px 1px 7px; border: 1px solid var(--border-2); border-radius: 999px;
  font-size: 0.74rem; font-weight: 700; color: var(--text-2); background: var(--surface-2);
}
.pv-tag::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--tag, var(--text-3)); }
.pv-rec-what b { font-weight: 700; color: var(--text-2); margin-right: 2px; }
.pv-rec-why { margin-left: 8px; font-size: 0.78rem; color: var(--text-3); }
.pv-stat-label .pv-swatch { display: inline-block; margin-right: 6px; vertical-align: 0; }
.pv-table-toggle summary { cursor: pointer; font-size: 0.78rem; font-weight: 600; color: var(--text-3); }
.pv-table-toggle[open] summary { margin-bottom: 8px; }
@media (max-width: 640px) {
  .pv { padding: 12px; }
  .pv-time { flex-basis: 78px; }
  .pv-time.pv-time-range { min-width: 128px; font-size: 0.76rem; }
  .pv-row { gap: 10px; flex-wrap: wrap; }
  .pv-doc .pv-actions { margin-left: calc(78px + 10px); }
  .pv-preview-frame { height: 70vh; min-height: 320px; }
  .pv-bar-row { grid-template-columns: minmax(70px, 38%) 1fr; gap: 8px; }
}
