.grade-boundaries-page { padding: 56px 32px 72px; overflow: hidden auto; scrollbar-gutter: stable; width: 100%; margin: 0 auto; color: var(--text, #1f2328); background: var(--surface, #fff); font: 14px/1.5 Inter, "Segoe UI", sans-serif; }
.grade-boundaries-page[hidden] { display: none !important; }
body:has(#dashboardWorkspace:not([hidden])) .main > #gradeBoundariesWorkspace:not([hidden]) { position: absolute; z-index: 2; inset: var(--shell-bar-height, 46px) 0 0 var(--dashboard-sidebar-width, 198px); height: auto; width: auto; max-width: none; margin: 0; min-height: 0; }
.grade-boundaries-page svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.gb-inner { max-width: 692px; margin: 0 auto; }

/* Headings and copy */
.grade-boundaries-page h1 { margin: 0 0 12px; font-size: 24px; line-height: 1.3; font-weight: 600; letter-spacing: -.5px; }
.gb-hero h1 span { color: var(--accent, #3766b4); }
.grade-boundaries-page h2 { margin: 0; font-size: 18px; line-height: 1.4; font-weight: 600; letter-spacing: -.3px; }
.gb-lede { margin: 0 0 12px; color: var(--muted, #6b7280); font-size: 15px; line-height: 1.55; }
.gb-sample-note { margin: 0 0 14px; padding: 8px 12px; border-radius: 10px; background: var(--surface-soft, #f1f2f4); color: var(--muted, #6b7280); font-size: 13px; }
.gb-group-label { margin: 22px 0 10px; color: var(--muted, #6b7280); font-size: 17px; font-weight: 500; letter-spacing: -.2px; }
.gb-group-label span { opacity: .8; }

/* Back button */
.gb-back { display: inline-flex; align-items: center; gap: 4px; margin: 0 0 22px; padding: 8px 14px 8px 8px; border-radius: 14px; background: var(--surface-soft, #f1f2f4); color: var(--muted, #6b7280); font-size: 13px; font-weight: 500; text-decoration: none; transition: background .15s, color .15s; }
.gb-back svg { width: 16px; height: 16px; }
.gb-back:hover { background: var(--surface-hover, #e8eaed); color: var(--text, #1f2328); }

/* Level tabs + filters */
.gb-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; position: relative; margin-bottom: 22px; }
.gb-segmented { display: inline-flex; padding: 3px; border-radius: 14px; background: var(--surface-soft, #f1f2f4); }
.gb-segmented button { border: 0; padding: 7px 12px; border-radius: 11px; background: transparent; color: var(--muted, #6b7280); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; transition: background .15s, color .15s, box-shadow .15s; }
.gb-segmented button[aria-selected="true"] { background: var(--surface, #fff); color: var(--text, #1f2328); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.gb-segmented button:not([aria-selected="true"]):hover { color: var(--text, #1f2328); }
.gb-filter { position: relative; }
.gb-pill-button { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px 9px 12px; border: 0; border-radius: 14px; background: var(--surface-soft, #f1f2f4); color: var(--muted, #6b7280); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; transition: background .15s, color .15s; }
.gb-pill-button svg { width: 18px; height: 18px; opacity: .7; }
.gb-pill-button:hover, .gb-pill-button[aria-expanded="true"] { background: var(--surface-hover, #e8eaed); color: var(--text, #1f2328); }

/* Popovers (filters + selects) */
.gb-popover { position: absolute; z-index: 20; background: var(--surface, #fff); border: 1px solid var(--border, #d9dde3); border-radius: 16px; box-shadow: 0 12px 32px rgba(0,0,0,.12); animation: gb-pop .112s ease-out; }
.gb-popover[hidden] { display: none; }
@keyframes gb-pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
.gb-filter-popover { top: calc(100% + 8px); left: 0; width: 280px; padding: 16px; }
.gb-filter-popover h3 { margin: 0 0 14px; font-size: 14px; font-weight: 600; }
.gb-filter-title { margin: 0 0 8px; font-size: 13px; font-weight: 500; }
.gb-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.gb-chip { border: 1px solid var(--border, #d9dde3); background: var(--surface, #fff); color: var(--text, #1f2328); padding: 4px 12px; border-radius: 8px; font: inherit; font-size: 13px; cursor: pointer; transition: background .15s, border-color .15s, color .15s; }
.gb-chip:hover { background: var(--surface-soft, #f1f2f4); }
.gb-chip[aria-pressed="true"] { background: var(--accent, #3766b4); border-color: var(--accent, #3766b4); color: #fff; }
.gb-filter-note { margin: 0 0 8px; color: var(--muted, #6b7280); font-size: 12.5px; line-height: 1.45; }
.gb-filter-key { margin: 0; padding: 0; list-style: none; color: var(--muted, #6b7280); font-size: 12.5px; line-height: 1.6; }

/* Sections */
.gb-section { margin-top: 30px; }
.gb-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.gb-subhead { margin: 0 0 14px !important; }

/* Select */
.gb-select { position: relative; flex-shrink: 0; }
.gb-select-button { display: inline-flex; align-items: center; justify-content: space-between; gap: 18px; min-width: 120px; padding: 9px 12px 9px 16px; border: 2px solid transparent; border-radius: 14px; background: var(--surface-soft, #f1f2f4); color: var(--text, #1f2328); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; transition: background .15s, border-color .15s; }
.gb-select-button svg { width: 18px; height: 18px; color: var(--muted, #6b7280); }
.gb-select-button:hover { background: var(--surface-hover, #e8eaed); }
.gb-select-button:focus-visible { outline: none; border-color: var(--text, #1f2328); }
.gb-select-list { top: calc(100% + 6px); right: 0; min-width: 100%; width: max-content; max-width: 280px; max-height: 248px; overflow: auto; margin: 0; padding: 6px; list-style: none; border-radius: 14px; }
.gb-select-list li { display: flex; align-items: center; gap: 8px; padding: 7px 10px 7px 6px; border-radius: 9px; color: var(--muted, #6b7280); font-size: 13.5px; cursor: pointer; white-space: nowrap; outline: none; }
.gb-select-list li:hover, .gb-select-list li:focus-visible { background: var(--surface-soft, #f1f2f4); color: var(--text, #1f2328); }
.gb-select-list li[aria-selected="true"] { color: var(--text, #1f2328); }
.gb-check { display: inline-flex; width: 16px; }
.gb-check svg { width: 14px; height: 14px; stroke-width: 2.4; }

/* Tables */
.gb-table-card, .gb-chart-card, .gb-session { border: 1px solid var(--border, #d9dde3); border-radius: 18px; background: var(--surface, #fff); overflow: hidden; }
.gb-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.gb-table th, .gb-table td { padding: 12px 14px; text-align: center; font-weight: 400; white-space: nowrap; }
.gb-table thead th { background: var(--surface-soft, #f1f2f4); color: var(--muted, #6b7280); font-weight: 500; }
.gb-table tbody tr { border-top: 1px solid var(--border, #d9dde3); }
.gb-table th:first-child, .gb-table td:first-child { text-align: left; }
.gb-points-table tbody th { text-align: left; font-weight: 500; color: var(--text, #1f2328); }
.gb-points-table th, .gb-points-table td { padding: 13px 8px; }
.gb-points-table th:first-child, .gb-points-table td:first-child { padding-left: 16px; }
.gb-table-scroll { overflow-x: auto; margin: 0 6px 6px; }
.gb-session-table { min-width: 640px; }
.gb-session-table thead th { text-align: right; }
.gb-session-table th:nth-child(-n+3), .gb-session-table td:nth-child(-n+3) { text-align: left; }
.gb-session-table td { text-align: right; }
.gb-session-table tbody th { text-align: left; font-weight: 400; }
.gb-session-table thead th:first-child { border-top-left-radius: 12px; }
.gb-session-table thead th:last-child { border-top-right-radius: 12px; }
.gb-na { color: var(--muted, #6b7280); opacity: .6; }
.gb-empty { margin: 0; padding: 28px 16px; color: var(--muted, #6b7280); text-align: center; border: 1px dashed var(--border, #d9dde3); border-radius: 16px; }

/* Session accordions */
.gb-session { margin-bottom: 10px; }
.gb-session > summary, .gb-faq-item > summary { cursor: pointer; font-weight: 500; list-style: none; }
.gb-session > summary { padding: 14px 16px; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.gb-session > summary::-webkit-details-marker, .gb-faq-item > summary::-webkit-details-marker { display: none; }
.gb-session > summary::before { content: ""; width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 7px solid currentColor; transition: transform .15s; }
.gb-session:not([open]) > summary::before { transform: rotate(-90deg); }
.gb-session > summary:hover { background: var(--surface-soft, #f1f2f4); }

/* Chart */
.gb-chart-card { padding: 18px 14px 14px; }
.gb-chart { position: relative; width: 100%; }
.grade-boundaries-page .gb-chart svg { stroke: none; fill: none; }
.gb-chart svg { display: block; width: 100%; height: auto; touch-action: pan-y; overflow: visible; }
.gb-chart svg .gb-axis { fill: var(--muted, #6b7280); stroke: none; font-size: 11px; }
.gb-chart svg circle { stroke: none; }
.grade-boundaries-page .gb-chart svg .gb-grid { stroke: var(--muted, #6b7280); stroke-opacity: .28; stroke-width: 1; stroke-dasharray: 4 4; }
.grade-boundaries-page .gb-chart svg .gb-cursor { stroke: var(--muted, #6b7280); stroke-opacity: .4; stroke-width: 1; }
.gb-hover[hidden] { display: none; }
.gb-tooltip { position: absolute; z-index: 3; min-width: 184px; padding: 8px 10px; border: 1px solid var(--border, #d9dde3); border-radius: 10px; background: var(--surface, #fff); box-shadow: 0 8px 24px rgba(0,0,0,.12); font-size: 12px; pointer-events: none; }
.gb-tooltip[hidden] { display: none; }
.gb-tooltip strong { display: block; margin-bottom: 4px; font-weight: 600; }
.gb-tooltip div { display: flex; align-items: center; gap: 6px; line-height: 1.7; }
.gb-tooltip div span { color: var(--muted, #6b7280); flex: 1; }
.gb-tooltip div b { font-weight: 600; }
.gb-tooltip i, .gb-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.gb-legend { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 14px; margin: 14px 0 0; padding: 0; list-style: none; color: var(--muted, #6b7280); font-size: 12px; }
.gb-legend li { display: inline-flex; align-items: center; gap: 6px; }
.gb-legend i { width: 10px; height: 10px; }

/* FAQ */
.gb-faq { margin-top: 38px; }
.gb-faq-item { border-top: 1px solid var(--border, #d9dde3); }
.gb-faq-item:last-child { border-bottom: 1px solid var(--border, #d9dde3); }
.gb-faq-item > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 2px; font-size: 14.5px; }
.gb-faq-item > summary::after { content: "+"; color: var(--muted, #6b7280); font-size: 18px; line-height: 1; }
.gb-faq-item[open] > summary::after { content: "\2212"; }
.gb-faq-item p { margin: 0 0 14px; padding: 0 2px; color: var(--muted, #6b7280); }

/* All subjects */
.gb-hero { margin-bottom: 8px; }
.gb-group h2 { margin: 28px 0 12px; color: var(--muted, #6b7280); font-size: 18px; font-weight: 500; }
.gb-subject-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.gb-subject-link { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; padding: 11px 12px 11px 16px; border-radius: 16px; background: var(--surface-soft, #f1f2f4); color: var(--text, #1f2328); font-size: 14.5px; text-decoration: none; transition: background .15s; }
.gb-subject-link svg { width: 18px; height: 18px; color: var(--muted, #6b7280); }
.gb-subject-link:hover { background: var(--surface-hover, #e8eaed); }
.gb-subject-link:focus-visible, .gb-back:focus-visible, .gb-pill-button:focus-visible, .gb-segmented button:focus-visible, .gb-chip:focus-visible { outline: 2px solid var(--accent, #3766b4); outline-offset: 2px; }

[data-theme="dark"] .gb-popover { box-shadow: 0 12px 32px rgba(0,0,0,.5); }
[data-theme="dark"] .gb-segmented button[aria-selected="true"] { background: var(--surface-hover, #1d1d1d); box-shadow: none; }

@media (max-width: 760px) {
    body:has(#dashboardWorkspace:not([hidden])) .main > #gradeBoundariesWorkspace:not([hidden]) { inset: var(--shell-bar-height, 46px) 0 0 0; }
    .grade-boundaries-page { padding: 28px 16px 56px; }
    .gb-subject-grid { grid-template-columns: 1fr; }
    .gb-filter-popover { width: min(280px, calc(100vw - 32px)); }
    .gb-select-list { max-width: calc(100vw - 32px); }
    .gb-section-head { flex-wrap: wrap; }
}

/* Real-data additions */
.gb-table-scroll-x { overflow-x: auto; }
.gb-overall th, .gb-overall td { font-weight: 600; background: var(--surface-soft, #f1f2f4); }
.gb-points-table tbody tr.gb-overall th { color: var(--text, #1f2328); }
.gb-table-note { margin: 10px 4px 0; color: var(--muted, #6b7280); font-size: 12.5px; line-height: 1.5; }
.gb-session-body:empty { display: none; }
.gb-points-table th:last-child, .gb-points-table td:last-child { color: var(--muted, #6b7280); }
.gb-overall td:last-child { color: var(--muted, #6b7280); }

.gb-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.grade-boundaries-page .gb-title-row h1 { margin: 0; }
.gb-tooltip div em { min-width: 34px; color: var(--muted, #6b7280); font-style: normal; font-size: 11.5px; text-align: right; opacity: .85; }
.gb-tooltip div b { min-width: 28px; text-align: right; }

/* Session block: wider on large screens, separate tables with breathing room */
.gb-session-body { padding: 10px 8px 6px; }
.gb-session-body .gb-table-scroll { margin: 0 0 10px; }
.gb-table-title { margin: 14px 8px 2px; font-size: 14px; font-weight: 600; }
.gb-session-body .gb-table-note { margin: 0 8px 8px; }
.gb-session-table { min-width: 460px; }
.gb-session-table thead th, .gb-session-table td { text-align: right; }
.gb-session-table th:first-child, .gb-session-table td:first-child, .gb-session-table thead th:first-child { text-align: left; }
.gb-session-table th:nth-child(2), .gb-session-table td:nth-child(2), .gb-session-table th:nth-child(3), .gb-session-table td:nth-child(3) { text-align: center; }
.gb-session-table tbody th { font-weight: 400; }
@media (min-width: 1000px) {
    #gbSessions { position: relative; left: 50%; width: min(780px, calc(100vw - var(--dashboard-sidebar-width, 198px) - 96px)); transform: translateX(-50%); }
}
.gb-session-table { min-width: 0; }
.gb-session-table th, .gb-session-table td { padding: 10px 10px; }
.gb-session-table th:first-child, .gb-session-table td:first-child { padding-left: 14px; white-space: nowrap; }
.gb-session-table th:last-child, .gb-session-table td:last-child { padding-right: 14px; }

/* Top banner: runs edge to edge; small-screen art below 1100px, wider art on large screens */
.gb-banner { display: block; margin: -28px -16px 16px; overflow: hidden; pointer-events: none; user-select: none; }
.gb-banner img { display: block; width: 100%; height: auto; aspect-ratio: 1760 / 560; min-height: 150px; object-fit: cover; object-position: center bottom; }
@media (min-width: 761px) { .gb-banner { margin: -56px -32px 28px; } }
@media (min-width: 1100px) {
    /* Never wider than 1380px, so on zoom out it keeps its size next to the content instead of growing with the window */
    .gb-banner { width: min(1380px, calc(100% + 64px)); margin: -56px 0 28px calc((100% - min(1380px, 100% + 64px)) / 2); }
    .gb-banner img { aspect-ratio: 2224 / 530; min-height: 0; }
}
@media (min-width: 1650px) { .gb-banner { margin-top: 0; border-radius: 28px; } }
