/* Hoffman Building Technologies brand: Hoffman Blue #0872B9, Green #398F44
   (sampled from Logo/HBT_STANDARD_RBG.png; see Logo/2025-Hoffman-Brand-Guidelines.pdf).
   The wiresheet canvas stays #0e1116 — block/category colors in src/categories.js
   are contrast-validated against it. Brightened variants below are for text on
   dark surfaces (WCAG ≥ 4.5:1); the pure brand colors are used as fills with
   white ink. */
:root {
  --bg: #0e1116;
  --panel: #131922;
  --panel-2: #1a222e;
  --line: #273140;
  --line-soft: #1e2733;
  --text: #e8eef5;
  --muted: #8d99a8;
  --hbt-blue: #0872b9;
  --hbt-blue-hover: #0a83d4;
  --hbt-green: #398f44;
  --accent: #3ba0e8;      /* Hoffman blue, lifted for dark-surface text/strokes */
  --ok: #55c168;          /* Hoffman green, lifted for dark-surface text */
  --danger: #f85149;
  --block: #21618c;
  --block-body: #1b3a52;
  --wire: #7d8590;
  --warn: #d29922;
  --radius: 8px;
  --shadow: 0 12px 36px #00000090, 0 2px 8px #00000060;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 'Segoe UI Variable Text', 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
}

body {
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  height: 100vh;
  overflow: hidden;
}

:is(button, input, select):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 16px;
  background: linear-gradient(180deg, #161d28, var(--panel));
  border-bottom: 1px solid var(--line);
  position: relative;
}
/* brand hairline: blue → green, echoing the two-tone H mark */
.topbar::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  background: linear-gradient(90deg, var(--hbt-blue) 0%, #1f817f 55%, var(--hbt-green) 100%);
  pointer-events: none;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark { height: 34px; width: auto; flex: none; }
.brand-text { min-width: 0; }
.brand h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.brand #meta {
  margin: 1px 0 0;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spacer { width: 10px; }

.btn {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px 13px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.btn:hover { background: #212b39; border-color: #35485e; }
.btn.primary {
  background: var(--hbt-blue);
  border-color: var(--hbt-blue);
  color: #fff;
  font-weight: 600;
}
.btn.primary:hover { background: var(--hbt-blue-hover); border-color: var(--hbt-blue-hover); }
.btn.icon { width: 32px; padding: 6px 0; text-align: center; font-size: 16px; }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: #ffffff0a; }
.file-btn { display: inline-flex; align-items: center; }
.zoom-label { color: var(--muted); min-width: 44px; text-align: center; font-variant-numeric: tabular-nums; }

/* tabs */
.tabs {
  display: flex;
  gap: 2px;
  padding: 4px 12px 0;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: thin;
}
.tab {
  background: transparent;
  color: var(--muted);
  border: none;
  border-bottom: 2px solid transparent;
  padding: 8px 13px 7px;
  font: inherit;
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
  border-radius: 6px 6px 0 0;
  transition: color 0.12s ease, background 0.12s ease;
}
.tab:hover { color: var(--text); background: #ffffff08; }
.tab.active {
  color: var(--text);
  font-weight: 600;
  border-bottom-color: var(--accent);
}

/* breadcrumbs (nested logic path) */
.crumbs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 14px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}
.crumb {
  background: transparent;
  color: var(--accent);
  border: none;
  padding: 2px 6px;
  border-radius: 4px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.crumb:hover { background: #ffffff0d; }
.crumb.current { color: var(--text); cursor: default; }
.crumb.current:hover { background: transparent; }
.crumb-sep { color: var(--muted); font-size: 10px; }

/* stage */
.stage {
  /* pin to the 1fr track — the crumbs row above may be display:none, which
     removes it from the grid and would otherwise shift this into an auto row */
  grid-row: 4;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 1px 1px, #ffffff10 1px, transparent 0) 0 0 / 24px 24px,
    var(--bg);
  cursor: grab;
}
.stage:active { cursor: grabbing; }
.sheet {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
}
.empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
}
.empty-mark {
  width: 88px;
  height: 86px;
  margin-bottom: 6px;
  background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGMAAABgCAYAAAAJr8w7AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAmaSURBVHhe7Z19bBPnHcetDp7nylZ11VZtU7Wuaysxsa0rvjsnIKSI+M7nQNoKqfmzVadNe9GWBt/5JYGAN2mTpgni80vMy6BlpdqmTKXtpCW5s4PNeAuDvUpjG+umjcIoECraVVoHgZt+j20aHh8Q5y5wTp6v9FVk57nn7ePnnueeO/3Ox6nm33G8dAFrpvfdf+QCWjvS43NDSd9dQia0J7Al/BafluutS2eFtI116dwNfF5Iy3XmdXnC1mnpQs3CoHJBSMsnfFgtvIf7Dlg4XvK8ue/81kJrR9bR/ToTCRn55WW7Oq3AoNKwRcp23zXiwLYOS0jLF31YNd8mjdVMz5vbcMRCkdEE3bGNik/L+rIXO6EDPGEAAqNr3sHgU8H+ZS+stoRMqK5T7pTnJQx+QPpG645Vlpj1DggwgZGWz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Yr9OpuLq/bb2P4U8HYdCd6BoNSZXJWDpI3hN1kgianrxdWwzb6u/7N8ho6n5r4lJRgMByoLdm2QBgMbRTzyrnaaw/Idvn2DjJ/wMiBigcGlT38prbP0cdPFa9LvQyGC+I3tX08kFeeEXPKNiETGhWyoTExK/8ssEWJtwyGH6PT24nB8JAYDA+JwfCQGAwPicHwkBgMD4nB8JAYDA+JwfCQGAwPqVEYS9PBMJ2HU/G69OCswbgvUbiXLtCrahQGnws+BY8EuWkhtXKx+zAgyplqXsGauRtFjDzS7oAjI3mu79CLWDO/THe8nRqBQV73qUvn4GE5V63Lp+vKsnFjMGqGsEHw2oPb7nGL+95xiGk+gWJji+mOt1NDMKodAlv3bpsux84zg3EnXAulHS+dxj2vPkR3+o3UKIw76SaBAcHl90OMwYsLnx+e1tZ5TQyGqzaq7wwvX+Iiw210Z99KDIabhjr17bdQZPiGt1ZvJgbDLUNAR3jXhTryVbqTpysGww1Hi9X3WYz20h3ciBgMxy6QEKc4MrqZ7txG1aww/kPCjQIQ11y2N8Qgv4nJ+4+iRVfe8MKnpfXLf/wEaajXHSDPFsvv+JBm/g3FShNIMyaQakwgzTxfbwP+nquzSnzW1prxlq1V80y9jTO4d/+/cbTwc7pTZyq/LvW07lg1weuy5y0MKhN8Wj7xf5K7VSjruXdgAAAAAElFTkSuQmCC')
    center / contain no-repeat;
  opacity: 0.45;
  filter: saturate(0.85);
}
.empty-title { margin: 0; font-size: 15px; font-weight: 600; color: var(--text); }
.empty .hint { margin: 0; font-size: 13px; max-width: 440px; text-align: center; }
.empty .hint strong { color: var(--text); font-weight: 600; }

/* Info tab: HTML panel swapped in place of the SVG (selectable text) */
.info-panel {
  position: absolute;
  inset: 0;
  overflow: auto;
  padding: 24px;
  cursor: default;
}
.info-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-start; /* cards keep their own height — no row stretching */
}
.info-card {
  flex: 0 1 430px; /* fixed-ish width so a wide screen fits cards side by side instead of stacking */
  min-width: 320px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.info-card h2 {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 650;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line-soft);
}
.info-card dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 18px;
  margin: 0;
  font-size: 13px;
}
.info-card dt { color: var(--muted); font-weight: 600; white-space: nowrap; }
.info-card dd { margin: 0; user-select: text; overflow-wrap: anywhere; }
.info-note { flex: 1 1 380px; margin: 4px 0; font-size: 13px; color: var(--muted); }
.info-error { color: var(--danger); }
.info-refresh { margin-top: 12px; }
.info-table {
  border-collapse: collapse;
  font-size: 13px;
  width: 100%;
}
.info-table th {
  text-align: left;
  color: var(--muted);
  font-weight: 600;
  padding: 4px 14px 6px 0;
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
}
.info-table td {
  padding: 5px 14px 5px 0;
  border-bottom: 1px solid var(--line-soft);
  user-select: text;
  overflow-wrap: anywhere;
}
.info-table tr:last-child td { border-bottom: none; }

/* Points tab: subtype tiles, reusing .info-card's look but laid out as a
   masonry (CSS multi-column) instead of flex rows. Flex-wrap made every short
   tile reserve a full-height row, capping the tall Analog Values tile and
   leaving big gaps; columns let short tiles stack together so the tall one
   fills the height it needs. Overrides .info-cards (defined earlier, so this
   wins). */
.points-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
  font-size: 12px;
}
.points-toolbar-label { color: var(--muted); margin-right: 2px; }
.points-sort-btn {
  background: var(--panel-2);
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px 12px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.points-sort-btn:hover { color: var(--text); border-color: #35485e; }
.points-sort-btn.active {
  background: var(--hbt-blue);
  border-color: var(--hbt-blue);
  color: #fff;
  font-weight: 600;
}
.points-cards {
  display: block;
  column-width: 460px;
  column-gap: 16px;
}
.points-cards .points-tile {
  /* multi-column masonry: don't split a tile across columns, and give each a
     bottom margin as the vertical gap between stacked tiles */
  display: inline-block;
  width: 100%;
  margin: 0 0 16px;
  vertical-align: top;
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
}

/* Scrollable row list: a controller with hundreds of points can't make a tile
   infinitely tall — it scrolls internally, growing to most of the viewport
   height first so it reaches down toward the bottom of the shorter tiles. */
.points-tile-body {
  max-height: calc(100vh - 210px);
  overflow-y: auto;
  /* keep the scrollbar off the values, and reserve its gutter even when a tile
     doesn't scroll so every tile's value column lines up */
  padding-right: 10px;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.points-tile-body::-webkit-scrollbar { width: 8px; }
.points-tile-body::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
.points-tile-body::-webkit-scrollbar-track { background: transparent; }
.points-col-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 0 0 4px;
  margin-bottom: 2px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.points-col-head span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.points-list { display: flex; flex-direction: column; }
.point-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 3px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
  cursor: grab;
  user-select: none;
}
.point-row.row-dragging {
  position: fixed;
  cursor: grabbing;
  background: var(--panel-2);
  box-shadow: var(--shadow), 0 0 0 1px var(--accent);
  border-radius: 6px;
  padding: 3px 8px;
  z-index: 1001;
}
.row-placeholder {
  box-sizing: border-box;
  margin: 2px 0;
  border: 1px dashed var(--line);
  border-radius: 4px;
}
.point-row:last-child { border-bottom: none; }
.point-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Fixed px column widths (not em) so the small-font column header and the
   larger-font rows share the exact same ID/Value column edges. */
.point-instance {
  flex: none;
  width: 44px;
  text-align: right;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.point-value {
  flex: none;
  min-width: 60px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.point-value.ok { color: var(--ok); }
.point-value.warn { color: var(--warn); }
.point-value.danger { color: var(--danger); }

/* Points tab: hybrid movable tiles (drag the header). Session-only, no
   persistence — see docs/superpowers/specs/2026-07-15-points-tile-drag-design.md
   and src/points-layout.js. */
/* Header band: colored per BACnet subtype (paintHeaderColor in
   points-view.js, matching the wiresheet's point-block header colors —
   src/categories.js POINT_CLASSES). Negative margins undo .info-card's own
   padding so the band spans the tile's full width, like a block header. */
.points-tile h2 {
  cursor: grab;
  user-select: none;
  margin: -16px -18px 10px;
  padding: 9px 18px 7px;
  border-radius: 11px 11px 0 0;
}
.points-tile h2:active { cursor: grabbing; }
.points-tile.dragging {
  position: fixed;
  margin: 0;
  box-shadow: var(--shadow), 0 0 0 2px var(--accent);
  transform: scale(1.02);
  z-index: 1000;
  cursor: grabbing;
}
.points-tile.dragging .points-tile-body { pointer-events: none; }
.tile-placeholder {
  box-sizing: border-box;
  width: 100%;
  margin: 0 0 16px;
  border: 2px dashed var(--line);
  border-radius: 12px;
  background: transparent;
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
}

/* blocks */
.block { cursor: grab; }
.block.dragging { cursor: grabbing; opacity: 0.85; }
.block-body {
  fill: var(--block-body);
  stroke: var(--block);
  stroke-width: 1.2;
}
.block-inner {
  fill: none;
  stroke: var(--block);
  stroke-width: 1;
  opacity: 0.55;
}
.block.composite .block-body { fill: #23324a; }
.block-header { fill: var(--block); }
.block-title {
  fill: #dbe9f7;
  font-weight: 600;
}
.block-subtitle { fill: var(--muted); }
.text-frame {
  fill: #ffffff08;
  stroke: var(--muted);
  stroke-width: 1;
}
.block-name {
  fill: var(--text);
  text-anchor: middle;
}
.drill-glyph {
  fill: #9fc3ee;
  font-size: 11px;
  font-weight: 700;
}
.text-shape { fill: var(--muted); font-size: 12px; }

/* tags + exported port markers: compact pills */
.tag-body {
  fill: #1d3a2a;
  stroke: #3f8f5f;
  stroke-width: 1;
}
.block.marker .tag-body {
  fill: #16324a;
  stroke: var(--accent);
}
.tag-name {
  fill: #b5e0c4;
  text-anchor: middle;
}
.block.marker .tag-name { fill: #a9cdf1; }

.port { fill: var(--panel); stroke: var(--wire); stroke-width: 1; }
.port-out { fill: var(--accent); stroke: var(--accent); }
.port-label { fill: var(--muted); }
.port-label-in { text-anchor: start; }
.port-label-out { text-anchor: end; }

.wire {
  fill: none;
  stroke: var(--wire);
  stroke-width: 1.5;
  opacity: 0.75;
}

/* live values */
.live-toggle.active {
  border-color: var(--hbt-green);
  color: var(--ok);
  background: #398f4422;
}
.live-toggle.error {
  border-color: var(--danger);
  color: var(--danger);
  background: #f8514918;
}
.live-state { font-size: 11px; color: var(--muted); min-width: 90px; }
.live-state.ok { color: var(--ok); }
.live-state.error { color: #f0883e; }

.value-badge {
  fill: #55c168;
  font-weight: 700;
  text-anchor: end;
  paint-order: stroke;
  stroke: #0e1116;
  stroke-width: 3px;
}
.live-stale .value-badge { fill: #8b949e; }
.live-fault .value-badge { fill: #f85149; }

.value-badge.badge-start { text-anchor: start; }
.value-badge.badge-middle { text-anchor: middle; }

/* controller-picture tab: I/O chips wired onto the product photo */
.io-chip { cursor: pointer; }
.io-chip .chip-body {
  fill: var(--panel-2);
  stroke-width: 1.4;
}
.io-chip:hover .chip-body { fill: #23324a; }
.io-chip .chip-term {
  font-size: 9px;
  font-weight: 700;
}
.io-chip .chip-name {
  font-size: 8px;
  fill: var(--text);
}
.io-wire {
  fill: none;
  stroke-width: 1.2;
  opacity: 0.6;
}
.io-term-dot { opacity: 0.85; }
.ctrl-note {
  fill: var(--muted);
  text-anchor: middle;
}

/* on-board temperature panel (controller tab) */
.sensor-panel-bg {
  fill: var(--panel);
  stroke: var(--line);
  stroke-width: 1;
}
.sensor-title {
  fill: var(--text);
  font-size: 11px;
  font-weight: 700;
}
.sensor-label {
  fill: var(--muted);
  font-size: 10px;
}
.sensor-value {
  fill: var(--ok);
  font-size: 10px;
  font-weight: 700;
  text-anchor: end;
}
.sensor-value.sensor-warn { fill: var(--warn); }
.sensor-value.sensor-alarm { fill: var(--danger); }

/* point popover (live details + reviewed write) */
.point-popover {
  position: fixed;
  z-index: 20;
  width: 270px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: var(--shadow);
  font-size: 12px;
}
.point-popover header { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.pop-sub { color: var(--muted); font-size: 11px; }
.pop-row { margin: 6px 0; }
.pop-muted { color: var(--muted); }
.pop-flag {
  margin-left: 6px; padding: 1px 6px; border-radius: 8px;
  background: #3d2c00; color: #d29922; font-size: 10px;
}
.pop-flag.err { background: #3d0e0e; color: #f85149; }
.pop-actions { display: flex; gap: 6px; }

/* controller config panel */
.config-panel {
  position: absolute;
  top: 70px;
  right: 16px;
  z-index: 10;
  width: 330px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.config-panel h2 {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 650;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line-soft);
}
.config-hint { margin: 8px 0 12px; font-size: 11px; color: var(--muted); }
.config-panel label {
  display: block;
  margin: 9px 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.config-panel select,
.config-panel input[type='text'],
.config-panel input[type='password'] {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 7px 9px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font: inherit;
  font-size: 13px;
  font-weight: 400;
  transition: border-color 0.12s ease;
}
.config-panel select:hover,
.config-panel input:hover { border-color: #35485e; }
.saved-row { display: flex; gap: 6px; margin-top: 4px; align-items: stretch; }
.saved-row select { flex: 1; margin-top: 0; }
.saved-row .btn { padding: 4px 9px; }
.config-remember { display: flex; align-items: center; gap: 7px; font-weight: 400; }
.config-remember input { accent-color: var(--hbt-blue); }
.config-actions { display: flex; gap: 8px; margin-top: 14px; }
.config-status { margin: 10px 0 0; font-size: 12px; color: var(--ok); min-height: 16px; }
.config-status.error { color: var(--danger); }

/* network scan (mDNS discovery) */
.scan-section { margin: 12px 0; padding: 12px 0; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.scan-btn { width: 100%; text-align: center; }
.scan-status { margin: 8px 0 0; font-size: 11px; color: var(--muted); }
.scan-results { margin-top: 8px; }
.scan-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 170px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.scan-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
  font-size: 12px;
}
.scan-item:last-child { border-bottom: none; }
.scan-item:hover { background: #ffffff08; }
.scan-item.added { cursor: default; }
.scan-item.added:hover { background: transparent; }
.scan-item input[type='checkbox'] { accent-color: var(--hbt-blue); flex: none; margin: 0; }
.scan-name { font-weight: 600; flex: none; min-width: 64px; overflow: hidden; text-overflow: ellipsis; }
.scan-ip { color: var(--muted); flex: 1; font-variant-numeric: tabular-nums; }
.scan-mac { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.scan-added-tag { color: var(--ok); font-size: 11px; flex: none; }
.scan-actions { display: flex; justify-content: flex-end; margin-top: 8px; }

.bulk-panel { z-index: 11; }
.bulk-results { list-style: none; margin: 10px 0 0; padding: 0; font-size: 12px; max-height: 150px; overflow: auto; }
.bulk-results li { padding: 4px 0; border-bottom: 1px solid var(--line-soft); }
.bulk-results li:last-child { border-bottom: none; }
.bulk-results .ok { color: var(--ok); }
.bulk-results .err { color: var(--danger); }

/* warnings */
.warnings {
  position: absolute;
  right: 16px;
  bottom: 16px;
  max-width: 460px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.warn-toggle {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--warn);
  border: none;
  padding: 8px 12px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.warn-toggle:hover { background: #ffffff08; }
.warn-list {
  display: none;
  margin: 0;
  padding: 0 16px 10px 28px;
  max-height: 200px;
  overflow: auto;
  color: var(--muted);
  font-size: 12px;
}
.warn-list.open { display: block; }
.warn-list li { margin: 3px 0; }
