/* Knowledge Base. Palette is the app's: teal #5C7E8F (hover #4a6b7a), greys #D4DDE2 / #f4f4f4,
   borders #A2A2A2. Mobile first: the tree folds behind a button until 820px. */

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #f4f4f4;
    color: #333;
    line-height: 1.5;
}

a { color: #3f6475; }
a:hover { color: #2c4a57; }

/* The header stays pinned while the page scrolls. Its height is fixed so the sticky sidebar and
   in-page anchors can clear it. */
:root { --kb-header-h: 56px; }
html { scroll-padding-top: calc(var(--kb-header-h) + 12px); }

/* ---- header ---- */
.kb-header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--kb-header-h);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    background: #5C7E8F;
    color: #fff;
    padding: 10px 16px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}
.kb-header h1 { margin: 0; font-size: 1.35rem; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kb-header h1 a, .kb-account a { color: inherit; text-decoration: none; }
.kb-account { position: relative; font-size: 0.95rem; white-space: nowrap; }
.kb-account > a, .kb-account-btn {
    display: inline-flex; align-items: center; gap: 6px;
    background: rgba(255, 255, 255, 0.12); border-radius: 20px; padding: 6px 14px;
    border: 0; color: #fff; font: inherit; cursor: pointer;
}
.kb-account > a:hover, .kb-account-btn:hover { background: rgba(255, 255, 255, 0.22); }

/* The same menu as the landing page's account menu. */
.kb-account-menu {
    display: none;
    position: absolute; top: calc(100% + 8px); right: 0; z-index: 500;
    min-width: 200px; overflow: hidden;
    background: #fff; color: #333; border-radius: 8px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
.kb-account-menu.open { display: block; }
.kb-menu-userid { padding: 12px 16px; border-bottom: 1px solid #eee; font-size: 0.85rem; color: #777; }
.kb-menu-userid strong { display: block; color: #333; font-size: 1rem; margin-top: 2px; }
.kb-account-menu a {
    display: flex; align-items: center; gap: 10px; padding: 12px 16px;
    color: #333; text-decoration: none; font-size: 0.95rem;
}
.kb-account-menu a:hover { background: #f4f4f4; color: #333; }
.kb-account-menu .kb-menu-logout { color: #b23b3b; border-top: 1px solid #eee; }

/* ---- layout ---- */
.kb-layout {
    display: flex;
    flex-direction: column;
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px;
    gap: 16px;
}

.kb-side {
    background: #fff;
    border: 1px solid #D4DDE2;
    border-radius: 8px;
}
.kb-menu-btn {
    width: 100%;
    display: flex; align-items: center; gap: 8px;
    border: 0; background: none; padding: 12px 14px;
    font: inherit; font-weight: bold; color: #3f6475; cursor: pointer;
}
.kb-side-body { display: none; padding: 0 12px 12px; }
.kb-side.kb-open .kb-side-body { display: block; }

.kb-main {
    flex: 1;
    min-width: 0;
    background: #fff;
    border: 1px solid #D4DDE2;
    border-radius: 8px;
    padding: 20px 20px 28px;
}

@media (min-width: 820px) {
    .kb-layout { flex-direction: row; align-items: flex-start; }
    .kb-side { width: 300px; flex: none; position: sticky; top: calc(var(--kb-header-h) + 16px); max-height: calc(100vh - var(--kb-header-h) - 32px); overflow: auto; }
    .kb-menu-btn { display: none; }
    .kb-side-body { display: block; padding-top: 12px; }
    .kb-main { padding: 24px 32px 36px; }
}

/* ---- search ---- */
.kb-search {
    display: flex; align-items: center; gap: 8px;
    border: 1px solid #A2A2A2; border-radius: 6px; padding: 6px 10px; margin-bottom: 10px;
    color: #777;
}
.kb-search input { border: 0; outline: 0; font: inherit; width: 100%; min-width: 0; background: transparent; }
.kb-search:focus-within { border-color: #5C7E8F; box-shadow: 0 0 0 2px rgba(92, 126, 143, 0.25); }

.kb-results { list-style: none; margin: 0; padding: 0; }
.kb-results li { border-bottom: 1px solid #eef1f3; }
.kb-results a { display: block; padding: 8px 6px; text-decoration: none; }
.kb-results a strong { display: block; color: #2c4a57; }
.kb-results a small { display: block; color: #777; font-size: 0.8rem; }
.kb-results .kb-noresult { padding: 8px 6px; color: #777; }

/* ---- tree ---- */
.kb-tree { list-style: none; margin: 0; padding: 0; }
.kb-tree .kb-tree { padding-left: 14px; border-left: 1px solid #eef1f3; margin-left: 9px; }
.kb-tree li { margin: 1px 0; }
.kb-tree summary { display: flex; align-items: center; cursor: pointer; list-style: none; }
.kb-tree summary::-webkit-details-marker { display: none; }
.kb-tree summary::before {
    content: "\25B8"; width: 16px; flex: none; color: #5C7E8F; font-size: 0.8rem;
    transition: transform 0.15s;
}
.kb-tree details[open] > summary::before { transform: rotate(90deg); }
.kb-tree .kb-leaf { padding-left: 16px; }

.kb-tree a, .kb-home-link {
    display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0;
    padding: 5px 6px; border-radius: 5px; text-decoration: none; color: #333; font-size: 0.92rem;
}
.kb-tree a i, .kb-home-link i { width: 16px; text-align: center; color: #5C7E8F; flex: none; }
.kb-tree a span, .kb-home-link span { overflow-wrap: anywhere; }
.kb-tree a:hover, .kb-home-link:hover { background: #eef3f5; }
.kb-tree a.kb-current, .kb-home-link.kb-current { background: #5C7E8F; color: #fff; }
.kb-tree a.kb-current i, .kb-home-link.kb-current i { color: #fff; }
.kb-home-link { margin-bottom: 4px; }

/* ---- article ---- */
.kb-crumbs { font-size: 0.85rem; color: #777; margin-bottom: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.kb-crumbs a { text-decoration: none; }
.kb-crumb-here { color: #333; }

.kb-title { margin: 0 0 14px; font-size: 1.6rem; color: #2c4a57; }
.kb-title i { color: #5C7E8F; margin-right: 4px; }
.kb-lead { font-size: 1.05rem; color: #555; margin-top: 0; }

.kb-body { overflow-wrap: anywhere; }
.kb-body h3 { color: #2c4a57; margin: 1.6em 0 0.5em; font-size: 1.15rem; border-bottom: 1px solid #eef1f3; padding-bottom: 4px; }
.kb-body h4 { margin: 1.2em 0 0.4em; }
.kb-body ul, .kb-body ol { padding-left: 1.4em; }
.kb-body li { margin: 0.25em 0; }
.kb-body code { background: #f1f4f6; border-radius: 3px; padding: 1px 5px; font-size: 0.9em; }
.kb-body table { border-collapse: collapse; margin: 0.8em 0; display: block; overflow-x: auto; }
.kb-body th, .kb-body td { border: 1px solid #D4DDE2; padding: 6px 10px; text-align: left; vertical-align: top; }
.kb-body th { background: #f1f4f6; }
/* A table's first column names the thing (?bib=, a setting, a status code): never break it. */
.kb-body td:first-child code { white-space: nowrap; }
.kb-body .kb-callout {
    border-left: 4px solid #5C7E8F; background: #f1f6f8; padding: 10px 14px; border-radius: 0 6px 6px 0; margin: 1em 0;
}
.kb-body .kb-callout.kb-warn { border-left-color: #c98a1a; background: #fcf6ea; }
.kb-stub { color: #777; font-style: italic; }

.kb-note {
    background: #f1f6f8; border: 1px solid #D4DDE2; border-radius: 6px; padding: 10px 14px; color: #3f6475;
}

.kb-children { margin-top: 28px; border-top: 1px solid #D4DDE2; padding-top: 8px; }
.kb-children h3 { font-size: 1.05rem; color: #2c4a57; }
.kb-children ul { list-style: none; padding: 0; margin: 0; }
.kb-children li { padding: 8px 0; border-bottom: 1px solid #eef1f3; }
.kb-children li a { font-weight: bold; text-decoration: none; }
.kb-children li a i { color: #5C7E8F; width: 18px; text-align: center; margin-right: 4px; }
.kb-children li span { display: block; color: #666; font-size: 0.9rem; margin-left: 26px; }

/* ---- home tiles ---- */
.kb-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 14px;
    margin-top: 18px;
}
.kb-tile {
    display: flex; flex-direction: column; gap: 6px;
    border: 1px solid #D4DDE2; border-radius: 8px; padding: 16px;
    text-decoration: none; color: #333; background: #fff;
    transition: box-shadow 0.15s, border-color 0.15s;
}
.kb-tile:hover { border-color: #5C7E8F; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08); color: #333; }
.kb-tile i { font-size: 1.6rem; color: #5C7E8F; }
.kb-tile strong { color: #2c4a57; font-size: 1.05rem; }
.kb-tile span { font-size: 0.88rem; color: #666; }
