/* =============================================================================
   shell.css - what every portal page shares (portal, Emulators, Monitor, Guide,
   Cheatsheet): colors, fonts, the top bar and phone menu, the docs contents list.
   Served at /shell.css. Cards, buttons and tables for the portal itself: /ui.css.
   ============================================================================= */
:root {
    --accent: rgb(218, 221, 153); --accent-hi: rgb(232, 234, 186);
    --accent-dim: rgba(218, 221, 153, 0.38); --accent-faint: rgba(218, 221, 153, 0.07);
    --bg: #050504; --panel: #0c0d08; --panel-hi: #14160e; --panel-border: #272819; --line-soft: #191a11;
    --text-body: #d0d3b0; --text-dim: #9a9d80; --text-faint: #72755c;
    --good: #8fd17a; --warn: #e0a555; --danger: #e8656e;
    --good-faint: rgba(143, 209, 122, .1); --warn-faint: rgba(224, 165, 85, .1); --danger-faint: rgba(232, 101, 110, .1);
    --mono: "Cascadia Mono", Consolas, "DejaVu Sans Mono", monospace;
    --sans: "Segoe UI Variable Text", "Segoe UI", system-ui, Roboto, sans-serif;
    --shell-h: 58px;
    /* older names some pages use */
    --border: var(--panel-border); --dim: var(--text-dim); --faint: var(--text-faint); --body: var(--text-body); --bad: var(--danger);
    color-scheme: dark;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-padding-top: calc(var(--shell-h) + 16px); }
body {
    background: var(--bg);
    background-image: repeating-linear-gradient(0deg, transparent 0 2px, rgba(218, 221, 153, .010) 2px 4px);
    color: var(--text-body); font: 14px/1.5 var(--sans); min-height: 100vh;
    -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
a { color: inherit; }
button, input, select, textarea { font-family: inherit; }
:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent); color: var(--bg); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #22231a; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #34362a; }
.ico { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }

/* ---------- top bar ---------- */
.shell { position: sticky; top: 0; z-index: 40; background: rgba(5, 5, 4, .92); backdrop-filter: blur(8px);
         border-bottom: 1px solid var(--panel-border); }
.shell::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
                background: linear-gradient(90deg, var(--accent) 0, var(--accent) 120px, var(--accent-dim) 120px, transparent 60%); }
.sh-in { display: flex; align-items: center; gap: 14px; height: var(--shell-h); padding: 0 28px; max-width: 1760px; margin: 0 auto; }
/* the Back button's place: always there, so the tabs never move */
.sh-slot { flex: none; width: 168px; display: flex; align-items: center; padding-right: 14px; border-right: 1px solid var(--line-soft); height: 30px; }
.sh-slot .sh-back { max-width: 100%; } .sh-slot .sh-back span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sh-brand { color: var(--accent); text-decoration: none; font-weight: 700; letter-spacing: 3px; font-size: 14px; white-space: nowrap; }
.sh-back { display: flex; text-decoration: none; align-items: center; gap: 6px; background: none; border: 1px solid var(--panel-border); color: var(--text-dim); cursor: pointer;
           padding: 7px 12px 7px 8px; font-size: 11px; font-weight: 600; letter-spacing: 2px; text-transform: uppercase; white-space: nowrap; }
.sh-back:hover { color: var(--accent); border-color: var(--accent-dim); background: var(--accent-faint); }
.sh-live { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.sh-live.warn { background: var(--warn); box-shadow: 0 0 8px rgba(224, 165, 85, .6); }
.sh-live.bad { background: var(--danger); box-shadow: 0 0 8px rgba(232, 101, 110, .6); }
.sh-nav { display: flex; gap: 2px; flex: 1; min-width: 0; justify-content: flex-start; }
.sh-nav a {
    display: flex; align-items: center; gap: 7px; padding: 8px 12px; border: 1px solid transparent; background: none; cursor: pointer;
    color: var(--text-dim); text-decoration: none; font-size: 11px; font-weight: 600; letter-spacing: 2px; text-transform: uppercase; white-space: nowrap;
}
.sh-nav a:hover { color: var(--accent); background: var(--accent-faint); }
.sh-nav a.on { color: var(--accent); border-color: var(--accent-dim); background: var(--accent-faint); }
.sh-nav a .ico { opacity: .85; }
.sh-nav.sh-right { flex: none; }
.sh-ext .ico { width: 10px; height: 10px; opacity: .6; margin-left: -3px; }
/* more tabs than before: drop their icons, then switch to the menu button, before they'd squeeze */
@media (max-width: 1320px) { .sh-nav a > .ico:first-child { display: none; } .sh-nav a { padding: 8px 10px; letter-spacing: 1.5px; } }
.sh-badge { background: var(--accent); color: var(--bg); font-size: 10px; font-weight: 700; padding: 0 6px; border-radius: 9px; letter-spacing: 0; line-height: 16px; }
.sh-who { display: flex; align-items: center; gap: 10px; padding-left: 16px; border-left: 1px solid var(--panel-border); font-size: 12px; color: var(--text-dim); white-space: nowrap; }
.sh-who b { color: var(--accent); font-weight: 600; }
.sh-burger { display: none; margin-left: auto; background: none; border: 1px solid var(--panel-border); color: var(--accent); width: 40px; height: 36px; cursor: pointer; }
.sh-burger .ico { width: 20px; height: 20px; }

.sh-btn { display: grid; place-items: center; background: transparent; color: var(--text-dim); border: 1px solid var(--panel-border); padding: 6px 9px; cursor: pointer;
          font-size: 9.5px; letter-spacing: 2px; text-transform: uppercase; font-weight: 700; }
.sh-btn:hover { color: var(--accent); border-color: var(--accent-dim); background: var(--accent-faint); }
.sh-dwho .sh-btn { display: inline-flex; gap: 7px; align-items: center; }
.sh-pill { font-size: 9px; letter-spacing: 1.5px; font-weight: 700; padding: 2px 7px; border: 1px solid var(--accent-dim); color: var(--accent); text-transform: uppercase; }

/* phone and small screens: one menu button, everything in the drawer */
.sh-drawer { display: none; }
@media (max-width: 1000px) {
    .sh-in { padding: 0 14px; gap: 12px; }
    .sh-slot { width: auto; border-right: 0; padding-right: 0; flex: 1; }
    .shell .sh-nav, .shell .sh-who { display: none; }
    .sh-burger { display: grid; place-items: center; }
    .sh-back span { max-width: 42vw; overflow: hidden; text-overflow: ellipsis; }
    .sh-drawer { display: block; position: fixed; inset: var(--shell-h) 0 0 0; background: var(--bg); z-index: 39; overflow-y: auto;
              transform: translateY(-8px); opacity: 0; pointer-events: none; transition: .16s; padding: 8px 0 40px; }
    .sh-drawer.open { transform: none; opacity: 1; pointer-events: auto; }
    .sh-drawer .mh { font-size: 9px; letter-spacing: 2.5px; color: var(--text-faint); font-weight: 700; padding: 18px 20px 6px; text-transform: uppercase; }
    .sh-drawer a { display: flex; align-items: center; gap: 12px; padding: 13px 20px; color: var(--text-body); text-decoration: none; font-size: 15px; border-bottom: 1px solid var(--line-soft); }
    .sh-drawer a.on { color: var(--accent); background: var(--accent-faint); box-shadow: inset 3px 0 0 var(--accent); }
    .sh-drawer a .ico { width: 18px; height: 18px; color: var(--text-dim); }
    .sh-drawer a.on .ico { color: var(--accent); }
    .sh-drawer .sh-dwho { padding: 18px 20px; display: flex; justify-content: space-between; align-items: center; color: var(--text-dim); font-size: 13px; }
    body.sh-open { overflow: hidden; }
}

/* ---------- docs pages: contents on the left ---------- */
.docwrap { display: grid; grid-template-columns: 230px 1fr; gap: 30px; max-width: 1280px; margin: 0 auto; padding: 26px 24px 80px; align-items: start; }
.toc { position: sticky; top: calc(var(--shell-h) + 18px); max-height: calc(100vh - var(--shell-h) - 36px); overflow-y: auto; border: 1px solid var(--panel-border); background: var(--panel); padding: 8px 0; }
.toc .mh, .toc > div:first-child { font-size: 9px; letter-spacing: 2.5px; color: var(--text-faint); font-weight: 700; padding: 8px 16px; text-transform: uppercase; }
.toc a { display: block; padding: 6px 16px; color: var(--text-dim); text-decoration: none; font-size: 13px; border-left: 2px solid transparent; }
.toc a:hover { color: var(--accent); background: var(--accent-faint); }
.toc a.on { color: var(--accent); border-left-color: var(--accent); background: var(--accent-faint); }
@media (max-width: 900px) {
    .docwrap { grid-template-columns: 1fr; padding: 16px 14px 60px; gap: 14px; }
    .toc { position: static; max-height: none; display: flex; overflow-x: auto; padding: 0; white-space: nowrap; }
    .toc .mh, .toc > div:first-child { display: none; }
    .toc a { border-left: 0; border-bottom: 2px solid transparent; padding: 11px 14px; }
    .toc a.on { border-bottom-color: var(--accent); }
}

/* ---------- the portal's own dialogs and action notes (shell.js UI) ---------- */
.ui-dlg { margin: auto; width: min(460px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 1px solid var(--panel-border);
          background: var(--panel); color: var(--text-body); box-shadow: 0 24px 60px rgba(0, 0, 0, .7); }
.ui-dlg.wide { width: min(640px, calc(100vw - 32px)); }
.ui-dlg::backdrop { background: rgba(0, 0, 0, .62); backdrop-filter: blur(3px); }
.ui-dlg form { display: flex; flex-direction: column; gap: 14px; padding: 22px 24px 20px; }
.ui-dt { font-size: 17px; font-weight: 700; line-height: 1.35; color: var(--text-body); overflow-wrap: anywhere; }
.ui-db { font-size: 14px; line-height: 1.6; color: var(--text-dim); overflow-wrap: anywhere; }
.ui-f { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-dim); }
.ui-f input, .ui-f select { width: 100%; padding: 10px 12px; font-size: 14.5px; background: var(--bg); border: 1px solid var(--panel-border); color: var(--text-body); font-family: inherit; }
.ui-f input:focus, .ui-f select:focus { outline: none; border-color: var(--accent); }
.ui-err { font-size: 13px; color: var(--danger); }
.ui-da { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.ui-btn { padding: 9px 16px; font: 600 14px var(--sans); cursor: pointer; border: 1px solid var(--panel-border); background: transparent; color: var(--text-body); }
.ui-btn:hover { border-color: var(--accent-dim); color: var(--accent); }
.ui-btn.primary { background: var(--accent); border-color: var(--accent); color: #080808; font-weight: 700; }
.ui-btn.primary:hover { filter: brightness(1.08); color: #080808; }
.ui-btn.primary.danger { background: var(--danger); border-color: var(--danger); color: #fff4f4; }
.ui-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ui-notes { position: fixed; z-index: 200; left: 50%; bottom: 22px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center;
            width: max-content; max-width: calc(100vw - 32px); pointer-events: none; }
.ui-note { pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 11px 12px 11px 16px; font-size: 14px; color: var(--text-body);
           background: var(--panel); border: 1px solid var(--panel-border); border-left: 3px solid var(--accent); box-shadow: 0 14px 34px rgba(0, 0, 0, .65);
           animation: ui-in .2s ease-out; transition: opacity .2s, transform .2s; }
.ui-note.error { border-left-color: var(--danger); }
.ui-note.out { opacity: 0; transform: translateY(6px); }
.ui-note button { background: none; border: 0; color: var(--accent); font: 700 13.5px var(--sans); cursor: pointer; padding: 2px 4px; }
.ui-note button.x { color: var(--text-faint); font-weight: 400; }
@keyframes ui-in { from { opacity: 0; transform: translateY(8px); } }
@media (max-width: 600px) { .ui-notes { bottom: 14px; } .ui-note { font-size: 13.5px; } }

/* ---------- action menus (UI.menu) ---------- */
.ui-menu { position: fixed; z-index: 210; min-width: 190px; padding: 5px 0; background: var(--panel); border: 1px solid var(--panel-border);
           box-shadow: 0 16px 40px rgba(0, 0, 0, .7); animation: ui-in .12s ease-out; }
.ui-mi { display: block; width: 100%; text-align: left; padding: 8px 16px; font: 14px var(--sans); color: var(--text-body); background: none; border: 0; cursor: pointer; text-decoration: none; }
.ui-mi:hover, .ui-mi:focus { background: var(--accent-faint); color: var(--accent); outline: none; }
.ui-mi.danger { color: var(--danger); } .ui-mi.danger:hover, .ui-mi.danger:focus { background: var(--danger-faint); color: var(--danger); }
.ui-msep { height: 1px; margin: 5px 0; background: var(--line-soft); }
/* visually hidden, still read out */
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- quick search (Ctrl+K) ---------- */
.sh-search { margin-left: 4px; }
.ui-dlg.qs { margin-top: 12vh; width: min(680px, calc(100vw - 24px)); }
.qs-in { display: flex; flex-direction: column; }
.qs-in input { width: 100%; border: 0; border-bottom: 1px solid var(--panel-border); background: transparent; color: var(--text-body); padding: 18px 20px; font: 17px var(--sans); outline: none; }
.qs-in input::-webkit-search-cancel-button { display: none; }
.qs-list { max-height: min(56vh, 460px); overflow-y: auto; padding: 6px 0; }
.qs-row { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 12px; align-items: baseline; padding: 9px 20px; color: var(--text-body); text-decoration: none; }
.qs-row.on { background: var(--accent-faint); }
.qs-row.on .qs-l { color: var(--accent); }
.qs-k { font-size: 12px; color: var(--text-faint); }
.qs-l { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qs-s { font-size: 12.5px; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.qs-none { padding: 18px 20px; color: var(--text-faint); font-size: 14px; }
.qs-foot { display: flex; gap: 18px; padding: 9px 20px; border-top: 1px solid var(--line-soft); font-size: 12px; color: var(--text-faint); }
.qs-foot kbd { font: 11px var(--mono); padding: 1px 5px; margin-right: 3px; border: 1px solid var(--panel-border); }
@media (max-width: 600px) { .ui-dlg.qs { margin-top: 8px; } .qs-row { grid-template-columns: minmax(0, 1fr) auto; } .qs-k { display: none; } .qs-s { max-width: 40vw; } .qs-foot { display: none; } }
