/* grd_ui in the browser. Colours and metrics are ext/grd_ui/grd_theme.h; every widget follows its draw code in
   grd_ui.cpp. Bevels are inset box-shadows: the lo edge is listed first so it owns the top-right and bottom-left
   corner pixels, which is the order rn::bevel_raise() draws them in. */

@font-face { font-family: grd-body; src: url(/fonts/grd-body.ttf) format("truetype"); }
@font-face { font-family: grd-body-sm; src: url(/fonts/grd-body-sm.ttf) format("truetype"); }
/* weight 700 = gen_font.py embolden(): 1px wider, 1px counters kept open. The px faces have no bold, and
   font-synthesis: none keeps Chrome from smearing one in. */
@font-face { font-family: grd-body; font-weight: 700; src: url(/fonts/grd-body-b.ttf) format("truetype"); }
@font-face { font-family: grd-body-sm; font-weight: 700; src: url(/fonts/grd-body-sm-b.ttf) format("truetype"); }
@font-face { font-family: grd-px8; src: url(/fonts/grd-px8.ttf) format("truetype"); }
@font-face { font-family: grd-px9; src: url(/fonts/grd-px9.ttf) format("truetype"); }
@font-face { font-family: grd-px10; src: url(/fonts/grd-px10.ttf) format("truetype"); }
@font-face { font-family: grd-px11; src: url(/fonts/grd-px11.ttf) format("truetype"); }

:root {
  --outline: #08080b;
  --well: #101014;
  --sunk: #16161c;
  --panel: #1b1b22;
  --idle: #22222b;
  --chrome: #26262f;
  --raise: #33333f;
  --active: #3d3d4d;
  --edge-hi: #5c5c72;
  --edge-dim: #3a3a49;
  --accent: #9b8cf0;
  --accent-hi: #cfc6ff;
  --text-hi: #f0eefa;
  --text: #c9c6dc;
  --text-dim: #8a879c;
  --text-off: #5f5c73;
  --shadow: rgba(0, 0, 0, .549);
  --dim: rgba(0, 0, 0, .627);
  /* app/ui_util.h tone:: */
  --ok: #7fc48c;
  --warn: #d8b46a;
  --err: #e07a74;

  --body: 14px "grd-body", Consolas, monospace;
  --sm: 14px "grd-body-sm", Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--well);
  color: var(--text);
  font-family: grd-body, Consolas, monospace;
  font-size: 12px;
  line-height: 16px;
  overflow: hidden;
  -webkit-font-smoothing: none;
  font-smooth: never;
  text-rendering: optimizeSpeed;
  font-kerning: none;
  font-synthesis: none;
  font-variant-ligatures: none;
  image-rendering: pixelated;
  cursor: var(--cur-arrow);
}
/* a native app: nothing selects or drags except what is typed into a field */
* { -webkit-user-select: none; user-select: none; -webkit-user-drag: none; }
input, textarea { -webkit-user-select: text; user-select: text; }
::selection { background: var(--accent); color: var(--well); }
/* Chrome on Windows filters outline glyphs horizontally even when they sit on the pixel grid; thresholding the
   coverage (#px in index.html) restores the exact bitmap. Text must be on a transparent box for this to work. */
.tx, .field { filter: url(#px); }
.tx .tx { filter: none; }
/* a span that is a flex item ("by ", " · " between a name and a time) would lose its edge spaces; wrapping stays as
   the parent sets it */
.tx { white-space-collapse: preserve; }
button, input, textarea { font: inherit; color: inherit; margin: 0; }
/* cursors (css/cursors.css, drawn in tools/cursors.py): the hand on anything that acts on a click */
button, a, .side-item, .tab, .combo, .popup .opt, .row.clickable, .check, .frow, .chip.code, .smi-pick .smi { cursor: var(--cur-hand); }
input, textarea, .selectable, .selectable * { cursor: var(--cur-text); }
button:disabled, .combo:disabled { cursor: var(--cur-no); }
[hidden] { display: none !important; }

/* faces: each at its own px size (see tools/gen_font.py) */
.f-body { font-family: grd-body, Consolas, monospace; font-size: 12px; }
.f-sm { font-family: grd-body-sm, Consolas, monospace; font-size: 11px; }
.f-px8 { font-family: grd-px8, grd-body-sm, monospace; font-size: 8px; }
.f-px9 { font-family: grd-px9, grd-body-sm, monospace; font-size: 9px; }
.f-px10 { font-family: grd-px10, grd-body-sm, monospace; font-size: 10px; }
.f-px11 { font-family: grd-px11, grd-body, monospace; font-size: 11px; }

.c-hi { color: var(--text-hi); }
.c-text { color: var(--text); }
.c-dim { color: var(--text-dim); }
.c-off { color: var(--text-off); }
.c-accent { color: var(--accent); }
.c-ok { color: var(--ok); }
.c-warn { color: var(--warn); }
.c-err { color: var(--err); }

/* ---- surfaces (grd_ui.cpp surface()) ---- */
.s-idle { background: var(--idle); box-shadow: inset -1px -1px 0 var(--outline), inset 1px 1px 0 var(--edge-dim); }
.s-raise { background: var(--raise); box-shadow: inset -1px -1px 0 var(--outline), inset 1px 1px 0 var(--edge-hi); }
.s-press { background: var(--raise); box-shadow: inset -1px -1px 0 var(--edge-hi), inset 1px 1px 0 var(--outline); }
.s-sunk { background: var(--sunk); box-shadow: inset -1px -1px 0 var(--edge-hi), inset 1px 1px 0 var(--outline); }
.s-well { background: var(--well); box-shadow: inset -1px -1px 0 var(--edge-hi), inset 1px 1px 0 var(--outline); }

/* ---- desktop ---- */
#desk { position: fixed; inset: 0; overflow: hidden; }

/* ---- window (window() / end_window()) ---- */
.win {
  position: absolute;
  display: flex;
  min-width: 320px;
  min-height: 150px;
  padding: 1px;
  background: var(--outline);
  box-shadow: 4px 4px 0 var(--shadow);
}
.win-in {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 1px;
  background: var(--panel);
  box-shadow: inset -1px -1px 0 var(--edge-dim), inset 1px 1px 0 var(--edge-hi);
}
.win-title {
  position: relative;
  flex: none;
  height: 25px;
  border-bottom: 1px solid var(--outline);
  background: var(--chrome);
  box-shadow: inset -1px -1px 0 var(--outline), inset 1px 1px 0 var(--edge-hi);
  touch-action: none;
  user-select: none;
  cursor: var(--cur-move);
}
.win-title::before {   /* accent tick, lit top pixel */
  content: "";
  position: absolute;
  left: 7px;
  top: 7px;
  width: 3px;
  height: 10px;
  background: linear-gradient(var(--accent-hi) 1px, var(--accent) 1px);
}
.win-title .t {
  position: absolute;
  left: 16px;
  right: 24px;
  top: 0;
  font: 11px/24px grd-px11, grd-body, monospace;
  color: var(--text-hi);
  white-space: nowrap;
  overflow: hidden;
}
.xbtn {
  position: absolute;
  width: 14px;
  height: 14px;
  padding: 0;
  border: 0;
  color: var(--text-dim);
}
.win-title .xbtn { right: 3px; top: 5px; }
.xbtn svg { display: block; }
.xbtn:hover { color: var(--text-hi); }
.win-body {
  flex: 1;
  display: flex;
  min-height: 0;
  position: relative;
}
.win-status {
  flex: none;
  position: relative;
  height: 23px;
  border-top: 1px solid var(--outline);
  background: var(--chrome);
  box-shadow: inset -1px -1px 0 var(--outline), inset 1px 1px 0 var(--edge-hi);
  white-space: nowrap;
  overflow: hidden;
}
.win-status .l {
  position: absolute;
  left: 8px;
  right: 120px;
  font: 9px/22px grd-px9, grd-body-sm, monospace;
  color: var(--text-dim);
  overflow: hidden;
}
.win-status .r {
  position: absolute;
  right: 22px;
  font: 8px/22px grd-px8, grd-body-sm, monospace;
  color: var(--text-off);
  white-space: pre;
}
.grip {
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 14px;
  height: 14px;
  color: var(--edge-hi);
  touch-action: none;
  cursor: var(--cur-resize);
}
.grip:hover, .grip.held { color: var(--accent); }
.grip svg { display: block; }

/* the padded, scrolling body (open_body_scroll) */
.pane {
  flex: 1;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 12px;
}
.pane > :last-child { margin-bottom: 0 !important; }

/* scrollbar (draw_scrollbar): well track, idle/raised thumb inset by a pixel */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--well); box-shadow: inset -1px -1px 0 var(--edge-hi), inset 1px 1px 0 var(--outline); }
::-webkit-scrollbar-thumb {
  min-height: 14px;
  border: 1px solid transparent;
  background: var(--idle) padding-box;
  box-shadow: inset -1px -1px 0 var(--outline), inset 1px 1px 0 var(--edge-dim);
}
::-webkit-scrollbar-thumb:hover { background-color: var(--raise); box-shadow: inset -1px -1px 0 var(--outline), inset 1px 1px 0 var(--edge-hi); }
::-webkit-scrollbar-thumb:active { background-color: var(--raise); box-shadow: inset -1px -1px 0 var(--edge-hi), inset 1px 1px 0 var(--outline); }
::-webkit-scrollbar-corner { background: var(--panel); }
::-webkit-scrollbar-button { display: none; }
/* Firefox has no ::-webkit-scrollbar; Chrome would drop the rules above if scrollbar-color reached it, hence @supports */
@supports not selector(::-webkit-scrollbar) {
  * { scrollbar-width: thin; scrollbar-color: var(--idle) var(--well); }
  *:hover { scrollbar-color: var(--raise) var(--well); }
}

/* ---- sidebar (sidebar()) ---- */
.sidebar {
  flex: none;
  width: 118px;
  display: flex;
  flex-direction: column;
  padding: 8px 2px 8px 1px;
  background: var(--sunk);
  box-shadow: inset -1px 0 0 var(--outline);
  overflow: hidden;
  user-select: none;
}
.sidebar + .pane { box-shadow: inset 1px 0 0 var(--edge-dim); }
.side-item {
  position: relative;
  flex: none;
  display: flex;
  align-items: flex-start;
  width: 115px;
  height: 22px;
  padding-left: 12px;
  font: 10px/22px grd-px10, grd-body-sm, monospace;
  color: var(--text-dim);
  text-decoration: none;
  white-space: nowrap;
}
.side-item:focus { outline: 0; }
.side-item > .ic { margin: 5px 5px 0 0; }
.side-end { margin-top: auto; }   /* pinned to the bottom of the column */
.side-item:hover { background: var(--idle); color: var(--text); }
.side-item.on {
  background: var(--active);
  color: var(--text-hi);
  box-shadow: inset 2px 0 0 var(--accent), inset 0 1px 0 var(--edge-hi), inset 0 -1px 0 var(--outline);
}
/* keyboard focus: a 1px accent frame inside the row, so it reads apart from the .on bar and shows on it too */
.side-item:focus-visible { outline: 1px solid var(--accent); outline-offset: -1px; }
.side-cap {   /* hub.cpp side_overlay(): group captions */
  height: 22px;
  padding: 9px 0 0 10px;
  font: 8px/10px grd-px8, grd-body-sm, monospace;
  color: var(--text-off);
}
.badge {   /* hub.cpp: the count chip at the right of a sidebar row */
  position: absolute;
  right: 6px;
  top: 5px;
  height: 12px;
  padding: 0 4px;
  background: var(--well);
  box-shadow: inset -1px -1px 0 var(--edge-dim), inset 1px 1px 0 var(--outline);
  font: 8px/12px grd-px8, grd-body-sm, monospace;
  color: var(--err);
}

/* ---- tabs (tabs()) ---- */
.tabs {
  display: flex;
  gap: 2px;
  flex: none;
  height: 22px;
  margin: -12px -12px 12px;
  padding: 2px 6px 0;
  background: var(--sunk);
  box-shadow: inset 0 -1px 0 var(--outline);
  user-select: none;
}
.tab {   /* off: raised 2px lower; the label still centres on the full 20px tab, as text_v() does */
  height: 18px;
  margin-top: 2px;
  padding: 0 14px;
  border: 0;
  font: 10px/20px grd-px10, grd-body-sm, monospace;
  background: var(--idle);
  color: var(--text-dim);
  box-shadow: inset -1px -1px 0 var(--outline), inset 1px 1px 0 var(--edge-dim);
}
.tab:hover { background: var(--raise); color: var(--text); box-shadow: inset -1px -1px 0 var(--outline), inset 1px 1px 0 var(--edge-hi); }
.tab.on {
  height: 20px;
  margin-top: 0;
  line-height: 20px;
  background: var(--panel);
  color: var(--text-hi);
  box-shadow: inset -1px 0 0 var(--outline), inset 0 1px 0 var(--accent), inset 1px 0 0 var(--edge-hi);
}

/* ---- layout rhythm: every item leaves row_gap (12) under it, prose leaves 3 ---- */
.pane > *, .stack > * { margin-bottom: 12px; }
.pane > .tl, .stack > .tl { margin-bottom: 3px; }
.pane > .kv, .stack > .kv { margin-bottom: 2px; }
.gap-2 { margin-bottom: 2px !important; }
.gap-6 { margin-bottom: 6px !important; }

/* heading(): pixel face in the accent, a two-tone rule after it */
.heading {
  display: flex;
  height: 14px;
  font: 10px/14px grd-px10, grd-body-sm, monospace;
  color: var(--accent);
  white-space: nowrap;
}
.heading::after {
  content: "";
  flex: 1;
  height: 2px;
  margin: 6px 0 0 8px;
  background: linear-gradient(var(--outline) 1px, var(--edge-dim) 1px);
}
.heading .aside { order: 2; margin-left: 8px; color: var(--text-off); font: 8px/14px grd-px8, grd-body-sm, monospace; }
.heading .aside + * { order: 3; }

.separator { height: 2px; background: linear-gradient(var(--outline) 1px, var(--edge-dim) 1px); }

/* text_line(): row of line height + 2, glyphs one pixel down */
.tl { display: flex; align-items: flex-start; font: 12px/16px grd-body, Consolas, monospace; }
.tl.f-sm { font: 11px/16px grd-body-sm, Consolas, monospace; }
.tl > .ic { margin: 2px 5px 0 0; }
.tl .grow { flex: 1; min-width: 0; }
.wrap { white-space: pre-wrap; overflow-wrap: anywhere; }

/* icons: 12 x 12 from the app's sheet, drawn 1:1 */
.ic {
  display: inline-block;
  flex: none;
  width: 12px;
  height: 12px;
  background: url(/img/icons.png) no-repeat;
  vertical-align: top;
}
.ic.blank { background: none; }
.ic.off { opacity: .333; }

/* ---- control rows (control_row()): label left, control right in the control column ---- */
.row {
  display: flex;
  align-items: flex-start;
  min-height: 22px;
  font: 12px/22px grd-body, Consolas, monospace;
}
.row > .ic { margin: 5px 5px 0 0; }
.row > .lab { flex: 1; min-width: 0; margin-right: 6px; white-space: nowrap; overflow: hidden; color: var(--text); }
.row > .ctrl { flex: none; width: 132px; display: flex; }
.row > .ctrl.w220 { width: 220px; }
.row > .ctrl.w120 { width: 120px; }
.row > .ctrl.grow { flex: 1; width: auto; }
/* a growing control takes the whole rest of the row: sharing it with the label also put the field on a half pixel,
   where the #px threshold erased its glyphs */
.row:has(> .ctrl.grow) > .lab { flex: none; }
.row .gap { width: 6px; flex: none; }
.row.btns { gap: 6px; }

/* button() */
.btn {
  position: relative;
  flex: none;
  display: inline-flex;
  justify-content: center;
  align-items: flex-start;
  height: 22px;
  min-width: 0;
  padding: 0 12px;
  border: 0;
  font: 12px/22px grd-body, Consolas, monospace;
  color: var(--text);
  background: var(--idle);
  box-shadow: inset -1px -1px 0 var(--outline), inset 1px 1px 0 var(--edge-dim);
  white-space: nowrap;
  user-select: none;
}
.btn > .ic { margin: 5px 5px 0 0; }
/* a button laid out as its own item takes its own line, at its own width */
.pane > .btn, .stack > .btn { display: flex; width: max-content; }
.btn:not(:disabled):hover { background: var(--raise); color: var(--text-hi); box-shadow: inset -1px -1px 0 var(--outline), inset 1px 1px 0 var(--edge-hi); }
.btn:not(:disabled):active { box-shadow: inset -1px -1px 0 var(--edge-hi), inset 1px 1px 0 var(--outline); padding-top: 1px; padding-left: 13px; }
.btn:focus-visible { outline: 0; box-shadow: inset -1px -1px 0 var(--outline), inset 1px 0 0 var(--accent), inset 0 1px 0 var(--accent); }
.btn.icon { width: 22px; padding: 0; }
.btn.icon > .ic { margin: 5px 0 0; }
.btn.icon:not(:disabled):active { padding: 1px 0 0 1px; }
/* login.cpp btn_off / OffScope: the button under a panel-coloured veil, inert (no hover or press, the no cursor) */
.btn:disabled::after { content: ""; position: absolute; inset: 0; background: rgba(27, 27, 34, .6); }
.btn.w220 { width: 220px; }
.btn.w120 { width: 120px; }
.btn.full { width: 100%; }

/* checkbox(): 13 px sunk box, accent when on, then "on" / "off" in the small face */
.check { display: flex; align-items: flex-start; user-select: none; }
.check .box {
  position: relative;
  flex: none;
  width: 13px;
  height: 13px;
  margin-top: 4px;
  background: var(--well);
  box-shadow: inset -1px -1px 0 var(--edge-hi), inset 1px 1px 0 var(--outline);
}
.row:hover .check .box, .check:hover .box { background: linear-gradient(var(--sunk), var(--sunk)) 1px 1px / 11px 11px no-repeat var(--well); }
.check.on .box { background: linear-gradient(var(--accent-hi), var(--accent-hi)) 1px 1px / 11px 1px no-repeat var(--accent); }
.check .box svg { position: absolute; left: 3px; top: 3px; display: none; color: var(--well); }
.check.on .box svg { display: block; }
.check .v { margin-left: 8px; font: 11px/22px grd-body-sm, Consolas, monospace; color: var(--text-off); }
.check.on .v { color: var(--text); }
.row.clickable { user-select: none; }

/* input_text(): sunk well, accent top/left edge while focused. The content box is exactly the 14 px line, so its
   origin is where the text starts; --sx / --sy (grd.js snapText) shift it onto the whole pixel without moving the box */
.field {
  width: 100%;
  height: 22px;
  padding: calc(4px + var(--sy, 0px)) calc(5px - var(--sx, 0px)) calc(4px - var(--sy, 0px)) calc(6px + var(--sx, 0px));
  border: 0;
  outline: 0;
  background: transparent;   /* the well is the .ctrl.well behind it, so the text can be thresholded */
  box-shadow: inset -1px -1px 0 var(--edge-hi), inset 1px 1px 0 var(--outline);
  font: 11px/14px grd-body-sm, Consolas, monospace;
  color: var(--text);
  caret-color: var(--text-dim);
}
.field:focus { box-shadow: inset -1px -1px 0 var(--edge-hi), inset 1px 0 0 var(--accent), inset 0 1px 0 var(--accent); }
.field::placeholder { color: var(--text-off); }
.ctrl.well, .fieldbox { background: var(--well); }
textarea.field { height: auto; min-height: 88px; resize: vertical; display: block; }

/* combo(): raised field, separator, 5x3 arrow; the list pops over everything */
.combo {
  position: relative;
  width: 100%;
  height: 22px;
  padding: 0 24px 0 7px;
  border: 0;
  text-align: left;
  background: var(--idle);
  box-shadow: inset -1px -1px 0 var(--outline), inset 1px 1px 0 var(--edge-dim);
  font: 11px/22px grd-body-sm, Consolas, monospace;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  user-select: none;
}
.combo::before {
  content: "";
  position: absolute;
  right: 18px;
  top: 3px;
  bottom: 3px;
  width: 2px;
  background: linear-gradient(90deg, var(--outline) 1px, var(--edge-hi) 1px);
}
.combo svg { position: absolute; right: 8px; top: 10px; color: var(--text-dim); }
.combo:not(:disabled):hover { background: var(--raise); color: var(--text-hi); box-shadow: inset -1px -1px 0 var(--outline), inset 1px 1px 0 var(--edge-hi); }
.combo:not(:disabled):hover svg, .combo.open svg { color: var(--accent); }
.combo.open {
  background: var(--raise);
  color: var(--text-hi);
  box-shadow: inset -1px -1px 0 var(--edge-hi), inset 1px 1px 0 var(--outline), inset 1px 0 0 var(--accent), inset 0 1px 0 var(--accent);
}
.combo:disabled { color: var(--text-off); }
.combo.sm { height: 18px; line-height: 18px; }
.combo.sm::before { top: 2px; bottom: 2px; }
.combo.sm svg { top: 8px; }

/* popup_backdrop(): hard shadow, outline, raised panel */
.popup {
  position: fixed;
  z-index: 100000;
  padding: 2px;
  background: var(--panel);
  box-shadow: 0 0 0 1px var(--outline), inset -1px -1px 0 var(--outline), inset 1px 1px 0 var(--edge-hi), 5px 5px 0 var(--shadow);
  overflow-y: auto;
}
.popup .opt {
  position: relative;
  height: 18px;
  padding: 0 6px 0 7px;
  font: 11px/18px grd-body-sm, Consolas, monospace;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.popup .opt:hover { background: var(--idle); color: var(--text-hi); }
.popup .opt.sel { background: var(--active); color: var(--text-hi); box-shadow: inset 2px 0 0 var(--accent); }
.tip {
  position: fixed;
  z-index: 100001;
  max-width: 316px;
  padding: 5px 8px 5px;
  background: var(--panel);
  box-shadow: 0 0 0 1px var(--outline), inset -1px -1px 0 var(--outline), inset 1px 1px 0 var(--edge-hi), 5px 5px 0 var(--shadow);
  font: 11px/15px grd-body-sm, Consolas, monospace;
  color: var(--text);
  pointer-events: none;
  white-space: pre-wrap;
}

/* stepper_int(): - [value] + */
.stepper { display: flex; width: 100%; gap: 1px; }
.stepper .btn { width: 18px; padding: 0; }
.stepper .btn:not(:disabled):active { padding: 1px 0 0 1px; }
.stepper .val {
  flex: 1;
  text-align: center;
  background: var(--well);
  box-shadow: inset -1px -1px 0 var(--edge-hi), inset 1px 1px 0 var(--outline);
  font: 11px/22px grd-body-sm, Consolas, monospace;
  color: var(--text);
}
.stepper svg { margin-top: 7px; }

/* list (begin_list / list_item / list_line) */
.list {
  padding: 1px;
  background: var(--sunk);
  box-shadow: inset -1px -1px 0 var(--edge-hi), inset 1px 1px 0 var(--outline);
  overflow-y: auto;
}
.li {
  position: relative;
  display: flex;
  align-items: flex-start;
  min-height: 18px;
  padding: 0 8px;
  font: 11px/18px grd-body-sm, Consolas, monospace;
  color: var(--text);
}
.li > .ic { margin: 3px 5px 0 0; }
.li:hover { background: var(--idle); }
.li.sel { background: var(--active); color: var(--text-hi); box-shadow: inset 2px 0 0 var(--accent), inset 0 1px 0 var(--edge-hi); }
.li .right { margin-left: auto; padding-left: 8px; color: var(--text-dim); white-space: nowrap; }

/* table (begin_table / table_row / table_cell) */
.table {
  display: flex;
  flex-direction: column;
  padding: 1px;
  background: var(--sunk);
  box-shadow: inset -1px -1px 0 var(--edge-hi), inset 1px 1px 0 var(--outline);
  min-height: 40px;
}
.thead {
  display: flex;
  flex: none;
  height: 16px;
  padding-left: 8px;
  background: var(--idle);
  box-shadow: inset -1px -1px 0 var(--outline), inset 1px 1px 0 var(--edge-dim);
}
.th {
  position: relative;
  flex: none;
  font: 8px/16px grd-px8, grd-body-sm, monospace;
  color: var(--text-off);
  white-space: nowrap;
  text-transform: uppercase;
}
.th:not(:last-child)::after { content: ""; position: absolute; right: 6px; top: 3px; width: 1px; height: 10px; background: var(--outline); }
.th.grow, .td.grow { flex: 1; min-width: 0; }
.tbody { flex: 1; overflow-y: auto; min-height: 0; }
.tr { display: flex; align-items: flex-start; min-height: 18px; padding-left: 8px; }
.tr:nth-child(even) { background: var(--well); }
.tr:hover { background: var(--idle); }
.tr.sel { background: var(--active); box-shadow: inset 2px 0 0 var(--accent); }
.td {
  flex: none;
  min-height: 18px;
  padding-right: 6px;
  font: 11px/18px grd-body-sm, Consolas, monospace;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.td > .ic { margin: 3px 5px 0 0; }
.td.flex { display: flex; align-items: flex-start; gap: 2px; overflow: visible; }
.td .btn, .td .combo { height: 18px; line-height: 18px; }
.td .btn { padding: 0 8px; font: 11px/18px grd-body-sm, Consolas, monospace; }
.td .btn:not(:disabled):active { padding: 1px 7px 0 9px; }
.td .btn > .ic { margin-top: 3px; }
.td .btn.icon { width: 18px; padding: 0; }
.td .btn.icon:not(:disabled):active { padding: 1px 0 0 1px; }
.empty-row { padding: 8px; font: 11px/16px grd-body-sm, Consolas, monospace; color: var(--text-off); }

/* app rows.cpp: row_kv (label dim, value right, idle rule) / row_chip / dot */
.kv {
  display: flex;
  align-items: flex-start;
  height: 18px;
  font: 11px/18px grd-body-sm, Consolas, monospace;
  color: var(--text-dim);
  box-shadow: inset 0 -1px 0 var(--idle);
}
.kv > .ic { margin: 3px 5px 0 0; }
.kv .v { margin-left: auto; padding-left: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* zero specificity, so a tone class on the value (c-hi, role-admin) wins */
:where(.kv .v) { color: var(--text); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: flex-start;
  height: 18px;
  padding: 0 7px;
  background: var(--well);
  box-shadow: inset -1px -1px 0 var(--edge-dim), inset 1px 1px 0 var(--outline);
  font: 11px/18px grd-body-sm, Consolas, monospace;
  white-space: nowrap;
}
.chip > .ic { margin: 3px 5px 0 0; }
.dot { display: inline-block; width: 6px; height: 6px; margin: 5px 6px 0 0; flex: none; background: currentColor; }

/* modal (begin_modal): dim quad over everything, a window in the middle */
.scrim { position: fixed; inset: 0; z-index: 99990; background: var(--dim); }

/* ---- small screens: the windows stop floating and stack ---- */
@media (max-width: 720px), (max-height: 480px) {
  body { overflow: auto; }
  #desk { position: static; display: flex; flex-direction: column; gap: 12px; padding: 8px 8px 16px; min-height: 100%; }
  .win { position: relative !important; left: auto !important; top: auto !important; width: auto !important;
         height: auto !important; min-width: 0; box-shadow: none; }
  .win.tall { height: calc(100vh - 16px) !important; min-height: 420px; }
  .grip { display: none; }
  .sidebar { width: 92px; }
  .side-item { width: 89px; }
  .row > .ctrl.w220 { width: 60%; }
  .btn.w220 { width: 100%; }
}
