:root { color-scheme: light; --ink: #2f3e46; --muted: #667773; --line: #dce3dc; --green: #354f52; --pale: #edf1e9; --error: #9b2828; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: #f7f8f5; font: 15px/1.7 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", sans-serif; }
button, textarea { font: inherit; }
a { color: inherit; }
.topbar { height: 76px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); padding: 0 5vw; background: #fff; }
.brand { text-decoration: none; font-weight: 800; font-size: 20px; letter-spacing: -.6px; }
.brand span { font-size: 13px; font-weight: 500; margin-left: 16px; color: var(--muted); }
.status, .pill { font-size: 12px; padding: 4px 12px; border-radius: 30px; background: var(--pale); white-space: nowrap; }
.status.offline { color: var(--error); background: #f8eaea; }
.layout { max-width: 1540px; margin: auto; display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 38px; padding: 42px 5vw; }
.layout > aside { align-self: start; position: sticky; top: 30px; max-height: calc(100vh - 60px); overflow-y: auto; scrollbar-gutter: stable; }
.layout > aside:focus-visible { outline: 2px solid #52796f; outline-offset: 3px; }
main { min-width: 0; }
.eyebrow { text-transform: uppercase; font-size: 11px; font-weight: 750; letter-spacing: 1.1px; color: #52796f; margin: 0 0 12px; }
h1 { font-size: 31px; line-height: 1.4; margin: 0 0 15px; letter-spacing: -1.2px; }
h2 { font-size: 21px; margin: 8px 0 14px; letter-spacing: -.5px; }
h3 { margin: 0; font-size: 17px; letter-spacing: -.35px; }
.muted { color: var(--muted); font-size: 13px; }
.small { font-size: 12px; min-height: 19px; margin-bottom: 0; }
nav { margin-top: 30px; }
#scenario { font-size: 14px; line-height: 1.7; }
#syntax-help > summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.exercise-level + .exercise-level { margin-top: 26px; }
.exercise-level > summary { margin: 0 0 9px; font-size: 19px; font-weight: 800; color: var(--ink); cursor: pointer; }
.exercise-level > summary::marker { color: #52796f; }
.exercise-level > summary:focus-visible { outline: 2px solid #52796f; outline-offset: 2px; border-radius: 4px; }
.exercise-group { margin-bottom: 6px; padding: 0; border-top: 0; border-bottom: 1px solid var(--line); }
.group-label { padding: 11px 2px; font-size: 16px; line-height: 1.5; font-weight: 800; color: var(--ink); cursor: pointer; overflow-wrap: anywhere; }
.group-label::marker { color: #52796f; }
.group-label:focus-visible { outline: 2px solid #52796f; outline-offset: 2px; border-radius: 4px; }
.exercise-list { max-height: 210px; overflow-y: auto; margin-bottom: 8px; }
.exercise { display: flex; align-items: baseline; gap: 12px; width: 100%; background: none; border: 0; border-radius: 7px; padding: 10px 12px; text-align: left; cursor: pointer; color: var(--ink); font-size: 13px; }
.exercise span { font-size: 11px; opacity: .7; }
.exercise:hover { background: #e9eee6; }
.exercise.active { background: var(--green); color: white; }
.sidebar-note { border-top: 1px solid var(--line); margin-top: 30px; padding-top: 20px; font-size: 12px; color: var(--muted); }
.sql-reference { margin-top: 22px; min-width: 0; }
.sql-reference h2 { margin: 0 0 10px; font-size: 16px; }
.sql-reference-scroll { max-height: 250px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.sql-reference-scroll:focus-visible { outline: 2px solid #52796f; outline-offset: 3px; }
.sql-reference table { table-layout: fixed; margin: 0; font-size: 12px; line-height: 1.45; }
.sql-reference th, .sql-reference td { padding: 7px 8px; vertical-align: top; overflow-wrap: anywhere; }
.sql-reference th:first-child, .sql-reference td:first-child { width: 55%; }
.sql-reference td code { font-size: 11.5px; white-space: normal; overflow-wrap: anywhere; }
.card { background: white; border: 1px solid var(--line); border-radius: 16px; padding: 26px; margin-bottom: 22px; }
.lab-card { padding: 0; overflow: hidden; }
.topic-header { min-height: 106px; padding: 24px 28px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.topic-header .eyebrow, .topic-header h2 { margin: 0; }
.topic-header .eyebrow { margin-bottom: 5px; }
.lab-grid { display: grid; grid-template-columns: minmax(0, 1fr); }
.schema-panel { min-width: 0; padding: 25px 22px; border-bottom: 1px solid var(--line); background: #fbfcf9; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.panel-label { margin: 0 0 7px; color: #52796f; font-size: 11px; font-weight: 800; letter-spacing: .8px; text-transform: uppercase; }
.schema-panel > .muted { margin: 12px 0 18px; line-height: 1.55; }
#schema-description { white-space: pre-line; }
.schema-table table { table-layout: fixed; margin-top: 0; font-size: 10.5px; line-height: 1.45; }
.schema-table th:nth-child(1) { width: 34%; }
.schema-table th:nth-child(2) { width: 31%; }
.schema-table th:nth-child(3) { width: 35%; }
.schema-table th, .schema-table td { padding: 8px 7px; vertical-align: top; overflow-wrap: anywhere; }
.schema-table td:first-child { white-space: nowrap; overflow-wrap: normal; }
.source-button { width: 100%; margin-top: 20px; }
#table-choice { margin: 6px 0 18px; padding: 9px; font: inherit; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); background: white; }
#table-choice-label { font-size: 12px; color: var(--muted); }
.problem-panel { min-width: 0; padding: 25px 28px; }
.problem-panel > details { border-top: 0; padding: 0; }
.problem-panel > #syntax-help { margin-top: 12px; }
summary.problem-heading { margin: 0; font-size: 19px; font-weight: 800; color: var(--ink); cursor: pointer; }
summary.problem-heading::marker { color: #52796f; }
summary.problem-heading h3 { display: inline; font: inherit; color: inherit; }
.problem-panel h3 { font-size: 20px; }
.problem-panel ul { margin-bottom: 0; }
.editor-panel { grid-column: 1 / -1; min-width: 0; padding: 25px 28px 20px; border-top: 1px solid var(--line); }
.schema-panel > .schema-note { margin-top: 0; font-size: 11px; }
#editor-help { margin: 11px 0 0; text-align: center; font-size: 11px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section-heading h2, .section-heading h3, .section-heading p { margin: 0; }
.section-heading label { font-size: 17px; font-weight: 750; letter-spacing: -.35px; }
ul { padding-left: 21px; font-size: 14px; }
li { margin: 7px 0; }
details { border-top: 1px solid #edf0eb; padding: 12px 0; font-size: 13px; }
summary { cursor: pointer; color: #52796f; font-weight: 650; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .88em; }
.autocomplete-wrap { position: relative; }
textarea { display: block; width: 100%; min-height: 280px; resize: vertical; margin: 17px 0 13px; border: 1px solid #d7dfd5; border-radius: 7px; padding: 19px; background: #fafbf8; font: 14px/1.8 ui-monospace, SFMono-Regular, Menlo, monospace; tab-size: 4; color: #253a3e; }
textarea:focus { outline: 2px solid #84a98c; outline-offset: 1px; }
.autocomplete-list { position: absolute; z-index: 20; margin: 0; width: min(360px, 100%); max-height: 175px; overflow-y: auto; padding: 5px; border: 1px solid #cad5ca; border-radius: 8px; background: white; box-shadow: 0 12px 30px rgba(47, 62, 70, .18); }
.autocomplete-option { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 34px; padding: 6px 9px; border-radius: 5px; cursor: pointer; }
.autocomplete-option[aria-selected="true"] { background: var(--pale); color: #253a3e; }
.autocomplete-value { overflow: hidden; font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; text-overflow: ellipsis; white-space: nowrap; }
.autocomplete-kind { flex: 0 0 auto; color: var(--muted); font-size: 10px; }
.editor-footer { display: flex; align-items: flex-start; justify-content: flex-end; gap: 16px; }
.actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; flex-wrap: wrap; }
button { border: 1px solid var(--line); border-radius: 6px; padding: 9px 13px; cursor: pointer; font-size: 12px; font-weight: 650; }
.primary { background: var(--green); color: white; border-color: var(--green); min-width: 112px; }
.secondary { background: white; color: var(--ink); }
button:disabled { opacity: .5; cursor: wait; }
button:focus-visible, summary:focus-visible { outline: 2px solid #52796f; outline-offset: 3px; }
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; margin-top: 15px; font-size: 12px; text-align: left; }
th { background: #f1f4ee; white-space: nowrap; font-weight: 650; }
th, td { border-bottom: 1px solid #e8ece5; padding: 10px 12px; }
td { max-width: 280px; overflow-wrap: anywhere; }
.null { color: #85918c; font-style: italic; }
.empty { text-align: center; padding: 30px 5px; font-size: 13px; color: var(--muted); }
#error, #source-error { color: var(--error); background: #fff1ef; padding: 15px; border-left: 3px solid var(--error); border-radius: 4px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; }
.result-card { min-height: 190px; }
.result-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: stretch; margin-top: 4px; }
.result-pane { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px 16px; background: #fbfcf9; }
/* Collapsing the expected table hands the full width to the run result. */
.result-compare:has(> details:not([open])) { grid-template-columns: auto minmax(0, 1fr); }
details.result-pane:not([open]) { align-self: start; }
.pane-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.pane-heading h3 { font-size: 19px; font-weight: 800; }
summary.pane-heading { display: list-item; margin: 0; font-size: 19px; font-weight: 800; color: var(--ink); cursor: pointer; }
summary.pane-heading::marker { color: #52796f; }
summary.pane-heading h3 { display: inline; font: inherit; color: inherit; }
summary.pane-heading .muted { float: right; }
.pane-heading .muted { font-size: 11px; text-align: right; }
.pane-table { max-height: 360px; overflow: auto; }
.pane-table table { margin-top: 11px; background: white; }
/* Result values stay on one line so words like Electronics are never split; the pane scrolls instead. */
.pane-table td { max-width: none; white-space: nowrap; overflow-wrap: normal; }
.pane-table th { position: sticky; top: 0; z-index: 1; }
.after-run { border-top: 1px solid var(--line); margin-top: 22px; padding-top: 5px; }
.solution-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; margin: 9px 0 12px; }
.solution-heading p { margin: 0; text-align: right; }
.comparison { margin: 12px 0 16px; border-left: 3px solid #52796f; border-radius: 4px; padding: 9px 12px; color: #52796f; background: #edf1e9; font-size: 13px; font-weight: 650; }
.comparison.loading { border-color: var(--line); color: var(--muted); background: #f7f8f5; font-weight: 500; }
.comparison.mismatch { border-color: #8a6019; color: #8a6019; background: #fff8e7; }
footer { color: var(--muted); font-size: 11px; text-align: center; padding: 8px 0 20px; }
dialog { width: min(1120px, calc(100vw - 40px)); max-height: calc(100vh - 56px); border: 1px solid var(--line); border-radius: 16px; padding: 0; color: var(--ink); background: white; box-shadow: 0 24px 80px rgba(47, 62, 70, .24); }
dialog::backdrop { background: rgba(31, 45, 48, .46); }
.dialog-shell { padding: 26px 28px 30px; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); padding-bottom: 17px; }
.dialog-heading h2 { margin: 0; }
.dialog-close { width: 36px; height: 36px; padding: 0; border-radius: 50%; background: white; color: var(--ink); font-size: 23px; line-height: 1; }
.source-result { max-height: calc(100vh - 260px); }
.source-result table { min-width: 940px; }
#source-status { min-height: 21px; margin: 13px 0 0; }
#source-error { margin-bottom: 0; }
@media (max-width: 1100px) {
  .layout { grid-template-columns: 230px minmax(0, 1fr); gap: 22px; padding: 25px; }
  .schema-table table { font-size: 11px; }
  .problem-panel { min-height: 0; }
}
@media (max-width: 720px) {
  .topbar { padding: 0 20px; }
  .brand span { display: none; }
  .layout { display: block; padding: 20px 14px; }
  .layout > aside { position: static; max-height: none; overflow: visible; }
  h1 { font-size: 26px; }
  h1 br { display: none; }
  nav { margin: 16px 0; }
  .sidebar-note { display: none; }
  .sql-reference { margin: 20px 0 26px; }
  .sql-reference-scroll { max-height: 230px; }
  .exercise { min-width: 0; border: 1px solid var(--line); }
  .card { border-radius: 12px; }
  .topic-header, .schema-panel, .problem-panel, .editor-panel { padding-left: 17px; padding-right: 17px; }
  .topic-header { min-height: 94px; }
  .schema-table { display: none; }
  .schema-panel > .muted { margin-bottom: 13px; }
  textarea { min-height: 230px; padding: 14px; }
  .editor-footer { align-items: stretch; flex-direction: column; }
  .actions { justify-content: stretch; }
  .actions button { flex: 1 1 auto; }
  .result-compare, .result-compare:has(> details:not([open])) { grid-template-columns: 1fr; gap: 14px; }
  .solution-heading { display: block; }
  .solution-heading p { margin-top: 6px; text-align: left; }
  .pane-table { max-height: 300px; }
  .result-card { padding: 20px 16px; }
  dialog { width: calc(100vw - 20px); max-height: calc(100vh - 20px); }
  .dialog-shell { padding: 20px 16px 22px; }
  .dialog-heading h2 { font-size: 18px; }
  .source-result { max-height: calc(100vh - 235px); }
}
