
:root {
    --forest: #163300;
    --lime: #9fe870;
    --spruce: #054d28;
    --linen: #e2f6d5;
    --blue: #0b4c72;
    --red: #cb272f;
    --charcoal: #454745;
    --obsidian: #0e0f0c;
    --pebble: #868685;
    --slate: #6a6c6a;
    --fog: #e8ebe6;
    --paper: #fff;
    --hair: rgba(14, 15, 12, .12);
    --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 84px
}

@media (prefers-reduced-motion:reduce) {
    html {
        scroll-behavior: auto
    }
}

body {
    font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-feature-settings: "calt";
    color: var(--charcoal);
    background: var(--paper);
    font-size: 1rem;
    line-height: 1.55;
    letter-spacing: -.006em;
    -webkit-font-smoothing: antialiased
}

h1,
h2,
h3,
h4 {
    color: var(--obsidian)
}

a {
    color: var(--forest)
}

::selection {
    background: var(--lime);
    color: var(--forest)
}

[hidden] {
    display: none !important
}

/* ---------- Top bar ---------- */
.topbar {
    background: #fff;
    border-bottom: 1px solid var(--hair);
    z-index: 1030
}

.navbar {
    min-height: 64px
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    color: var(--forest);
    text-decoration: none;
    font-size: 1.05rem;
    letter-spacing: -.01em
}

.brand-mark {
    background: var(--forest);
    color: #fff;
    border-radius: 999px;
    padding: 3px 12px;
    font-weight: 900;
    letter-spacing: -.02em
}

.brand-sub {
    font-weight: 500;
    color: var(--slate)
}

.navbar-toggler {
    border: 1px solid var(--forest);
    border-radius: 999px;
    padding: 6px 14px;
    font-weight: 500;
    color: var(--forest);
    font-size: .9rem
}

.navbar-toggler:focus {
    box-shadow: none
}

.pillnav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 4px;
    background: var(--fog);
    border-radius: 999px
}

.pillnav a {
    display: block;
    padding: 7px 14px;
    border-radius: 999px;
    color: var(--forest);
    font-weight: 500;
    font-size: .93rem;
    text-decoration: none;
    transition: background .15s
}

.pillnav a:hover {
    background: var(--linen)
}

.pillnav a.active {
    background: var(--forest);
    color: #fff
}

.search input {
    width: 100%;
    border-radius: 999px;
    border: 1px solid var(--pebble);
    padding: 9px 18px;
    font-size: .93rem;
    color: var(--charcoal);
    background: #fff;
    outline: 0
}

.search input:focus {
    border-color: var(--forest)
}

@media (min-width:992px) {
    .search {
        width: 230px
    }
}

@media (max-width:991.98px) {
    .pillnav {
        border-radius: 20px;
        margin: 12px 0
    }

    .search {
        margin-bottom: 14px
    }
}

/* ---------- Buttons / tags ---------- */
.btn-lime {
    display: inline-block;
    background: var(--lime);
    color: var(--forest);
    border-radius: 999px;
    padding: 11px 24px;
    font-weight: 500;
    text-decoration: none;
    transition: background .15s
}

.btn-lime:hover {
    background: #8bd95d;
    color: var(--forest)
}

.btn-ghost {
    display: inline-block;
    border: 1px solid #fff;
    color: #fff;
    border-radius: 999px;
    padding: 11px 24px;
    font-weight: 500;
    text-decoration: none;
    transition: background .15s, color .15s
}

.btn-ghost:hover {
    background: #fff;
    color: var(--forest)
}

.link-u {
    color: var(--forest);
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 4px
}

.tag {
    display: inline-block;
    background: var(--linen);
    color: var(--forest);
    border-radius: 999px;
    padding: 6px 14px;
    font-size: .78rem;
    font-weight: 500;
    letter-spacing: 0
}

.tag.dark {
    background: var(--forest);
    color: var(--lime)
}

.chip {
    display: inline-block;
    background: var(--fog);
    color: var(--forest);
    border-radius: 999px;
    padding: 2px 10px;
    font-size: .7rem;
    font-weight: 600;
    letter-spacing: .03em;
    text-transform: uppercase;
    vertical-align: middle
}

.sec-dark .chip {
    background: var(--forest);
    color: var(--lime)
}

/* ---------- Hero ---------- */
.hero {
    padding: 72px 0 64px;
    text-align: center
}

.display {
    font-weight: 900;
    text-transform: uppercase;
    font-size: clamp(2.6rem, 10.5vw, 6.5625rem);
    line-height: .85;
    letter-spacing: -.04em;
    color: var(--obsidian);
    margin: 22px 0 26px
}

.hero .lead-w {
    max-width: 640px;
    margin: 0 auto 28px;
    font-size: 1.15rem;
    color: var(--charcoal)
}

.byline {
    margin: 18px 0 0;
    font-size: .9rem;
    color: var(--slate)
}

.byline strong {
    color: var(--forest)
}

.cta {
    display: flex;
    gap: 22px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap
}

.hero-code {
    max-width: 780px;
    margin: 48px auto 0;
    text-align: left;
    background: var(--forest);
    border-radius: 28px;
    padding: 10px
}

.hero-code .code {
    border-radius: 20px;
    background: transparent
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    max-width: 780px;
    margin: 36px auto 0
}

.stat b {
    display: block;
    font-weight: 900;
    font-size: clamp(1.8rem, 5vw, 2.8rem);
    letter-spacing: -.04em;
    line-height: 1;
    color: var(--obsidian)
}

.stat span {
    font-size: .9rem;
    color: var(--slate)
}

/* ---------- TOC ---------- */
.toc {
    padding: 0 0 72px
}

.toc h2 {
    font-size: clamp(1.6rem, 4vw, 2.25rem);
    font-weight: 700;
    letter-spacing: -.011em;
    margin-bottom: 24px
}

.toc-item {
    display: block;
    height: 100%;
    background: var(--fog);
    border-radius: 10px;
    padding: 20px;
    text-decoration: none;
    transition: background .15s
}

.toc-item:hover {
    background: var(--linen)
}

.toc-item .num {
    display: block;
    font-weight: 900;
    font-size: 2rem;
    letter-spacing: -.04em;
    line-height: 1;
    color: var(--forest);
    margin-bottom: 12px
}

.toc-item strong {
    display: block;
    color: var(--obsidian);
    font-weight: 700
}

.toc-item small {
    display: block;
    color: var(--slate);
    font-size: .85rem;
    margin-top: 2px;
    line-height: 1.4
}

/* ---------- Sections ---------- */
.sec {
    padding: 76px 0
}

.sec-linen {
    background: var(--linen)
}

.sec-dark {
    background: var(--forest);
    color: #e8ebe6
}

.sec-head {
    max-width: 760px;
    margin-bottom: 36px
}

.sec-head h2 {
    font-size: clamp(2rem, 5vw, 2.8rem);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -.011em;
    margin: 14px 0 12px
}

.sec-head p {
    font-size: 1.08rem;
    margin: 0
}

.sec-dark .sec-head h2 {
    color: var(--lime)
}

.sec-dark .sec-head p {
    color: #fff
}

.sec-dark a {
    color: var(--lime)
}

.cs-card {
    min-width: 0;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 0 0 1px var(--hair);
    padding: 24px;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 14px
}

.cs-card h3 {
    font-size: 1.18rem;
    font-weight: 700;
    letter-spacing: -.01em;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap
}

.cs-card p {
    margin: 0;
    font-size: .95rem
}

.cs-card ul,
.cs-card ol.plainlist {
    margin: 0;
    padding-left: 1.15rem;
    font-size: .95rem
}

.cs-card li+li {
    margin-top: 4px
}

.sec-dark .cs-card {
    background: var(--spruce);
    box-shadow: none;
    color: #fff
}

.sec-dark .cs-card h3 {
    color: #fff
}

.sec-dark .cs-card p,
.sec-dark .cs-card li {
    color: #e8ebe6
}

.card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px
}

.venn {
    width: 104px;
    flex: none
}

.venn svg {
    width: 100%;
    height: auto;
    display: block
}

/* inline code */
code:not(pre code) {
    background: var(--fog);
    color: var(--forest);
    border-radius: 6px;
    padding: 1px 6px;
    font-family: var(--mono);
    font-size: .84em;
    font-weight: 500;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word
}

.sec-dark code:not(pre code) {
    background: var(--forest);
    color: var(--linen)
}

/* ---------- Code blocks ---------- */
.code {
    background: var(--forest);
    border-radius: 10px;
    overflow: hidden
}

.sec-dark .code {
    background: var(--obsidian)
}

.code-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 9px 10px 0 18px;
    font-size: .68rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #a9bb9d;
    font-weight: 500
}

.code-bar button {
    border: 1px solid rgba(255, 255, 255, .3);
    background: transparent;
    color: #e8ebe6;
    border-radius: 999px;
    padding: 3px 12px;
    font-size: .72rem;
    font-family: inherit;
    letter-spacing: 0;
    text-transform: none;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s, color .15s
}

.code-bar button:hover {
    background: #fff;
    color: var(--forest)
}

.code-bar button.ok {
    background: var(--lime);
    border-color: var(--lime);
    color: var(--forest)
}

.code pre {
    margin: 0;
    padding: 8px 18px 18px;
    overflow-x: auto;
    color: #e8ebe6;
    font-family: var(--mono);
    font-size: .8rem;
    line-height: 1.7;
    tab-size: 4
}

.code pre code {
    font-family: inherit;
    background: none;
    padding: 0;
    color: inherit
}

.k {
    color: var(--lime);
    font-weight: 500
}

.t {
    color: #7fd6b0
}

.f {
    color: #e2f6d5
}

.s {
    color: #f4d58d
}

.n {
    color: #8fd3ff
}

.v {
    color: #ffb5a7
}

.b {
    color: #fff
}

.c {
    color: #8fa386;
    font-style: italic
}

/* ---------- Tables ---------- */
.sqlserver-table {
    --bs-table-bg: transparent;
    font-size: .9rem;
    margin: 0;
    color: inherit
}

.sqlserver-table th {
    background: var(--fog);
    color: var(--obsidian);
    font-weight: 600;
    font-size: .74rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    border-bottom: 0;
    white-space: nowrap;
    padding: 10px 14px
}

.sqlserver-table th:first-child {
    border-radius: 10px 0 0 10px
}

.sqlserver-table th:last-child {
    border-radius: 0 10px 10px 0
}

.sqlserver-table td {
    border-color: var(--hair);
    padding: 10px 14px;
    vertical-align: top;
    color: inherit
}

.sqlserver-table td:first-child {
    font-weight: 600;
    color: var(--obsidian);
    white-space: nowrap
}

.sec-dark .sqlserver-table th {
    background: var(--forest);
    color: var(--lime)
}

.sec-dark .sqlserver-table td {
    border-color: rgba(255, 255, 255, .16);
    color: #fff
}

.sec-dark .sqlserver-table td:first-child {
    color: #fff
}

/* ---------- Notes ---------- */
.note {
    border-radius: 10px;
    padding: 12px 16px;
    font-size: .9rem;
    background: var(--linen);
    color: var(--forest);
    display: flex;
    gap: 10px;
    align-items: flex-start
}

.sec-linen .note {
    background: var(--fog)
}

.note>span:last-child {
    min-width: 0;
    overflow-wrap: anywhere
}

.note .lbl {
    flex: none;
    background: var(--forest);
    color: #fff;
    border-radius: 999px;
    padding: 1px 10px;
    font-size: .7rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    margin-top: 2px
}

.note.warn .lbl {
    background: var(--red)
}

.sec-dark .note {
    background: var(--forest);
    color: #fff
}

.sec-dark .note .lbl {
    background: var(--lime);
    color: var(--forest)
}

/* ---------- Steps ---------- */
.steps {
    list-style: none;
    padding: 0 !important;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    counter-reset: s
}

.steps li {
    counter-increment: s;
    background: var(--fog);
    border-radius: 999px;
    padding: 5px 14px 5px 6px;
    font-weight: 500;
    font-size: .88rem;
    color: var(--forest);
    display: flex;
    gap: 8px;
    align-items: center;
    margin: 0 !important
}

.steps li::before {
    content: counter(s);
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--forest);
    color: #fff;
    font-size: .72rem;
    font-weight: 700
}

/* ---------- Schema (dataset) ---------- */
.tbl {
    background: var(--spruce);
    border-radius: 10px;
    padding: 18px;
    height: 100%
}

.tbl h4 {
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 10px
}

.tbl ul {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: .85rem
}

.tbl li {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 4px 0;
    border-top: 1px solid rgba(255, 255, 255, .14);
    color: #e8ebe6
}

.tbl li:first-child {
    border-top: 0
}

.tbl .k2 {
    background: var(--forest);
    color: var(--lime);
    border-radius: 999px;
    padding: 0 8px;
    font-size: .66rem;
    font-weight: 600;
    align-self: center
}

.relation {
    font-family: var(--mono);
    font-size: .82rem;
    background: var(--obsidian);
    color: var(--linen);
    border-radius: 10px;
    padding: 14px 18px;
    overflow-x: auto;
    white-space: pre;
    line-height: 1.8
}

/* ---------- Footer ---------- */
.foot {
    background: var(--obsidian);
    color: #e8ebe6;
    padding: 80px 0 40px
}

.foot-title {
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: -.04em;
    line-height: .88;
    font-size: clamp(2.4rem, 9vw, 5.5rem);
    color: var(--lime);
    margin: 0 0 20px
}

.foot p {
    max-width: 560px
}

.foot-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 44px;
    padding-top: 28px;
    border-top: 1px solid rgba(255, 255, 255, .18)
}

.foot-row strong {
    color: #fff;
    font-size: 1.1rem
}

.foot-row span {
    color: #a9bb9d;
    font-size: .88rem
}

.totop {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--forest);
    color: #fff;
    border: 0;
    font-size: 1.2rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s;
    z-index: 1040
}

.totop.show {
    opacity: 1;
    pointer-events: auto
}

.totop:hover {
    background: var(--spruce)
}

.result-info {
    padding: 28px 12px 0;
    font-weight: 500;
    color: var(--forest)
}

body.searching .hero,
body.searching .toc {
    display: none
}

body.searching .sec {
    padding: 36px 0
}

@media (max-width:575.98px) {
    .note {
        flex-direction: column;
        gap: 6px
    }

    .cs-card {
        padding: 18px
    }

    .sqlserver-table td:first-child {
        white-space: normal
    }
}

@media print {

    .topbar,
    .totop,
    .search,
    .hero-code,
    .code-bar button,
    .toc {
        display: none !important
    }

    .sec {
        padding: 20px 0
    }

    .sec-linen,
    .sec-dark {
        background: #fff !important;
        color: #000
    }

    .cs-card {
        break-inside: avoid;
        box-shadow: 0 0 0 1px #bbb;
        background: #fff !important;
        color: #000 !important
    }

    .code,
    .sec-dark .code {
        background: #f4f4f4 !important
    }

    .code pre,
    .code span {
        color: #000 !important
    }

    .sec-dark .sec-head h2,
    .sec-dark .cs-card h3,
    .sec-dark .cs-card p {
        color: #000 !important
    }
}
