.sql-page {
    --sql-ink: #202b30;
    --sql-muted: #647276;
    --sql-line: #d7dfdc;
    --sql-green: #17684f;
    --sql-green-dark: #124e3c;
    --sql-paper: #f3f6f2;
    color: var(--sql-ink);
    background: #fff;
    padding-top: var(--header-height);
}

.sql-intro {
    padding: clamp(3.5rem, 8vw, 6.5rem) 0 3.75rem;
    background:
        linear-gradient(118deg, rgba(233, 241, 232, .94), rgba(250, 246, 232, .8) 68%, rgba(255, 255, 255, .9)),
        repeating-linear-gradient(135deg, transparent 0 24px, rgba(23, 104, 79, .035) 24px 25px);
    border-bottom: 1px solid #e6ebe7;
}

.sql-intro__inner {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 3rem;
}

.sql-intro__copy { max-width: 760px; }

.sql-eyebrow {
    margin: 0 0 .85rem;
    color: var(--sql-green);
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.sql-eyebrow span { margin-right: .55rem; color: #a76b2c; }

.sql-intro h1 {
    max-width: 700px;
    margin: 0;
    color: #24352f;
    font-size: clamp(2.5rem, 5vw, 4.5rem);
    line-height: 1.05;
}

.sql-intro h1 span { color: var(--sql-green); }

.sql-intro__description {
    max-width: 590px;
    margin: 1.25rem 0 1.15rem;
    color: #4b5c57;
    font-size: 1.1rem;
}

.sql-text-link { color: var(--sql-green-dark); font-size: .92rem; font-weight: 700; }
.sql-text-link span { padding-left: .25rem; }

.sql-intro__note {
    display: flex;
    align-items: flex-start;
    gap: .8rem;
    width: 250px;
    flex: 0 0 250px;
    padding: 1rem 0 0 1rem;
    border-left: 1px solid #b9c9bf;
}

.sql-intro__note-mark { color: #a76b2c; font-size: 1.2rem; font-weight: 700; }
.sql-intro__note p { margin: 0; color: #53625d; font-size: .82rem; line-height: 1.55; }
.sql-intro__note strong { color: #263b32; }

.sql-workspace { padding: 3.5rem 0 4.5rem; }

.sql-section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.sql-section-heading .sql-eyebrow { margin-bottom: .35rem; }
.sql-section-heading h2 { margin: 0; color: #223b31; font-size: 1.75rem; }
.sql-section-heading > p { margin: 0 0 .2rem; color: var(--sql-muted); font-size: .9rem; }

.sql-controls {
    display: flex;
    align-items: flex-end;
    gap: .8rem;
    padding: 1rem;
    background: #f5f7f5;
    border: 1px solid var(--sql-line);
    border-bottom: 0;
}

.sql-select { display: grid; gap: .35rem; min-width: 150px; color: #586762; font-size: .72rem; font-weight: 700; }
.sql-select select {
    width: 100%;
    min-height: 40px;
    padding: .5rem 2rem .5rem .7rem;
    color: #25352f;
    background: #fff;
    border: 1px solid #ccd6d1;
    border-radius: 3px;
    font-size: .82rem;
}

.sql-controls__actions { display: flex; gap: .55rem; margin-left: auto; }
.sql-button, .sql-copy, .sql-clear { min-height: 40px; padding: .55rem .9rem; border-radius: 3px; font-size: .82rem; font-weight: 700; }
.sql-button--quiet { color: #38564a; border: 1px solid #bdcbc3; background: #fff; }
.sql-button--primary { color: #fff; background: var(--sql-green); }
.sql-button--primary:hover { background: var(--sql-green-dark); }
.sql-button:focus-visible, .sql-copy:focus-visible, .sql-clear:focus-visible, .sql-select select:focus-visible { outline: 3px solid #dfa653; outline-offset: 2px; }

.sql-editors { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border: 1px solid var(--sql-line); }
.sql-editor { min-width: 0; background: #fff; }
.sql-editor + .sql-editor { border-left: 1px solid var(--sql-line); }

.sql-editor__topline, .sql-editor__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 45px;
    padding: .6rem .9rem;
    color: #5f6e68;
    background: #fbfcfb;
    font-size: .75rem;
}

.sql-editor__topline { border-bottom: 1px solid #e5eae7; }
.sql-editor__topline label { color: #263b32; font-size: .82rem; font-weight: 700; }
.sql-editor textarea {
    display: block;
    width: 100%;
    min-height: 330px;
    padding: 1.1rem;
    resize: vertical;
    border: 0;
    border-radius: 0;
    outline: none;
    color: #283b36;
    background: #fff;
    font-family: var(--ff-mono);
    font-size: .84rem;
    line-height: 1.75;
    tab-size: 4;
}

.sql-editor textarea:focus { box-shadow: inset 0 0 0 2px #8eae9c; }
.sql-editor textarea::placeholder { color: #a0aaa5; }
.sql-editor--output textarea { background: #fbfcfb; }
.sql-editor__foot { justify-content: flex-start; min-height: 38px; border-top: 1px solid #e5eae7; }
.sql-copy { min-height: 30px; padding: .3rem .6rem; color: var(--sql-green-dark); background: #e8f1eb; font-size: .72rem; }
.sql-copy:disabled { color: #89938e; cursor: not-allowed; background: #eef0ee; }
.sql-workspace__bottom { display: flex; justify-content: space-between; gap: 1rem; padding-top: .75rem; color: var(--sql-muted); font-size: .76rem; }
.sql-clear { min-height: auto; padding: 0; color: #52635b; font-size: .76rem; text-decoration: underline; text-underline-offset: 3px; }

.sql-guide { padding: 4rem 0 5.5rem; background: var(--sql-paper); border-top: 1px solid #e1e8e2; }
.sql-guide__layout { display: grid; grid-template-columns: minmax(230px, .75fr) minmax(0, 1.25fr); gap: clamp(2rem, 7vw, 6rem); }
.sql-guide__heading { align-self: start; position: sticky; top: calc(var(--header-height) + 2rem); }
.sql-guide__heading h2 { max-width: 360px; margin: 0 0 1rem; color: #24382f; font-size: 2rem; }
.sql-guide__heading > p:last-child { max-width: 380px; margin: 0; color: #5c6963; font-size: .95rem; }
.sql-guide__content { max-width: 720px; }
.sql-guide__content h3 { margin: 2rem 0 .55rem; color: #273c32; font-size: 1.12rem; }
.sql-guide__content h3:first-child { margin-top: 0; }
.sql-guide__content p { margin: 0 0 1rem; color: #53615b; font-size: .91rem; line-height: 1.75; }
.sql-example { margin: 1.5rem 0; padding: 1rem 1.1rem; background: #fff; border: 1px solid #dce4dd; border-left: 3px solid #b07a39; }
.sql-example__label { margin: .25rem 0 .45rem !important; color: #7a6343 !important; font-size: .68rem !important; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.sql-example pre { overflow-x: auto; margin: 0 0 1rem; color: #273d34; font-family: var(--ff-mono); font-size: .78rem; line-height: 1.7; white-space: pre; }
.sql-example pre:last-child { margin-bottom: .1rem; }
.sql-reference-scroll { max-width: 100%; margin: 1.25rem 0 .75rem; overflow-x: auto; border: 1px solid #dce4dd; background: #fff; }
.sql-reference-scroll:focus-visible { outline: 3px solid #dfa653; outline-offset: 2px; }
.sql-reference { width: 100%; min-width: 610px; border-collapse: collapse; text-align: left; font-size: .8rem; }
.sql-reference caption { padding: .8rem 1rem; color: #5c6963; background: #f7f9f7; font-size: .76rem; text-align: left; }
.sql-reference th, .sql-reference td { padding: .7rem .85rem; border-top: 1px solid #e5eae7; vertical-align: top; }
.sql-reference thead th { color: #2e4539; background: #f7f9f7; font-size: .72rem; }
.sql-reference tbody th { color: #344b40; white-space: nowrap; }
.sql-reference code { color: #254c3b; font-family: var(--ff-mono); font-size: .76rem; white-space: nowrap; }
.sql-reference-note { font-size: .82rem !important; }
.sql-guide__list { display: grid; gap: .65rem; margin: .85rem 0 2rem; padding-left: 1.25rem; list-style: disc; color: #53615b; font-size: .9rem; line-height: 1.65; }
.sql-guide__list code { color: #254c3b; font-family: var(--ff-mono); font-size: .85em; }
.sql-faq { padding: .95rem 0; border-top: 1px solid #d8e0d9; }
.sql-faq:last-child { border-bottom: 1px solid #d8e0d9; }
.sql-faq summary { color: #2e4539; cursor: pointer; font-size: .88rem; font-weight: 700; }
.sql-faq p { margin: .6rem 0 0; }

@media (max-width: 760px) {
    .sql-intro { padding-top: 3.5rem; }
    .sql-intro__inner { align-items: flex-start; flex-direction: column; gap: 1.75rem; }
    .sql-intro__note { width: auto; flex-basis: auto; }
    .sql-controls { align-items: stretch; flex-wrap: wrap; }
    .sql-select { flex: 1 1 135px; }
    .sql-controls__actions { width: 100%; margin: .25rem 0 0; }
    .sql-controls__actions button { flex: 1; }
    .sql-editors { grid-template-columns: 1fr; }
    .sql-editor + .sql-editor { border-top: 1px solid var(--sql-line); border-left: 0; }
    .sql-editor textarea { min-height: 260px; }
    .sql-guide__layout { grid-template-columns: minmax(0, 1fr); gap: 2rem; }
    .sql-guide__heading { position: static; }
}

@media (max-width: 440px) {
    .sql-section-heading { align-items: flex-start; flex-direction: column; }
    .sql-workspace__bottom { align-items: flex-start; flex-direction: column; gap: .35rem; }
    .sql-editor textarea { min-height: 225px; padding: .85rem; font-size: .77rem; }
}

@media (prefers-reduced-motion: reduce) {
    .sql-page *, .sql-page *::before, .sql-page *::after { scroll-behavior: auto !important; }
}