/* @ndb/ds components. The layout is a copy of the AWS console shell: top
   bar, breadcrumb bar, a left nav, the content, a footer, and a split panel
   under a list for the selected row. Needs tokens.css. Rules are grouped by
   part; the gallery (gallery/index.html) shows each one. */

/* part: reset */
body { margin: 0; }
img { max-width: 100%; }
[hidden]:not([hidden=until-found i]) { display: none !important; }

/* part: base */
button, input, select, textarea { font-stretch: 87.5%; }
* { box-sizing: border-box; }
html, body { height: 100%; }
body { background: var(--bg); color: var(--ink); font: 12px/1.45 var(--font); font-stretch: 87.5%; -webkit-font-smoothing: antialiased; overflow: hidden; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 60; background: var(--bg); }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius:2px; }
h1, h2, h3, h4 { margin: 0; text-wrap: balance; }
code, .mono { font-family: var(--mono); font-size: 0.9em; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.res { color: var(--ink); text-decoration: underline; text-decoration-color: var(--faint); text-underline-offset: 3px; cursor: pointer; background: none; border: 0; padding: 0; font: inherit; }
.res:hover { color: var(--link); text-decoration-color: var(--link); }
.info:not(.alert) { color: var(--link); font-size: 10.5px; font-weight: 700; margin-left: 6px; cursor: pointer; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* part: app shell */
.app { height: 100%; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; }
.pad { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

/* part: top bar */
.top { border-top: 3px solid var(--brand); border-bottom: 1px solid var(--line); background: var(--bg); }
.top-row { display: flex; align-items: center; gap: 12px; height: 44px; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 700; font-size: 14px; letter-spacing: -0.01em; }
.brand:hover { text-decoration: none; }
.brand .mark { width: 26px; height: 26px; }
.brand small { font-weight: 500; color: var(--muted); font-size: 12px; }
.vsep { width: 1px; height: 22px; background: var(--line-2); }
.ibtn { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius:2px; border: 0; background: none; color: var(--ink-2); cursor: pointer; position: relative; flex: none; }
.ibtn:hover { background: var(--soft); }
.ibtn svg { width: 17px; height: 17px; }
.badge { position: absolute; top: 1px; right: 0; min-width: 17px; height: 17px; border-radius:2px; background: #d91515; color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; border: 2px solid var(--bg); }
.search { position: relative; flex: 1; max-width: 640px; }
.search input { width: 100%; height: 30px; border: 1px solid var(--input); border-radius:2px; padding: 0 92px 0 34px; font: inherit; color: var(--ink); background: var(--bg); }
.search input::placeholder { color: var(--muted); font-style: italic; }
.search > svg { position: absolute; left: 10px; top: 7px; width: 16px; height: 16px; color: var(--ink-2); }
.search kbd { position: absolute; right: 10px; top: 7px; font: 10.5px var(--font); color: var(--muted); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.region { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; height: 30px; font-size: 11px; color: var(--ink); background: none; border: 0; cursor: pointer; padding: 0 8px; height: 34px; border-radius:2px; white-space: nowrap; }
.region:hover { background: var(--soft); }
.acct { display: grid; text-align: right; line-height: 1.25; padding: 2px 8px; border-radius:2px; cursor: pointer; background: none; border: 0; font: inherit; color: var(--ink); }
.acct b { font-size: 11px; background: var(--acct-bg); color: var(--acct-ink); padding: 1px 6px; border-radius:2px; justify-self: end; }
.acct small { font-size: 10.5px; color: var(--ink-2); }

/* part: favorites bar */
.favs { border-bottom: 1px solid var(--line); background: var(--bg); }
.favs-row { display: flex; align-items: center; gap: 14px; height: 30px; overflow-x: auto; scrollbar-width: none; }
.favs-row::-webkit-scrollbar { display: none; }
.fav { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.fav i { width: 18px; height: 18px; border-radius:2px; display: grid; place-items: center; color: #fff; font: 700 10px var(--font); font-style: normal; }
.fav:hover { text-decoration: none; color: var(--link); }

/* part: breadcrumb bar */
.crumbbar { display: flex; align-items: center; gap: 8px; height: 28px; font-size: 10.5px; border-bottom: 1px solid var(--line); background: var(--bg); }
.navbtn { width: 20px; height: 20px; border-radius:2px; border: 0; background: var(--accent); color: #fff; display: grid; place-items: center; cursor: pointer; flex: none; }
.navbtn svg { width: 12px; height: 12px; }
.crumbbar .ibtn { width: 22px; height: 22px; }
.crumbbar .ibtn svg { width: 13px; height: 13px; }
.crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; overflow: hidden; white-space: nowrap; }
.crumbs a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--faint); text-underline-offset: 3px; }
.crumbs .sep { color: var(--faint); }
.crumbs a.home { display: inline-grid; place-items: center; color: var(--ink-2); text-decoration: none; }
.crumbbar .end { margin-left: auto; display: flex; gap: 4px; }

/* part: body and side nav */
.body { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 0; }
.body.nav-off { grid-template-columns: 0 minmax(0, 1fr); }
.side { border-right: 1px solid var(--line); overflow: auto; background: var(--bg); padding: 22px 0 40px; }
.body.nav-off .side { visibility: hidden; }
.side-head { display: flex; justify-content: space-between; align-items: center; padding: 0 16px 0 24px; margin-bottom: 12px; }
.ws { min-width: 0; flex: 1; }
.ws-btn { list-style: none; display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 6px; align-items: center; cursor: pointer; padding: 4px 6px; margin-left: -6px; border-radius: 2px; }
.ws-btn::-webkit-details-marker { display: none; }
.ws-btn:hover { background: var(--soft); }
.ws-name { font-size: 15px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-btn small { grid-row: 2; color: var(--muted); font-size: 11px; }
.ws-btn svg { grid-row: 1 / span 2; grid-column: 2; width: 14px; height: 14px; color: var(--muted); }
.side-head h2 { font-size: 17px; font-weight: 600; }
.side a.item, .side .group > summary { display: block; padding: 4px 24px; color: var(--ink); font-size: 13px; }
.side a.item:hover { color: var(--link); text-decoration: none; }
.side a.item.on { color: var(--link); font-weight: 700; }
.side .group { margin-top: 8px; }
.side .group > summary { list-style: none; font-weight: 600; font-size: 14px; padding-left: 14px; cursor: pointer; display: flex; align-items: center; gap: 6px; }
.side .group > summary::-webkit-details-marker { display: none; }
.side .group > summary svg { width: 14px; height: 14px; transition: transform .15s; }
.side .group:not([open]) > summary svg { transform: rotate(-90deg); }
.side .group a.item { padding-left: 26px; }
.side .new { font-size: 10.5px; color: var(--link); font-weight: 600; margin-left: 6px; text-decoration: underline dashed; text-underline-offset: 3px; }
.side hr { border: 0; border-top: 1px solid var(--line); margin: 16px 24px 8px; }
.content { overflow: auto; min-width: 0; background: var(--page); }
.inner { padding-block: 16px 40px; display: grid; gap: 16px; align-content: start; }

/* part: footer */
.foot { display: flex; align-items: center; gap: 18px; height: 30px; border-top: 1px solid var(--line); font-size: 11px; background: var(--bg); overflow: hidden; white-space: nowrap; }
.foot a { color: var(--ink); }
.foot .r { margin-left: auto; display: flex; gap: 18px; color: var(--ink-2); }
.foot svg { width: 15px; height: 15px; vertical-align: -3px; margin-right: 5px; }

/* part: buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 28px; padding: 0 12px; border-radius: 2px; border: 1.5px solid var(--muted); background: var(--bg); color: var(--ink); font: 600 12px var(--font); cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--soft); text-decoration: none; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--primary-bg); border-color: var(--primary-bg); color: var(--primary-ink); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn[disabled], .btn.off { border-color: var(--line-2); color: var(--faint); cursor: not-allowed; background: var(--bg); }
.btn-danger { color: var(--bad); border-color: var(--bad); }
.btn-danger.solid { background: var(--bad); color: #fff; }
.btn-sm { height: 24px; padding: 0 10px; font-size: 11px; }
.btn-icon { width: 28px; padding: 0; }
.split-btn { display: inline-flex; }
.split-btn .btn:first-child { border-radius: 2px 0 0 2px; border-right-width: 0; }
.split-btn .btn:last-child { border-radius: 0 2px 2px 0; border-left: 1.5px solid var(--primary-split); width: 28px; padding: 0; }
.split-btn .btn:not(.btn-primary):last-child { border-left-color: var(--muted); }
.linkbtn { background: none; border: 0; padding: 0; color: var(--link); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.ext::after { content: ""; display: inline-block; width: 12px; height: 12px; margin-left: 4px; vertical-align: -1px; background: currentColor; -webkit-mask: var(--ext-mask) no-repeat center / contain; mask: var(--ext-mask) no-repeat center / contain; }
:root { --ext-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4'%3E%3Cpath d='M14 4h6v6M20 4l-9 9M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5'/%3E%3C/svg%3E"); }

/* part: menus */
details.menu { position: relative; }
details.menu > summary { list-style: none; }
details.menu > summary::-webkit-details-marker { display: none; }
.pop { position: absolute; right: 0; top: calc(100% + 4px); min-width: 220px; background: var(--panel); border: 1px solid var(--line-2); border-radius:2px; box-shadow: 0 8px 24px rgba(0, 7, 22, 0.14); padding: 6px 0; z-index: 70; }
.pop .mi { display: flex; justify-content: space-between; gap: 12px; width: 100%; padding: 7px 16px; background: none; border: 0; font: inherit; color: var(--ink); text-align: left; cursor: pointer; white-space: nowrap; }
.pop .mi:hover { background: var(--soft); text-decoration: none; }
.pop .mi small { color: var(--muted); }
.pop .mi.danger { color: var(--bad); }
.pop .mi[aria-disabled="true"] { color: var(--faint); cursor: default; }
.pop .mh { padding: 8px 16px; font-size: 10.5px; font-weight: 700; color: var(--muted); }
.pop hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }

/* part: mega menu */
/* part: no text selection on the chrome (menus, bars, buttons); code stays selectable */
.top, .crumbbar, .side, .mega, .pop, .btn, .tab, .seg, summary { -webkit-user-select: none; user-select: none; }
.mega pre, .pop pre, .side pre { -webkit-user-select: text; user-select: text; }

.mega { position: fixed; left: max(16px, env(safe-area-inset-left, 0px)); top: calc(env(safe-area-inset-top, 0px) + 50px); width: min(900px, calc(100vw - 32px)); max-height: calc(100vh - 80px); overflow: auto; display: grid; grid-template-columns: minmax(0, 1fr) 300px; background: var(--panel); border: 1px solid var(--line-2); border-radius: 2px; box-shadow: 0 16px 40px rgba(0, 7, 22, 0.22); z-index: 85; }
.mega-links { padding: 18px 22px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px 22px; align-content: start; }
.mega h6 { margin: 0 0 6px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); }
.mega .ml { display: block; padding: 4px 0; color: var(--ink); font-size: 13px; }
.mega .ml:hover { color: var(--link); text-decoration: none; }
.mega .ml.on { color: var(--link); font-weight: 700; }
.mega .ml .new { font-size: 10.5px; color: var(--link); font-weight: 600; margin-left: 4px; }
.mega-svc { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: 12px; display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: baseline; }
.mega-svc h6 { margin: 0 8px 0 0; }
.mega-svc a { color: var(--ink-2); font-size: 12px; }
.mega-tip { border-left: 1px solid var(--line); background: var(--soft); padding: 18px 20px; display: grid; gap: 10px; align-content: start; min-width: 0; }
.mega-tip h3 { font-size: 15px; font-weight: 700; }
.mega-tip p { margin: 0; color: var(--ink-2); font-size: 12.5px; line-height: 1.5; }
.mega-tip pre { margin: 0; padding: 8px 10px; background: var(--code-bg); border: 1px solid var(--line); font: 11.5px/1.55 var(--mono); color: var(--ink-2); overflow-x: auto; white-space: pre; }
.mega-tip .row-end { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
@media (max-width: 860px) {
  .mega { grid-template-columns: minmax(0, 1fr); }
  .mega-links { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mega-tip { border-left: 0; border-top: 1px solid var(--line); }
}

/* part: search results */
.palette { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: var(--panel); border: 1px solid var(--line-2); border-radius:2px; box-shadow: 0 12px 32px rgba(0, 7, 22, 0.18); padding: 6px; z-index: 80; max-height: 420px; overflow: auto; }
.palette h6 { margin: 8px 10px 4px; font-size: 10.5px; color: var(--muted); }
.palette .hit { display: flex; gap: 10px; padding: 7px 10px; border-radius:2px; cursor: pointer; }
.palette .hit small { margin-left: auto; color: var(--muted); }
.palette .hit.on, .palette .hit:hover { background: var(--accent-wash); }

/* part: page header */
.phead { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; justify-content: space-between; }
.phead h1 { font-size: 20.5px; font-weight: 600; letter-spacing: -0.01em; display: flex; align-items: baseline; gap: 4px; flex-wrap: wrap; }
.phead h1 .count { color: var(--muted); font-weight: 400; }
.phead p { margin: 4px 0 0; color: var(--ink-2); }
.tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; }
.updated { text-align: right; font-size: 11px; color: var(--ink-2); line-height: 1.3; }

/* part: containers */
.box { background: var(--panel); border: 1px solid var(--line); border-radius:2px; box-shadow: var(--shadow); min-width: 0; }
.box-head { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: flex-start; padding: 14px 18px 8px; }
.box-head h2 { font-size: 17px; font-weight: 600; }
.box-head p { margin: 4px 0 0; color: var(--ink-2); }
.box-body { padding: 6px 18px 16px; display: grid; gap: 14px; min-width: 0; }
.box-foot { border-top: 1px solid var(--line); padding: 10px 18px; }
.box-part { border-top: 1px solid var(--line); }
.cols { display: grid; gap: 16px; }
.cols.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dash { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 16px; align-items: start; }

/* part: resource tiles */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tile { display: flex; justify-content: space-between; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius:2px; padding: 7px 10px; }
.tile b { font-weight: 500; font-variant-numeric: tabular-nums; }

/* part: status */
.st { display: inline-flex; align-items: center; gap: 5px; font-weight: 500; white-space: nowrap; }
.st svg { width: 15px; height: 15px; flex: none; }
.st.ok { color: var(--ok); }
.st.bad { color: var(--bad); }
.st.warn { color: var(--warn); }
.st.idle { color: var(--muted); }
.st.busy { color: var(--link); }
.st.busy svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* part: key values */
.kv { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kv > div { display: grid; gap: 14px; align-content: start; padding: 4px 18px; min-width: 0; }
.kv > div + div { border-left: 1px solid var(--line); }
.kv dl { margin: 0; display: grid; gap: 3px; }
.kv dt { color: var(--muted); font-weight: 500; font-size: 12px; }
.kv dd { margin: 0; overflow-wrap: anywhere; display: flex; gap: 6px; align-items: flex-start; flex-wrap: wrap; color: var(--ink); font-weight: 600; font-size: 13px; }
.kv dd .muted { font-weight: 500; }
.kv dd .mono { font-family: var(--font); font-size: inherit; }
.kv dl { gap: 4px; }
.cp { display: inline-grid; place-items: center; width: 20px; height: 20px; background: none; border: 0; padding: 0; color: var(--ink-2); cursor: pointer; flex: none; }
.cp svg { width: 16px; height: 16px; }
.cp:hover { color: var(--link); }

/* part: tables */
.twrap { overflow-x: auto; }
table { font: inherit; font-size: 13px; width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th { text-align: left; font-weight: 700; color: var(--ink-2); padding: 6px 10px; white-space: nowrap; border-bottom: 1px solid var(--line-2); position: relative; }
th + th::before { content: ""; position: absolute; left: 0; top: 9px; bottom: 9px; width: 1px; background: var(--line-2); }
th .sorter { all: unset; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
th .sorter svg { width: 11px; height: 11px; color: var(--muted); }
th .sorter.on svg { color: var(--ink); }
td { font-weight: 500; padding: 5px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
tbody tr { cursor: default; }
tbody tr:hover td { background: var(--soft); }
tbody tr.sel td { background: var(--sel-wash); border-top: 1px solid var(--sel-line); border-bottom: 1px solid var(--sel-line); }
table.aws { border-collapse: separate; border-spacing: 0; }
table.aws td { border-top: 1px solid transparent; border-bottom: 1px solid transparent; }
table.aws tbody tr.sel td:first-child { border-radius: 2px 0 0 2px; }
table.aws tbody tr.sel td:last-child { border-radius: 0 2px 2px 0; }
table.aws thead th { border-bottom: 1px solid var(--line-2); }
table.aws tbody tr.sel td { background: var(--sel-wash); border-top-color: var(--sel-line); border-bottom-color: var(--sel-line); }
table.aws tbody tr.sel td:first-child { border-left: 1px solid var(--sel-line); }
table.aws tbody tr.sel td:last-child { border-right: 1px solid var(--sel-line); }
table.aws tbody tr:not(.sel):hover td { background: var(--soft); }
table.aws td:first-child, table.aws th:first-child { border-left: 1px solid transparent; }
table.aws td:last-child { border-right: 1px solid transparent; }
td.r, th.r { text-align: right; }
td.trunc { max-width: 230px; overflow: hidden; text-overflow: ellipsis; }
.chk { width: 16px; height: 16px; accent-color: var(--sel-line); cursor: pointer; margin: 0; vertical-align: -3px; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.filters .fs { display: grid; gap: 2px; }
.filters .seg a, .filters .seg button { display: inline-flex; align-items: center; height: 25px; }
.filters .fs label { font-size: 11px; font-weight: 700; }
.filters .grow { flex: 1; min-width: 220px; position: relative; }
.filters .grow svg { position: absolute; left: 10px; top: 6px; width: 16px; height: 16px; color: var(--ink-2); }
.filters .grow input { padding-left: 34px; }
.pager { display: flex; align-items: center; gap: 10px; margin-left: auto; color: var(--ink-2); }
.pager b { font-weight: 700; color: var(--ink); }

/* part: forms */
.input, select.input { height: 28px; border: 1px solid var(--input); border-radius:2px; padding: 0 10px; font: inherit; color: var(--ink); background: var(--bg); width: 100%; }
.input::placeholder { color: var(--muted); font-style: italic; }
select.input { padding-right: 28px; }
.input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.field { display: grid; gap: 4px; }
.field label, .lbl { font-weight: 700; font-size: 12px; }
.hint { color: var(--muted); font-size: 11px; }
.rcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.rcard { position: relative; display: grid; gap: 4px; padding: 12px 14px; border: 1px solid var(--line-2); border-radius:2px; cursor: pointer; }
.rcard input { position: absolute; opacity: 0; }
.rcard:has(input:checked) { border: 2px solid var(--accent); padding: 11px 13px; background: var(--accent-wash); }
.rcard:has(input:disabled) { opacity: 0.5; cursor: not-allowed; }
.rcard:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.rcard .p { color: var(--ink-2); font-size: 11px; }
.rcard .s { font: 11px var(--mono); color: var(--muted); }
.row { display: flex; gap: 12px; justify-content: space-between; align-items: center; flex-wrap: wrap; padding: 12px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row small { display: block; color: var(--muted); }
.toggle { appearance: none; width: 34px; height: 20px; border-radius: 10px; background: var(--input); position: relative; cursor: pointer; flex: none; }
.toggle::after { content: ""; position: absolute; width: 14px; height: 14px; top: 3px; left: 3px; border-radius: 50%; background: #fff; transition: left .15s; }
.toggle:checked { background: var(--accent); }
.toggle:checked::after { left: 17px; }

/* part: tabs */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--line-2); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 8px 14px 7px; font-weight: 700; color: var(--ink-2); border: 0; background: none; border-bottom: 4px solid transparent; cursor: pointer; white-space: nowrap; font: 700 12px var(--font); position: relative; }
.tab + .tab::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 1px; background: var(--line-2); }
.tab:hover { color: var(--link); }
.tab.on { color: var(--link); border-bottom-color: var(--link); }
.seg { display: inline-flex; max-width: 100%; border: 1.5px solid var(--muted); border-radius:2px; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg a, .seg button { flex: none; white-space: nowrap; }
.seg button { border: 0; background: var(--bg); padding: 3px 12px; font: 700 11px var(--font); color: var(--ink-2); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line-2); }
.seg button.on { background: var(--primary-bg); color: var(--primary-ink); }
.sub { display: flex; align-items: center; gap: 6px; font-size: 15.5px; font-weight: 600; }
.sub button { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.sub svg { width: 14px; height: 14px; }

/* part: split panel */
.splitview { height: 100%; display: grid; grid-template-rows: minmax(120px, 1fr) auto; overflow: hidden; }
.splitview .upper { overflow: auto; min-height: 0; }
.drawer { border-top: 1px solid var(--line-2); background: var(--panel); display: grid; grid-template-rows: auto minmax(0, 1fr); box-shadow: 0 -2px 6px rgba(0, 7, 22, 0.05); }
.grip { height: 14px; display: grid; place-items: center; cursor: row-resize; touch-action: none; }
.grip::before { content: ""; width: 22px; height: 2px; border-radius:2px; background: var(--ink-2); }
.drawer-scroll { overflow: auto; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-block: 2px 8px; }
.drawer-head h2 { font-size: 17px; font-weight: 600; overflow-wrap: anywhere; }
.drawer.min .drawer-scroll .drawer-body { display: none; }

/* part: code and url */
.urlbox { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line-2); border-radius:2px; background: var(--code-bg); padding: 6px 6px 6px 12px; min-width: 0; }
.urlbox code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; font-size: 11px; }
.code { border: 1px solid var(--line); border-radius:2px; overflow: hidden; background: var(--code-bg); }
.code-head { display: flex; justify-content: space-between; align-items: center; padding: 5px 8px 5px 12px; border-bottom: 1px solid var(--line); font: 11px var(--mono); color: var(--muted); }
.code pre { margin: 0; padding: 12px; overflow-x: auto; font: 11px/1.6 var(--mono); color: var(--ink-2); }
.code .k { color: var(--code-k); }
.code .s { color: var(--code-s); }
.code .c { color: var(--faint); }

/* part: dev tools */
.dtpage { height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 0; padding-block: 12px 12px; }
.dt-tool { display: grid; grid-template-rows: auto minmax(0, 1fr); min-height: 0; }
.dt-head { position: relative; }
.dtpage .phead { padding-bottom: 8px; }
.dt-tabs { display: flex; align-items: flex-end; border-bottom: 1px solid var(--line-2); }
.dt-tabs .tab { font-size: 13px; }
.dt-links { display: flex; align-items: center; gap: 16px; padding: 8px 2px; flex-wrap: wrap; }
.dt-links .lnk { background: none; border: 0; padding: 0; font: inherit; font-size: 13px; color: var(--ink); cursor: pointer; }
.dt-links .lnk:hover { text-decoration: underline; color: var(--link); }
.dt-links .grow { flex: 1; }
.dt-links label { display: flex; gap: 6px; align-items: center; font-weight: 700; }
.dt-links select.input { width: auto; height: 26px; }
.dt-links .combo-btn { height: 26px; }
.dt-tabs button.tab { background: none; border: 0; border-bottom: 2px solid transparent; font: inherit; cursor: pointer; }
.dt-tabs button.tab.on { border-bottom-color: var(--accent); }
.dt { --left: 50%; display: grid; grid-template-columns: minmax(240px, var(--left)) 10px minmax(240px, 1fr); border: 1px solid var(--line-2); min-height: 0; background: var(--bg); }
.dt-pane { display: grid; grid-template-rows: minmax(0, 1fr); min-width: 0; min-height: 0; position: relative; }
.dt-scroll { overflow: auto; display: grid; grid-template-columns: 52px minmax(0, 1fr); align-items: start; min-height: 100%; background: var(--ed-area); }
.dt-gut { background: var(--ed-gut); color: var(--ed-gut-ink); text-align: right; padding: 8px 10px 8px 0; user-select: none; white-space: pre; font: 13px/20px var(--mono); min-height: 100%; align-self: stretch; }
.dt-code { position: relative; min-height: 100%; align-self: stretch; width: max-content; min-width: 100%; }
.dt-code pre, .dt-code textarea { margin: 0; padding: 8px 12px 40px; font: 13px/20px var(--mono); white-space: pre; tab-size: 2; letter-spacing: 0; }
.dt-code pre { pointer-events: none; color: var(--ink-2); min-height: 100%; }
.dt-code textarea { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; outline: 0; resize: none; background: transparent; color: transparent; caret-color: var(--ink); overflow: hidden; }
.dt-code textarea::selection { background: rgba(0, 108, 224, 0.22); color: transparent; }
.dt-active { position: absolute; left: 0; right: 0; background: rgba(0, 108, 224, 0.06); border-left: 2px solid var(--accent); pointer-events: none; }
.dt-act { position: absolute; right: auto; display: flex; gap: 6px; z-index: 2; }
.dt-act button { width: 22px; height: 22px; display: grid; place-items: center; border: 0; background: none; color: var(--tk-k); cursor: pointer; padding: 0; }
.dt-act button:hover { color: var(--accent); }
.dt-act svg { width: 16px; height: 16px; }
.dt-split { background: var(--soft); border-inline: 1px solid var(--line-2); cursor: col-resize; display: grid; place-items: center; touch-action: none; }
.dt-split::before { content: ""; width: 4px; height: 18px; border-inline: 1px solid var(--muted); }
.dt-out-wrap { background: var(--bg); }
.dt-out-wrap .dt-scroll { background: var(--bg); }
.dt-out-wrap .dt-gut { background: var(--soft); }
.dt-meta { position: absolute; right: 12px; top: 8px; font: 12px var(--mono); color: var(--ink-2); background: var(--panel); border: 1px solid var(--line); padding: 1px 8px; z-index: 2; }
.dt-meta b { color: var(--ok); }
.tk-m { color: var(--tk-m); }
.tk-p { color: var(--tk-k); }
.tk-k { color: var(--tk-k); }
.tk-s { color: var(--tk-s); }
.tk-n { color: var(--tk-n); }
.tk-b { color: var(--tk-b); }
.tk-c { color: #8c8c94; }
.hist { position: absolute; z-index: 5; top: 34px; left: 0; width: min(520px, 100%); background: var(--panel); border: 1px solid var(--line-2); box-shadow: 0 8px 24px rgba(0, 7, 22, .14); }
.hist button { display: flex; justify-content: space-between; gap: 12px; width: 100%; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 8px 12px; font: 12px var(--mono); text-align: left; cursor: pointer; color: var(--ink); }
.hist button:hover { background: var(--soft); }
.hist small { color: var(--muted); font-family: var(--font); }
.hist .hist-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 0; padding: 8px 12px; border-bottom: 1px solid var(--line); font-weight: 400; font-size: 12px; }
.hist .hist-row select.input { width: auto; height: 26px; }
.dt-prof { overflow: auto; padding: 36px 16px 16px; display: grid; gap: 12px; align-content: start; }
.dt-prof table { width: 100%; border-collapse: collapse; font-size: 12px; }
.dt-prof th, .dt-prof td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.dt-prof td.num { text-align: right; font-variant-numeric: tabular-nums; }
.dt-tool .dt-gut, .dt-tool .dt-code pre, .dt-tool .dt-code textarea { font-size: var(--dt-size, 13px); line-height: var(--dt-lh, 20px); }
.dt-out-wrap[data-mode="profiler"] [data-dt="out-scroll"] { display: none; }
@media (max-width: 860px) {
  .dtpage { height: auto; }
  .dt { grid-template-columns: minmax(0, 1fr); }
  .dt-split { display: none; }
  .dt-pane { min-height: 360px; }
}

/* part: combobox */
.combo { display: inline-flex; align-items: center; gap: 6px; position: relative; min-width: 0; }
.combo-label { font-weight: 700; }
.combo details { position: relative; min-width: 0; }
.combo summary { list-style: none; }
.combo summary::-webkit-details-marker { display: none; }
.combo-btn { display: flex; align-items: center; gap: 8px; min-width: 200px; max-width: 340px; cursor: pointer; }
.combo-btn svg { width: 12px; height: 12px; flex: none; color: var(--muted); }
.combo-val { flex: 1; min-width: 0; display: flex; gap: 6px; align-items: baseline; overflow: hidden; white-space: nowrap; }
.combo-val small, .combo-list small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.combo-pop { position: absolute; z-index: 80; top: calc(100% + 4px); left: 0; width: max(100%, 320px); max-width: calc(100vw - 24px); background: var(--panel); border: 1px solid var(--line-2); box-shadow: 0 8px 24px rgba(0, 7, 22, 0.14); padding: 8px; display: grid; gap: 6px; }
.combo-list { list-style: none; margin: 0; padding: 0; max-height: 280px; overflow: auto; }
.combo-list li > a, .combo-list li > button { display: flex; gap: 8px; align-items: baseline; width: 100%; padding: 6px 8px; background: none; border: 0; font: inherit; font-size: 13px; color: var(--ink); text-align: left; cursor: pointer; text-decoration: none; white-space: nowrap; }
.combo-list li[aria-selected="true"] > * { font-weight: 600; }
.combo-list li.on > *, .combo-list li > *:hover { background: var(--sel-wash); }
.combo-empty { color: var(--muted); font-size: 12px; margin: 0; padding: 4px 8px; }
.field > .combo { display: flex; }
.field > .combo details { flex: 1; }
.field > .combo .combo-btn { min-width: 0; max-width: none; }

/* part: charts */
.chart-card { display: grid; gap: 4px; min-width: 0; }
.chart-card header { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px; }
.chart-card h3 { font-size: 13px; font-weight: 700; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 11px; color: var(--ink-2); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius:2px; vertical-align: -2px; margin-right: 5px; }
svg.chart { width: 100%; height: auto; display: block; }
svg.chart .grid { stroke: var(--chart-grid); }
svg.chart .axis { fill: var(--ink-2); font: 10px var(--font); }
svg.chart .axis-t { fill: var(--ink); font: 700 11px var(--font); }

/* part: chart hover (src/chart.js) */
.chart-card { position: relative; }
svg.chart .xh { stroke: var(--muted); stroke-dasharray: 3 3; }
svg.chart .hov-dot { stroke: var(--panel); stroke-width: 2; }
.chart-tip { position: absolute; z-index: 3; display: grid; gap: 2px; padding: 6px 9px; background: var(--panel); color: var(--ink); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 12px; white-space: nowrap; pointer-events: none; }
.chart-tip b { font-weight: 700; }
.chart-tip i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }

/* part: alerts */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius:2px; border: 2px solid; }
.alert svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.alert.info { border-color: #4c7fd6; background: var(--info-wash); }
.alert.info svg { color: #4c7fd6; }
.alert.bad { border-color: var(--bad); background: var(--bad-wash); }
.alert.bad svg { color: var(--bad); }
.alert.warn { border-color: #fbd332; background: var(--warn-wash); }
.alert.warn svg { color: var(--warn); }
.tag { display: inline-block; padding: 0 8px; border-radius:2px; border: 1px solid var(--line-2); font-size: 11px; background: var(--soft); white-space: nowrap; }
.example { font-size: 10.5px; color: var(--warn); background: var(--warn-wash); border: 1px solid #fbd332; border-radius:2px; padding: 0 6px; font-weight: 600; white-space: nowrap; }

/* part: modal and toast */
.scrim { position: fixed; inset: 0; background: rgba(15, 20, 26, 0.55); display: grid; place-items: center; z-index: 90; padding: 16px; }
.dialog { width: min(560px, 100%); background: var(--panel); border-radius:2px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3); }
.dialog footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); }
dialog.dialog { padding: 0; border: 0; color: var(--ink); max-width: calc(100vw - 32px); max-height: calc(100dvh - 32px); }
dialog.dialog::backdrop { background: rgba(15, 20, 26, 0.55); }
dialog.dialog form { margin: 0; }
dialog.dialog .box-body { padding-bottom: 20px; }
.flash { position: fixed; left: 50%; transform: translateX(-50%); top: calc(env(safe-area-inset-top, 0px) + 12px); display: grid; gap: 8px; z-index: 95; width: min(640px, calc(100% - 32px)); }
.flash div { display: flex; gap: 10px; align-items: center; background: #037f0c; color: #fff; padding: 10px 14px; border-radius:2px; font-weight: 600; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2); animation: drop .2s ease-out; }
.flash svg { width: 18px; height: 18px; flex: none; }
@keyframes drop { from { transform: translateY(-8px); opacity: 0; } }

:root .i-sun { display: none; }
:root[data-theme="dark"] .i-sun { display: block; }
:root[data-theme="dark"] .i-moon { display: none; }

/* part: replication */
.links { display: grid; gap: 12px; }
.link { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.4fr) minmax(180px, 1fr); align-items: center; gap: 0; border: 1px solid var(--line); background: var(--panel); padding: 14px 18px; cursor: pointer; }
a.link { color: inherit; text-decoration: none; }
.link:hover { border-color: var(--line-2); }
.link.sel { border-color: var(--sel-line); background: var(--sel-wash); }
.node { display: grid; gap: 2px; min-width: 0; }
.node.copy { text-align: right; justify-items: end; }
.node .role { font-size: 10.5px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.node b { font-size: 14px; overflow-wrap: anywhere; }
.node small { color: var(--muted); }
.wire { display: grid; gap: 6px; justify-items: center; padding: 0 14px; }
.wire .line { position: relative; width: 100%; height: 2px; background: var(--line-2); overflow: hidden; }
.wire .line::after { content: ""; position: absolute; inset: 0 auto 0 -30%; width: 30%; background: linear-gradient(90deg, transparent, currentColor, transparent); animation: flow 1.4s linear infinite; }
.wire.streaming { color: var(--ok); }
.wire.streaming .line { background: color-mix(in srgb, var(--ok) 35%, transparent); }
.wire.resync, .wire.starting { color: var(--warn); }
.wire.resync .line, .wire.starting .line { background: color-mix(in srgb, var(--warn) 35%, transparent); }
.wire.resync .line::after, .wire.starting .line::after { animation-duration: 2.6s; }
.wire.down { color: var(--bad); }
.wire.down .line { background: repeating-linear-gradient(90deg, var(--bad) 0 6px, transparent 6px 12px); }
.wire.down .line::after, .wire.unknown .line::after { display: none; }
.wire .nums { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.wire .nums b { color: var(--ink); font-weight: 600; }
@keyframes flow { to { left: 100%; } }
@media (prefers-reduced-motion: reduce) { .wire .line::after { animation: none; display: none; } }
.progress { display: grid; gap: 6px; }
.bar { height: 6px; background: var(--line); width: 100%; }
.bar > i { display: block; height: 100%; background: var(--warn); }
@media (max-width: 860px) {
  .link { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .node.copy { text-align: left; justify-items: start; }
  .wire { padding: 0; }
  .combo { flex-wrap: wrap; }
  .combo-btn { min-width: 0; max-width: 100%; }
  .combo-pop { left: 0; right: auto; width: min(320px, calc(100vw - 24px)); }
}

/* part: responsive */
@media (max-width: 1100px) {
  .dash { grid-template-columns: minmax(0, 1fr); }
  .kv { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kv > div:nth-child(3) { border-left: 0; }
  .cols.c3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  body { overflow: auto; }
  .app { height: auto; min-height: 100%; }
  .body, .body.nav-off { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; z-index: 75; top: 0; bottom: 0; left: 0; width: min(300px, 86vw); box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2); padding-top: calc(env(safe-area-inset-top, 0px) + 22px); padding-left: env(safe-area-inset-left, 0px); }
  .body.nav-off .side { display: none; }
  .content { overflow: visible; }
  .splitview { height: auto; display: block; }
  .splitview .upper { overflow: visible; }
  .grip { display: none; }
  .drawer { height: auto !important; }
  .drawer-scroll { overflow: visible; }
  .search kbd, .region span, .acct small, .favs, .crumbbar .end, .foot .r { display: none; }
  .search input { padding-right: 10px; }
  .tiles, .cols.c2, .cols.c3 { grid-template-columns: minmax(0, 1fr); }
  .kv { grid-template-columns: minmax(0, 1fr); }
  .kv > div + div { border-left: 0; border-top: 1px solid var(--line); padding-top: 18px; }
  .dt { grid-template-columns: minmax(0, 1fr); }
  .dt-out { border-left: 0; border-top: 1px solid #23252d; min-height: 220px; }
  .btn .lbl { display: none; }
}
@media (max-width: 520px) {
  .top-row { gap: 6px; }
  .top .hide-sm { display: none; }
  .brand small { display: none; }
}

/* part: server rendered (links as tabs and segments, POST forms in menus) */
a.tab:hover, a.ml:hover, .seg a:hover, .pop a.mi:hover { text-decoration: none; }
.seg a { display: inline-block; padding: 3px 12px; font: 700 11px var(--font); color: var(--ink-2); background: var(--bg); }
.seg a + a { border-left: 1px solid var(--line-2); }
.seg a.on { background: var(--primary-bg); color: var(--primary-ink); }
.pop form { margin: 0; }
th a.sorter { all: unset; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
th a.sorter svg { width: 11px; height: 11px; color: var(--muted); }
th a.sorter.on svg { color: var(--ink); }
.side-head > span:first-child { flex: 1; }
.crumbs a.home svg { width: 13px; height: 13px; }
a.tile { color: inherit; text-decoration: none; }
.ellipsis { display: inline-block; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.ws-btn small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* part: bars */
.bars { display: grid; gap: 6px; }
.bar-row { display: grid; grid-template-columns: minmax(80px, 200px) minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 12px; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: 11px; }
.bar-track { height: 14px; background: var(--soft); border-radius: 2px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--chart-1); }
.bar-value { font-weight: 600; min-width: 48px; text-align: right; }
