@font-face { font-family: "Barlow SC"; src: url(fonts/barlow-sc-Regular.woff) format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Barlow SC"; src: url(fonts/barlow-sc-Medium.woff) format("woff"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Barlow SC"; src: url(fonts/barlow-sc-SemiBold.woff) format("woff"); font-weight: 600; font-display: swap; }

/* Anodized-aluminum faceplate: grey metal, screen-printed ink, one amber "energized" signal. */
:root {
  --bg: #DDE2E6;
  --panel: #EEF1F3;
  --panel-2: #E5E9EC;
  --ink: #1D2733;
  --ink-2: #5E6B78;
  --line: #C3CAD1;
  --amber: #E8A10C;
  --amber-soft: #F6DFA8;
  --ok: #2E9E5B;
  --bad: #C2412D;
  --hole: #B7BFC7;
  --cell: 76px;
  --gap: 12px;
  --display: "Barlow SC", "Arial Narrow", sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
/* Dark: chosen explicitly, or following the system unless Light was chosen. */
:root[data-theme="dark"] { 
    --bg: #161B20;
    --panel: #1F252C;
    --panel-2: #262D35;
    --ink: #E3E8EC;
    --ink-2: #8E9AA6;
    --line: #313A44;
    --amber: #F0B03A;
    --amber-soft: #5A4519;
    --ok: #47B877;
    --bad: #E0644F;
    --hole: #2C343D;
    color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { 
    --bg: #161B20;
    --panel: #1F252C;
    --panel-2: #262D35;
    --ink: #E3E8EC;
    --ink-2: #8E9AA6;
    --line: #313A44;
    --amber: #F0B03A;
    --amber-soft: #5A4519;
    --ok: #47B877;
    --bad: #E0644F;
    --hole: #2C343D;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 15px/1.45 var(--body); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
a { color: inherit; }

/* ---------- top bar ---------- */
.bar { display: flex; align-items: center; gap: 20px; padding: 0 20px; height: 56px; border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 20; }
.mark { font: 600 22px/1 var(--display); letter-spacing: .01em; text-decoration: none; display: flex; align-items: center; gap: 8px; }
.mark i { width: 26px; height: 26px; flex: none; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3E%3Crect width='512' height='512' rx='112' fill='%231D2733'/%3E%3Cpath d='M190 128 V384' stroke='%23F4F1EA' stroke-width='40' stroke-linecap='round'/%3E%3Cpath d='M190.0 128.0 A128 128 0 0 1 190.0 384.0' fill='none' stroke='%23F4F1EA' stroke-width='40' stroke-linecap='round'/%3E%3Cpath d='M239.0 195.4 A70 70 0 0 1 239.0 316.6' fill='none' stroke='%23E8A10C' stroke-width='30' stroke-linecap='round'/%3E%3Ccircle cx='216' cy='256' r='26' fill='%23E8A10C'/%3E%3C/svg%3E") center / contain no-repeat; }
.auth .mark i { width: 34px; height: 34px; }
.tabs { display: flex; gap: 2px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.tab { font: 500 16px/1 var(--display); padding: 10px 12px; border-radius: 6px; text-decoration: none; color: var(--ink-2); white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab[aria-current] { color: var(--ink); background: var(--panel-2); }
.bar-right { display: flex; gap: 8px; align-items: center; margin-left: auto; }

.btn { text-decoration: none; border: 1px solid var(--line); background: var(--panel); padding: 7px 14px; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--ink-2); }
.btn.primary { background: var(--ink); color: var(--panel); border-color: var(--ink); }
.btn.on { background: var(--amber); border-color: var(--amber); color: #1D2733; }
.btn.danger { color: var(--bad); }
.btn.ghost { border-color: transparent; background: none; }
.btn:disabled { opacity: .5; cursor: default; }

/* ---------- pages ---------- */
.page { max-width: 1240px; margin: 0 auto; padding: 24px 20px 80px; }
.page h1 { font: 600 30px/1.1 var(--display); margin: 0 0 4px; }
.page .lead { color: var(--ink-2); margin: 0 0 24px; max-width: 60ch; }
.head-row { display: flex; align-items: end; gap: 16px; justify-content: space-between; flex-wrap: wrap; margin-bottom: 20px; }

.auth { min-height: 100%; display: grid; place-items: center; padding: 20px; }
.auth form { width: min(360px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 28px; }
.auth .mark { font-size: 30px; margin-bottom: 6px; }
.auth p { color: var(--ink-2); margin: 0 0 20px; }

label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 4px; }
input[type=text], input[type=password], input[type=number], input[type=time], select {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg);
}
input:focus, select:focus { outline: none; border-color: var(--ink); }
.err { color: var(--bad); font-size: 14px; min-height: 20px; margin: 4px 0 8px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

/* ---------- devices ---------- */
.devlist { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.dev { display: grid; grid-template-columns: 18px 1fr auto auto; gap: 14px; align-items: center; padding: 14px 18px; border-top: 1px solid var(--line); }
.dev:first-child { border-top: 0; }
.dev .name { font: 500 18px/1.2 var(--display); }
.dev .meta { color: var(--ink-2); font-size: 13px; font-variant-numeric: tabular-nums; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--hole); }
.dot.live { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.creds { background: var(--panel); border: 1px solid var(--amber); border-radius: 10px; padding: 18px 20px; margin-bottom: 20px; }
.creds h2 { font: 600 20px/1.2 var(--display); margin: 0 0 4px; }
.creds p { margin: 0 0 12px; color: var(--ink-2); }
pre.code { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 12px; overflow-x: auto; font: 13px/1.5 ui-monospace, Menlo, Consolas, monospace; margin: 0 0 10px; user-select: all; }
.empty { text-align: center; padding: 48px 20px; color: var(--ink-2); }
.empty strong { display: block; font: 600 22px/1.2 var(--display); color: var(--ink); margin-bottom: 6px; }

/* ---------- dashboard grid ---------- */
.board-wrap { position: relative; }
.board { position: relative; display: grid; grid-template-columns: repeat(12, 1fr); grid-auto-rows: var(--cell); gap: var(--gap); min-height: calc(var(--cell) * 6); }
/* Edit mode shows the perfboard: one hole per grid cell. */
.editing .board { background-image: radial-gradient(circle at center, var(--hole) 0 3px, transparent 3.5px); background-size: calc((100% + var(--gap)) / var(--icols, 12)) calc(var(--cell) + var(--gap)); background-position: calc(-1 * var(--gap) / 2) calc(-1 * var(--gap) / 2); }

.w { container-type: size; position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px 30px; overflow: hidden; display: flex; flex-direction: column; min-width: 0; }
.w-label { position: absolute; left: 14px; bottom: 7px; right: 50px; font: 500 var(--lab-fs, 14px)/1.3 var(--display); color: var(--lab-color, var(--ink-2)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-pin { position: absolute; right: 12px; bottom: 7px; font: 500 calc(var(--lab-fs, 14px) * .86)/1.5 var(--display); color: var(--ink-2); opacity: .7; font-variant-numeric: tabular-nums; }
.w.offline .w-pin::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--bad); margin-right: 5px; vertical-align: 1px; }
.w-body { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }

.editing .w { cursor: grab; border-style: dashed; border-color: var(--ink-2); touch-action: none; }
.editing .w.drag { cursor: grabbing; opacity: .85; z-index: 5; box-shadow: 0 8px 24px rgba(20, 30, 40, .2); }
.editing .w.sel { border-color: var(--amber); border-style: solid; box-shadow: 0 0 0 2px var(--amber); }
.editing .w .w-body * { pointer-events: none; }
.editing .w .resize { pointer-events: auto; }
/* inside a tabs widget, its tab buttons and child widgets stay interactive while editing */
.editing .tabsw .tabbar .tab-btn, .editing .tabsw .board > .w, .editing .tabsw .board > .w .resize { pointer-events: auto; }
.editing .tabsw .board > .w .w-body * { pointer-events: none; }
.resize { display: none; position: absolute; right: 0; bottom: 0; width: 22px; height: 22px; cursor: nwse-resize; }
.resize::after { content: ""; position: absolute; right: 5px; bottom: 5px; width: 8px; height: 8px; border-right: 2px solid var(--ink-2); border-bottom: 2px solid var(--ink-2); }
.editing .resize { display: block; }
.editing .w-pin { right: 28px; }
/* Tiny widgets (1 cell): drop the pin badge, keep the label readable. */
@container (max-width: 110px) {
  .w-pin { display: none; }
  .w-label { right: 0; font-size: calc(var(--lab-fs, 14px) * .86); bottom: 5px; } /* Small / Normal / Large stay different */
}
.ghost-cell { border: 2px dashed var(--amber); border-radius: 8px; pointer-events: none; z-index: 1; }

/* ---------- widgets ---------- */
.w { --w-accent: var(--amber); }
.w-body { color: var(--w-text, inherit); }
.big { font: 500 clamp(16px, min(22cqw, 38cqh), 60px)/1 var(--display); font-variant-numeric: tabular-nums; letter-spacing: -.01em; white-space: nowrap; }
.big small { font-size: .45em; color: var(--ink-2); margin-left: 4px; letter-spacing: 0; }
.na { color: var(--ink-2); }

/* Button: shape-* sets the outline, look-* the style. --k-on / --k-off come from the widget colors. */
.key { --k-on: var(--w-accent); width: 100%; height: 100%; max-height: 120px; border: 1px solid var(--line); border-radius: 8px; background: var(--k-off, var(--panel-2)); color: var(--k-off-text, var(--ink)); cursor: pointer; font: 600 18px/1 var(--display); display: flex; align-items: center; justify-content: center; gap: 10px; transition: background .12s, border-color .12s, box-shadow .12s, transform .06s; user-select: none; touch-action: manipulation; }
.key.shape-square { border-radius: 3px; }
.key.shape-circle { border-radius: 50%; width: auto; max-width: 100%; aspect-ratio: 1; max-height: 100%; }
.key:active { transform: translateY(1px); }
.key.look-indicator::before { content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--hole); transition: background .12s, box-shadow .12s; flex: none; }
.key.look-indicator.on { border-color: var(--k-on); }
.key.look-indicator.on::before { background: var(--k-on); box-shadow: 0 0 0 4px color-mix(in srgb, var(--k-on) 30%, transparent), 0 0 14px var(--k-on); }
.key.look-flat { border-color: transparent; }
.key.look-flat.on { background: var(--k-on); color: var(--k-on-text); }
.key.look-outline { background: transparent; border: 2px solid var(--k-off, var(--line)); color: var(--ink-2); }
.key.look-outline.on { border-color: var(--k-on); color: var(--k-on); background: color-mix(in srgb, var(--k-on) 10%, transparent); }
.key.look-outline.fill-half.on { background: color-mix(in srgb, var(--k-on) 45%, transparent); color: var(--ink); }
.key.look-outline.fill-solid.on { background: var(--k-on); color: var(--k-on-text); }
.key.look-raised { border: 0; box-shadow: 0 5px 0 var(--k-off-edge, var(--line)); margin-bottom: 5px; height: calc(100% - 5px); }
.key.look-raised.on { background: var(--k-on); color: var(--k-on-text); box-shadow: 0 5px 0 var(--k-on-edge); }
.key.look-raised:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--k-off-edge, var(--line)); }
.key.look-raised.on:active { box-shadow: 0 1px 0 var(--k-on-edge); }

.slider { width: 100%; display: flex; flex-direction: column; gap: 6px; }
input[type=range] { width: 100%; accent-color: var(--w-accent, var(--amber)); height: 28px; }

.gauge { width: 100%; height: 100%; }
.gauge .track { stroke: var(--panel-2); }
.gauge .fill { stroke: var(--w-accent); transition: stroke-dashoffset .3s; }
.gauge text { fill: var(--w-text, var(--ink)); font-family: var(--display); font-variant-numeric: tabular-nums; }
.gauge .lim { fill: var(--ink-2); font-size: 11px; }

.led { width: 40%; max-width: 64px; aspect-ratio: 1; border-radius: 50%; background: var(--hole); border: 3px solid var(--panel-2); transition: background .15s, box-shadow .15s; }
.led.on { background: var(--c, var(--amber)); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c, var(--amber)) 30%, transparent), 0 0 22px var(--c, var(--amber)); }

.prog { width: 100%; }
.prog .big { font-size: clamp(20px, 2.6vw, 30px); margin-bottom: 8px; }
.prog .track { height: 14px; background: var(--panel-2); border-radius: 7px; overflow: hidden; border: 1px solid var(--line); }
.prog .fill { height: 100%; background: var(--w-accent); width: 0; transition: width .3s; }

.graph { width: 100%; height: 100%; display: flex; flex-direction: column; gap: 4px; }
.graph-head { display: flex; justify-content: space-between; align-items: baseline; }
.graph-head .big { font-size: clamp(18px, 2vw, 26px); }
.graph-head .rng { font: 500 13px/1 var(--display); color: var(--ink-2); }
.graph canvas { flex: 1; min-height: 0; width: 100%; }

.term { width: 100%; height: 100%; display: flex; flex-direction: column; gap: 6px; }
.term-out { flex: 1; min-height: 0; overflow-y: auto; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; font: 13px/1.45 ui-monospace, Menlo, Consolas, monospace; white-space: pre-wrap; word-break: break-word; }
.term-out .in { color: var(--ink-2); }
.term input { font: 13px ui-monospace, Menlo, Consolas, monospace; padding: 6px 8px; }

.log { width: 100%; height: 100%; overflow-y: auto; font-size: 13px; }
.log div { display: flex; gap: 10px; padding: 3px 0; border-bottom: 1px solid var(--panel-2); }
.log time { color: var(--ink-2); font-variant-numeric: tabular-nums; flex: none; }
.log span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* input + menu widgets */
.inputw { width: 100%; }
.input-row { display: flex; gap: 6px; align-items: center; }
.input-row input { flex: 1; min-width: 0; font: 500 clamp(16px, min(9cqw, 22cqh), 26px)/1.2 var(--display); font-variant-numeric: tabular-nums; padding: 8px 10px; }
.input-row input:focus { border-color: var(--w-accent); }
.input-row input[aria-invalid=true] { border-color: var(--bad); }
.input-row .unit { color: var(--ink-2); font: 500 16px var(--display); }
.step { flex: none; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-2); font: 600 20px/1 var(--display); cursor: pointer; }
.step:active { background: var(--w-accent); color: #1D2733; }
.input-msg { min-height: 18px; font-size: 12px; color: var(--ink-2); margin-top: 4px; }
.input-row:has([aria-invalid=true]) + .input-msg { color: var(--bad); }
/* text input: fills the widget and wraps; the font stays a reading size */
.inputw.text { height: 100%; display: flex; flex-direction: column; }
.inputw.text .input-row { flex: 1; min-height: 0; align-items: stretch; }
.input-row textarea { flex: 1; min-width: 0; min-height: 0; resize: none; color: inherit; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); outline: none; overflow-y: auto; font: 400 clamp(15px, min(5cqw, 12cqh), 19px)/1.35 var(--body, inherit); padding: 8px 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
.input-row textarea:focus { border-color: var(--w-accent); }
.segs { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; }
.seg { flex: 1 1 0; min-width: 56px; padding: 10px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-2); font: 500 15px/1 var(--display); cursor: pointer; }
.seg[aria-pressed=true] { background: var(--w-accent, var(--amber)); border-color: var(--w-accent, var(--amber)); color: #1D2733; }
.menuw { width: 100%; }

/* multi-pin graph legend */
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; min-width: 0; }
.lg { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 2px 0; cursor: pointer; font-size: 13px; color: var(--ink-2); }
.lg i { width: 10px; height: 10px; border-radius: 2px; flex: none; }
.lg b { font: 500 15px var(--display); color: var(--ink); font-variant-numeric: tabular-nums; }
.lg[aria-pressed=false] { opacity: .4; text-decoration: line-through; }

/* ---------- editor drawer ---------- */
.drawer { position: fixed; top: 56px; right: 0; bottom: 0; width: 320px; background: var(--panel); border-left: 1px solid var(--line); padding: 18px; overflow-y: auto; z-index: 15; }
.drawer h2 { font: 600 20px/1.2 var(--display); margin: 0 0 12px; }
.drawer h3 { font: 500 15px/1.2 var(--display); color: var(--ink-2); margin: 20px 0 8px; }
/* while editing, the board is centred in the space left of the side panel */
.editing .edit-area { padding-right: 320px; }
.palette { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.palette button { text-align: left; padding: 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); cursor: pointer; }
.palette button:hover { border-color: var(--ink-2); }
.palette b { display: block; font: 500 16px/1.2 var(--display); }
.palette small { color: var(--ink-2); font-size: 12px; }
.drawer-actions { display: flex; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.drawer textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); font: 13px/1.5 ui-monospace, Menlo, Consolas, monospace; resize: vertical; }
.hint { display: block; color: var(--ink-2); font-size: 12px; margin: 4px 0 8px; }
label.check { display: flex; gap: 8px; align-items: center; margin: 8px 0 14px; font-size: 14px; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sw { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--panel); box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; }
.sw[aria-pressed=true] { box-shadow: 0 0 0 2px var(--ink); }
.sw-default { background: conic-gradient(var(--amber) 0 50%, var(--panel-2) 0 100%); }
.swatches input[type=color], .range-row input[type=color], .gs-table input[type=color] { width: 34px; height: 30px; padding: 2px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); cursor: pointer; }
.range-row { display: grid; grid-template-columns: 1fr auto 1fr 40px 30px; gap: 6px; align-items: center; margin-bottom: 6px; }
.range-row .rng-name { grid-column: 1 / 5; grid-row: 2; min-width: 0; padding: 4px 8px; font-size: 13px; }
.range-row.rng-over input[type=number] { border-color: var(--warn, #E8A10C); }
.rng-warn { color: var(--warn, #E8A10C); margin: 0 0 8px; }
.range-row .btn { padding: 4px 8px; }
/* a graph's pins in the panel: one line each, edited in the pins table (0.99.73) */
.series-list { display: grid; gap: 6px; }
.series-line { display: grid; grid-template-columns: 12px 1fr; column-gap: 8px; align-items: center; text-align: left; width: 100%; padding: 7px 9px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); font: inherit; cursor: pointer; }
.series-line:hover { border-color: var(--accent); }
.series-dot { width: 12px; height: 12px; border-radius: 50%; grid-row: span 2; }
.series-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.series-where, .series-tags { grid-column: 2; font-size: 12px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.series-edit { justify-self: start; }
.gs-dialog .br-table td select, .gs-dialog .br-table td input[type=text] { width: 100%; min-width: 0; }
.gs-table td .gs-label { min-width: 120px; }
.gs-table td .gs-per { margin-top: 4px; }
.gs-table .gs-rng { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.gs-table .gs-rng-row td { background: var(--bg) !important; padding: 8px 12px 10px; }
.gs-table .gs-rng-row .series-rng { max-width: 560px; }
.gs-table tr.gs-focus td { box-shadow: inset 0 0 0 9999px color-mix(in srgb, var(--accent) 10%, transparent); }

/* modal dialogs */
dialog { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--ink); padding: 22px; width: min(420px, calc(100% - 32px)); }
dialog::backdrop { background: rgba(15, 20, 25, .45); }
dialog h2 { font: 600 22px/1.2 var(--display); margin: 0 0 6px; }
dialog p { color: var(--ink-2); margin: 0 0 14px; }
dialog .warn { color: var(--bad); }
dialog .drawer-actions { justify-content: flex-end; }

/* users page */
.badge { display: inline-block; font: 500 12px/1 var(--display); padding: 3px 7px; border-radius: 4px; background: var(--panel-2); color: var(--ink-2); margin-left: 6px; vertical-align: 2px; }
.badge.admin { background: var(--amber-soft); color: var(--ink); }
.badge.off { background: color-mix(in srgb, var(--bad) 18%, transparent); color: var(--bad); }
.adduser { display: grid; grid-template-columns: 1fr 1fr auto auto; gap: 10px; align-items: center; max-width: 720px; }
@media (max-width: 760px) { .adduser { grid-template-columns: 1fr; } }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--panel); padding: 10px 16px; border-radius: 8px; z-index: 50; font-size: 14px; }
.conn { font-size: 13px; color: var(--bad); }

/* ---------- small screens: widgets flow in 4 columns ---------- */
@media (max-width: 760px) {
  :root { --cell: 64px; --gap: 10px; }
  .bar { gap: 4px 10px; padding: 8px 12px 0; height: auto; flex-wrap: wrap; }
  .mark { font-size: 20px; }
  .bar-right { flex-wrap: nowrap; justify-content: flex-end; gap: 4px; margin-left: auto; min-width: 0; }
  .bar-right .btn { padding: 6px 10px; font-size: 15px; }
  .layout-pick { max-width: 120px; }
  .menu-btn { display: inline-flex; font-size: 20px; line-height: 1; padding: 4px 10px !important; }
  .bar-links { display: none; }
  .bar.menu-open .bar-links { display: flex; flex-direction: column; align-items: stretch; position: absolute; top: calc(100% - 2px); right: 8px; min-width: 200px; padding: 6px; gap: 2px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(15, 20, 25, .25); z-index: 30; }
  .bar.menu-open .bar-links .btn { text-align: left; padding: 10px 12px; font-size: 16px; }
  .bar.menu-open .bar-links .theme-btn { width: auto; height: auto; justify-content: flex-start; gap: 8px; }
  .bar.menu-open .bar-links .theme-btn::after { content: 'Theme'; }
  body { overflow-x: hidden; }
  .tabs { order: 3; flex-basis: 100%; padding-bottom: 6px; }
  .drawer { width: 100%; top: auto; height: var(--sheet, 45vh); border-left: 0; border-top: 1px solid var(--line); padding-top: 0; border-radius: 14px 14px 0 0; box-shadow: 0 -8px 24px rgba(15, 20, 25, .18); overscroll-behavior: contain; }
  body.sheet-min .drawer { overflow: hidden; }
  .drawer-top .sheet-handle { position: static; cursor: ns-resize; touch-action: none; align-self: stretch; }
  .sheet-handle .grip { position: absolute; top: 6px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 2px; background: var(--ink-2); opacity: .5; }
  .sheet-arrow::before { content: '▾'; color: var(--ink-2); }
  body.sheet-min .sheet-arrow::before { content: '▴'; }
  .editing .edit-area { padding-right: 0; }
  .editing .page { padding-bottom: calc(var(--sheet, 45vh) + 24px); }
  /* the page scrolls when a finger starts on a widget; a long press picks it up */
  .editing .w { touch-action: pan-x pan-y; }
  .editing .resize { touch-action: none; } /* a selected widget still scrolls the page: it moves only after a long press */
  .dev { grid-template-columns: 14px 1fr auto; }
  .dev .meta-wide { display: none; }
  .page { padding: 16px 12px 60px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
a.btn[aria-current] { background: var(--panel-2); }

/* pins page */
.pinrow { display: grid; grid-template-columns: 56px minmax(0, 1fr) 120px minmax(0, 150px) 190px 64px; gap: 12px; align-items: center; padding: 10px 18px; border-top: 1px solid var(--line); }
.pinrow:first-child { border-top: 0; }
.pinhead { font-size: 13px; color: var(--ink-2); padding-top: 12px; padding-bottom: 8px; }
.pin-no { font: 600 17px var(--display); font-variant-numeric: tabular-nums; }
.pin-val { display: flex; flex-direction: column; min-width: 0; font-variant-numeric: tabular-nums; }
.pin-val span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pin-val small { color: var(--ink-2); font-size: 12px; }
.pinrow .hint { margin: 3px 0 0; }
.pin-ud { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.pin-ud select { font-size: 12px; padding: 3px 4px; min-width: 0; }
@media (max-width: 760px) {
  .pinrow { grid-template-columns: 44px 1fr 104px; padding: 10px 12px; }
  .pinrow > :nth-child(4), .pinrow > :nth-child(5), .pinrow > :nth-child(6) { grid-column: 2 / -1; }
  .pinhead { display: none; }
}

/* theme button */
.bar-link, .bar-edit { display: inline-flex; align-items: center; gap: 4px; }
.bar-links .bar-link { padding-left: 8px; padding-right: 8px; }
.bar-ico { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.bar.icons:not(.menu-open) .bar-links .bl-text { display: none; }
.bar.icons:not(.menu-open) .bar-links .bar-link { padding-left: 9px; padding-right: 9px; }
.bar.menu-open .bar-links .bar-link { gap: 10px; }
.bar.menu-open .bar-links .bar-ico { width: 18px; height: 18px; }
.theme-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 34px; padding: 0; }
.theme-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

/* full-screen dashboard: no bar, edge to edge, rows sized to fit the screen */
body.kiosk .page { max-width: none; margin: 0; padding: var(--gap); }
body.kiosk { overflow-x: hidden; }
.kiosk-exit { position: fixed; top: 10px; right: 10px; z-index: 40; opacity: 0; pointer-events: none; transition: opacity .2s; box-shadow: 0 2px 10px rgba(0,0,0,.15); }
.kiosk-exit.show { opacity: 1; pointer-events: auto; }
body.kiosk .board { min-height: 0; }

/* graph widget: expand button, crosshair */
.graph canvas { cursor: crosshair; }
.graph-head .rng { display: inline-flex; align-items: center; gap: 6px; flex: none; }
.expand { border: 1px solid var(--line); background: var(--panel-2); border-radius: 5px; width: 24px; height: 22px; padding: 0; cursor: pointer; color: var(--ink-2); font-size: 13px; line-height: 1; }
.expand:hover { color: var(--ink); border-color: var(--ink-2); }

/* history viewer */
.hv { position: fixed; inset: 0; z-index: 60; background: rgba(15, 20, 25, .55); display: grid; place-items: center; padding: 20px; }
.hv-panel { width: min(1400px, 100%); height: min(860px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.hv-top { display: flex; align-items: center; justify-content: space-between; }
.hv-top h2 { font: 600 22px/1.2 var(--display); margin: 0; }
.hv-top .btn { font-size: 22px; line-height: 1; padding: 4px 12px; }
.hv-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.hv-presets { width: auto; flex-wrap: nowrap; }
.hv-presets .seg { flex: none; min-width: 48px; padding: 8px 10px; }
.hv-nav { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.hv-nav input[type=date] { width: auto; padding: 6px 8px; }
/* 0.99.86: from – to, periods, the whole window */
.hv-dates { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; max-width: 100%; }
.hv-dates input { width: 18ch; box-sizing: content-box; padding: 6px 8px; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) { .hv-dates input { width: 15ch; font-size: 13px; } }
.hv-period { width: auto; padding: 6px 8px; }
.hv-topbtns { display: flex; gap: 6px; align-items: center; }
.hv.hv-max { padding: 6px; }
.hv.hv-max .hv-panel { width: 100%; height: 100%; max-width: none; }
.hv-chart { min-height: 160px; }
.hv-chart { flex: 1; min-height: 0; position: relative; }
.hv-canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; touch-action: none; }
.hv-canvas:active { cursor: grabbing; }
.hv-status { font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; min-height: 18px; }
@media (max-width: 760px) {
  .hv { padding: 0; }
  .hv-panel { border-radius: 0; height: 100%; padding: 12px; }
  .hv-presets { overflow-x: auto; width: 100%; }
}
.hv { --w-accent: var(--amber); }

/* color widget */
.cp { width: 100%; display: flex; flex-direction: column; gap: 6px; }
.cp-head { display: flex; align-items: center; gap: 10px; position: relative; }
.cp-preview { width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--panel); box-shadow: 0 0 0 1px var(--line), 0 2px 10px rgba(0,0,0,.15); cursor: pointer; flex: none; }
.cp-native { position: absolute; left: 0; top: 0; width: 38px; height: 38px; opacity: 0; pointer-events: none; }
.cp-code { font: 500 16px var(--display); font-variant-numeric: tabular-nums; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp input[type=range] { -webkit-appearance: none; appearance: none; height: 16px; border-radius: 8px; background: var(--track, var(--panel-2)); border: 1px solid var(--line); margin: 0; accent-color: auto; }
.cp-hue { --track: linear-gradient(90deg, #f00, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00); }
.cp input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 2px solid #1D2733; box-shadow: 0 1px 4px rgba(0,0,0,.3); cursor: pointer; }
.cp input[type=range]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 2px solid #1D2733; cursor: pointer; }
.cp-swatches { display: flex; flex-wrap: wrap; gap: 5px; }
.cp-swatches .sw { width: 22px; height: 22px; }
@container (max-height: 150px) { .cp-swatches { display: none; } }

/* tabs widget */
.w-tabs { padding: 0 0 26px; }
.w-tabs > .w-body { display: block; }
.tabsw { height: 100%; display: flex; flex-direction: column; min-height: 0; }
.tabbar { display: flex; gap: 2px; padding: 6px 8px 0; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; flex: none; }
.tab-btn { border: 0; background: none; padding: 8px 12px; font: 500 15px/1 var(--display); color: var(--ink-2); border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.tab-btn[aria-selected=true] { color: var(--ink); border-bottom-color: var(--w-accent); }
.tab-scroll { flex: 1; min-height: 0; overflow: auto; padding: var(--gap); }
.board.inner { min-height: 0; }
.editing .board.inner { background-image: radial-gradient(circle at center, var(--hole) 0 3px, transparent 3.5px); background-size: calc((100% + var(--gap)) / var(--icols, 4)) calc(var(--cell) + var(--gap)); }
.tab-empty { color: var(--ink-2); font-size: 13px; padding: 8px 2px; }
.w-tabs > .w-label { bottom: 4px; }

/* device selector */
.selector { font: 500 16px var(--display); }

/* editor */
.layoutbar { padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.layoutbar .field { margin-bottom: 8px; }
.layoutbar .row .btn { flex: 1; }
.layout-pick { width: auto; padding: 6px 8px; font-size: 14px; }
.hidden-list { display: flex; flex-wrap: wrap; gap: 6px; }
.sel-list { margin: 0 0 8px; padding-left: 18px; color: var(--ink-2); font-size: 14px; }
.dev-checks .check { margin: 4px 0; }
.tab-row { grid-template-columns: 1fr 34px 34px; }
.w-selector { padding: 8px 12px 24px; }
.w-selector .selector { padding: 4px 8px; height: 34px; }
.w-selector .w-label { bottom: 4px; }

/* dragging into / out of tabs */
.editing .w.drag-out { opacity: .45; }
.editing .w.drop-into { border-color: var(--amber); border-style: solid; box-shadow: 0 0 0 3px var(--amber), 0 0 0 9px color-mix(in srgb, var(--amber) 22%, transparent); }
.editing .w.drop-into .tab-scroll { background: color-mix(in srgb, var(--amber) 10%, transparent); }
.editing .board.drop-into { outline: 3px dashed var(--amber); outline-offset: 4px; border-radius: 8px; }
.tab-btn.drop-into { background: var(--amber); color: #1D2733; border-radius: 6px 6px 0 0; }
.ghost-cell { background: color-mix(in srgb, var(--amber) 18%, transparent); }

/* ---------- settings ---------- */
.settings .card, .card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; margin-bottom: 20px; max-width: 760px; }
.card h2 { font: 600 20px/1.2 var(--display); margin: 0 0 10px; }
.card h3 { font: 600 16px/1.2 var(--display); margin: 20px 0 6px; }
.row.wrap { flex-wrap: wrap; }
.row.wrap > * { min-width: 200px; }
.tg-ok { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; flex: 1 0 auto !important; }
.tg-ok code, .chat-row code { font: 13px ui-monospace, Menlo, Consolas, monospace; background: var(--bg); padding: 2px 6px; border-radius: 4px; }
.chats { margin-top: 12px; }
.chat-row { display: grid; grid-template-columns: 1fr auto auto auto; gap: 10px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--line); }
.chat-row:first-child { border-top: 0; }
.chat-row .name { font: 500 16px/1.2 var(--display); }
.chat-row .meta { color: var(--ink-2); font-size: 13px; }
@media (max-width: 640px) { .chat-row { grid-template-columns: 1fr auto; } }

/* ---------- share dialog ---------- */
.shares { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.share-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "who pins rm" "how how how"; gap: 6px 8px; align-items: center; }
.share-row > b { grid-area: who; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-row > select { grid-area: how; }
.share-row > .sp-toggle { grid-area: pins; }
.share-row > .danger { grid-area: rm; }
.share-add { display: grid; grid-template-columns: minmax(90px, 1fr) minmax(0, 150px) auto; gap: 8px; align-items: center; margin-top: 8px; }
.share-row > b .badge { margin-left: 6px; }
.share-item { border: 1px solid var(--line); border-radius: 8px; padding: 8px; margin: 4px 0; }
.share-pins { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.sp-list { display: flex; flex-direction: column; gap: 4px; max-height: 300px; overflow-y: auto; }
.sp-tools { display: flex; flex-direction: column; gap: 6px; padding: 6px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.sp-findrow { display: flex; gap: 8px; align-items: center; }
.sp-find { flex: 1; min-width: 0; }
.sp-count { flex: none; margin: 0; }
.sp-bulk, .sp-range { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sp-bulk .hint, .sp-range .hint { margin: 0; }
.sp-bulk .btn, .sp-range .btn { padding: 4px 9px; font-size: 13px; }
.share-pins .sp-range input.sp-n { width: 62px; flex: none; padding-left: 6px; padding-right: 4px; }
.share-pins .sp-range select { width: auto; flex: 1 1 130px; min-width: 0; }
.share-pins .sp-range .btn { flex: none; }
.share-pins .sp-bulk .btn { flex: none; }
.share-pins .hint { margin: 0 0 4px; }
.sp-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 90px) 170px; gap: 8px; align-items: center; font-size: 14px; }
.sp-pin { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-val { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.share-pins > select { justify-self: start; }
@media (max-width: 560px) {
  .sp-row { grid-template-columns: minmax(0, 1fr) 150px; }
  .sp-val { display: none; }
}

/* ---------- server-side widgets ---------- */
.dot.bad { background: var(--bad); }
.srv, .bridge, .notify { width: 100%; height: 100%; display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.srv-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.srv-state { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-2); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srv-state .dot { flex: none; width: 8px; height: 8px; }
.srv-test { padding: 3px 10px; font-size: 13px; flex: none; }
.srv-log { flex: 1; }
.log .fail span { color: var(--bad); }
.bridge, .notify { justify-content: center; }
.bridge-route { display: flex; align-items: center; gap: 8px; font: 500 14px/1.2 var(--display); color: var(--ink-2); min-width: 0; }
.bridge-route span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bridge-route b { color: var(--w-accent); font-size: 18px; }
.bridge .big { font-size: clamp(18px, min(16cqw, 30cqh), 40px); }
.notify-last { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notify-last time { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.notify .btn { align-self: flex-start; padding: 4px 10px; font-size: 13px; }
.notify .srv-state { white-space: normal; align-items: flex-start; }
.notify .srv-state .dot { margin-top: 5px; }

/* ---------- background widgets ---------- */
.bg-list { display: flex; flex-direction: column; gap: 6px; }
.bg-item { display: grid; grid-template-columns: 10px 1fr; column-gap: 10px; align-items: center; text-align: left; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); cursor: pointer; color: inherit; font: inherit; }
.bg-item:hover { border-color: var(--ink-2); }
.bg-item b { font: 500 15px/1.2 var(--display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bg-item small { grid-column: 2; color: var(--ink-2); font-size: 12px; }
.activity { height: 260px; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--panel); display: flex; container-type: size; --w-accent: var(--amber); }
.activity > * { flex: 1; }
.activity .big { font-size: 28px; }
dialog.wview { width: min(620px, calc(100% - 32px)); }
.wview-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.wview-head h2 { margin: 0; }
.wview-head .btn { font-size: 20px; line-height: 1; padding: 4px 10px; }
.activity.popup { height: min(60vh, 440px); }

.w-compact .w-body { align-items: stretch; }
.ctile { width: 100%; height: 100%; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 0; border-radius: 6px; }
.ctile:hover { background: var(--panel-2); }
.ct-top { position: relative; display: block; }
.ct-icon { width: 26px; height: 26px; fill: none; stroke: var(--w-accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; display: block; }
.w-telegram .ct-icon path { fill: var(--w-accent); stroke: none; }
.ct-top .dot { position: absolute; right: -6px; top: -4px; width: 9px; height: 9px; border: 2px solid var(--panel); box-sizing: content-box; }
.ct-text { font: 500 13px/1 var(--display); color: var(--ink-2); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.w-compact { padding: 6px 6px 24px; }
.w-compact .w-label { left: 6px; right: 6px; bottom: 5px; font-size: calc(var(--lab-fs, 14px) * .86); text-align: center; }
.w-compact .w-pin { display: none; }
.bg-list { margin-bottom: 22px; }

.pin-hist { display: flex; flex-direction: column; font-size: 13px; font-variant-numeric: tabular-nums; align-items: flex-start; }
.pin-hist small { color: var(--ink-2); font-size: 12px; }
.linkish { border: 0; background: none; padding: 0; font: inherit; font-size: 12px; cursor: pointer; text-decoration: underline; color: var(--ink-2); }
.linkish.danger { color: var(--bad); }

/* ---------- server page ---------- */
.server .card { max-width: none; }
/* quick-jump list beside Settings and Server (pagetoc.js) */
.page.has-toc { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 28px; align-items: start; max-width: 1460px; }
.ptoc-box { position: sticky; top: 72px; max-height: calc(100vh - 92px); overflow-y: auto; font-size: 14px; padding-top: 6px; }
.ptoc-title { font-weight: 700; margin: 0 0 6px; }
.ptoc-back { display: block; margin: 0 0 14px; padding: 6px 8px; border-radius: 6px; color: var(--ink); text-decoration: none; font-weight: 600; }
.ptoc-back:hover { background: var(--panel-2); }
.ptoc { list-style: none; margin: 0; padding: 0 0 0 10px; border-left: 2px solid var(--line); }
.ptoc li a { display: block; padding: 4px 8px; color: var(--ink-2); text-decoration: none; border-radius: 6px; line-height: 1.3; }
.ptoc li a:hover { color: var(--ink); background: var(--panel-2); }
.ptoc li a[aria-current] { color: var(--ink); background: var(--panel-2); font-weight: 600; }
.ptoc-jump { display: none; }
@media (max-width: 760px) {
  .page.has-toc { display: block; }
  .ptoc-box { display: none; }
  .ptoc-jump { display: block; width: 100%; margin: 0 0 14px; }
}
.server-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 20px; align-items: start; }
.server-cols .card { margin-bottom: 0; }
.server-cols + .card { margin-top: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.card-head h2 { margin: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat span { font: 500 13px/1.2 var(--display); color: var(--ink-2); }
.stat b { font: 500 26px/1.15 var(--display); font-variant-numeric: tabular-nums; }
.stat small { color: var(--ink-2); font-size: 12px; }
.stat.bad { border-color: var(--bad); }
.stat.bad b { color: var(--bad); }
.chart-card canvas { width: 100%; height: 200px; display: block; }
.chart-card .legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--ink-2); }
.chart-card .lg { display: inline-flex; align-items: center; gap: 6px; }
.chart-card .lg i { width: 12px; height: 3px; border-radius: 2px; display: inline-block; }
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.tbl th { text-align: left; font: 500 13px var(--display); color: var(--ink-2); padding: 6px 10px 6px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 7px 10px 7px 0; border-bottom: 1px solid var(--panel-2); white-space: nowrap; }
.tbl td.actions { text-align: right; }
.tbl td.actions .btn { padding: 4px 9px; font-size: 13px; }
.tbl .dot { display: inline-block; }
.bad-text { color: var(--bad); text-decoration: underline dotted; cursor: help; }
.row.wrap3 { flex-wrap: wrap; }
.row.wrap3 > * { min-width: 120px; }
.staged { border-color: var(--amber); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; font-size: 14px; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; word-break: break-all; }
.tbl td small.hint { display: inline; margin: 0; }

/* clock widget */
.clock { width: max-content; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; white-space: nowrap; flex: none; transform-origin: center; }
.clock-time { font: 500 30px/1 var(--display); font-variant-numeric: tabular-nums; letter-spacing: -.01em; color: var(--w-text, var(--ink)); }
.clock-date { font: 500 12px/1.2 var(--display); color: var(--ink-2); }
.clock-zone { font-size: 9px; color: var(--ink-2); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 16px; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.stack .card { margin-bottom: 0; }
.server-cols + .server-cols { margin-top: 20px; }
select.mini { font-size: 12px; padding: 2px 4px; margin: 3px 0; width: 100%; max-width: 200px; }
.tabs { min-width: 0; overflow: hidden; }
.tabs .tab { flex: none; }
.tabs.squeeze .tab[aria-current] { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 0 1 auto; min-width: 6ch; }
.proj-new { width: 100%; justify-content: flex-start; margin-top: 4px; border-top: 1px solid var(--line); border-radius: 0; }
.tab-more { color: var(--ink); white-space: nowrap; }
.proj-menu { position: fixed; z-index: 40; width: 280px; max-height: min(70vh, 480px); display: flex; flex-direction: column; gap: 8px; padding: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(15, 20, 25, .2); }
.proj-menu input { width: 100%; padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: inherit; }
.proj-list { overflow-y: auto; display: flex; flex-direction: column; }
.proj-list a { padding: 8px 10px; border-radius: 6px; text-decoration: none; font: 500 16px/1.2 var(--display); color: var(--ink); }
.proj-list a:hover, .proj-list a.cur { background: var(--panel-2); }
.help-btn { padding: 4px 10px; font-size: 13px; }
dialog.wide { width: min(760px, calc(100% - 32px)); }
.code-wrap { position: relative; }
.code-wrap pre.code { white-space: pre; max-height: 50vh; overflow: auto; user-select: text; padding-right: 64px; }
.code-copy { position: absolute; top: 6px; right: 6px; padding: 3px 9px; font-size: 12px; background: var(--panel); }
.guide { display: grid; grid-template-columns: 150px 1fr; gap: 16px; min-height: 340px; }
.guide-list { display: flex; flex-direction: column; gap: 2px; border-right: 1px solid var(--line); padding-right: 10px; overflow-y: auto; max-height: 60vh; }
.guide-list button { text-align: left; border: 0; background: none; padding: 6px 8px; border-radius: 6px; cursor: pointer; font: 500 15px/1.2 var(--display); color: var(--ink-2); }
.guide-list button[aria-selected="true"] { background: var(--panel-2); color: var(--ink); }
.guide-body h3 { margin: 0 0 6px; font: 600 18px/1.2 var(--display); }
@media (max-width: 640px) { .guide { grid-template-columns: 1fr; } .guide-list { flex-direction: row; flex-wrap: wrap; border-right: 0; max-height: none; } }

/* ---------- display styles ---------- */
/* 7-segment and LCD */
.segwrap { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 2px; }
.segdisp { flex: 1; height: 100%; max-height: 120px; min-width: 0; display: flex; align-items: center; justify-content: center; border-radius: 6px; padding: 6% 5%; }
.segdisp.segfit { flex: none; max-height: none; box-sizing: border-box; } /* sized by the Value widget (fit) */
.segwrap.seg7 .segdisp { background: #0C0E11; box-shadow: inset 0 2px 6px rgba(0,0,0,.6); }
.seg7 { width: 100%; height: 100%; overflow: visible; }
.segwrap.seg7 .seg7 .on { fill: var(--seg, var(--w-accent)); filter: drop-shadow(0 0 3px var(--seg, var(--w-accent))); }
.segwrap.seg7 .seg7 .off { fill: var(--seg, var(--w-accent)); opacity: .07; }
.segwrap.lcd .segdisp { background: linear-gradient(180deg, #C5D3A4, #AFBF8C); box-shadow: inset 0 2px 5px rgba(0,0,0,.35); border: 2px solid #5D6650; }
.segwrap.lcd .seg7 .on { fill: var(--seg, #1C2614); }
.segwrap.lcd .seg7 .off { fill: #1C2614; opacity: .07; }
.seg-unit { font: 500 clamp(12px, 9cqh, 20px)/1 var(--display); color: var(--ink-2); align-self: flex-end; margin-bottom: 8%; }

/* digit boxes */
.flipwrap { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; height: 100%; }
.flipdigits { display: flex; gap: 4px; align-items: center; font: 600 min(46cqh, 21cqw, 64px)/1 var(--display); }
.flipdigits .cell { position: relative; display: flex; align-items: center; justify-content: center; min-width: .72em; padding: .12em .1em; border-radius: 6px; background: linear-gradient(180deg, #2B323B 0 50%, #232931 50% 100%); color: var(--flip, #F4F6F8); font: inherit; font-variant-numeric: tabular-nums; box-shadow: 0 2px 4px rgba(0,0,0,.25); }
.flipdigits .cell::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: rgba(0,0,0,.55); }
.flipdigits .sep { display: flex; align-items: center; color: var(--ink-2); }
.flip-unit { font: 500 clamp(12px, 10cqh, 20px)/1 var(--display); color: var(--ink-2); align-self: flex-end; margin-bottom: 6%; }

/* colored tile */
.vtile { width: 100%; height: 100%; border-radius: 6px; background: var(--tile, var(--w-accent)); color: #1D2733; display: flex; align-items: center; justify-content: center; transition: background .3s; }
.vtile .big small { color: inherit; opacity: .75; }

/* gauge styles */
.gauge.dial .face { fill: var(--panel-2); stroke: var(--line); }
.gauge .tick { stroke: var(--ink-2); stroke-width: .8; }
.gauge .tick.major { stroke: var(--ink); stroke-width: 1.6; }
.gauge.dial .lim { font-size: 8px; }
.gauge .needle { transition: transform .5s cubic-bezier(.3, 1.4, .5, 1); }
.gauge .needle path { fill: var(--w-accent); }
.gauge .needle circle { fill: var(--ink); }
.gauge.segs .seg { stroke: var(--panel-2); transition: stroke .2s; }
.gauge.segs .seg.on { stroke: var(--w-accent); }
.gauge.ring .fill, .gauge.half .fill { transition: stroke-dashoffset .3s; }

/* LED styles */
.ledstatus { width: 100%; height: 100%; display: flex; align-items: center; justify-content: flex-end; gap: 8px; color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; }
.ledstatus .sl-dot { width: 11px; height: 11px; border-radius: 50%; background: #555; flex: none; }
.ledstatus .sl-dot.ok { background: #2E9E5B; box-shadow: 0 0 6px #2E9E5B; }
.ledstatus .sl-dot.bad { background: #C2412D; }
.ledstatus .sl-dot.on { background: var(--c); box-shadow: 0 0 6px var(--c); }
.ledstatus .sl-net { margin-right: 10px; }
.ledwrap { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.ledicon { height: 90%; width: auto; max-width: 100%; max-height: 120px; overflow: visible; transition: filter .2s; }
.ledwrap.on .ledicon { filter: drop-shadow(0 0 7px var(--c)) drop-shadow(0 0 2px var(--c)); }
.ledicon.icon-led .body, .ledicon.icon-led .rim { fill: color-mix(in srgb, var(--c) 30%, #6B7178); transition: fill .15s; }
.ledicon.icon-led .rim { filter: brightness(.85); }
.ledwrap.on .ledicon.icon-led .body, .ledwrap.on .ledicon.icon-led .rim { fill: var(--c); }
.ledicon .leg { fill: #A3ABB4; }
.ledicon .shine { fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; opacity: .45; }
.ledicon.icon-bulb .body { fill: rgba(190, 200, 210, .22); stroke: var(--ink-2); stroke-width: 1.5; transition: fill .15s; }
.ledwrap.on .ledicon.icon-bulb .body { fill: color-mix(in srgb, var(--c) 75%, #fff); stroke: color-mix(in srgb, var(--c) 70%, #000); }
.ledicon.icon-bulb .filament { fill: none; stroke: #7E858D; stroke-width: 1.6; stroke-linejoin: round; }
.ledwrap.on .ledicon.icon-bulb .filament { stroke: #FFF7D6; }
.ledicon.icon-bulb .base { fill: #9AA3AD; }
.lamp { width: min(78%, 74px); aspect-ratio: 1; border-radius: 50%; padding: 12%; background: radial-gradient(circle at 35% 30%, #E9EDF0, #8D959E 60%, #5E656D); box-shadow: 0 2px 4px rgba(0,0,0,.3); }
.lamp i { display: block; width: 100%; height: 100%; border-radius: 50%; background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.35), transparent 40%), color-mix(in srgb, var(--c) 22%, #1C2128); box-shadow: inset 0 2px 5px rgba(0,0,0,.6); transition: background .15s, box-shadow .15s; }
.ledwrap.on .lamp i { background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.7), transparent 45%), var(--c); box-shadow: inset 0 -2px 6px rgba(0,0,0,.25), 0 0 16px var(--c); }
.ringled { width: min(62%, 64px); aspect-ratio: 1; border-radius: 50%; border: 6px solid color-mix(in srgb, var(--c) 22%, var(--panel-2)); transition: border-color .15s, box-shadow .15s; }
.ledwrap.on .ringled { border-color: var(--c); box-shadow: 0 0 12px var(--c), inset 0 0 10px color-mix(in srgb, var(--c) 60%, transparent); }
.textled { padding: 6px 14px; border-radius: 999px; font: 600 clamp(13px, 22cqh, 22px)/1 var(--display); letter-spacing: .04em; background: var(--panel-2); color: var(--ink-2); border: 1px solid var(--line); transition: background .15s, color .15s; white-space: nowrap; }
.ledwrap.on .textled { background: var(--c); color: #fff; border-color: transparent; box-shadow: 0 0 10px color-mix(in srgb, var(--c) 50%, transparent); text-shadow: 0 1px 1px rgba(0,0,0,.25); }

/* progress */
.prog2 { width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: center; gap: 8px; min-height: 0; }
.prog2 .big { font-size: clamp(16px, min(14cqw, 26cqh), 30px); }
.prog2.v { align-items: center; padding-top: 2px; }
.ptrack { position: relative; display: flex; background: var(--panel-2); border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.prog2.h .ptrack { height: 16px; }
.prog2.v .ptrack { flex: 1; width: min(48px, 70%); min-height: 30px; flex-direction: column; }
.pfill { background: var(--w-accent); transition: width .3s, height .3s; position: relative; }
.prog2.h .pfill { height: 100%; width: 0; }
.prog2.v .pfill { position: absolute; left: 0; right: 0; bottom: 0; height: 0; }
.ptrack.segments { background: none; border: 0; gap: 3px; border-radius: 0; overflow: visible; }
.prog2.h .ptrack.segments { height: 18px; }
.ptrack.segments i { flex: 1; background: var(--panel-2); border-radius: 2px; transition: background .15s; }
.ptrack.segments i.on { background: var(--w-accent); box-shadow: 0 0 5px color-mix(in srgb, currentColor 0%, transparent); }
.ptrack.tank { border-radius: 14px; border: 2px solid color-mix(in srgb, var(--ink-2) 60%, transparent); }
.prog2.h .ptrack.tank { height: 26px; }
.ptrack.tank .pfill { background-image: linear-gradient(90deg, rgba(255,255,255,.18), transparent 40%, rgba(0,0,0,.12)); }
.prog2.v .ptrack.tank .wave { position: absolute; top: -5px; left: 0; width: 200%; height: 10px; background: radial-gradient(ellipse 12px 5px at 12px 5px, rgba(255,255,255,.35) 98%, transparent) repeat-x 0 0 / 24px 10px; animation: wave 2.4s linear infinite; }
@keyframes wave { to { transform: translateX(-24px); } }
@media (prefers-reduced-motion: reduce) { .ptrack.tank .wave { animation: none; } }

/* vertical slider */
.slider.vert { height: 100%; align-items: center; }

/* vertical tabs */
.tabsw.left { flex-direction: row; }
.tabsw.left .tabbar { flex-direction: column; border-bottom: 0; border-right: 1px solid var(--line); padding: 8px 0 8px 4px; overflow-x: hidden; overflow-y: auto; max-width: 40%; }
.tabsw.left .tab-btn { border-bottom: 0; border-right: 2px solid transparent; text-align: left; overflow: hidden; text-overflow: ellipsis; }
.tabsw.left .tab-btn[aria-selected=true] { border-right-color: var(--w-accent); background: color-mix(in srgb, var(--w-accent) 8%, transparent); }
.tabsw.left .tab-btn.drop-into { border-radius: 6px 0 0 6px; }

.ledwrap .led { flex: none; }
.ledwrap.on .led { background: var(--c, var(--amber)); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c, var(--amber)) 30%, transparent), 0 0 22px var(--c, var(--amber)); }
.clock-season { font-size: 9px; color: var(--ink-2); }
.clock-season.summer { color: var(--amber); }

/* two-factor, display links */
.qr { width: 180px; height: 180px; flex: none; border-radius: 6px; image-rendering: pixelated; }
.qr-box { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.qr-box > div { flex: 1; min-width: 200px; }
code.secret { font: 600 14px ui-monospace, Menlo, Consolas, monospace; background: var(--bg); padding: 2px 6px; border-radius: 4px; word-break: break-all; user-select: all; }
pre.code.recovery { column-count: 2; font-size: 15px; }
.links { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 4px; }
.link-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); }
.link-btns { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; flex: none; }
@media (max-width: 560px) { .link-row { flex-wrap: wrap; } .link-btns { width: 100%; } }
.link-new { margin-top: 12px; }
code.link-url { display: block; font: 13px ui-monospace, Menlo, Consolas, monospace; background: var(--bg); padding: 8px; border-radius: 6px; word-break: break-all; user-select: all; }
body.display.nocursor, body.display.nocursor * { cursor: none !important; }
body.display-ro .w-button .key, body.display-ro .w-slider .sl, body.display-ro .w-input input, body.display-ro .w-input textarea, body.display-ro .w-input button,
body.display-ro .w-menu button, body.display-ro .w-menu select, body.display-ro .w-color button, body.display-ro .w-color input,
body.display-ro .w-terminal input { pointer-events: none; }
body.display-ro .w-terminal input { display: none; }
dialog:has(.links), dialog:has(.qr-box) { width: min(640px, calc(100% - 32px)); }

@media (min-width: 761px) {
  .menu-btn, .sheet-handle .grip, .sheet-arrow { display: none; }
  .bar-links { display: flex; gap: 2px; align-items: center; }
}
@media (max-width: 760px) {
  .editing .resize { width: 34px; height: 34px; }
  @container (max-width: 70px) { .editing .resize { width: 16px; height: 16px; } .editing .resize::after { right: 3px; bottom: 3px; width: 6px; height: 6px; } } /* a tiny tile: the rest of it moves the widget */
}

/* buttons: long presses must not select text or open the callout menu (phones) */
.w-button, .w-button * { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
.key.push { touch-action: none; }

/* motion widget */
.motion { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--ink-2); min-height: 0; }
.motion .m-art { flex: 1; min-height: 0; width: 100%; max-height: 100%; overflow: visible; }
.motion.running { color: var(--w-accent); }
.motion .m-state { font: 500 clamp(11px, min(7cqw, 12cqh), 16px)/1.2 var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; color: var(--ink-2); }
.motion.running .m-state { color: var(--ink); }
.m-art .m-line { fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.m-art .m-line.thin { stroke-width: 1.6; opacity: .6; }
.m-art .m-line.thick { stroke-width: 7; }
.m-art .m-fill { fill: color-mix(in srgb, currentColor 20%, transparent); stroke: currentColor; stroke-width: 2.5; stroke-linejoin: round; }
.m-art .m-solid { fill: currentColor; }
.m-art .m-tire { fill: none; stroke: currentColor; stroke-width: 8; }
.m-art .m-belt { fill: none; stroke: currentColor; stroke-width: 4; stroke-dasharray: 7 5; }
.motion.stopped:not(.stop-calm) { color: var(--bad); }
.motion.stopped:not(.stop-calm) .m-state { color: var(--bad); font-weight: 600; }
.motion.stopped.stop-blink .m-art, .motion.stopped.stop-blink .m-state { animation: m-blink 1s steps(1, end) infinite; }
.motion.stopped.stop-pulse .m-art { animation: m-pulse 2s ease-in-out infinite; }
.motion.stopped:not(.stop-calm) .m-art { filter: drop-shadow(0 0 6px color-mix(in srgb, var(--bad) 55%, transparent)); }
@keyframes m-blink { 50% { opacity: .2; } }
@keyframes m-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .motion.stopped .m-art, .motion.stopped .m-state { animation: none !important; } }

/* button: real switches (slide, rocker, lever), horizontal or vertical */
.key.tg { border: 0; background: none; box-shadow: none; max-height: none; flex-direction: column; gap: 6px; color: var(--ink-2); padding: 0; font: 600 clamp(11px, min(8cqw, 10cqh), 16px)/1.1 var(--display); }
.key.tg:active { transform: none; }
.key.tg.on { color: var(--ink); }
.key.tg:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }
.tg-body { position: relative; display: block; flex: none; transition: background .15s, box-shadow .15s; }
.tg-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
/* slide */
.tg-slide.tg-h .tg-body { height: min(calc(var(--av) * .85), calc(var(--bw) * .45), 64px); aspect-ratio: 2 / 1; }
.tg-slide.tg-v .tg-body { width: min(calc(var(--av) * .5), calc(var(--bw) * .7), 52px); aspect-ratio: 1 / 2; }
.tg-slide .tg-body { border-radius: 999px; background: var(--k-off, var(--hole)); box-shadow: inset 0 2px 4px rgba(0, 0, 0, .25); }
.tg-slide.on .tg-body { background: var(--k-on); }
.tg-knob { position: absolute; top: 8%; left: 4%; height: 84%; aspect-ratio: 1; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0, 0, 0, .35); transition: transform .18s cubic-bezier(.3, .7, .4, 1.2); }
.tg-slide.tg-v .tg-knob { top: auto; bottom: 4%; left: 8%; width: 84%; height: auto; }
.tg-slide.tg-h.on .tg-knob { transform: translateX(119%); }
.tg-slide.tg-v.on .tg-knob { transform: translateY(-119%); }
/* rocker: lit paddle, the pressed side is lower */
.tg-rocker.tg-v .tg-body { height: min(var(--av), calc(var(--bw) * 1.5), 130px); aspect-ratio: 2 / 3; }
.tg-rocker.tg-h .tg-body { width: min(calc(var(--av) * 1.66), var(--bw), 170px); aspect-ratio: 5 / 3; }
.tg-rocker .tg-body { border-radius: 8px; background: #1d232b; padding: 7%; box-shadow: 0 2px 6px rgba(0, 0, 0, .35); }
.tg-paddle { display: flex; width: 100%; height: 100%; border-radius: 5px; overflow: hidden; background: var(--k-off, #5b6570); color: rgba(255, 255, 255, .85); transition: background .15s, box-shadow .15s; }
.tg-v .tg-paddle { flex-direction: column; }
.tg-h .tg-paddle { flex-direction: row-reverse; }
.tg-paddle b { flex: 1; display: grid; place-items: center; font: 700 clamp(10px, 9cqh, 22px)/1 var(--display); transition: background .15s; }
.tg-paddle .tg-o { background: linear-gradient(rgba(0, 0, 0, .35), rgba(0, 0, 0, .05)); }
.tg-paddle .tg-i { background: linear-gradient(rgba(255, 255, 255, .22), rgba(255, 255, 255, 0)); }
.tg-h .tg-paddle .tg-o { background: linear-gradient(90deg, rgba(0, 0, 0, .35), rgba(0, 0, 0, .05)); }
.tg-h .tg-paddle .tg-i { background: linear-gradient(90deg, rgba(255, 255, 255, .22), rgba(255, 255, 255, 0)); }
.tg-rocker.on .tg-paddle { background: var(--k-on); color: var(--k-on-text); box-shadow: 0 0 14px color-mix(in srgb, var(--k-on) 60%, transparent); }
.tg-rocker.on .tg-paddle .tg-i { background: linear-gradient(rgba(0, 0, 0, .3), rgba(0, 0, 0, .05)); }
.tg-rocker.on .tg-paddle .tg-o { background: linear-gradient(rgba(255, 255, 255, .25), rgba(255, 255, 255, 0)); }
.tg-rocker.tg-h.on .tg-paddle .tg-i { background: linear-gradient(270deg, rgba(0, 0, 0, .3), rgba(0, 0, 0, .05)); }
.tg-rocker.tg-h.on .tg-paddle .tg-o { background: linear-gradient(270deg, rgba(255, 255, 255, .25), rgba(255, 255, 255, 0)); }
/* lever toggle switch on a metal plate */
.tg-lever.tg-v .tg-body { height: min(var(--av), calc(var(--bw) * 1.66), 140px); aspect-ratio: 3 / 5; }
.tg-lever.tg-h .tg-body { width: min(calc(var(--av) * 1.66), var(--bw), 180px); aspect-ratio: 5 / 3; }
.tg-lever .tg-body { border-radius: 8px; background: linear-gradient(135deg, #d9dee3, #9aa3ad); box-shadow: 0 2px 6px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .6); }
.tg-nut { position: absolute; left: 50%; top: 50%; width: 30%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; background: radial-gradient(circle at 35% 35%, #f4f6f8, #7d8792 70%); box-shadow: 0 1px 3px rgba(0, 0, 0, .4); }
.tg-h .tg-nut { width: auto; height: 30%; }
.tg-lever .tg-bat { position: absolute; left: 50%; top: 50%; width: 16%; height: 32%; margin-left: -8%; transform-origin: 50% 100%; transform: translateY(-100%) rotate(180deg); transition: transform .16s ease-out; border-radius: 40% 40% 20% 20%; background: linear-gradient(90deg, #8d97a2, #f5f7f9 45%, #8d97a2); box-shadow: 0 2px 4px rgba(0, 0, 0, .35); }
.tg-lever.tg-v.on .tg-bat { transform: translateY(-100%) rotate(0deg); }
.tg-lever.tg-h .tg-bat { left: 50%; top: 50%; margin: 0; width: 32%; height: 16%; transform-origin: 0 50%; transform: translateY(-50%) rotate(180deg); border-radius: 20% 40% 40% 20%; background: linear-gradient(#8d97a2, #f5f7f9 45%, #8d97a2); }
.tg-lever.tg-h.on .tg-bat { transform: translateY(-50%) rotate(0deg); }
.tg-lbl { position: absolute; font: 700 clamp(8px, 6cqh, 13px)/1 var(--display); color: #3b434c; letter-spacing: .04em; }
.tg-v .tg-lon { top: 6%; left: 0; right: 0; text-align: center; }
.tg-v .tg-loff { bottom: 6%; left: 0; right: 0; text-align: center; }
.tg-h .tg-lon { right: 6%; top: 50%; transform: translateY(-50%); }
.tg-h .tg-loff { left: 6%; top: 50%; transform: translateY(-50%); }
.tg-lamp { position: absolute; width: 9%; aspect-ratio: 1; border-radius: 50%; background: #5d646c; box-shadow: inset 0 1px 2px rgba(0, 0, 0, .5); }
.tg-v .tg-lamp { right: 10%; top: 50%; transform: translateY(-50%); }
.tg-h .tg-lamp { width: auto; height: 9%; left: 50%; top: 9%; transform: translateX(-50%); }
.tg-lever.on .tg-lamp { background: var(--k-on); box-shadow: 0 0 8px var(--k-on), 0 0 2px var(--k-on); }

/* ---------- small tiles: every widget must fit (checked at 1×1 … 4×3 on phone and desktop) ---------- */
/* Space the body really has (container units already exclude the tile padding). */
.w-body { --bw: 100cqw; --bh: 100cqh; }
@container (max-width: 110px) {
  .w-body { margin-inline: -9px; --bw: calc(100cqw + 18px); }
  .w-label { left: 5px; right: 5px; text-align: center; }
}
@container (max-width: 60px) { .w-label { left: 2px; right: 2px; } } /* very narrow tiles (8 columns on a phone): the whole width */
@container (max-height: 100px) {
  .w-body { margin-top: -7px; margin-bottom: -10px; --bh: calc(100cqh + 17px); }
  .w-label { bottom: 3px; font-size: calc(var(--lab-fs, 14px) * .8); }
  .w-pin { bottom: 3px; }
}
.w-compact .w-body, .w-selector .w-body { margin: 0 !important; }
/* Those negative margins reclaim the label's space on short tiles. Widgets
 * without a label and with less padding of their own (picture 6 px, graph,
 * tabs) have nothing to reclaim: the body would reach past the tile and its
 * picture be cut off at the bottom (a logo on a TV page). */
.w-picture.nofoot > .w-body, .w-graph.nofoot > .w-body, .w-tabs.nofoot > .w-body { margin-top: 0; margin-bottom: 0; --bh: 100cqh; }
/* buttons */
.key { min-width: 0; overflow: hidden; }
.key .k-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.key:not(.tg) { font-size: min(18px, max(11px, calc(var(--bw) * .2))); padding-inline: 4px; }
@container (max-width: 120px) {
  .key.look-indicator { flex-direction: column; gap: 5px; }
  .key.look-indicator::before { width: 10px; height: 10px; }
}
.key.tg { --av: calc(var(--bh) - 26px); }
@container (max-height: 120px) {
  .key.tg { --av: var(--bh); }
  .key.tg .tg-text { display: none; }
}
@container (max-width: 80px) { .tg-lbl { display: none; } }
@container (max-height: 100px) { .tg-lbl { display: none; } }
/* LED */
.led { width: min(40%, 64px, calc(var(--bh) * .8)); }
.lamp { width: min(78%, 74px, var(--bh)); }
.ringled { width: min(62%, 64px, calc(var(--bh) * .85)); }
@container (max-height: 100px) { .ringled { border-width: 4px; } .lamp { padding: 9%; } }
/* big numbers can get smaller in tiny tiles */
.big { font-size: clamp(11px, min(22cqw, 38cqh), 60px); }
/* the Value widget fills its tile (a huge tile with a small number); a long value is scaled down to fit (fitInside) */
.w-value .big { font-size: clamp(11px, min(30cqw, 55cqh), 260px); line-height: .78; padding-bottom: .04em; } /* the box hugs the digits, so they can fill the tile */
/* progress */
@container (max-height: 100px) {
  .prog2 { gap: 3px; }
  .prog2 .big { font-size: 13px; }
  .prog2.h .ptrack, .prog2.h .ptrack.segments { height: 10px; }
  .prog2.h .ptrack.tank { height: 14px; border-width: 1px; }
  .prog2.v .big { display: none; }
  .prog2.v .ptrack { min-height: 0; }
}
@container (max-width: 80px) { .prog2 .big { font-size: 11px; } .prog2 .big small { display: none; } .prog2.v .ptrack { width: 70%; } }
/* slider */
@container (max-height: 100px) { .slider { gap: 2px; } .slider .big { font-size: 13px; } .slider.vert .big { display: none; } }
@container (max-width: 80px) { .slider .big { font-size: 12px; } }
/* input */
@container (max-height: 100px) { .input-msg { display: none; } .input-row input, .input-row textarea { padding: 3px 6px; font-size: 14px; } .input-row .unit { font-size: 13px; } }
/* menu: the list replaces buttons that do not fit (set from the script) */
.menu-box { width: 100%; }
.menu-box .menu-alt { display: none; }
.menu-box.as-list .segs { position: absolute; visibility: hidden; pointer-events: none; width: 100%; }
.menu-box.as-list .menu-alt { display: block; }
.menu-box { position: relative; }
@container (max-height: 100px) { .menu-alt { padding: 3px 6px; } }
/* color */
@container (max-height: 160px) { .cp-preview, .cp-native { width: 26px; height: 26px; } .cp { gap: 4px; } .cp input[type=range] { height: 12px; } }
@container (max-width: 150px) { .cp-code { display: none; } }
/* device selector */
@container (max-height: 70px) { .w-selector .selector { height: 28px; padding: 2px 6px; font-size: 14px; } }
/* log: time above the value when narrow */
@container (max-width: 160px) { .log div { flex-direction: column; gap: 0; } .log time { font-size: .85em; } }
/* compact background tiles: status dot in the tile corner, icon shrinks */
.w-compact .ctile { position: relative; }
.w-compact .ct-top { position: static; }
.w-compact .ct-top .dot { right: 2px; top: 2px; width: 7px; height: 7px; }
.ct-icon { width: min(26px, 55cqw, 40cqh); height: auto; aspect-ratio: 1; }
@container (max-width: 70px) { .ct-text { font-size: 11px; } }
@container (max-height: 80px) { .ct-text { display: none; } }
/* motion: drop the text line in tiny tiles, the colour still shows the state */
@container (max-width: 90px) { .motion .m-state { display: none; } }
@container (max-height: 100px) { .motion .m-state { display: none; } }
/* notify (full tile) */
@container (max-height: 170px) { .notify .btn { display: none; } }
@container (max-width: 80px) { .textled { padding: 3px 6px; font-size: 11px; } }
@container (max-height: 100px) { .slider:not(.vert) { flex-direction: row; align-items: center; gap: 6px; } .slider:not(.vert) .big { flex: none; } }
@container (max-height: 100px) and (max-width: 110px) { .slider:not(.vert) .big { display: none; } }
@container (max-height: 170px) { .notify .srv-state, .notify .srv-state * { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .notify { gap: 4px; } }
.notify .srv-log, .srv .srv-log { flex: 1; min-height: 0; height: auto; }
/* code example dialogs: wide enough for the code, long lines scroll inside the code box */
dialog:has(.guide) { width: min(980px, calc(100% - 32px)); }
dialog:has(.code-wrap):not(:has(.guide)) { width: min(820px, calc(100% - 32px)); }
.guide-body, .guide > * { min-width: 0; }
dialog:has(.code-wrap) { overflow-x: hidden; }
.code-wrap .btn.code-copy { background: var(--panel-2); border: 1px solid var(--line); z-index: 1; }
@media (max-width: 640px) { .code-wrap pre.code { padding-top: 40px; padding-right: 12px; } }

[hidden] { display: none !important; }
/* fixed screen layouts */
.screen-wrap { position: relative; margin: 0 auto; overflow: hidden; border-radius: 6px; box-shadow: 0 0 0 1px var(--line); }
.board.screen { transform-origin: 0 0; box-sizing: border-box; min-height: 0; overflow: hidden; background-color: var(--bg); }
/* as-designed layouts: the picture of a phone (tablet …) layout, scaled; outlined only where it doesn't fill the width */
.screen-wrap.design { overflow: visible; border-radius: 0; box-shadow: none; }
.board.screen.design { overflow: visible; background-color: transparent; }
@media (min-width: 761px) { body:not(.kiosk) .screen-wrap.design { outline: 1px dashed color-mix(in srgb, var(--line) 70%, transparent); outline-offset: 8px; } }
.preview-w { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--ink-2); }
.preview-w select { flex: 1; min-width: 0; }
.editing .board.screen { overflow: visible; background-origin: content-box; }
.screen-edge { position: absolute; left: 0; right: 0; height: 0; border-top: 4px dashed var(--bad); pointer-events: none; z-index: 3; }
.screen-edge span { position: absolute; right: 12px; top: 6px; font: 600 26px var(--display); color: var(--bad); background: var(--bg); padding: 2px 8px; border-radius: 4px; }
body.kiosk .page.has-screen { padding: 0; min-height: 100vh; display: flex; align-items: center; justify-content: center; }
body.kiosk .screen-wrap { box-shadow: none; border-radius: 0; }

.zoombar { display: flex; align-items: center; gap: 8px; margin: -4px 0 12px; }
.zoombar > span { font-size: 13px; color: var(--ink-2); margin-right: 2px; }
.zoombar .btn { flex: none; width: 36px; padding: 5px 0; font: 600 18px/1 var(--display); }
.zoombar b { min-width: 52px; text-align: center; font: 600 16px var(--display); font-variant-numeric: tabular-nums; }
.zoombar small { margin-left: auto; color: var(--ink-2); font-size: 12px; }

/* clock styles (base size; the whole clock is scaled to fill the tile) */
.clock { gap: 3px; }
.clock-seg { width: auto; height: auto; padding: 0; gap: 4px; }
.clock-seg .segdisp { flex: none; height: 46px; max-height: none; padding: 7px 9px; }
.clock-seg .seg7 { height: 32px; width: auto; }
.clock-seg .seg-unit { font-size: 11px; margin-bottom: 4px; }
.clock-flip { font: 600 30px/1 var(--display); }
.clock .flipwrap { display: flex; align-items: flex-end; gap: 4px; }
.clock .flip-unit { font: 600 11px var(--display); color: var(--ink-2); margin-bottom: 2px; }
.clock-analog { width: 110px; height: 110px; overflow: visible; }
.ca-face { fill: var(--panel-2); stroke: var(--line); stroke-width: 3; }
.ca-tick { stroke: var(--ink-2); stroke-width: 1.5; opacity: .6; }
.ca-tick.big { stroke: var(--w-text, var(--ink)); stroke-width: 3.5; opacity: 1; stroke-linecap: round; }
.ca-num { font: 600 15px var(--display); fill: var(--w-text, var(--ink)); text-anchor: middle; }
.ca-hand { stroke: var(--w-text, var(--ink)); stroke-linecap: round; }
.ca-hand.hour { stroke-width: 7; }
.ca-hand.min { stroke-width: 4.5; }
.ca-hand.sec { stroke: var(--w-accent); stroke-width: 2; }
.ca-pin { fill: var(--w-accent); }
.clock-analog + .clock-date { margin-top: 2px; }
.clock.colon-off .seg7 .colon { opacity: .08; filter: none; }
.clock.colon-off .flipdigits .sep { visibility: hidden; }
/* tabs: their grid scrolls while editing too */
.editing .tabsw .tab-scroll { pointer-events: auto; overscroll-behavior: contain; }

/* direction (vector) widget */
.vec { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 0; color: var(--w-accent); }
.vec-art { flex: 1; min-height: 0; width: 100%; overflow: visible; }
.vec-rot { transform-box: view-box; transform-origin: 0 0; transition: transform .6s cubic-bezier(.3, .8, .3, 1); }
.vec-fill { fill: currentColor; stroke: color-mix(in srgb, currentColor 70%, #000); stroke-width: 2; stroke-linejoin: round; }
.vec-fill.round { stroke-linejoin: round; stroke-width: 6; stroke: currentColor; }
.vec-back { fill: var(--ink-2); opacity: .5; }
.vec-line { fill: none; stroke: currentColor; stroke-width: 6; stroke-linecap: round; }
.vec-pin { fill: var(--panel); stroke: currentColor; stroke-width: 3; }
.vec-ring { fill: var(--panel-2); stroke: var(--line); stroke-width: 3; }
.vec-ring.faint { fill: none; stroke: color-mix(in srgb, currentColor 18%, transparent); stroke-width: 2; }
.vec-tick { stroke: var(--ink-2); stroke-width: 1.5; opacity: .55; }
.vec-tick.big { stroke: var(--w-text, var(--ink)); stroke-width: 3; opacity: 1; }
.vec-card { font: 700 22px var(--display); fill: var(--w-text, var(--ink)); text-anchor: middle; }
.vec-card.n { fill: var(--bad); }
.vec-text { font: 500 clamp(11px, min(8cqw, 11cqh), 18px)/1.2 var(--display); color: var(--w-text, var(--ink)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; font-variant-numeric: tabular-nums; }
@container (max-height: 100px) { .vec-text { display: none; } }
@media (prefers-reduced-motion: reduce) { .vec-rot { transition: none; } }

/* checkboxes widget */
.chk { width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: center; gap: 6px; overflow: auto; min-height: 0; }
.chk-item { display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 4px 2px; font: 500 15px/1.2 var(--display); color: var(--ink); cursor: pointer; text-align: left; min-width: 0; border-radius: 6px; }
.chk-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chk-item:hover { background: var(--panel-2); }
.chk-mark { flex: none; width: 20px; height: 20px; border: 2px solid var(--ink-2); border-radius: 5px; position: relative; transition: background .12s, border-color .12s; }
.chk-item[role=radio] .chk-mark { border-radius: 50%; }
.chk-item.on .chk-mark { background: var(--w-accent); border-color: var(--w-accent); }
.chk-item.on .chk-mark::after { content: ""; position: absolute; left: 5px; top: 1px; width: 5px; height: 10px; border: solid #1D2733; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }
.chk-item[role=radio].on .chk-mark::after { left: 4px; top: 4px; width: 8px; height: 8px; border: 0; border-radius: 50%; background: #1D2733; transform: none; }
.chk-switch .chk-mark { width: 34px; height: 20px; border-radius: 999px; border: 0; background: var(--hole); }
.chk-switch .chk-mark::before { content: ""; position: absolute; left: 3px; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.chk-switch .chk-item.on .chk-mark { background: var(--w-accent); }
.chk-switch .chk-item.on .chk-mark::before { transform: translateX(14px); }
.chk-switch .chk-item .chk-mark::after { display: none; }
.chk-chip { flex-direction: row; flex-wrap: wrap; align-content: center; }
.chk-chip .chk-item { flex: 1 1 auto; justify-content: center; border: 1px solid var(--line); background: var(--panel-2); padding: 8px 10px; }
.chk-chip .chk-item.on { background: var(--w-accent); border-color: var(--w-accent); color: #1D2733; }
.chk-chip .chk-mark { display: none; }
@container (max-height: 120px) { .chk { gap: 2px; } .chk-item { padding: 1px 2px; font-size: 13px; } .chk-mark { width: 16px; height: 16px; } }
@container (max-width: 90px) { .chk-item span { font-size: 12px; } .chk-item { gap: 5px; } }

/* temperature widget (base size; scaled to fill the tile) */
.tv { --tc: var(--w-accent); display: flex; flex-direction: column; align-items: center; gap: 6px; width: max-content; flex: none; transform-origin: center; }
.tv-val { display: flex; align-items: baseline; gap: 3px; font: 600 30px/1 var(--display); font-variant-numeric: tabular-nums; color: var(--w-text, var(--tc)); white-space: nowrap; }
.tv-unit { font-size: 15px; color: var(--ink-2); font-weight: 500; }
.tv-icon .ti { width: 56px; height: 56px; display: block; color: var(--tc); overflow: visible; }
@container (orientation: landscape) { .tv-icon-row, .tv.tv-icon { flex-direction: row; gap: 10px; } }
.tv.tv-thermo { flex-direction: row; align-items: center; gap: 10px; }
.tv-scale { display: flex; align-items: stretch; gap: 2px; }
.tv-tube { width: 28px; height: 84px; display: block; overflow: visible; }
.tv-ends { display: flex; flex-direction: column; justify-content: space-between; padding: 2px 0 22px; }
.tv-end { font-size: 8px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.tv-glass { fill: var(--panel-2); stroke: var(--ink-2); stroke-width: 2; }
.tv-fill, .tv-bulb { fill: var(--tc); transition: y .4s, height .4s, fill .4s; }
.tv-tick { stroke: var(--ink-2); stroke-width: 1.2; }
.ti-line { fill: none; stroke: currentColor; stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
.ti-solid { fill: currentColor; stroke: none; }
.ti-tint { fill: color-mix(in srgb, currentColor 22%, transparent); }
.ti-core { fill: color-mix(in srgb, #FFE9A8 80%, currentColor); }
.ti-flame { transform-origin: 32px 58px; animation: ti-flicker 1.4s ease-in-out infinite; filter: drop-shadow(0 0 4px currentColor); }
.ti-flame + .ti-core { transform-origin: 32px 58px; animation: ti-flicker 1.1s ease-in-out infinite reverse; }
@keyframes ti-flicker { 0%, 100% { transform: scale(1, 1); } 30% { transform: scale(.96, 1.05); } 60% { transform: scale(1.03, .97); } }
.ti-wave { animation: ti-rise 2.2s ease-in-out infinite; }
@keyframes ti-rise { 0%, 100% { transform: translateY(2px); opacity: .7; } 50% { transform: translateY(-2px); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .ti-flame, .ti-flame + .ti-core, .ti-wave { animation: none; } }

/* Modbus */
.mb-add { margin-top: 0; }
.mb-status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; font-size: 14px; }
.mb-status .dot.bad, .mb-srv-row .dot.bad { background: var(--bad); }
.mb-error { flex-basis: 100%; color: var(--bad); font-size: 13px; }
.mb-conn { display: grid; grid-template-columns: 2fr 1fr 1fr 1.4fr 1fr 1fr; gap: 0 12px; }
@media (max-width: 900px) { .mb-conn { grid-template-columns: 1fr 1fr; } }
.mb-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 12px 0 8px; }
.mb-tools select { width: auto; }
.mb-table-wrap { overflow-x: auto; }
.mb-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.mb-table th { text-align: left; font: 500 12px var(--display); color: var(--ink-2); padding: 6px 4px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.mb-table td { padding: 4px; border-bottom: 1px solid var(--panel-2); vertical-align: middle; }
.mb-table input[type=text], .mb-table input[type=number], .mb-table select { padding: 5px 6px; font-size: 13px; min-width: 0; }
.mb-table td:nth-child(1) select { width: 68px; }
.mb-table td:nth-child(2) input { min-width: 120px; }
.mb-table td:nth-child(3) select { width: 96px; }
.mb-table td:nth-child(4) input { width: 76px; }
.mb-table td:nth-child(5) select { width: 140px; }
.mb-table td:nth-child(6) select { width: 72px; }
.mb-table .narrow { width: 64px; }
.mb-table td.c { text-align: center; }
.mb-live { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; min-width: 70px; }
.mb-actions { white-space: nowrap; text-align: right; }
.mb-actions .btn { padding: 4px 8px; }
.mb-decode tr.current td { background: color-mix(in srgb, var(--amber) 14%, transparent); }
.mb-decode .mb-num { font-variant-numeric: tabular-nums; font-weight: 600; }
dialog:has(.mb-decode) { width: min(640px, calc(100% - 32px)); }
.mb-srv-list { display: flex; flex-direction: column; gap: 4px; margin-top: 14px; }
.mb-srv-row { display: flex; align-items: center; gap: 8px; text-decoration: none; padding: 6px 8px; border-radius: 6px; flex-wrap: wrap; }
.mb-srv-row:hover { background: var(--panel-2); }
.back { color: var(--ink-2); text-decoration: none; font-size: 14px; }
.mb-page .card { max-width: none; }
.mb-tools select { max-width: 280px; }
/* split value (whole + decimal part) settings under a register */
.mb-table tr.mb-has-sub td { border-bottom: 0; }
.mb-table tr.mb-sub td { padding-top: 0; }
.mb-split { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; font-size: 13px; background: var(--panel-2); padding: 6px 10px; border-radius: 8px; margin-bottom: 2px; }
.mb-split span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.mb-table tr.mb-sub select { width: auto !important; }
.mb-table tr.mb-sub input { min-width: 0 !important; width: 76px !important; }
.mb-table tr.mb-sub small { display: block; margin: 2px 0 4px 10px; }

/* Sensor widget: more pictures */
.ti .thin, .ti-line.thin { stroke-width: 2.2; }
.ti-text { fill: currentColor; font: 700 13px var(--display); }
.ti-level { transition: y .4s, height .4s; }
.ti-needle { transition: transform .5s; }
.ti-fall { animation: ti-fall 1.2s linear infinite; }
@keyframes ti-fall { 0% { transform: translateY(-3px); opacity: 0; } 30% { opacity: 1; } 100% { transform: translateY(4px); opacity: 0; } }
.ti-move { animation: ti-move 1.6s ease-in-out infinite; }
@keyframes ti-move { 0%, 100% { transform: translateX(-2px); } 50% { transform: translateX(2px); } }
.ti-sway { transform-origin: 10px 22px; animation: ti-sway 2.4s ease-in-out infinite; }
@keyframes ti-sway { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(4deg); } }
.ti-pulse { animation: ti-pulse 1.6s ease-in-out infinite; }
@keyframes ti-pulse { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }
.ti-blink { animation: ti-pulse 1s steps(2) infinite; }
.ti-glow { filter: drop-shadow(0 0 5px currentColor); }
@media (prefers-reduced-motion: reduce) { .ti-fall, .ti-move, .ti-sway, .ti-pulse, .ti-blink { animation: none; } }
.tv-icon .ti-img { width: 56px; height: 56px; display: block; object-fit: contain; -webkit-user-drag: none; user-select: none; }
.tv-tube.tv-bar { height: 76px; }
.tv-scale-bar .tv-ends { padding-bottom: 2px; }

/* picture chooser */
.pic-chooser h3 { margin: 14px 0 6px; font-size: 13px; }
.pic-chooser h3:first-child { margin-top: 0; }
.pic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; }
.pic-tile { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); cursor: pointer; font: inherit; min-width: 0; }
.pic-tile:hover { border-color: var(--accent); }
.pic-tile.current { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent); }
.pic-art { display: flex; align-items: center; justify-content: center; height: 40px; color: var(--accent); }
.pic-art .ti, .pic-art .pic-img { width: 38px; height: 38px; object-fit: contain; }
.pic-auto { display: flex; gap: 1px; }
.pic-auto .ti, .pic-auto .pic-img { width: 24px !important; height: 24px !important; }
.pic-name { font-size: 11px; line-height: 1.2; text-align: center; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.pic-del, .pic-ren { position: absolute; top: 2px; width: 20px; height: 20px; line-height: 20px; border-radius: 50%; font-size: 13px; text-align: center; color: var(--ink-2); background: var(--panel-2); opacity: 0; }
.pic-del { right: 2px; color: var(--bad, #C83728); }
.pic-ren { left: 2px; }
.pic-tile:hover .pic-del, .pic-tile:hover .pic-ren, .pic-tile:focus-within .pic-del, .pic-tile:focus-within .pic-ren { opacity: 1; }
@media (hover: none) { .pic-del, .pic-ren { opacity: 1; } }
.pic-btn { display: flex; align-items: center; gap: 10px; width: 100%; justify-content: flex-start; text-align: left; padding: 6px 10px; }
.pic-btn .pic-art { height: 32px; width: 40px; flex: none; }
.pic-btn .pic-art .ti, .pic-btn .pic-art .pic-img { width: 30px; height: 30px; }
.pic-btn .pic-change { margin-left: auto; color: var(--ink-2); font-size: 12px; }
.pic-auto-fields .grid2 { align-items: end; }
.pic-btn .pic-art:has(.pic-auto) { width: auto; }
.pic-btn > span:nth-child(2) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* per-pin color ranges in the graph settings */
.series-rng-btn { justify-self: start; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 2px 6px !important; }
.rng-dots { display: inline-flex; gap: 2px; }
.rng-dots i { width: 10px; height: 10px; border-radius: 3px; display: block; }
.series-rng { display: grid; gap: 6px; border-top: 1px dashed var(--line); padding-top: 6px; }
.mb-adv { margin-top: 10px; }
.mb-adv summary { cursor: pointer; font-weight: 500; color: var(--ink-2); }
.mb-adv .mb-conn { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 700px) { .mb-adv .mb-conn { grid-template-columns: 1fr; } }

/* Logic (rules) page */
.logic-page .card.rule { max-width: none; padding: 14px 16px; }
.rules { display: grid; gap: 14px; }
.rule.off { opacity: .6; }
.rule-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
/* Logic page as a list (0.99.45): one line per rule / sequence, groups, find */
.logic-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 4px 0 12px; }
.logic-tools .logic-find { flex: 1 1 240px; max-width: 360px; width: auto; }
.logic-tools .logic-filter { width: auto; flex: none; }
.logic-hidden { margin: 0 0 12px; padding: 8px 12px; border-radius: 8px; background: color-mix(in srgb, #E8A10C 14%, transparent); border: 1px solid color-mix(in srgb, #E8A10C 40%, transparent); font-size: 14px; }
.logic-hidden .btn { margin-left: 6px; }
.lgrp { margin: 0 0 12px; }
.undo-row { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 10px; }
.undo-row .btn { padding: 6px 10px; }
.lg-head { display: flex; align-items: center; gap: 10px; padding: 4px 2px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.lg-fold { background: none; border: 0; color: var(--ink); font: 600 16px var(--display); cursor: pointer; padding: 2px 4px; }
.lg-count { color: var(--ink-2); font-size: 13px; flex: 1; }
.lg-hide { padding: 3px 9px; font-size: 13px; }
.lg-items { display: flex; flex-direction: column; gap: 6px; }
.lgrp > .lg-items > .card.rule { margin: 0; }
.rules { display: flex; flex-direction: column; gap: 6px; }
.rule-line1 { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); min-width: 0; }
.rule-line1.off { opacity: .6; }
.rule-line1 .rl-name { display: flex; align-items: baseline; gap: 10px; flex: 1; min-width: 0; background: none; border: 0; color: var(--ink); text-align: left; cursor: pointer; padding: 2px 0; font: inherit; }
.rule-line1 .rl-name strong { font: 600 15px var(--display); white-space: nowrap; }
.rl-sum { color: var(--ink-2); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.rl-open { width: 26px; height: 26px; flex: none; border-radius: 6px; border: 1px solid var(--line); background: var(--panel-2); color: var(--ink); font: 600 16px/1 var(--display); cursor: pointer; }
.rule-line1 .rule-badge { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; }
.rl-copy { padding: 4px 9px; }
.lg-pick { display: inline-flex; align-items: center; gap: 6px; }
.lg-field { width: 130px; padding: 5px 8px; }
@media (max-width: 640px) {
  .rule-line1 { flex-wrap: wrap; }
  .rule-line1 .rl-name { flex: 1 1 calc(100% - 80px); flex-direction: column; gap: 2px; }
  .rl-sum { white-space: normal; }
  .rl-copy { display: none; }
}
.rule-head .rule-name { flex: 1 1 200px; font: 600 17px var(--display); padding: 6px 8px; }
.rule-head .btn { padding: 5px 9px; }
.rule-badge { font-size: 12px; padding: 3px 8px; border-radius: 999px; background: var(--panel-2); color: var(--ink-2); max-width: 340px; }
.rule-badge.live { background: color-mix(in srgb, #2E9E5B 18%, transparent); color: #2E9E5B; }
.rule-badge.warn { background: color-mix(in srgb, #E8A10C 20%, transparent); color: #B87F06; }
.rule-badge.bad { background: color-mix(in srgb, #C2412D 16%, transparent); color: #C2412D; }
.rule-block { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 8px; display: grid; gap: 6px; justify-items: start; }
.rule-block h3 { margin: 0; font: 600 14px var(--display); display: flex; align-items: center; gap: 6px; }
.rule-block h3 select { width: auto; padding: 2px 6px; }
.rule-row, .rule-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; width: 100%; }
.rule-row select, .rule-row input, .rule-line select, .rule-line input { width: auto; min-width: 0; padding: 5px 7px; font-size: 14px; }
.rule-row select { max-width: 220px; }
.rule-val { width: 110px !important; }
.rule-win { width: 70px !important; }
.rule-over { display: inline-flex; gap: 6px; align-items: center; }
.rule-over[hidden], .rule-per[hidden] { display: none; }
.rule-n { width: 20px; height: 20px; border-radius: 50%; background: var(--panel-2); font-size: 11px; display: inline-flex; align-items: center; justify-content: center; color: var(--ink-2); flex: none; }
.rule-live { font-size: 12px; font-variant-numeric: tabular-nums; margin-left: auto; white-space: nowrap; }
.rule-live.ok { color: #2E9E5B; } .rule-live.no { color: var(--ink-2); }
.rule-x { padding: 2px 8px !important; }
.rule-days { display: inline-flex; gap: 2px; }
.rule-days .day { border: 1px solid var(--line); background: var(--panel); color: var(--ink-2); border-radius: 5px; padding: 3px 5px; font-size: 12px; cursor: pointer; }
.rule-days .day.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.rule-action { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px; display: grid; gap: 6px; background: var(--bg); }
.rule-action .field { margin: 0; flex: 1 1 180px; }
.rule-msg { display: grid; gap: 4px; }
.rule-msg textarea { width: 100%; font-family: inherit; font-size: 14px; line-height: 1.4; padding: 6px 8px; }
.rule-chips { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.chip { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 1px 8px; font-size: 12px; cursor: pointer; color: var(--ink); }
.chip:hover { border-color: var(--accent); }
.rule-times { gap: 14px; color: var(--ink-2); font-size: 14px; margin-top: 4px; }
.rule-times input.narrow { width: 70px !important; }
.rule-activity { margin-top: 8px; }
.rule-activity summary { cursor: pointer; color: var(--ink-2); font-size: 13px; }
.rule-log .log-row { display: flex; gap: 10px; font-size: 13px; padding: 3px 0; border-bottom: 1px solid var(--panel-2); }
.rule-log .log-row time { color: var(--ink-2); white-space: nowrap; }
.rule-log .log-row.bad span { color: #C2412D; }
.logic-page .head-row { flex-wrap: wrap; }
.logic-page .head-row select { width: auto; max-width: 100%; }
@media (max-width: 640px) { .rule-live { margin-left: 26px; width: 100%; } .rule-badge { max-width: 100%; } }
.hm { width: 76px !important; font-variant-numeric: tabular-nums; }

/* Logic: groups (brackets) and and/or between conditions */
.rule-join { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); padding-left: 26px; line-height: 1; }
.rule-group { width: 100%; box-sizing: border-box; border: 1px solid var(--line); border-left: 3px solid var(--amber); border-radius: 8px; padding: 6px 8px 8px; display: grid; gap: 6px; justify-items: start; background: var(--panel-2); }
.rule-group-head { display: flex; align-items: center; gap: 6px; width: 100%; font: 600 13px var(--display); white-space: nowrap; }
.rule-group-head select { width: auto; padding: 2px 6px; font-size: 13px; }
.rule-group-head .rule-live { margin-left: 8px; font-weight: 400; }
.rule-group .btn.small { padding: 3px 8px; font-size: 13px; }

/* tiles without the label/pin line at the bottom (default for tabs and graphs) */
.w.nofoot { padding-bottom: 12px; }
.w-tabs.nofoot { padding: 0; }
.w-graph { padding: 8px 10px 30px; }
.w-graph.nofoot { padding: 8px 8px 6px; }
.w.nofoot.offline::after { content: ""; position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--bad); z-index: 2; }

/* tabs widget grown to its content (view mode): tab names stick to the top while the page scrolls */
.w-tabs.grown { overflow: clip; }
.w-tabs.grown .tab-scroll { overflow: hidden; }
.w-tabs.grown .tabbar { position: sticky; top: var(--stick-top, 0); z-index: 5; background: var(--panel); border-radius: 8px 8px 0 0; }
.w-tabs.grown .tabsw.left .tabbar { align-self: flex-start; max-height: calc(100vh - var(--stick-top, 0px)); border-radius: 8px 0 0 8px; }

/* app icon designer */
.app-icon-small { flex: none !important; width: 44px !important; height: 44px; object-fit: cover; border-radius: 10px; box-shadow: 0 1px 4px rgba(0,0,0,.2); }
.icon-designer { display: grid; grid-template-columns: 200px 1fr; gap: 16px; align-items: start; }
@media (max-width: 600px) { .icon-designer { grid-template-columns: 1fr; } }
.icon-previews { display: grid; gap: 10px; justify-items: center; }
.icon-canvas { width: 180px; height: 180px; border-radius: 12px; box-shadow: 0 2px 10px rgba(0,0,0,.2); }
.icon-masks { display: flex; gap: 10px; }
.icon-mask { width: 48px; height: 48px; }
.icon-mask.round { border-radius: 50%; }
.icon-mask.squircle { border-radius: 22%; }
.icon-mask.square { border-radius: 4px; }
.icon-designer .sw.on { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon-designer input[type=color] { width: 40px; height: 28px; padding: 0; border: 0; background: none; }
.icon-pics { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 4px; max-height: 210px; overflow-y: auto; padding: 2px; }
.icon-pic { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 4px; cursor: pointer; color: var(--ink); aspect-ratio: 1; }
.icon-pic .ti { width: 100%; height: 100%; display: block; }
.icon-pic.on { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent); }
.link-row select.link-layout, .link-row select.link-theme { display: block; margin-top: 4px; max-width: 100%; width: auto; font-size: 13px; padding: 3px 6px; }

/* top bar on medium screens (phone turned, small laptop): links in the ☰ menu */
@media (min-width: 761px) {
  .bar.compact .menu-btn { display: inline-flex; font-size: 20px; line-height: 1; padding: 4px 10px !important; }
  .bar.compact .bar-links { display: none; }
  .bar.compact.menu-open .bar-links { display: flex; flex-direction: column; align-items: stretch; position: absolute; top: calc(100% - 2px); right: 8px; min-width: 200px; padding: 6px; gap: 2px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(15, 20, 25, .25); z-index: 30; }
  .bar.compact.menu-open .bar-links .btn { text-align: left; padding: 10px 12px; font-size: 16px; }
  .bar.compact.menu-open .bar-links .theme-btn { width: auto; height: auto; justify-content: flex-start; gap: 8px; }
  .bar.compact.menu-open .bar-links .theme-btn::after { content: 'Theme'; }
}
.bar { overflow-x: clip; } /* never wider than the screen: a phone would zoom the page out */
.icon-designer .cp-swatches { align-items: center; }

/* slider and progress grow with the tile (container units: the tile is the container) */
.slider { --k: clamp(20px, min(30cqh, 11cqw), 76px); gap: clamp(4px, 3cqh, 14px); }
.slider.vert { --k: clamp(20px, min(30cqw, 16cqh), 76px); }
.slider .big { font-size: clamp(20px, min(13cqw, 22cqh), 64px); line-height: 1.05; }
.sl { position: relative; flex: none; width: 100%; height: var(--k); cursor: pointer; touch-action: pan-y; outline: none; --p: 0; -webkit-tap-highlight-color: transparent; }
.slider.vert .sl { flex: 1; width: var(--k); height: auto; min-height: 40px; touch-action: pan-x; }
.sl-track { position: absolute; left: calc(var(--k) / 2); right: calc(var(--k) / 2); top: 50%; height: calc(var(--k) * .3); transform: translateY(-50%); border-radius: 999px; background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.slider.vert .sl-track { left: 50%; right: auto; top: calc(var(--k) / 2); bottom: calc(var(--k) / 2); width: calc(var(--k) * .3); height: auto; transform: translateX(-50%); }
.sl-fill { position: absolute; left: 0; top: 0; bottom: 0; width: calc(var(--p) * 100%); background: var(--w-accent); border-radius: inherit; }
.slider.vert .sl-fill { top: auto; right: 0; width: auto; height: calc(var(--p) * 100%); }
.sl-knob { position: absolute; top: 50%; left: calc(var(--p) * (100% - var(--k))); width: var(--k); height: var(--k); transform: translateY(-50%); border-radius: 50%; background: #fff; border: max(2px, calc(var(--k) * .08)) solid var(--w-accent); box-shadow: 0 1px 4px rgba(0,0,0,.35); box-sizing: border-box; transition: transform .1s; }
.slider.vert .sl-knob { top: auto; left: 50%; bottom: calc(var(--p) * (100% - var(--k))); transform: translateX(-50%); }
.sl.active .sl-knob { transform: translateY(-50%) scale(1.08); }
.slider.vert .sl.active .sl-knob { transform: translateX(-50%) scale(1.08); }
.sl:focus-visible .sl-knob { outline: 3px solid color-mix(in srgb, var(--w-accent) 50%, transparent); outline-offset: 2px; }
@container (max-height: 100px) { .slider:not(.vert) .sl { flex: 1; min-width: 40px; } }

.prog2 { gap: clamp(4px, 3cqh, 14px); }
.prog2 .big { font-size: clamp(16px, min(12cqw, 22cqh), 64px); line-height: 1.05; }
.prog2.h .ptrack { height: clamp(14px, min(26cqh, 9cqw), 110px); border-radius: clamp(7px, min(8cqh, 3cqw), 22px); }
.prog2.h .ptrack.segments { height: clamp(16px, min(30cqh, 10cqw), 120px); gap: clamp(3px, .8cqw, 8px); }
.prog2.h .ptrack.tank { height: clamp(24px, min(34cqh, 12cqw), 140px); border-radius: clamp(12px, min(17cqh, 6cqw), 70px); border-width: clamp(2px, .6cqmin, 4px); }
.prog2.v .ptrack { width: clamp(24px, min(36cqw, 40cqh), 220px); border-radius: clamp(7px, 3cqmin, 22px); }
.prog2.v .ptrack.segments { gap: clamp(3px, 1cqh, 8px); }
.prog2.v .ptrack.tank { border-radius: clamp(12px, 6cqmin, 60px); border-width: clamp(2px, .6cqmin, 4px); }
.ptrack.segments i { border-radius: clamp(2px, .8cqmin, 6px); }
/* small tiles keep their compact sizes (after the growing sizes above) */
@container (max-height: 100px) {
  .prog2 { gap: 3px; } .prog2 .big { font-size: 13px; }
  .prog2.h .ptrack, .prog2.h .ptrack.segments { height: 10px; }
  .prog2.h .ptrack.tank { height: 14px; border-width: 1px; }
  .slider { gap: 2px; --k: 20px; } .slider .big { font-size: 13px; }
}
@container (max-width: 80px) { .prog2 .big { font-size: 11px; } .prog2.v .ptrack { width: 70%; } .slider .big { font-size: 12px; } }

/* server history */
.stats-card canvas { height: 180px; }
.stats-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-bottom: 6px; }
.stats-ranges .seg { padding: 5px 10px; font-size: 13px; }
.stats-card .legend { margin-top: 8px; }
.stats-events { margin-top: 10px; font-size: 13px; }
.stats-ev-list { display: grid; gap: 4px; }
.stats-ev { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stats-ev i { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.stats-ev time { font-variant-numeric: tabular-nums; color: var(--ink-2); }
.stats-card .stats-nav .btn { padding: 4px 10px; }
.stats-ranges { width: auto; } .stats-ranges .seg { flex: none; min-width: 0; }
.stats-ranges .seg { color: var(--ink); } .stats-ranges .seg[aria-pressed=true] { background: var(--amber); border-color: var(--amber); color: #1D2733; } /* outside widgets there is no --w-accent */
.dev-projects { margin-top: 2px; } .dev-projects a { color: inherit; text-decoration: underline; text-decoration-color: var(--line); }
/* new project dialog */
.choices { display: grid; gap: 6px; margin-bottom: 12px; }
.choice { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.choice:has(input:checked) { border-color: var(--amber); }
.choice input { margin-top: 3px; flex: none; }
.choice span { display: grid; gap: 2px; }
.map-devs .field input { margin-top: 6px; }
dialog pre.code { overflow-x: auto; max-width: 100%; }
/* range buttons on graphs */
.graph-head { flex-wrap: wrap; row-gap: 4px; column-gap: 8px; }
.graph-head .rng { margin-left: auto; flex: 0 1 auto; max-width: 100%; }
.rbs { display: inline-flex; flex-wrap: wrap; justify-content: flex-end; gap: 1px; }
.rb { border: 0; background: none; color: var(--ink-2); font: 500 11px/1 var(--display); padding: 4px 5px; border-radius: 4px; cursor: pointer; }
.rb:hover { color: var(--ink); background: var(--panel-2); }
.rb[aria-pressed=true] { color: var(--ink); background: var(--panel-2); box-shadow: inset 0 -2px 0 var(--amber); }
@media (pointer: coarse) { .rb { font-size: 12px; padding: 6px 5px; } }
.owner-group h2 { display: flex; align-items: baseline; gap: 8px; font-size: 18px; margin: 18px 0 8px; } .owner-group h2 small { font: 400 13px/1 var(--body, inherit); color: var(--ink-2); }
@media (max-width: 760px) { body.editing:not(.sheet-min) .tab-scroll > .board.inner { padding-bottom: calc(var(--sheet, 45vh) - 40px); } }
/* device status in the top bar and the connection history */
.devstat { position: relative; padding: 6px 8px; display: inline-flex; align-items: center; }
.devstat .chip-ico rect, .devstat .chip-ico path { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.devstat-n { position: absolute; top: 0; right: 0; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--bad); color: #fff; font: 700 10px/16px var(--display); text-align: center; }
.devstat-ok { position: absolute; top: 3px; right: 3px; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.devstat.bad { color: var(--bad); }
.devstat-list { display: grid; gap: 10px; max-height: 65vh; overflow-y: auto; }
dialog:has(.devstat-list) { width: min(640px, 94vw); max-width: min(640px, 94vw); }
.devstat-head > div { min-width: 0; }
.devstat-row { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.devstat-head { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; }
.dot.dead { background: var(--bad); }
.conn-list { list-style: none; margin: 8px 0 0; padding: 0; font-size: 13px; display: grid; gap: 4px; }
.conn-list li { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 10px; padding-left: 10px; border-left: 3px solid var(--ok); }
.conn-list li.off { border-left-color: var(--bad); }
.conn-list time { color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.off-text { color: var(--bad); }
@media (max-width: 560px) { .conn-list li { grid-template-columns: 1fr; gap: 0; } }
.brand-sub { margin: -8px 0 10px; font-size: 12px; } .mark-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 22ch; }
/* analog panel meter (gauge style "meter") */
.gauge.meter { --m-ink: #232323; }
.gauge.meter .m-case { fill: #2c2f33; stroke: #15171a; stroke-width: 1; }
.gauge.meter .mf0 { stop-color: #f7f2e3; }
.gauge.meter .mf1 { stop-color: #e6dcc3; }
.gauge.meter .m-face { stroke: rgba(0,0,0,.35); stroke-width: .6; }
.gauge.meter .m-scale { stroke: var(--m-ink); stroke-width: .9; }
.gauge.meter .m-mirror { stroke: #b9bec4; stroke-width: 2.2; opacity: .9; }
.gauge.meter .m-tick { stroke: var(--m-ink); stroke-width: .5; }
.gauge.meter .m-tick.major { stroke-width: 1.1; }
.gauge.meter .m-num { fill: var(--m-ink); font: 600 7.5px var(--display); }
.gauge.meter .m-unit { fill: var(--m-ink); font: 700 15px Georgia, 'Times New Roman', serif; }
.gauge.meter .m-val { fill: #5a5242; font: 600 7.5px var(--display); font-variant-numeric: tabular-nums; }
.gauge.meter .m-needle path { fill: var(--m-needle, #c0271f); filter: drop-shadow(1.2px 1.5px .6px rgba(0,0,0,.35)); }
.gauge.meter .m-needle { transition: transform .9s cubic-bezier(.25, 1.35, .45, 1); }
.gauge.meter .m-pivot { fill: #1b1d20; }
.gauge.meter .m-screw { fill: #6b7076; stroke: #2a2d31; stroke-width: .6; }
.gauge.meter .m-glass { pointer-events: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .gauge.meter .mf0 { stop-color: #e4dcc6; } :root:not([data-theme="light"]) .gauge.meter .mf1 { stop-color: #cfc4a8; } }
:root[data-theme="dark"] .gauge.meter .mf0 { stop-color: #e4dcc6; }
:root[data-theme="dark"] .gauge.meter .mf1 { stop-color: #cfc4a8; }
@media (prefers-reduced-motion: reduce) { .gauge.meter .m-needle { transition: transform .2s; } }
/* knob (slider look "knob") */
.knob-wrap { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; min-height: 0; }
.knob { width: 100%; height: 100%; max-height: 100%; touch-action: none; cursor: grab; outline: none; -webkit-tap-highlight-color: transparent; user-select: none; }
.knob.active { cursor: grabbing; }
.knob .k-track { stroke: var(--panel-2); }
.knob .k-fill { stroke: var(--w-accent); }
.knob .k-cap { fill: #3a3f46; filter: drop-shadow(0 2px 2.5px rgba(0,0,0,.35)); }
.knob .k-top { fill: #555c65; stroke: rgba(255,255,255,.14); stroke-width: 1; }
.knob .k-grip { stroke: rgba(255,255,255,.18); stroke-width: 1.4; stroke-linecap: round; }
.knob .k-mark { stroke: var(--w-accent); stroke-width: 3.2; stroke-linecap: round; }
.knob .k-val { fill: #fff; font: 600 15px/1 var(--display); font-variant-numeric: tabular-nums; pointer-events: none; }
.knob .k-unit { fill: rgba(255,255,255,.7); font: 500 7.5px var(--display); pointer-events: none; }
.knob .k-lim { fill: var(--ink-2); font: 500 8px var(--display); }
.knob:focus-visible .k-cap { stroke: color-mix(in srgb, var(--w-accent) 60%, transparent); stroke-width: 1.2; stroke-dasharray: 3 2; }
.knob.active .k-cap { filter: drop-shadow(0 3px 4px rgba(0,0,0,.45)); }
/* knob styles: silver and chicken-head (the modern one above) */
.knob .k-hit { fill: none; }
.knob .k-tick { stroke: var(--ink-2); stroke-width: .7; }
.knob .k-tick.major { stroke: var(--ink); stroke-width: 1.4; }
.knob .k-num { fill: var(--ink-2); font: 600 7.5px var(--display); }
.knob.k-silver .k-val, .knob.k-chicken .k-val { fill: var(--ink); font: 600 11px/1 var(--display); }
.knob .k-shadow { fill: rgba(0,0,0,.28); filter: blur(2.5px); }
.knob .k-rim { stroke: #5d6268; stroke-width: .8; }
.knob .k-knurl { stroke: rgba(60,64,70,.55); stroke-width: .9; }
.knob .k-face { stroke: rgba(0,0,0,.25); stroke-width: .5; }
.knob .k-brush { fill: none; stroke: rgba(255,255,255,.22); stroke-width: .35; }
.knob .k-brush:nth-child(odd) { stroke: rgba(80,85,92,.12); }
.knob .k-groove { stroke: #3b3f45; stroke-width: 2.6; stroke-linecap: round; }
.knob .k-dot { fill: var(--w-accent); }
.knob .k-glare { pointer-events: none; }
.knob .k-skirt { stroke: #000; stroke-width: .6; }
.knob .k-flute { stroke: rgba(255,255,255,.12); stroke-width: .9; }
.knob .k-head { stroke: #000; stroke-width: .6; filter: drop-shadow(0 2px 2px rgba(0,0,0,.45)); }
.knob .k-line { stroke: #f2efe6; stroke-width: 2.2; stroke-linecap: round; }
.knob .k-shine { fill: rgba(255,255,255,.10); }
.knob.k-silver:focus-visible .k-face, .knob.k-chicken:focus-visible .k-skirt { stroke: color-mix(in srgb, var(--w-accent) 70%, transparent); stroke-width: 1.2; stroke-dasharray: 3 2; }
/* sequences (Logic page) */
.seq-head { margin-top: 34px; }
.seq-head h2 { font: 600 24px/1.2 var(--display); margin: 0; }
.seq-step.now { border-color: var(--amber); box-shadow: 0 0 0 2px color-mix(in srgb, var(--amber) 35%, transparent); }
.seq-limit { gap: 6px; flex-wrap: wrap; }
/* Macro widget */
.macro { width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: center; gap: clamp(4px, 4cqh, 10px); }
.macro-btns { display: flex; gap: 8px; }
.macro-btns .btn { flex: 1; min-height: clamp(34px, 30cqh, 64px); font: 600 clamp(14px, min(9cqw, 16cqh), 22px)/1.1 var(--display); }
.macro-state { font-size: clamp(11px, min(5cqw, 9cqh), 14px); color: var(--ink-2); text-align: center; line-height: 1.25; min-height: 1.25em; }
.macro-state.bad { color: var(--bad); }
.macro-state.warn { color: var(--amber); }
.macro-bar { height: 5px; border-radius: 3px; background: var(--panel-2); overflow: hidden; }
.macro-bar i { display: block; height: 100%; width: 0; background: var(--w-accent); transition: width .5s linear; }
.w.running .macro-state { color: var(--ink); }
.macro-na { font-size: 13px; text-align: center; }
body.display-ro .w-macro button { pointer-events: none; opacity: .6; }
.seq-step input.narrow { width: 6.5em; flex: none; }
.seq-tools { display: inline-flex; flex: none; margin-left: auto; gap: 2px; }
.expand.snap { display: inline-flex; align-items: center; justify-content: center; } .expand.snap svg { display: block; }

/* the editor panel's title bar: what is selected, and close (or Done) */
.drawer-top { position: sticky; top: -18px; z-index: 3; display: flex; align-items: center; gap: 8px; margin: -18px -18px 12px; padding: 12px 12px 10px 18px; background: var(--panel); border-bottom: 1px solid var(--line); }
.drawer-top .sheet-handle { position: relative; display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; margin: 0; padding: 0; border: 0; background: none; color: var(--ink); text-align: left; cursor: default; }
.sheet-title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.15; }
.sheet-title b { font: 600 18px/1.2 var(--display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dt-kind { font: 600 10.5px/1.2 var(--display); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
.dt-close { flex: none; width: 38px; height: 38px; padding: 0; font-size: 18px; line-height: 1; border-radius: 8px; }
.dt-close:hover { background: var(--panel-2); color: var(--bad); }
.dt-done { flex: none; }
@media (max-width: 760px) { .drawer-top { top: 0; margin: 0 -18px 12px; padding: 14px 12px 6px 18px; min-height: 52px; } }

/* Graph: drag sideways to look back; the badge leads back to now */
.graph-plot { flex: 1; min-height: 0; position: relative; }
.graph-plot canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: pan-y; }
.graph-plot canvas.panning { cursor: grabbing; }
.pan-now { position: absolute; top: 2px; left: 50%; transform: none; display: inline-flex; align-items: center; gap: 8px; max-width: calc(100% - 8px); white-space: nowrap; padding: 4px 6px 4px 10px; border: 1px solid var(--line); border-radius: 999px; background: color-mix(in srgb, var(--panel) 88%, transparent); color: var(--ink-2); font: 500 12px/1 var(--display); cursor: pointer; box-shadow: 0 1px 4px rgb(0 0 0 / .15); backdrop-filter: blur(3px); }
.pan-now[hidden] { display: none; }
.pan-now span { overflow: hidden; text-overflow: ellipsis; }
.pan-now b { padding: 3px 7px; border-radius: 999px; background: var(--amber); color: #1D2733; font-weight: 600; }
.pan-now:hover { color: var(--ink); border-color: var(--ink-2); }

/* Change device / duplicate tab dialogs */
.swap-rows { display: grid; gap: 10px; margin: 8px 0 4px; }
.swap-row { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1.2fr); align-items: center; gap: 8px; }
.swap-row select { width: 100%; min-width: 0; }
.swap-from { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.swap-arrow { color: var(--ink-2); }
@media (max-width: 520px) { .swap-row { grid-template-columns: 1fr; gap: 4px; } .swap-arrow { display: none; } }

/* History viewer: never wider than the screen (a grid item sized itself to the
   one-line range buttons, pushing the close button off a phone screen). */
.hv { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
.hv-panel { min-width: 0; min-height: 0; justify-self: center; overflow: hidden; }
.hv-top { gap: 8px; min-width: 0; }
.hv-top h2 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hv-top .btn { flex: none; }
.hv-tools, .hv-nav, .hv-presets { min-width: 0; max-width: 100%; }
.hv-presets { overflow-x: auto; scrollbar-width: none; }
@media (max-width: 760px) {
  .hv-panel { padding: max(10px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom)); gap: 8px; }
  .hv-top h2 { font-size: 19px; }
  .hv-tools { gap: 6px; }
  .hv-presets { flex-wrap: wrap; overflow: visible; }
  .hv-presets .seg { min-width: 40px; padding: 6px 8px; }
  .hv-nav { flex-wrap: wrap; width: 100%; }
  .hv-nav .btn { flex: none; padding: 6px 10px; }
  .hv-nav input[type=date] { flex: 1 1 130px; min-width: 0; max-width: 170px; }
}

/* Editing on a phone: a tab scrolled to its end hands the swipe on to the page,
   so the bottom of a long tab can come up above the editor panel. */
@media (max-width: 760px) { body.editing .tabsw .tab-scroll { overscroll-behavior-y: auto; } }

/* tabs: the new tab slides in after a sideways swipe */
.board.inner.swipe-next { animation: tab-in-next .2s ease-out; }
.board.inner.swipe-prev { animation: tab-in-prev .2s ease-out; }
@keyframes tab-in-next { from { transform: translateX(28px); opacity: .3; } }
@keyframes tab-in-prev { from { transform: translateX(-28px); opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .board.inner.swipe-next, .board.inner.swipe-prev { animation: none; } }

/* terminal: input row with the Clear button, and its confirmation */
.term { position: relative; }
.term-bar { display: flex; gap: 6px; align-items: stretch; }
.term-bar input { flex: 1; min-width: 0; }
.term-ro .term-bar { position: absolute; right: 14px; top: 5px; opacity: .75; } /* read only: just the clear button, in the corner */
.term-ro .term-bar:hover, .term-ro .term-bar:focus-within { opacity: 1; }
.term-ro .term-out { padding-right: 44px; }
.term-ro .term-clear { height: 28px; }
.term-clear { flex: none; display: inline-flex; align-items: center; justify-content: center; padding: 0 9px; color: var(--ink-2); }
.term-clear:hover { color: var(--bad); }
.term-ask { position: absolute; left: 6px; right: 6px; bottom: 46px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 4px 14px rgb(0 0 0 / .18); font-size: 13px; z-index: 2; }
.term-ask[hidden] { display: none; }
.term-ask span { flex: 1 1 140px; }
.term-ask .btn { padding: 5px 12px; }
.display-ro .term-clear { display: none; }
.term-out .ts { color: var(--ink-2); opacity: .8; }

/* editing on a phone: the widget picked up by a long press */
.editing .w.lifted { box-shadow: 0 10px 28px rgb(0 0 0 / .28); outline: 2px solid var(--amber); outline-offset: 2px; z-index: 6; }

/* editing: holding a finger on a widget must not start the phone's text
   selection (or its menu); that also scrolled the page on its own */
.editing .w, .editing .w * { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.editing .w input, .editing .w textarea { -webkit-user-select: text; user-select: text; }

/* display link rows: the text and lists shrink, Revoke always fits */
.link-row > div { flex: 1 1 auto; min-width: 0; }
.link-row > .btn { flex: none; }
.link-row select.link-layout, .link-row select.link-theme { min-width: 0; }

/* sliders: dragging must never select text (a selection then got dragged instead of the knob) */
.sl, .sl * { -webkit-user-select: none; user-select: none; -webkit-user-drag: none; }

/* API tokens: example commands */
.code-ex { margin: 10px 0 0; padding: 10px 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; font: 12px/1.5 ui-monospace, Menlo, Consolas, monospace; white-space: pre-wrap; word-break: break-all; }

/* ---------- server-side devices: approvals, HTTP devices ---------- */
.approval-banner { border: 1px solid var(--amber); background: color-mix(in srgb, var(--amber) 12%, var(--panel)); border-radius: 10px; padding: 10px 14px; margin: 0 0 16px; font-size: 14px; line-height: 1.45; }
.approval-banner.rejected, .approval-banner.broken { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 10%, var(--panel)); }
.approval-banner code { overflow-wrap: anywhere; }
.badge.approval { background: var(--amber-soft); color: var(--ink); }
.badge.approval.rejected, .badge.approval.broken { background: color-mix(in srgb, var(--bad) 18%, transparent); color: var(--bad); }
.nav-count { display: inline-block; min-width: 18px; padding: 2px 5px; margin-left: 6px; border-radius: 9px; background: var(--amber); color: #1D2733; font: 600 11px/14px var(--body); text-align: center; vertical-align: 1px; }
.srv-add { display: flex; gap: 8px; flex-wrap: wrap; }
.approvals h3 { font: 500 14px var(--display); color: var(--ink-2); margin: 14px 0 6px; }
.appr-list { display: flex; flex-direction: column; gap: 8px; }
.appr-row { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: center; }
.appr-row.waiting { border-color: var(--amber); }
.appr-row > :not(.appr-actions) { grid-column: 1; min-width: 0; }
.appr-main { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.appr-main .badge:first-child { margin-left: 0; }
.appr-target code, .appr-detail { overflow-wrap: anywhere; }
.appr-actions { grid-column: 2; grid-row: 1 / span 3; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.appr-note { width: 220px; }
.appr-all { margin-top: 12px; }
.appr-all summary { cursor: pointer; color: var(--ink-2); }
.appr-all .appr-list { margin-top: 8px; }
@media (max-width: 640px) {
  .appr-row { grid-template-columns: 1fr; }
  .appr-actions { grid-column: 1; grid-row: auto; justify-content: flex-start; margin-top: 6px; }
  .appr-note { width: 100%; }
}
.http-conn { display: grid; grid-template-columns: minmax(0, 4fr) 1fr 1fr 1fr; gap: 0 12px; }
@media (max-width: 900px) { .http-conn { grid-template-columns: 1fr 1fr; } .http-conn .http-url { grid-column: 1 / -1; } }
.http-auth { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 12px; }
@media (max-width: 700px) { .http-auth { grid-template-columns: 1fr; } }
.http-body { display: grid; grid-template-columns: 3fr 1fr; gap: 0 12px; }
@media (max-width: 700px) { .http-body { grid-template-columns: 1fr; } }
.http-headers { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.http-hdr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) auto auto; gap: 8px; align-items: center; }
.http-hdr label.check { margin: 0; }
@media (max-width: 600px) { .http-hdr { grid-template-columns: 1fr 1fr; } }
.http-table td.http-path input { min-width: 220px; width: 100%; }
.http-table td:nth-child(2) input { min-width: 110px; }
.http-tv { font-size: 12px; color: var(--ink-2); margin: 2px 0 0 4px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; max-width: 360px; }
.http-tv.bad { color: var(--bad); }
.http-table .btn.on { border-color: var(--amber); }
.http-table tr.flash td { animation: http-flash 1.6s ease-out; }
@keyframes http-flash { from { background: color-mix(in srgb, var(--amber) 35%, transparent); } }
.http-reply { margin-top: 12px; }
.http-reply .warn { overflow-wrap: anywhere; }
.http-cert { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin: 8px 0; }
.http-cert code { overflow-wrap: anywhere; font-size: 12px; }
.http-raw { max-height: 320px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; }
.http-rawbox { margin-top: 10px; }
.http-rawbox summary { cursor: pointer; color: var(--ink-2); }
.jp-search { margin: 6px 0 8px; max-width: 420px; }
.jp-tree, .jp-hits { max-height: 480px; overflow: auto; border: 1px solid var(--panel-2); border-radius: 8px; padding: 6px 8px; }
ul.jp { list-style: none; margin: 0; padding-left: 16px; font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.jp-tree > ul.jp, ul.jp-hits { padding-left: 0; }
ul.jp details > summary { cursor: pointer; }
.jp-key { color: var(--ink-2); overflow-wrap: anywhere; }
.jp-leaf { all: unset; cursor: pointer; border-radius: 4px; padding: 0 4px; display: inline-flex; gap: 8px; align-items: baseline; }
.jp-leaf:hover, .jp-leaf:focus-visible { background: color-mix(in srgb, var(--amber) 22%, transparent); outline: none; }
.jp-leaf .jp-add { font: 500 11px var(--body); color: var(--ink-2); opacity: 0; }
.jp-leaf:hover .jp-add, .jp-leaf:focus-visible .jp-add { opacity: 1; }
@media (hover: none) { .jp-leaf .jp-add { opacity: .7; } }
.jp-val { font-weight: 600; overflow-wrap: anywhere; }
.jp-val.string { color: #2E7D4F; }
.jp-val.boolean, .jp-val.null { color: #8250C4; }
:root[data-theme="dark"] .jp-val.string { color: #7FD19E; }
:root[data-theme="dark"] .jp-val.boolean, :root[data-theme="dark"] .jp-val.null { color: #C3A3F0; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .jp-val.string { color: #7FD19E; } :root:not([data-theme="light"]) .jp-val.boolean, :root:not([data-theme="light"]) .jp-val.null { color: #C3A3F0; } }
.card textarea, dialog textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: inherit; font: 13px/1.5 ui-monospace, Menlo, Consolas, monospace; resize: vertical; }
.chat-row input.chat-name { font: 500 15px/1.2 var(--body); padding: 4px 8px; max-width: 320px; }
.chat-row { grid-template-columns: 1fr auto auto auto; }
.tg-pick select { max-width: 420px; }
.tg-pick .tg-ids[hidden] { display: none; }

/* ---------- virtual devices ---------- */
.dot.virt { border-radius: 3px; transform: rotate(45deg) scale(.85); } /* a diamond: not a connection */
.dot.virt.v0 { background: transparent; box-shadow: inset 0 0 0 2px var(--hole); }
.dot.virt.v1 { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.dot.virt.v2 { background: #9BBF2E; }
.dot.virt.v3 { background: #E8890C; }
.dot.virt.v4 { background: var(--hole); }
.badge.virt { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ink); }
.devstat-n.warn { background: #E8890C; }
.devstat.warn { color: #C2700A; }
.dev-add .check { margin: 6px 0 0; font-size: 13px; color: var(--ink-2); }
.dev-knock { font-size: 13px; color: var(--ink); background: var(--amber-soft); border-radius: 6px; padding: 4px 8px; margin: 4px 0; display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.dev-knock .btn { padding: 2px 8px; }
.dev-kind { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 4px; }
.dev-kind h3 { font: 500 14px var(--display); margin: 6px 0 2px; }
.act-strip { display: flex; align-items: flex-end; gap: 1px; height: 56px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.act-strip i { flex: 1; min-width: 1px; background: var(--ok); border-radius: 1px 1px 0 0; }
.act-strip i.zero { height: 2px; background: color-mix(in srgb, #E8890C 55%, transparent); }
.act-strip i.none { height: 2px; background: var(--panel-2); }
.act-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-2); margin: 2px 0 6px; }

/* ---------- group widget: a frame with a title around widgets ---------- */
.w-group { padding: 0; background: transparent; border-color: transparent; overflow: visible; }
.w-group > .w-body { display: block; }
.editing .w-group { background: transparent; }
.grp { --grp-c: var(--grp-accent, var(--ink-2)); height: 100%; display: flex; flex-direction: column; min-height: 0; border-radius: 10px; box-sizing: border-box; }
.grp .tab-scroll { padding: 8px; }
.grp-title { font: 600 14px/18px var(--display); color: var(--grp-c); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: none; }
.grp-line { border: 1.5px solid color-mix(in srgb, var(--grp-c) 55%, transparent); }
.grp-card { background: var(--panel); border: 1px solid var(--line); }
.grp-none .grp-title { padding: 0 4px; }
.grp-card .grp-title { padding: 8px 12px 0; }
/* title in the frame line: the top line is drawn on both sides of the title, so it needs no background behind it */
.grp-line.grp-t-line { border-top: 0; border-radius: 0 0 10px 10px; margin-top: 9px; height: calc(100% - 9px); }
.grp-line.grp-t-line > .grp-title { display: flex; align-items: center; gap: 6px; height: 18px; margin: -9px -1.5px 0; }
.grp-line.grp-t-line > .grp-title::before, .grp-line.grp-t-line > .grp-title::after { content: ""; align-self: flex-end; height: 9px; border-top: 1.5px solid color-mix(in srgb, var(--grp-c) 55%, transparent); }
.grp-line.grp-t-line > .grp-title::before { width: 10px; flex: none; border-left: 1.5px solid color-mix(in srgb, var(--grp-c) 55%, transparent); border-top-left-radius: 10px; }
.grp-line.grp-t-line > .grp-title::after { flex: 1; min-width: 10px; border-right: 1.5px solid color-mix(in srgb, var(--grp-c) 55%, transparent); border-top-right-radius: 10px; }
.grp-line.grp-t-line > .grp-title > span { overflow: hidden; text-overflow: ellipsis; }
.grp-t-bar > .grp-title { padding: 5px 12px; background: color-mix(in srgb, var(--grp-c) 16%, transparent); border-radius: 9px 9px 0 0; }
.grp-none.grp-t-bar > .grp-title { border-radius: 6px; }
.editing .grp .board > .w, .editing .grp .board > .w .resize, .editing .grp .tab-scroll { pointer-events: auto; }
.editing .grp .board > .w .w-body * { pointer-events: none; }
.editing .w-group.drop-into .tab-scroll { background: color-mix(in srgb, var(--amber) 10%, transparent); }
.w-group.grown .tab-scroll { overflow: hidden; }

/* ---------- text widget ---------- */
.w-text { padding: 8px 12px; }
.w-text > .w-body { display: block; }
.w-text.w-style-plain { background: transparent; border-color: transparent; }
.w-text.w-style-note { background: #FFF1A8; border-color: #E8D372; color: #3A3416; box-shadow: 0 2px 6px rgba(60, 50, 10, .15); }
.w-text.w-style-note .tx-v { color: #2A250C; }
.editing .w-text.w-style-plain { background: transparent; }
.tx { height: 100%; display: flex; flex-direction: column; overflow: hidden; overflow-wrap: anywhere; line-height: 1.35; }
.tx-v-middle { justify-content: center; }
.tx-v-bottom { justify-content: flex-end; }
.tx-a-center { text-align: center; }
.tx-a-right { text-align: right; }
.tx-small { font-size: 13px; }
.tx-normal { font-size: 15px; }
.tx-large { font-size: 19px; }
.tx-title { font: 600 26px/1.2 var(--display); }
.tx-huge { font: 600 40px/1.1 var(--display); }
.tx-h { font-size: 1.3em; font-weight: 600; font-family: var(--display); }
.tx-gap { height: .6em; }
.tx ul { margin: 0; padding-left: 1.2em; }
.tx-a-center ul, .tx-a-right ul { list-style-position: inside; padding-left: 0; }
.tx .tx-v { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--w-text, var(--ink)); }

/* ---------- HMI panels (Modbus server) ---------- */
.warnbox { background: color-mix(in srgb, var(--amber) 14%, transparent); border: 1px solid color-mix(in srgb, var(--amber) 45%, transparent); border-radius: 8px; padding: 8px 12px; margin: 0 0 10px; }
.pn-row { display: flex; gap: 12px; flex-wrap: wrap; }
.pn-row .field { flex: 1 1 160px; }
.pn-scroll { overflow-x: auto; max-height: 46vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; margin: 8px 0; }
.pn-table { border-collapse: collapse; width: 100%; font-size: 13px; }
.pn-table th, .pn-table td { padding: 5px 8px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--line); }
.pn-table th { position: sticky; top: 0; background: var(--panel); font-weight: 500; color: var(--ink-2); }
.pn-table .mono { font-family: var(--mono, ui-monospace, monospace); }
.pn-table .pn-val { color: var(--ink-2); max-width: 9em; overflow: hidden; text-overflow: ellipsis; }
.pn-table label.check { margin: 0; }
.pn-add { display: flex; gap: 8px; align-items: center; }
.pn-add input { width: 6em; }
.pn-more ul { margin: 6px 0; padding-left: 1.2em; }
.pn-state { display: flex; align-items: center; gap: 6px; margin: 10px 0 0; }
.pn-clients h3, .pn-exports h3 { font: 500 14px var(--display); margin: 14px 0 4px; }
dialog:has(.pn-table) { width: min(760px, calc(100vw - 24px)); }

/* ---------- label and pin at the top ---------- */
.w.foot-top { padding: 30px 14px 12px; }
.w-tabs.foot-top { padding: 26px 0 0; }
.w-selector.foot-top { padding: 27px 12px 8px; }
.w-compact.foot-top { padding: 22px 6px 6px; }
.w-graph.foot-top { padding: 30px 10px 8px; }
.w-text.foot-top { padding: 30px 12px 8px; }
.w-text:not(.nofoot):not(.foot-top) { padding-bottom: 30px; }
.w.foot-top > .w-label, .w.foot-top > .w-pin { bottom: auto; top: 7px; }
.w-compact.foot-top > .w-label { top: 5px; }
.editing .w.foot-top > .w-pin { right: 12px; }
@container (max-width: 110px) { .w.foot-top > .w-label { top: 5px; } }

/* ---------- label size ---------- */
.w.lab-s { --lab-fs: 12px; } .w.lab-l { --lab-fs: 18px; } .w.lab-xl { --lab-fs: 24px; }
.w.lab-l:not(.nofoot):not(.foot-top):not(.w-compact) { padding-bottom: 36px; }
.w.lab-l.foot-top:not(.w-compact) { padding-top: 36px; }
.w.w-tabs.lab-l:not(.nofoot):not(.foot-top):not(.w-compact) { padding-bottom: 32px; }
.w.w-tabs.lab-l.foot-top:not(.w-compact) { padding-top: 32px; }
.w.w-selector.lab-l:not(.nofoot):not(.foot-top):not(.w-compact) { padding-bottom: 30px; }
.w.w-selector.lab-l.foot-top:not(.w-compact) { padding-top: 33px; }
.w.w-graph.lab-l:not(.nofoot):not(.foot-top):not(.w-compact) { padding-bottom: 36px; }
.w.w-graph.lab-l.foot-top:not(.w-compact) { padding-top: 36px; }
.w.w-text.lab-l:not(.nofoot):not(.foot-top):not(.w-compact) { padding-bottom: 36px; }
.w.w-text.lab-l.foot-top:not(.w-compact) { padding-top: 36px; }
.w.lab-xl:not(.nofoot):not(.foot-top):not(.w-compact) { padding-bottom: 44px; }
.w.lab-xl.foot-top:not(.w-compact) { padding-top: 44px; }
.w.w-tabs.lab-xl:not(.nofoot):not(.foot-top):not(.w-compact) { padding-bottom: 40px; }
.w.w-tabs.lab-xl.foot-top:not(.w-compact) { padding-top: 40px; }
.w.w-selector.lab-xl:not(.nofoot):not(.foot-top):not(.w-compact) { padding-bottom: 38px; }
.w.w-selector.lab-xl.foot-top:not(.w-compact) { padding-top: 41px; }
.w.w-graph.lab-xl:not(.nofoot):not(.foot-top):not(.w-compact) { padding-bottom: 44px; }
.w.w-graph.lab-xl.foot-top:not(.w-compact) { padding-top: 44px; }
.w.w-text.lab-xl:not(.nofoot):not(.foot-top):not(.w-compact) { padding-bottom: 44px; }
.w.w-text.lab-xl.foot-top:not(.w-compact) { padding-top: 44px; }

/* ---------- process view ---------- */
.w-process { padding: 6px; }
.w-process > .w-body { display: block; min-height: 0; }
.pv-wrap { position: relative; height: 100%; }
.pv { width: 100%; height: 100%; display: block; overflow: visible; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
.pv-zoom { -webkit-tap-highlight-color: transparent; position: absolute; top: 2px; right: 2px; width: 30px; height: 30px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel); color: var(--ink-2); cursor: pointer; font-size: 16px; line-height: 1; opacity: .7; }
.pv-zoom:hover { opacity: 1; }
.editing .pv-zoom { display: none; }
.pv-empty { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; text-align: center; padding: 8px; }
.pv-part, .pv-texts { cursor: pointer; }
.pv-body { fill: var(--panel-2); stroke: var(--ink-2); stroke-width: 2; }
.pv-hollow { fill: var(--panel-2); }
.pv-edge { fill: none; stroke: var(--ink-2); stroke-width: 2; }
.pv-fill { fill: #d6a648; opacity: .85; transition: y .6s, height .6s; }
.pv-pulley { fill: var(--panel); stroke: var(--ink-2); stroke-width: 2; }
.pv-hub { fill: var(--ink-2); }
.pv-blade { fill: var(--ink-2); }
.pv-belt { stroke: var(--ink-2); stroke-width: 3; stroke-dasharray: 8 6; fill: none; }
.pv-buckets { stroke: var(--ink-2); stroke-width: 6; stroke-dasharray: 5 9; fill: none; }
.pv-spin { transform-box: fill-box; transform-origin: center; }
.pv-run .pv-belt, .pv-run .pv-buckets { stroke: var(--ok); animation: pv-dash var(--pv-dur, 1s) linear infinite; }
.pv-run.pv-spin { animation: pv-spin var(--pv-dur, 1s) linear infinite; }
.pv-run.pv-spin .pv-blade, .pv-run.pv-spin .pv-hub { fill: var(--ok); }
.pv-rev .pv-belt, .pv-rev .pv-buckets, .pv-rev.pv-spin { animation-direction: reverse; }
.pv-ccw.pv-spin { animation-direction: reverse; } /* turns anticlockwise when running forward */
.pv-rev.pv-ccw.pv-spin { animation-direction: normal; }
@keyframes pv-dash { to { stroke-dashoffset: -28; } } /* belts 8 + 6, buckets 5 + 9: two periods */
@keyframes pv-spin { to { transform: rotate(360deg); } }
.pv-stopped .pv-body { stroke: color-mix(in srgb, var(--ink-2) 70%, transparent); }
.pv-alarm .pv-body, .pv-alarm .pv-edge, .pv-alarm .pv-pulley { stroke: var(--bad); stroke-width: 3; }
.pv-alarm > * { animation: pv-alarm 1.2s ease-in-out infinite; }
@keyframes pv-alarm { 50% { opacity: .45; } }
.pv-offline { opacity: .55; }
.pv-vbody { transition: fill .3s; }
.pv-open .pv-vbody, .pv-open .pv-gate { fill: var(--ok); }
.pv-closed .pv-vbody { fill: color-mix(in srgb, var(--bad) 35%, var(--panel-2)); }
.pv-partial .pv-vbody { fill: var(--amber); }
.pv-gate { fill: var(--ink-2); transition: y .4s; }
.pv-branch { stroke: var(--ink-2); stroke-width: 6; stroke-linecap: round; opacity: .3; }
.pv-branch.pv-active { opacity: 1; stroke: #d6a648; }
.pv-flap { stroke: var(--ink); stroke-width: 4; stroke-linecap: round; transition: all .4s; }
.pv-jdot { fill: var(--ink-2); }
.pv-tagbox { fill: var(--panel); stroke: var(--line); stroke-width: 1.5; }
.pv text { paint-order: stroke; stroke: var(--panel); stroke-width: 3px; stroke-linejoin: round; }
.pv-name { font: 500 12px var(--display); fill: var(--ink-2); }
.pv-val { font: 500 12px var(--display); fill: var(--ink); font-variant-numeric: tabular-nums; }
.pv-big { font: 600 15px var(--display); fill: var(--ink); font-variant-numeric: tabular-nums; }
.pv-ltext { font-family: var(--display); fill: var(--ink); }
.pv-ltext-s { font-size: 11px; } .pv-ltext-m { font-size: 14px; } .pv-ltext-l { font-size: 20px; font-weight: 600; } .pv-ltext-xl { font-size: 30px; font-weight: 600; }
.pv-alarm .pv-big, .pv-alarm .pv-val { fill: var(--bad); }
.pv-line { fill: none; stroke-linejoin: round; stroke-linecap: round; stroke: color-mix(in srgb, var(--ink-2) 75%, transparent); transition: stroke .3s; }
.pv-line-pipe { stroke: #5f8fb8; }
.pv-line-air { stroke: color-mix(in srgb, #8fb0cc 70%, transparent); }
.pv-line-wire { stroke: var(--ink); }
.pv-line-signal { stroke: var(--ink-2); }
.pv-colored .pv-line { stroke: var(--pv-lc); }
.pv-flow { fill: none; stroke: none; stroke-linecap: round; pointer-events: none; }
/* the shift per cycle must be a whole number of dash periods (6 + 12 = 18), or the dashes jump back at every cycle */
.pv-flowing .pv-flow { stroke: #f0c060; stroke-dasharray: 6 12; animation: pv-flow 1.2s linear infinite; }
@keyframes pv-flow { to { stroke-dashoffset: -36; } }
.pv-flowing.pv-rev .pv-flow { animation-direction: reverse; }
.pv-line-pipe ~ .pv-flow { stroke: #bfe0ff; }
.pv-hit { fill: none; stroke: transparent; stroke-width: 14; pointer-events: stroke; }
@media (prefers-reduced-motion: reduce) { .pv *, .pv-run .pv-belt { animation: none !important; } }
/* zoom view */
.pv-overlay, .pv-editor { position: fixed; inset: 0; z-index: 900; background: var(--bg); display: flex; flex-direction: column; }
.pv-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--panel); }
.pv-bar .grow { flex: 1; }
.pv-stage { flex: 1; overflow: hidden; touch-action: none; position: relative; -webkit-tap-highlight-color: transparent; }
.pv-zoomhint { padding: 6px 12px; margin: 0; border-top: 1px solid var(--line); background: var(--panel); }
.pv-stage > svg { transform-origin: 0 0; }
/* popup */
.pv-pop { min-width: min(320px, 80vw); }
.pv-row { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: baseline; padding: 5px 0; border-bottom: 1px solid var(--line); }
.pv-row-alarm b { color: var(--bad); }
.pv-spark { margin: 10px 0; }
.pv-spark-svg { width: 100%; height: 60px; display: block; }
.pv-spark-svg polyline { fill: none; stroke: var(--amber); stroke-width: 2; vector-effect: non-scaling-stroke; }
.pv-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.pv-controls > .hint { flex-basis: 100%; margin: 0; }
.pv-armed { background: var(--bad) !important; color: #fff !important; border-color: var(--bad) !important; }
.pv-slider { flex-basis: 100%; display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; align-items: center; }
.pv-slider label { grid-column: 1 / -1; }
.pv-act-status { flex-basis: 100%; font-size: 13px; color: var(--ink-2); min-height: 1.2em; }
/* editor */
.pv-palette { display: flex; flex-wrap: wrap; gap: 4px; }
.pv-palette .btn { padding: 4px 9px; font-size: 13px; }
.pv-palette .btn.on { background: var(--amber-soft); border-color: var(--amber); }
.pv-zl { font-size: 13px; color: var(--ink-2); min-width: 3.4em; text-align: center; }
.pv-ed-main { flex: 1; display: grid; grid-template-columns: 1fr 300px; min-height: 0; }
.pv-ed-left { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.pv-ed-stage { flex: 1; overflow: auto; padding: 12px; outline: none; touch-action: none; }
.pv-ed-stage > svg { width: auto; height: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; }
.pv-ed-hint { padding: 6px 12px; border-top: 1px solid var(--line); margin: 0; }
.pv-ed-panel { overflow: auto; padding: 12px; border-left: 1px solid var(--line); background: var(--panel); }
.pv-ed-panel h3 { margin: 4px 0 8px; font: 600 15px var(--display); }
.pv-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pv-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.pv-range { display: grid; grid-template-columns: 1fr 1fr 44px auto; gap: 4px; margin-bottom: 4px; }
.pv-dot { fill: var(--ink-2); opacity: .35; }
.pv-gridbg { pointer-events: none; }
.pv-port { fill: var(--panel); stroke: var(--amber); stroke-width: 2; cursor: crosshair; }
.pv-port:hover { fill: var(--amber); }
.pv-sel { fill: none; stroke: var(--amber); stroke-width: 1.5; stroke-dasharray: 4 3; pointer-events: none; }
.pv-sel-line { stroke-width: 3; }
.pv-handle { fill: var(--amber); stroke: var(--panel); stroke-width: 2; cursor: move; }
.pv-boxsel { fill: color-mix(in srgb, var(--amber) 12%, transparent); stroke: var(--amber); stroke-width: 1.5; stroke-dasharray: 4 3; pointer-events: none; }
.pv-rubber { stroke: var(--amber); stroke-width: 2; stroke-dasharray: 4 4; pointer-events: none; }
.pv-editing .pv-part, .pv-editing .pv-texts { cursor: move; }
@media (max-width: 760px) {
  .pv-ed-main { grid-template-columns: 1fr; grid-template-rows: 1fr 40%; }
  .pv-ed-panel { border-left: 0; border-top: 1px solid var(--line); }
}
.w-process:not(.nofoot):not(.foot-top) { padding-bottom: 30px; }
.w-process.foot-top { padding-top: 30px; }
.w.w-process.lab-l:not(.nofoot):not(.foot-top):not(.w-compact) { padding-bottom: 36px; }
.w.w-process.lab-l.foot-top:not(.w-compact) { padding-top: 36px; }
.w.w-process.lab-xl:not(.nofoot):not(.foot-top):not(.w-compact) { padding-bottom: 44px; }
.w.w-process.lab-xl.foot-top:not(.w-compact) { padding-top: 44px; }
.pn-cant { opacity: .55; } .pn-check { margin-top: 4px; }
.pn-trace-box { margin-top: 12px; }
.pn-trace { max-height: 320px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; font-size: 12px; }
.pn-tr { display: grid; grid-template-columns: 5.5em 11em 1fr 1.4fr; gap: 8px; padding: 4px 8px; border-bottom: 1px solid var(--line); }
.pn-tr.bad .mono:last-child { color: var(--bad); }
.pn-tr .mono { font-family: var(--mono, ui-monospace, monospace); overflow-wrap: anywhere; }
@media (max-width: 640px) { .pn-tr { grid-template-columns: 1fr 1fr; } }
.pv-swirl { stroke-dasharray: 3 3; opacity: .6; }
.pv-die { stroke-dasharray: 2 4; stroke-width: 3; }
.pv-run.pv-spin .pv-pulley { stroke: var(--ok); }
.pv-screw { stroke-width: 1.5; opacity: .6; }
.pv-fin { stroke: var(--ink-2); stroke-width: 1; opacity: .55; }
.pv-fanring { opacity: .6; }
.pv-spipe { stroke-width: 3; }
.pv-sdot { fill: var(--ink-2); }
.pv-bubble { fill: var(--panel); }
.pv-btext { font: 700 10px var(--display); fill: var(--ink); pointer-events: none; }
.pv-alarm .pv-btext { fill: var(--bad); }
.pv-rod { transition: transform .35s ease-out; }
.pv-prox { fill: var(--panel-2); stroke: var(--ink-2); stroke-width: 1.5; transition: fill .2s; }
.pv-prox-on { fill: var(--ok); }
/* designed parts */
.pv-cs { fill: none; stroke: var(--ink-2); stroke-width: 2; stroke-linejoin: round; }
.pv-cs-body { fill: var(--panel-2); }
.pv-cs-dark { fill: var(--ink-2); }
.pv-cs-nostroke { stroke: none; }
.pv-cs-line { fill: none; }
.pv-cs-fill { opacity: .85; transition: y .6s, height .6s, width .6s; pointer-events: none; }
.pv-cs-text { font-family: var(--display); fill: var(--ink); font-variant-numeric: tabular-nums; }
.pv-cs-blink { animation: pv-alarm 1s ease-in-out infinite; }
.pv-alarm .pv-cs { stroke: var(--bad); }
.pv-missing { stroke-dasharray: 4 3; }
/* part designer */
.pd-editor { position: fixed; inset: 0; z-index: 950; background: var(--bg); display: flex; flex-direction: column; }
.pd-tools { display: flex; flex-wrap: wrap; gap: 4px; }
.pd-tools .btn { padding: 4px 9px; font-size: 13px; }
.pd-tools .btn.on { background: var(--amber-soft); border-color: var(--amber); }
.pd-main { grid-template-columns: 1fr 330px; }
.pd-stage { flex: 1; overflow: auto; padding: 16px; outline: none; touch-action: none; display: grid; place-items: center; }
.pd-canvas { width: auto; height: auto; background: var(--panel); border-radius: 6px; }
.pd-canvas [data-shape] { pointer-events: all; cursor: move; }
.pd-bg { pointer-events: none; }
.pd-box { fill: none; stroke: var(--amber); stroke-width: 1; stroke-dasharray: 5 4; pointer-events: none; }
.pd-selbox { fill: none; stroke: var(--amber); stroke-width: 1.2; stroke-dasharray: 3 3; pointer-events: none; }
.pd-handle { fill: var(--amber); stroke: var(--panel); stroke-width: 2; cursor: crosshair; }
.pd-port { fill: var(--panel); stroke: #3b82c4; stroke-width: 2.5; cursor: grab; }
.pd-port.on { fill: #3b82c4; }
.pd-portdir { stroke: #3b82c4; stroke-width: 2; pointer-events: none; }
.pd-draft { fill: none; stroke: var(--amber); stroke-width: 1.5; stroke-dasharray: 4 3; pointer-events: none; }
.pd-draftpt { fill: var(--amber); pointer-events: none; }
.pd-hint { padding: 6px 12px; margin: 0; border-top: 1px solid var(--line); }
.pd-panel { overflow: auto; padding: 12px; border-left: 1px solid var(--line); background: var(--panel); }
.pd-panel h3 { margin: 14px 0 6px; font: 600 15px var(--display); }
.pd-panel h3:first-child { margin-top: 0; }
.pd-inp { border: 1px solid var(--line); border-radius: 8px; padding: 6px; margin-bottom: 6px; display: grid; gap: 4px; }
.pd-inp-top, .pd-inp-row { display: flex; gap: 4px; }
.pd-inp-top input { flex: 1; }
.pd-inp-row input { width: 5em; min-width: 0; }
.pd-inp-row select { flex: 1; min-width: 0; }
.pd-color { display: flex; gap: 6px; align-items: center; }
.pd-color input[type=number] { width: 4.5em; }
.pd-try { display: grid; grid-template-columns: 1fr 5em auto auto; gap: 4px; align-items: center; margin-bottom: 4px; }
.pd-list { display: grid; gap: 6px; margin-top: 10px; }
.pd-row { display: grid; grid-template-columns: 56px 1fr; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
.pd-row-b { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
.pd-thumb { width: 56px; height: 56px; }
.pd-new { display: flex; flex-wrap: wrap; gap: 6px; }
.pv-pal-sep { font-size: 12px; color: var(--ink-2); align-self: center; margin-left: 6px; }
.pv-pal-custom { border-style: dashed; }
@media (max-width: 760px) { .pd-main { grid-template-columns: 1fr; grid-template-rows: 1fr 45%; } .pd-panel { border-left: 0; border-top: 1px solid var(--line); } }
.pv-pinshift-go { align-self: end; }
.pv-lrow { display: grid; grid-template-columns: 1fr auto auto; gap: 4px; align-items: center; font-size: 13px; padding: 2px 0; }
.pv-swap-io { margin-top: 6px; }
.tr .tr-fit { flex: 1; min-height: 0; min-width: 0; width: 100%; display: flex; align-items: center; justify-content: center; overflow: visible; }
.tr .tr-txt { display: flex; flex-direction: column; align-items: center; gap: 2px; flex: none; transform-origin: center; }
.tr .tr-val { font: 600 20px var(--display); color: var(--w-text, var(--ink)); line-height: 1; white-space: nowrap; }
.tr .tr-val small { font-size: .55em; margin-left: 2px; color: var(--ink-2); }
.tr .tr-chg { font-size: 11px; color: currentColor; font-weight: 600; white-space: nowrap; text-align: center; line-height: 1.2; }
/* sizes from the space the widget really has (its body, not the tile with padding and label) */
.w-trend > .w-body { container-type: size; }
.tr { --tr-col: 56%; --tr-row: 40%; }
.tr.tr-f-text { --tr-col: 32%; --tr-row: 24%; }
.tr.tr-f-arrow { --tr-col: 74%; --tr-row: 58%; }
.tr.tr-f-textonly .vec-art, .tr.tr-f-arrowonly .tr-fit { display: none; }
.tr.tr-f-textonly .tr-val { color: currentColor; } /* no arrow: the value carries the trend colour */
.tr.tr-f-arrowonly .vec-art { flex: 1 1 auto; height: 100%; max-width: none; }
.tr .vec-art { flex: 0 0 var(--tr-col); min-height: 24px; }
/* a short body: the arrow on the left, as tall as the body, the texts (scaled to fill) beside it */
@container (max-height: 130px) {
  .tr { flex-direction: row; gap: 8px; }
  .tr .vec-art { flex: none; height: 100%; width: auto; aspect-ratio: 1; max-width: var(--tr-row); min-height: 0; }
  .tr.tr-f-arrowonly .vec-art { max-width: none; flex: 1 1 auto; }
  .tr .tr-fit { height: 100%; justify-content: flex-start; }
  .tr .tr-txt { align-items: flex-start; transform-origin: left center; }
  .tr .tr-chg { text-align: left; }
}
/* one row high: value and change on one line */
@container (max-height: 56px) { .tr .tr-txt { flex-direction: row; align-items: baseline; gap: 8px; } }

/* MQTT devices */
.mq-conn { grid-template-columns: minmax(0, 3fr) 1fr minmax(0, 2fr) minmax(0, 2fr); }
.mq-filter { flex: 1 1 220px; min-width: 0; font-family: var(--mono, monospace); }
.mq-topic { font-family: var(--mono, monospace); }
.mq-topics { display: flex; flex-direction: column; gap: 4px; }
.mq-topic-box > summary { cursor: pointer; padding: 4px 0; }
.mq-topic-box > summary code { font-size: 13px; }
.mq-raw { font-size: 13px; background: var(--panel-2); padding: 2px 6px; border-radius: 4px; }
.mq-z2m { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin: 8px 0 14px; }
.mq-z2m h3 { margin-top: 4px; }
.mq-zdev { padding: 4px 0; border-top: 1px solid var(--line); }
.mq-zdev > summary { cursor: pointer; padding: 4px 0; }
.mq-props { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.mq-prop { font-size: 13px; padding: 4px 10px; }
.mq-zall { font-size: 13px; }
@media (max-width: 900px) { .mq-conn { grid-template-columns: 1fr 1fr; } }

/* Devices page: the four "+ … device" buttons in one row */
.srv-add { align-items: center; justify-content: flex-end; }
.dev-kind-opts { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.dev-kind-opt { align-items: flex-start; gap: 8px; margin: 0; }
.dev-kind-opt input { margin-top: 3px; }
@media (max-width: 640px) { .srv-add { justify-content: flex-start; } }
.dev-head-text { flex: 1 1 340px; min-width: 0; }
.dev-head-text .lead { max-width: 60ch; }
.dev-head-add .err:empty { display: none; }

/* process editor: the selected part's texts can be dragged on their own */
.pv-tbox { fill: none; stroke: var(--accent); stroke-width: 1; stroke-dasharray: 4 3; opacity: .8; pointer-events: none; }
.pv-editing .pv-tmoved text { cursor: move; }
.pv-editing .pv-tmove { cursor: move; }
.pv-tpos { margin-top: 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }

/* ---------- process view: rooms (house plan) ---------- */
.pv-room-floor { fill: var(--panel-2); }
.pv-room-tint { fill: transparent; opacity: .42; transition: fill .6s; }
.pv-room-fx { fill: transparent; }
.pv-room-fx.pv-fx-tint { opacity: .3; }
.pv-room-fx.pv-fx-pulse { opacity: .3; animation: pv-pulse 2.4s ease-in-out infinite; }
@keyframes pv-pulse { 0%, 100% { opacity: .12; } 50% { opacity: .5; } }
.pv-room-dust { fill: transparent; }
.pv-dust-pat circle { opacity: .8; }
.pv-dusty2 .pv-room-floor { fill: color-mix(in srgb, var(--panel-2) 78%, #8a6a45); }
.pv-wall { fill: none; stroke: var(--ink-2); stroke-linecap: square; pointer-events: none; }
.pv-wall-in { stroke-width: 2.5; }
.pv-wall-out { stroke-width: 4.5; stroke: var(--ink); }
.pv-window line { stroke: #4ea3d9; stroke-width: 1.6; pointer-events: none; }
.pv-window { pointer-events: none; }
.pv-door line, .pv-door path { stroke: var(--ink-2); stroke-width: 1.3; fill: none; pointer-events: none; }
.pv-door path { stroke-dasharray: 2 2; }
.pv-room, .pv-room-t { cursor: pointer; }
.pv-room-t text { stroke: color-mix(in srgb, var(--panel) 70%, transparent); stroke-width: 2.5px; }
.pv-room-name { font: 500 11px var(--display); fill: var(--ink-2); text-anchor: middle; }
.pv-room-val { font: 600 15px var(--display); fill: var(--ink); text-anchor: middle; font-variant-numeric: tabular-nums; }
.pv-room-sub { font: 500 10px var(--display); fill: var(--ink-2); text-anchor: middle; font-variant-numeric: tabular-nums; }
.pv-room-t.pv-alarm .pv-room-val { fill: var(--bad); }
.pv-room-badges { font: 600 10px var(--display); text-anchor: middle; fill: var(--ink-2); }
.pv-station rect { fill: var(--panel); stroke: var(--ink-2); stroke-width: 1.2; }
.pv-station line { stroke: var(--ink-2); stroke-width: 1; }
.pv-station circle { fill: var(--ok); }
.pv-views { position: absolute; top: 2px; left: 2px; display: inline-flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; background: var(--panel); z-index: 1; }
.pv-bar .pv-views { position: static; }
.pv-vbtn { -webkit-tap-highlight-color: transparent; border: 0; background: transparent; color: var(--ink-2); font: 500 12px var(--display); padding: 5px 9px; cursor: pointer; min-height: 30px; }
.pv-vbtn + .pv-vbtn { border-left: 1px solid var(--line); }
.pv-vbtn.on { background: var(--ink); color: var(--panel); }
.editing .pv-views { display: none; }
@media (prefers-reduced-motion: reduce) { .pv-room-fx.pv-fx-pulse { animation: none; opacity: .38; } }
/* editor: rooms */
.pv-room-selo { fill: none; stroke: var(--amber); stroke-width: 2; stroke-dasharray: 5 3; pointer-events: none; }
.pv-paint-cell { fill: var(--amber); opacity: .3; stroke: var(--amber); stroke-width: 1.5; pointer-events: none; }
.pv-paint-cell.pv-erase { fill: var(--bad); stroke: var(--bad); }
.pv-edge-hover { stroke: var(--amber); stroke-width: 5; stroke-linecap: round; opacity: .7; pointer-events: none; }
.pv-pal-sep { color: var(--ink-2); font-size: 12px; align-self: center; padding: 0 4px; }
.pv-ed-mode { background: color-mix(in srgb, var(--amber) 18%, transparent); border-radius: 6px; padding: 6px 8px; }

.pv-meas { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; margin: 6px 0; }
.pv-meas > summary { cursor: pointer; font-weight: 600; padding: 2px 0; }
.pv-meas[open] > summary { margin-bottom: 6px; }
.pv-m-range { grid-template-columns: 1fr 1fr 44px auto; padding-bottom: 6px; border-bottom: 1px dashed var(--line); }
.pv-m-range .pv-mr-look, .pv-m-range .pv-mr-label { grid-column: 1 / -1; min-width: 0; }

/* ---------- process view: storage sensors, screw, rotary valve, pump, mill, dryer, furnace, bag filter ---------- */
.pv-lamp { fill: var(--panel); stroke: var(--ink-2); stroke-width: 1.2; }
.pv-lamp.pv-lamp-on { fill: var(--ok); stroke: var(--ok); }
.pv-lamp-t { font: 600 8px var(--display); fill: var(--ink-2); }
.pv-flights { fill: none; stroke: var(--ink-2); stroke-width: 2; }
.pv-shaft { stroke: var(--ink-2); stroke-width: 1.5; opacity: .6; }
.pv-run .pv-flights { stroke: var(--ok); }
.pv-run.pv-slide10 { animation: pv-slide10 var(--pv-dur, 1s) linear infinite; }
.pv-run.pv-slide { animation: pv-slide14 var(--pv-dur, 1s) linear infinite; }
.pv-rev.pv-slide10, .pv-rev.pv-slide { animation-direction: reverse; }
@keyframes pv-slide10 { to { transform: translateX(10px); } }
@keyframes pv-slide14 { to { transform: translateX(14px); } }
.pv-stripes { fill: none; stroke: var(--ink-2); stroke-width: 1.5; opacity: .55; }
.pv-run .pv-stripes { stroke: var(--ok); opacity: .8; }
.pv-vane { stroke: var(--ink-2); stroke-width: 2.5; stroke-linecap: round; }
.pv-run .pv-vane { stroke: var(--ok); }
.pv-hammer { fill: var(--ink-2); }
.pv-run .pv-hammer { fill: var(--ok); }
.pv-screen { fill: none; stroke: var(--ink-2); stroke-width: 2; stroke-dasharray: 2 3; }
/* heating: water coloured by temperature, heat exchanger plates, boiler coil and heater */
.pv-water { stroke: none; opacity: .85; }
.pv-shell { stroke-width: 3; }
.pv text.pv-inwater { fill: #fff; stroke: rgba(0,0,0,.45); stroke-width: 2.5px; paint-order: stroke; font-weight: 600; }
.pv-plate-h { stroke: #C2412D; stroke-width: 1.6; }
.pv-plate-c { stroke: #3D7BE0; stroke-width: 1.6; }
.pv-thot { fill: #C2412D; }
.pv-tcold { fill: #3D7BE0; }
.pv-alarm .pv-thot, .pv-alarm .pv-tcold { fill: var(--bad); }
.pv-coil { fill: none; stroke: var(--ink-2); stroke-width: 2; stroke-linejoin: round; }
.pv-coil-on .pv-coil { stroke: #C2412D; }
.pv-coil-flow { fill: none; stroke: #fff; stroke-width: 1.2; stroke-dasharray: 3 9; opacity: 0; stroke-linejoin: round; }
.pv-coil-on .pv-coil-flow { opacity: .8; animation: pv-flow 1.2s linear infinite; }
.pv-elem { fill: none; stroke: var(--ink-2); stroke-width: 2.5; stroke-linecap: round; }
.pv-elem-on .pv-elem { stroke: #f07b16; filter: drop-shadow(0 0 3px #f07b16); }
/* heat pump: the refrigerant circle; pipe loops in the ground / floor */
.pv-ref { fill: none; stroke: var(--ink-2); stroke-width: 1.6; stroke-linejoin: round; }
.pv-ref-c { fill: none; stroke: #3D7BE0; stroke-width: 2.2; stroke-linejoin: round; }
.pv-ref-h { fill: none; stroke: #C2412D; stroke-width: 2.2; stroke-linejoin: round; }
.pv-hp-cold { fill: #3D7BE0; opacity: .75; }
.pv-hp-hot { fill: #C2412D; opacity: .75; }
.pv-comp { fill: var(--panel); stroke: var(--ink-2); stroke-width: 1.6; }
.pv-comp-t { fill: var(--ink-2); }
.pv-ref-flow, .pv-loop-flow { fill: none; stroke: var(--ink); stroke-width: 1.2; stroke-dasharray: 3 9; opacity: 0; }
.pv-loop-flow { stroke: #fff; }
.pv-run .pv-ref-flow, .pv-run .pv-loop-flow { opacity: .7; animation: pv-flow 1.4s linear infinite; }
.pv-run .pv-loop-flow.pv-rev { animation-direction: reverse; }
.pv-soil { fill: #8b6b47; opacity: .35; }
.pv-grass { fill: none; stroke: #4c9a3a; stroke-width: 2.5; stroke-linecap: round; }
.pv-screed { fill: #b8b2a7; opacity: .3; }
.pv-insul { fill: none; stroke: #d9b44a; stroke-width: 1.2; }
.pv-floorline { stroke: #a87b4f; stroke-width: 4; }
.pv-loop { fill: none; stroke-width: 3.5; stroke-linejoin: round; stroke-linecap: round; }
@media (prefers-reduced-motion: reduce) { .pv-coil-on .pv-coil-flow, .pv-run .pv-ref-flow, .pv-run .pv-loop-flow { animation: none; } }
.pv-flame { display: none; transform-box: fill-box; transform-origin: 50% 100%; }
.pv-burning .pv-flame { display: inline; animation: pv-flicker .7s ease-in-out infinite alternate; }
.pv-flame-o { fill: #f07b16; }
.pv-flame-i { fill: #ffd34d; }
@keyframes pv-flicker { from { transform: scale(.92, .86); } to { transform: scale(1.04, 1.06); } }
.pv-bag { fill: var(--panel); stroke: var(--ink-2); stroke-width: 1.2; }
.pv-pulsing .pv-bag { stroke: var(--ok); animation: pv-bagpulse 1.1s ease-in-out infinite; }
@keyframes pv-bagpulse { 50% { opacity: .35; } }
.pv-colopt { display: inline-flex; align-items: center; gap: 8px; }
.pv-colopt input[type=color] { width: 48px; height: 32px; padding: 0; }
@media (prefers-reduced-motion: reduce) { .pv-burning .pv-flame, .pv-pulsing .pv-bag, .pv-run.pv-slide, .pv-run.pv-slide10 { animation: none; } }
/* process editor: the parts menu */
.pv-palette { align-items: center; }
.pv-cat { position: relative; display: inline-flex; }
.pv-cat-btn.on { border-color: var(--amber); }
.pv-menu { display: none; position: absolute; top: calc(100% + 4px); left: 0; z-index: 40; min-width: 220px; max-height: min(70vh, 520px); overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 28px rgba(0, 0, 0, .22); padding: 6px; }
.pv-cat.open .pv-menu { display: grid; gap: 2px; }
.pv-mi { -webkit-tap-highlight-color: transparent; display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: transparent; color: var(--ink);
  font: 500 14px var(--body, inherit); text-align: left; padding: 5px 8px; border-radius: 7px; cursor: pointer; min-height: 40px; }
.pv-mi:hover, .pv-mi:focus-visible { background: var(--panel-2); }
.pv-mi-pic { flex: 0 0 44px; height: 32px; display: grid; place-items: center; color: var(--ink-2); font-size: 18px; }
.pv-thumb { width: 44px; height: 32px; overflow: visible; pointer-events: none; }
.pv-thumb .pv-body { stroke-width: 2.5; }
.pv-find-box { margin-left: 4px; }
.pv-find { width: 150px; min-height: 34px; }
.pv-find-box.open .pv-menu { display: grid; gap: 2px; }
.pv-find-menu { left: auto; right: 0; }
.pv-mi-none { margin: 6px 8px; }
.pv-house-sec { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; }
.pv-house-sec > summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
.pv-thumb { display: block; }
.pv-fpins { display: flex; flex-direction: column; align-items: stretch; gap: 4px; }
.pv-fpins > .pv-fpin-add { align-self: flex-start; }
.pv-fpin { display: flex; gap: 6px; }
.pv-fpin select { flex: 1; }

/* Usage widget: amount of a counter for a period */
.usage { display: flex; flex-direction: column; gap: 4px; flex: 1; height: 100%; min-height: 0; }
.us-head { display: flex; align-items: center; gap: 4px; }
.us-mid { flex: 1; min-width: 0; position: relative; text-align: center; }
.us-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.us-pick { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.us-title::after { content: ' ▾'; color: var(--ink-2); font-weight: 400; font-size: 11px; }
.us-nav { flex: none; width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--line); background: var(--field, transparent); color: var(--ink); font-size: 18px; line-height: 1; cursor: pointer; padding: 0; }
.us-nav:disabled { opacity: .3; cursor: default; }
.us-big { text-align: center; font-size: clamp(20px, 14cqh, 44px); font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink); line-height: 1.15; }
.us-big small { font-size: .45em; color: var(--ink-2); font-weight: 400; }
.us-sub { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 10px; font-size: 12px; color: var(--ink-2); text-align: center; }
.us-cmp.up { color: #D98A1C; }
.us-cmp.down { color: #2E9E5B; }
.us-cost { color: var(--ink); font-weight: 600; }
.us-note { font-style: italic; }
.us-bars { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.us-cols { flex: 1; min-height: 24px; display: flex; align-items: flex-end; gap: 2px; }
.us-col { flex: 1; height: 100%; display: flex; align-items: flex-end; min-width: 1px; }
.us-col i { display: block; width: 100%; min-height: 1px; border-radius: 2px 2px 0 0; background: var(--w-accent, var(--amber, #E8A10C)); opacity: .85; }
.us-col.now i { opacity: .5; }
.us-col.future i { opacity: 0; }
.us-col:hover i { opacity: 1; }
.us-axis { display: flex; justify-content: space-between; font-size: 10px; color: var(--ink-2); }
@container (max-height: 170px) { .us-bars { display: none; } .us-sub { font-size: 11px; } }
@container (max-height: 110px) { .us-sub { display: none; } }
.counter-form { display: grid; gap: 8px; }
.counter-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; }
.counter-actions h3 { width: 100%; margin: 0; font-size: 13px; }
.counter-btn { display: block; margin-top: 2px; font-size: 12px; }
@container (max-width: 160px) { .us-nav { width: 20px; height: 22px; font-size: 14px; } .us-title { font-size: 12px; } .us-title::after { display: none; } .us-head { gap: 2px; } }

/* the admin's read-only view of another user's project (0.65) */
.adminview-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 16px; background: var(--panel); border-bottom: 2px solid var(--amber); font-size: 14px; }
.adminview-tag { font-weight: 700; color: var(--amber); text-transform: uppercase; letter-spacing: .04em; font-size: 12px; }
.adminview-what { flex: 1; min-width: 0; color: var(--ink-2); }
.dev-unreach { margin: 0 0 14px; padding: 10px 14px; border-radius: 8px; border-left: 4px solid var(--amber); background: color-mix(in srgb, var(--amber) 12%, var(--panel)); }
.dev-unreach h2 { font-size: 16px; margin: 0 0 4px; }
.dev-unreach p { margin: 0 0 6px; }
.dev-unreach ul { margin: 0; padding-left: 20px; }
ul.activity { margin: 0; padding: 0; list-style: none; max-height: 260px; overflow-y: auto; }
ul.activity li { padding: 4px 0; border-bottom: 1px solid var(--line); }
ul.activity li:last-child { border-bottom: 0; }
.proj-ico { color: var(--ink-2); font-size: 15px; line-height: 1; text-align: center; }
@media (max-width: 560px) { .adminview-note { display: none; } .adminview-bar { padding: 6px 12px; } }
/* the device status chip on a display link (0.66) */
.devstat.devstat-float { position: absolute; top: max(8px, env(safe-area-inset-top)); right: max(8px, env(safe-area-inset-right)); z-index: 30; background: color-mix(in srgb, var(--panel) 88%, transparent); border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px; box-shadow: 0 2px 8px rgb(0 0 0 / .15); backdrop-filter: blur(4px); }
.link-status { margin: 0 0 0 8px; display: inline-flex; font-size: 13px; }
body.devstat-on main.board-wrap { padding-top: 50px; } /* the chip gets its own line: never over a control */
/* it scrolls away with the page (0.66.1): the page is always tall enough to scroll it out of sight */
body.devstat-on { min-height: calc(100dvh + 50px); }
html.sbar-none { scrollbar-width: none; } /* share.js chipScrollbar: only the chip's line to scroll */
html.sbar-none::-webkit-scrollbar { display: none; }
.rule-row > .hint, .rule-line > .hint { margin: 0; }
/* calculated pins (0.69) */
.calc-card { margin: 0 0 16px; }
.calc-row { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 8px 0; border-top: 1px solid var(--line); }
.calc-row .pin-no { padding-top: 8px; }
.calc-formula { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; width: 100%; }
.calc-out { font-size: 13px; margin-top: 4px; min-height: 18px; overflow-wrap: anywhere; }
.calc-out .err { color: var(--bad); }
.calc-btns { display: flex; gap: 6px; }
.calc-tools { justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.calc-add, .calc-ins { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.calc-add select { width: auto; }
.calc-ins select { width: auto; max-width: 180px; }
.calc-ins .hint { margin: 0; }
.calc-tag { display: block; color: var(--amber); font-weight: 600; }
@media (max-width: 560px) { .calc-row { grid-template-columns: 1fr; } .calc-row .pin-no { padding-top: 0; } }
.calc-ins button { flex: none; width: auto; }
/* "+ Any pin…" in rule messages (0.70) */
.rule-pinchip { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.rule-pinpick { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.rule-pinpick select { width: auto; max-width: 170px; padding: 4px 8px; font-size: 13px; }
/* Status widget (0.71) */
.w-status .w-body { position: relative; align-self: stretch; }
.st { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 6px 8px; border-radius: 8px; }
.st-in { display: flex; flex-direction: column; align-items: center; gap: 2px; white-space: nowrap; }
.st-row { display: flex; align-items: center; gap: .35em; }
.st-text { font-weight: 700; font-size: 22px; line-height: 1.1; }
.st-code { font-size: 12px; opacity: .75; font-variant-numeric: tabular-nums; }
.st-text.na { opacity: .8; }
.st-s-tile { background: var(--st); }
.st-s-tile.st-none { background: transparent; color: var(--ink); }
.st-s-text .st-text { color: var(--st); }
.st-s-text.st-none .st-text { color: var(--ink); }
.st-lamp { width: .7em; height: .7em; border-radius: 50%; background: var(--st); box-shadow: 0 0 .45em var(--st); flex: none; }
.st-s-lamp.st-none .st-lamp { background: var(--line); box-shadow: none; }
.st-hint { position: absolute; left: 6px; right: 6px; bottom: 4px; font-size: 11px; color: var(--ink-2); text-align: center; }
/* value texts dialog (0.71) */
.pt-rows { display: grid; gap: 6px; max-height: 46vh; overflow-y: auto; padding-right: 2px; }
.pt-row { display: grid; grid-template-columns: 64px minmax(0, 1fr) 140px 28px; gap: 6px; align-items: center; }
.pt-colcell { display: flex; gap: 4px; align-items: center; min-width: 0; }
.pt-colcell .pt-col { flex: 1; min-width: 0; }
.pt-pick { flex: none; width: 34px; height: 34px; padding: 2px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-2); cursor: pointer; }
.pt-pick.none { opacity: .45; }
.pt-head { font-size: 12px; color: var(--ink-2); }
.pt-col { padding: 6px; }
.pt-paste { width: 100%; font-family: ui-monospace, Menlo, Consolas, monospace; margin: 6px 0; }
.texts-btn { display: block; margin-top: 4px; font-size: 12px; }
@media (max-width: 560px) { .pt-row { grid-template-columns: 56px minmax(0, 1fr) 112px 28px; } }
.tg-fmt { margin-top: 6px; }
.tg-fmt-hint { display: block; line-height: 1.5; }
.tg-fmt-ex { display: block; white-space: pre; margin-top: 4px; padding: 6px 8px; border-radius: 6px; background: var(--panel-2); font-size: 12px; }
/* Devices: my devices, then a section per user who shared (0.73) */
.dev-groups { display: grid; gap: 18px; }
.dev-tools { justify-content: flex-start; gap: 12px; flex-wrap: wrap; align-items: center; }
.dev-find { max-width: 320px; }
.dev-which { display: flex; gap: 6px; }
.dev-which .seg { flex: none; min-width: 0; padding: 8px 12px; font-size: 14px; }
.dev-group-head { display: flex; align-items: center; gap: 8px; font-size: 17px; margin: 0 0 8px; }
.dev-group-head.shared b { color: var(--owner); }
.owner-ava { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--owner); color: #fff; font: 700 14px/1 var(--display); flex: none; }
.dev.dev-shared { border-left: 4px solid var(--owner); background: color-mix(in srgb, var(--owner) 7%, var(--panel)); }
/* Devices on a phone: the buttons on their own line (the page was wider than the screen) */
@media (max-width: 760px) {
  .devlist > .dev { grid-template-columns: 18px minmax(0, 1fr); padding: 12px 12px; }
  .devlist > .dev > .meta-wide { display: none; }
  .devlist > .dev > .row { grid-column: 1 / -1; flex-wrap: wrap; justify-content: flex-start; gap: 2px 4px; margin: 0 -8px; }
  .devlist > .dev > .row .btn { padding: 6px 10px; flex: none; width: auto; }
  .dev-find { max-width: none; flex: 1 1 100%; }
}
/* controls on pins I may only see (0.74) */
.w.w-ro:not(.w-terminal) .w-body { opacity: .55; filter: grayscale(.6); pointer-events: none; }
.w.w-ro.w-terminal input, .w.w-ro.w-terminal .term-send { display: none; }
.w-ro-tag { position: absolute; top: 6px; right: 8px; z-index: 2; font: 600 10px/1 var(--display); letter-spacing: .04em; text-transform: uppercase; color: var(--ink-2); background: var(--panel-2); padding: 3px 6px; border-radius: 4px; cursor: help; }
body.editing .w.w-ro .w-body { pointer-events: auto; }
/* "Show only when" (0.97): hidden or greyed out while the condition is false;
   while editing every widget stays visible (faded) so it can be changed */
body:not(.editing) .w.w-when-off:not(.w-when-dim) { display: none; }
.w.w-when-off.w-when-dim .w-body { opacity: .4; filter: grayscale(.7); pointer-events: none; }
body.editing .w.w-when-off { opacity: .45; outline: 2px dotted var(--ink-2); outline-offset: -4px; }
body.editing .w.w-when-off.w-when-dim .w-body { pointer-events: none; }
.when-cmp .row { display: flex; gap: 8px; }
.w-when-tag { position: absolute; top: 6px; right: 8px; z-index: 2; max-width: calc(100% - 16px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 600 10px/1 var(--display); letter-spacing: .02em; color: var(--ink-2); background: var(--panel-2); padding: 3px 6px; border-radius: 4px; cursor: help; }
.when-cmp .when-op { width: 5.5em; flex: none; }

/* Screen widget and the TV's progress line (0.76) */
.scrw { width: 100%; height: 100%; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.scrw-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 13px; color: var(--ink-2); }
.scrw-tv { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scrw-mode { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; padding: 1px 7px; border-radius: 9px; background: var(--panel-2); }
.scrw-mode.on { background: var(--w-accent, var(--amber)); color: #1a1306; }
.scrw-now { display: flex; flex-direction: column; align-items: center; text-align: center; line-height: 1.2; }
.scrw-now b { font: 600 clamp(16px, min(8cqw, 14cqh), 28px)/1.15 var(--display); }
.scrw-now small { color: var(--ink-2); min-height: 1.2em; }
.scrw-btns { display: flex; gap: 8px; }
.scrw-btns .btn { flex: 1; min-height: 44px; font-size: 16px; }
.scrw-list { display: flex; flex-direction: column; gap: 4px; overflow-y: auto; min-height: 0; flex: 1; }
.scrw-item { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.scrw-item small { margin-left: auto; color: var(--ink-2); }
.scrw-item.cur { border-color: var(--w-accent, var(--amber)); box-shadow: inset 3px 0 0 var(--w-accent, var(--amber)); font-weight: 600; }
.scrw-item:disabled { cursor: default; opacity: .7; }
.scrw-n { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--panel-2); font-size: 12px; }
#scr-bar { position: fixed; left: 0; right: 0; bottom: 0; height: 3px; z-index: 50; pointer-events: none; }
#scr-bar i { display: block; height: 100%; width: 0; background: var(--amber); opacity: .7; }
.scr-rows { display: flex; flex-direction: column; gap: 4px; margin: 8px 0 12px; max-height: 45vh; overflow-y: auto; }
.scr-row { display: flex; align-items: center; gap: 6px 12px; flex-wrap: wrap; padding: 4px 0; border-bottom: 1px solid var(--line); }
.scr-row:last-child { border-bottom: 0; }
.scr-name { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.scr-name .check span { overflow-wrap: anywhere; word-break: normal; }
.scr-name .scr-end { font-size: 13px; padding-left: 26px; white-space: nowrap; }
.scr-ctl { display: flex; align-items: center; gap: 4px; flex: none; margin-left: auto; }
.scr-secs-box { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.scr-secs-box .scr-secs { width: 5.5em; }
dialog.scr-dlg { width: min(640px, 96vw); }
.scr-row.off .scr-secs-box { opacity: .4; }
.scr-secs-box { display: inline-flex; align-items: center; gap: 3px; }
.scr-secs { width: 5.5em; }

/* price plans (0.77) */
.pr-bands { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 6px; }
.pr-band { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; display: flex; flex-direction: column; gap: 6px; }
.pr-band-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pr-band-top input[type=text]:first-child { flex: 1 1 8em; min-width: 6em; }
.pr-num { width: 7em; }
.pr-time { width: 4.2em; text-align: center; }
.pr-days { display: flex; flex-wrap: wrap; gap: 4px; }
.pr-day { min-width: 34px; min-height: 32px; padding: 2px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink-2); font: inherit; font-size: 13px; cursor: pointer; }
.pr-day[aria-pressed=true] { background: var(--amber); border-color: var(--amber); color: #1a1306; font-weight: 600; }
.pr-hol { width: 100%; font: inherit; font-size: 13px; }
.pr-today { margin-top: 6px; }
.pr-strip-head { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.pr-strip { display: flex; align-items: flex-end; gap: 1px; height: 64px; margin-top: 4px; border-bottom: 1px solid var(--line); }
.pr-strip i { flex: 1; background: var(--amber); opacity: .55; min-width: 1px; }
.pr-strip i.cur { opacity: 1; background: var(--ink); }
.pr-strip i.none { background: var(--line); }
.pr-strip-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-2); }
.pr-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.pr-item { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.pr-item-main { flex: 1 1 14em; display: flex; flex-direction: column; min-width: 0; }
.pr-now { font-variant-numeric: tabular-nums; font-weight: 600; }
.us-cost.partly { opacity: .8; }

/* Reports (0.77) */
.rp-pick { display: flex; flex-wrap: wrap; gap: 10px 18px; }
.rp-dev { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; margin: 0; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rp-dev legend { font-weight: 600; padding: 0 4px; }
.rp-pick-small { flex-direction: column; gap: 2px; max-height: 30vh; overflow-y: auto; flex-wrap: nowrap; }
.rp-bar { justify-content: flex-start; gap: 8px 12px; margin-top: 12px; align-items: flex-end; flex-wrap: wrap; }
.rp-f { display: flex; flex-direction: column; gap: 3px; margin: 0; }
.rp-f > span { font-size: 12px; color: var(--ink-2); }
.rp-f select { width: auto; }
.rp-bar input.rp-dt { width: 10.5em; font-variant-numeric: tabular-nums; }
.rp-bar select { padding-top: 8px; padding-bottom: 8px; }
.rp-dt.bad { border-color: var(--bad); box-shadow: 0 0 0 1px var(--bad); }
.rp-dash { padding-bottom: 8px; color: var(--ink-2); }
.rp-bar label.check.rp-cmp { margin: 0 0 8px; }
.rp-all { display: flex; gap: 10px; align-items: baseline; margin: 8px 0 0; font-size: 14px; }
.rp-dev label.check { margin: 0; padding: 3px 0; }
.rp-dev label.check small { margin-left: 2px; }
.reports .card { max-width: 1100px; }
.reports .rp-controls h2 { margin: 14px 0 8px; }
.reports .rp-controls h2:first-child { margin-top: 0; }
.rp-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.rp-scroll { overflow-x: auto; max-width: 100%; }
.rp-table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; margin: 6px 0 14px; }
.rp-table th, .rp-table td { padding: 5px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.rp-table th[scope=row] { font-weight: 500; white-space: normal; }
.rp-table .num { text-align: right; }
.rp-table thead th { font-size: 12px; color: var(--ink-2); font-weight: 600; }
.rp-total th, .rp-total td { font-weight: 700; border-top: 2px solid var(--line); }
.rp-chg.up { color: #c62828; } .rp-chg.down { color: #2e7d32; }
.rp-emails { display: flex; flex-direction: column; gap: 4px; }
.rp-preview { white-space: pre-wrap; background: var(--panel-2); border-radius: 8px; padding: 8px 10px; font-size: 12.5px; max-height: 30vh; overflow: auto; }
@media print {
  /* paper is white: the light colours, whatever the screen's theme */
  :root, :root[data-theme="dark"], :root:not([data-theme="light"]) {
    --bg: #fff; --panel: #fff; --panel-2: #f2f2f2; --ink: #000; --ink-2: #444; --line: #999; --amber: #b07800; --ok: #1d7a43; --bad: #b3261e; color-scheme: light;
  }
  html, body { height: auto; background: #fff !important; color: #000 !important; }
  .reports { -webkit-print-color-adjust: exact; print-color-adjust: exact; } /* the ranges' colour dots */
  .bar, .rp-controls, .toast, .ptoc-box, .ptoc-jump { display: none !important; }
  .page { max-width: none !important; width: auto !important; margin: 0 !important; padding: 0 !important; background: #fff !important; color: #000 !important; }
  .reports .card { max-width: none !important; background: #fff !important; border: none !important; box-shadow: none !important; padding: 0 !important; margin: 0 0 18pt !important; }
  .reports .rp-scroll { overflow: visible !important; }
  .reports h2 { font-size: 15pt; margin: 0 0 4pt; }
  .reports .rp-table { width: 100%; font-size: 10pt; margin: 4pt 0 10pt; }
  .reports .rp-table th, .reports .rp-table td { border-bottom: 0.5pt solid #999; padding: 3pt 6pt; color: #000; }
  .reports .rp-table thead th { color: #333; font-size: 9pt; }
  .reports .rp-table tr { break-inside: avoid; }
  .reports .rp-table thead { display: table-header-group; }
  .reports .rp-hours + .rp-hours, .reports .rp-out + .rp-hours { break-before: auto; }
  .reports .hint, .reports small { color: #444 !important; }
  .rp-chg.up { color: #b3261e !important; } .rp-chg.down { color: #1d7a43 !important; }
  @page { margin: 14mm 12mm; }
}
.pr-band-top input, .pr-band-top .btn { width: auto; flex: 0 0 auto; }
.pr-band-top input[type=text]:first-child { flex: 1 1 8em; }
.pr-band-top .pr-num { width: 6.5em; }
.pr-band-top .pr-time { width: 4.8em; }
.pr-btns, .rp-bar { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; justify-content: flex-start; margin-top: 6px; }
.pr-btns > *, .rp-bar > * { flex: 0 0 auto; width: auto; }
.rp-dates input { width: auto; }

/* Manual and (?) help (0.79) */
.help-q { display: inline-grid; place-items: center; width: 20px; height: 20px; min-width: 20px; padding: 0; margin: 0 4px; border-radius: 50%;
  border: 1.5px solid var(--ink-2); background: transparent; color: var(--ink-2); font: 700 12px/1 var(--font, system-ui); cursor: pointer; vertical-align: middle; flex: 0 0 auto; }
.help-q:hover, .help-q:focus-visible { border-color: var(--amber); color: var(--ink); background: var(--panel-2); }
@media (pointer: coarse) { .help-q { width: 26px; height: 26px; min-width: 26px; font-size: 14px; } }
.help-tip { position: fixed; z-index: 1000; width: 320px; max-width: calc(100vw - 16px); display: flex; flex-direction: column; gap: 4px; padding: 10px 12px;
  border-radius: 10px; background: var(--panel); color: var(--ink); border: 1px solid var(--line); box-shadow: 0 6px 24px rgba(0,0,0,.22); font-size: 13px; line-height: 1.4; pointer-events: none; }
dialog.help-panel { width: min(640px, calc(100vw - 24px)); max-height: min(80vh, 820px); padding: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); color: var(--ink);
  display: flex; flex-direction: column; }
dialog.help-panel:not([open]) { display: none; }
dialog.help-panel::backdrop { background: rgba(0,0,0,.35); }
.help-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px 0 16px; }
.help-badge { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); font-weight: 700; }
.help-body { overflow-y: auto; padding: 0 18px 8px; flex: 1; }
.help-body .man-sec h2 { margin-top: 4px; }
.help-foot { padding: 10px 16px 14px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; }
.bar-help { font-weight: 700; min-width: 36px; }
.bar.compact.menu-open .bar-help::after, .bar.menu-open .bar-help::after { content: ' Manual'; font-weight: 500; }

.page.manual { max-width: 1180px; }
.man-top { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.man-title { margin: 0; }
.man-print { margin-left: auto; }
.man-search { position: relative; margin: 10px 0 14px; }
.man-q { width: 100%; font-size: 16px; padding: 10px 12px; }
.man-results { position: absolute; z-index: 20; left: 0; right: 0; top: 100%; margin-top: 4px; max-height: 70vh; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 28px rgba(0,0,0,.2); padding: 6px; }
.man-results ol { list-style: none; margin: 0; padding: 0; }
.man-results li { padding: 8px 10px; border-radius: 8px; }
.man-results li:hover { background: var(--panel-2); }
.man-results a { text-decoration: none; color: var(--ink); }
.man-snip { font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.man-snip mark { background: rgba(232,161,12,.35); color: inherit; border-radius: 3px; }
.man-wrap { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 28px; align-items: start; }
.man-toc-box { position: sticky; top: 70px; max-height: calc(100vh - 90px); overflow-y: auto; }
.man-toc-box > summary { font-weight: 700; cursor: pointer; padding: 4px 0; }
.man-toc { font-size: 14px; }
.man-toc-chap { display: block; font-weight: 700; margin: 10px 0 2px; color: var(--ink); text-decoration: none; }
.man-toc ul { list-style: none; margin: 0; padding: 0 0 0 10px; border-left: 2px solid var(--line); }
.man-toc li a { display: block; padding: 3px 6px; color: var(--ink-2); text-decoration: none; border-radius: 6px; }
.man-toc a[aria-current] { color: var(--ink); background: var(--panel-2); font-weight: 600; }
.man-body { min-width: 0; line-height: 1.6; font-size: 15.5px; }
.man-body > h1 { margin-top: 0; }
.man-sec { padding-top: 6px; border-radius: 8px; scroll-margin-top: 70px; transition: background .6s; }
.man-sec.man-flash { background: rgba(232,161,12,.12); }
.man-sec h2 { font-size: 21px; margin: 26px 0 8px; display: flex; align-items: baseline; gap: 8px; }
.man-anchor { font-size: 15px; color: var(--ink-2); text-decoration: none; opacity: 0; }
.man-sec h2:hover .man-anchor, .man-anchor:focus { opacity: 1; }
.man-body h4, .help-body h4 { margin: 18px 0 4px; font-size: 16px; }
.man-body code, .help-body code { background: var(--panel-2); padding: 1px 5px; border-radius: 4px; font-size: .92em; }
.man-code { background: var(--panel-2); padding: 10px 12px; border-radius: 8px; overflow-x: auto; font-size: 13.5px; }
.man-code code { background: none; padding: 0; }
.man-fig { margin: 12px 0 16px; }
.man-fig img { max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 8px; cursor: zoom-in; display: block; }
.man-fig figcaption { font-size: 13px; color: var(--ink-2); margin-top: 4px; }
dialog.man-zoom { padding: 0; border: none; background: transparent; width: auto; max-width: 98vw; max-height: 98vh; overflow: visible; cursor: zoom-out; }
dialog.man-zoom img { display: block; margin: 0 auto; max-width: 96vw; max-height: 94vh; border-radius: 8px; background: #fff; box-shadow: 0 10px 40px rgba(0,0,0,.45); }
dialog.man-zoom .man-zoom-cap { color: #fff; font-size: 14px; text-align: center; margin-top: 10px; text-shadow: 0 1px 2px rgba(0,0,0,.6); }
dialog.man-zoom .man-zoom-x { position: fixed; top: 10px; right: 14px; width: 40px; height: 40px; border: none; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; font-size: 26px; line-height: 1; cursor: pointer; }
dialog.man-zoom::backdrop { background: rgba(0,0,0,.85); }
.man-call, .man-where-line { display: flex; gap: 10px; align-items: baseline; padding: 8px 12px; border-radius: 8px; margin: 10px 0; background: var(--panel-2); border-left: 4px solid var(--ink-2); }
.man-where-line { padding: 3px 8px; margin: 4px 0 0; font-size: 13px; border-left-width: 3px; }
.man-call-k { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--ink-2); flex: 0 0 auto; }
.man-where { border-left-color: var(--amber); }
.man-tip { border-left-color: #2e7d32; }
.man-warning { border-left-color: #c62828; }
.man-tablewrap { overflow-x: auto; }
.man-table { border-collapse: collapse; margin: 8px 0 14px; font-size: 14px; }
.man-table th, .man-table td { border-bottom: 1px solid var(--line); padding: 5px 10px 5px 0; text-align: left; vertical-align: top; }
.man-table th { font-size: 12.5px; color: var(--ink-2); }
.man-pn { display: flex; justify-content: space-between; margin: 32px 0 10px; padding-top: 12px; border-top: 1px solid var(--line); }
@media (max-width: 899px) {
  .man-wrap { grid-template-columns: 1fr; gap: 6px; }
  .man-toc-box { position: static; max-height: none; border: 1px solid var(--line); border-radius: 10px; padding: 6px 12px; }
}
@media print {
  .man-top, .man-search, .man-toc-box, .man-pn, .man-anchor, .help-q { display: none !important; }
  .man-wrap { display: block; }
  .man-body { font-size: 11pt; }
  .man-print-ch { page-break-before: always; }
  .man-sec { break-inside: auto; }
  .man-fig { break-inside: avoid; }
}

/* calculated pins: + Pin… picker and operators (0.79) */
.calc-tools-row { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; margin: 4px 0 2px; }
.calc-ops { display: flex; flex-wrap: wrap; gap: 3px; }
.calc-op { min-width: 30px; min-height: 30px; padding: 2px 7px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink); font: inherit; font-size: 13px; cursor: pointer; }
.calc-op:hover { border-color: var(--amber); }
dialog.cpp { width: min(720px, calc(100vw - 24px)); max-height: min(86vh, 760px); display: flex; flex-direction: column; gap: 8px; }
dialog.cpp:not([open]) { display: none; }
.cpp-q { width: 100%; font-size: 15px; }
.cpp-body { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 10px; min-height: 0; flex: 1; overflow: hidden; }
.cpp-devs[hidden] + .cpp-pins { grid-column: 1 / -1; }
.cpp-devs, .cpp-pins { overflow-y: auto; display: flex; flex-direction: column; gap: 3px; max-height: 52vh; }
.cpp-dev, .cpp-pin { display: flex; align-items: baseline; gap: 8px; text-align: left; padding: 6px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); font: inherit; cursor: pointer; min-height: 38px; }
.cpp-dev[aria-selected=true] { border-color: var(--amber); box-shadow: inset 3px 0 0 var(--amber); font-weight: 600; }
.cpp-pin:hover:not([disabled]), .cpp-dev:hover { border-color: var(--amber); }
.cpp-pin[disabled] { opacity: .45; cursor: default; }
.cpp-pin b { min-width: 2.6em; }
.cpp-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cpp-pin code { font-size: 12px; color: var(--ink-2); }
.cpp-foot { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
@media (max-width: 620px) {
  .cpp-body { grid-template-columns: 1fr; overflow-y: auto; }
  .cpp-devs { flex-direction: row; flex-wrap: wrap; max-height: none; }
  .cpp-dev { min-height: 34px; }
  .cpp-pins { max-height: none; }
}
dialog:has(.pt-rows) { width: min(580px, calc(100% - 32px)); }

/* ---------- the sun (0.87) ---------- */
.place-row { display: flex; gap: 6px; flex-wrap: wrap; }
.place-row .place-in { flex: 1 1 200px; min-width: 0; font-variant-numeric: tabular-nums; }
.place-in.bad { border-color: var(--bad); }
.place-note { display: block; margin-top: 4px; }
.sun-body { display: flex; flex-direction: column; gap: 6px; min-height: 0; width: 100%; height: 100%; align-self: stretch; container-type: size; }
.sun-none { display: flex; flex-direction: column; gap: 4px; align-items: center; justify-content: center; text-align: center; height: 100%; color: var(--ink-2); font-size: 13px; padding: 6px; }
.sun-head { display: flex; gap: 8px; align-items: baseline; font-size: 12px; color: var(--ink-2); flex-wrap: wrap; }
.sun-head .sun-state { font-weight: 600; color: var(--ink); font-size: 14px; }
.sun-head .sun-el { margin-left: auto; font-variant-numeric: tabular-nums; }
.sun-arc { position: relative; flex: 1 1 auto; min-height: 40px; border-radius: 8px; overflow: hidden; }
.sun-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.sun-hz { stroke: rgba(255, 255, 255, .7); stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.sun-tw { stroke: rgba(255, 255, 255, .28); stroke-width: 1; stroke-dasharray: 3 4; vector-effect: non-scaling-stroke; }
.sun-path { fill: none; stroke: rgba(255, 255, 255, .9); stroke-width: 2; vector-effect: non-scaling-stroke; }
.sun-now { stroke: rgba(255, 255, 255, .65); stroke-width: 1; vector-effect: non-scaling-stroke; }
.sun-dot { position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: #FFC93C; border: 2px solid #fff; box-shadow: 0 0 10px rgba(255, 201, 60, .8); pointer-events: none; }
.sun-dot.down { background: #9AA7C7; box-shadow: none; }
.sun-axis { position: absolute; top: 2px; z-index: 1; font-size: 10px; color: rgba(255, 255, 255, .85); text-shadow: 0 1px 2px rgba(0, 0, 0, .5); }
.sun-axis.l { left: 4px; } .sun-axis.m { left: 50%; transform: translateX(-50%); } .sun-axis.r { right: 4px; }
.sun-times { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 12px; overflow: hidden; min-height: 0; flex: 0 1 auto; }
.sun-t { display: flex; gap: 5px; align-items: baseline; }
.sun-t .sun-tl { color: var(--ink-2); }
.sun-t b { font-variant-numeric: tabular-nums; }
.sun-t.main b { font-size: 16px; }
@container (max-height: 120px) { .sun-head .sun-len, .sun-t:not(.main) { display: none; } }
@container (max-width: 180px) { .sun-head .sun-len, .sun-t:not(.main), .sun-axis.m { display: none; } .sun-t.main b { font-size: 14px; } .sun-times { gap: 0 8px; } }
@container (max-width: 120px) { .sun-t { flex-direction: column; gap: 0; } .sun-head .sun-el { display: none; } }
@container (max-height: 200px) and (max-width: 260px) { .sun-t:not(.main) { display: none; } }
.pv-sky { pointer-events: none; transition: fill 2s; }

/* ---------- picture widget (0.88) ---------- */
.w-picture.nofoot { padding: 6px; }
.w-picture > .w-body { display: block; min-height: 0; overflow: hidden; }
.w-picture.w-style-plain { background: transparent; border-color: transparent; box-shadow: none; }
.editing .w-picture.w-style-plain { background: transparent; }
.pict { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.pict-a-left { justify-content: flex-start; }
.pict-a-right { justify-content: flex-end; }
.pict-art.pic-img, .pict > svg { display: block; min-width: 0; min-height: 0; }
.pict-none-fit .pict-art, .pict-none .pict-art { max-width: 100%; max-height: 100%; }
.pict-contain .pict-art { max-width: 100%; max-height: 100%; width: 100%; height: 100%; object-fit: contain; }
.pict-contain.pict-a-left .pict-art { object-position: left center; }
.pict-contain.pict-a-right .pict-art { object-position: right center; }
.pict-cover .pict-art { width: 100%; height: 100%; object-fit: cover; }
.w-video > .w-body { display: block; min-height: 0; overflow: hidden; }
.w-video.w-style-plain { background: #000; border-color: transparent; box-shadow: none; }
.w-video.w-style-plain.nofoot { padding: 0; border-radius: 0; }
.w-video.w-style-plain.nofoot .video { border-radius: 0; }
.w-video.w-style-card.nofoot { padding: 6px; }
.video { position: relative; width: 100%; height: 100%; background: #000; border-radius: inherit; overflow: hidden; }
.video .video-el { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transition: opacity .25s; }
.video .video-el.on { opacity: 1; }
.video-msg { position: absolute; left: 8px; right: 8px; bottom: 8px; padding: 6px 10px; border-radius: 6px; background: rgba(0, 0, 0, .72); color: #fff; font-size: 13px; }
.video-sound { position: absolute; top: 8px; right: 8px; }
.video-none { height: 100%; display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.scr-end { font-size: 13px; white-space: nowrap; }
.pict-none { height: 100%; display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.w-label .lab-v { font-variant-numeric: tabular-nums; }

/* ---------- 3D gauges (0.89) ---------- */
.gauge.g3 { overflow: visible; }
.g3 .g3-track { stroke: #E4E7EA; }
.g3 .g3-fill { stroke: var(--w-accent); }
.g3 .g3-edge { stroke: rgba(0, 0, 0, .55); stroke-width: .9; }
.g3 .g3-shine { pointer-events: none; }
.g3 text.g3-val { font-weight: 700; fill: var(--w-text, var(--ink)); paint-order: stroke; stroke: rgba(0, 0, 0, .18); stroke-width: .6px; }
:root[data-theme="dark"] .g3 text.g3-val { stroke: rgba(0, 0, 0, .55); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .g3 text.g3-val { stroke: rgba(0, 0, 0, .55); } }
.g3 text.g3-unit, .g3 text.g3-lim { fill: var(--ink-2); }
.g3-bezel text.g3-val { fill: #F4F6F8; stroke: rgba(0, 0, 0, .6); }
.g3-bezel text.g3-unit, .g3-bezel text.g3-num { fill: #C9D0D8; }
.g3-bezel .g3-tick { stroke: #AEB6BF; stroke-width: .6; }
.g3-bezel .g3-tick.major { stroke: #F4F6F8; stroke-width: 1.3; }
.g3-bezel .g3-needle-body { fill: var(--w-accent, #E4572E); }
.g3-bezel .g3-glass { pointer-events: none; }
.g3 .g3-shine { stroke: #fff; opacity: 0; }
.g3 .g3-fill { transition: stroke 1.2s ease; }

/* label alignment and the pin badge off (0.90): without the badge the label has the whole width */
.w.nopin > .w-label { right: 14px; }
.editing .w.nopin > .w-label { right: 28px; }
.w.lab-center > .w-label { text-align: center; }
.w.lab-right > .w-label { text-align: right; }
.graph canvas.g-still { cursor: default; }
.ti-ghost { opacity: .45; }

/* history viewer: select a range, time in ranges (0.94) */
.hv-sel { position: absolute; top: 14px; bottom: 18px; background: color-mix(in srgb, var(--amber) 22%, transparent); border-left: 2px solid var(--amber); border-right: 2px solid var(--amber); pointer-events: none; }
.hv-selmark { position: absolute; top: 14px; bottom: 18px; width: 0; border-left: 2px dashed var(--amber); pointer-events: none; }
.hv-canvas.hv-selecting { cursor: col-resize; }
.hv-nav .btn.on { background: var(--amber); color: #1D2733; border-color: var(--amber); }
.hv-status.hint { color: var(--amber); font-weight: 600; }
.hv-report { border-top: 1px solid var(--line); padding-top: 10px; max-height: 42vh; overflow: auto; display: grid; gap: 14px; }
.hv-report.hv-rep-busy .hv-rep-block { opacity: .55; transition: opacity .2s; }
.hv-rep-head { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.hv-rep-head .btn { margin-left: auto; }
.hv-rep-pin { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.hv-rep-pin > i { width: 12px; height: 12px; border-radius: 3px; }
.hv-th-l { display: flex; gap: 6px; align-items: center; margin-left: auto; font-size: 13px; color: var(--ink-2); }
.hv-th { width: 200px; padding: 4px 8px; }
.hv-rep-t { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.hv-rep-t th { text-align: left; font-weight: 600; color: var(--ink-2); font-size: 12px; padding: 3px 6px; }
.hv-rep-t td { padding: 4px 6px; border-top: 1px solid var(--line); }
.hv-rep-t .num { text-align: right; white-space: nowrap; }
.hv-rep-t td.bar { width: 35%; min-width: 120px; }
.hv-rep-t td:nth-child(2) { width: 30%; }
.hv-rep-t td.bar span { display: block; height: 10px; border-radius: 3px; min-width: 1px; }
.hv-rep-t tfoot td { font-weight: 600; }
.hv-rep-t .muted td { color: var(--ink-2); font-weight: 400; }
.hv-sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: middle; }
@media (max-width: 600px) { .hv-rep-t td.bar { display: none; } .hv-th { width: 140px; } }

/* running hours widget (0.95) */
.hw-t { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.hw-t td { padding: 2px 4px; }
.hw-t .num { text-align: right; white-space: nowrap; }
.hw-t .muted td { color: var(--ink-2); }
.hw-body { min-height: 0; overflow: auto; }
.hw-col { display: flex; flex-direction: column-reverse; justify-content: flex-start; align-items: stretch; }
.hw-col i { width: 100%; display: block; border-radius: 0; min-height: 0; }
.hw-big { font-variant-numeric: tabular-nums; }
.import-btn, .hours-btn { display: block; }
.imp-src { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 6px 0; }
.imp-url { flex: 1 1 260px; min-width: 0; }
.imp-paste { width: 100%; font: 12px/1.4 var(--mono, monospace); }
.imp-chart { width: 100%; height: 140px; display: block; }
.imp-preview p { margin: 6px 0; }
.hours-row .rng-name { grid-column: 1 / 5; grid-row: 2; }
/* 0.98 Bridges: many forwardings in one widget */
.bridges { height: 100%; width: 100%; align-self: stretch; overflow: auto; }
.bridges-list { display: flex; flex-direction: column; gap: 2px; }
.br-row { display: grid; grid-template-columns: 10px minmax(60px, 1fr) minmax(0, 1.6fr) auto; align-items: center; gap: 8px; padding: 4px 2px; border-bottom: 1px solid var(--line); font-size: 13px; }
.br-row .dot { width: 8px; height: 8px; }
.br-row.off { opacity: .5; }
.br-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.br-path { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.br-val { font-variant-numeric: tabular-nums; max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }
@container (max-width: 360px) { .br-path { display: none; } .br-row { grid-template-columns: 10px 1fr auto; } }
.br-sum { display: flex; flex-direction: column; gap: 8px; }
.br-sum-list { list-style: none; margin: 0; padding: 0; font-size: 13px; max-height: 240px; overflow: auto; }
.br-sum-list li { padding: 3px 0; border-bottom: 1px solid var(--line); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.br-sum-list li.off { opacity: .55; }
.br-sum-list span { color: var(--ink-2); }
dialog.br-dialog { width: min(1280px, calc(100% - 32px)); max-height: calc(100vh - 32px); }
.br-tools { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.br-find { flex: 0 1 280px; }
.br-count { flex: 1; }
.br-table-wrap { overflow: auto; max-height: calc(100vh - 290px); border: 1px solid var(--line); border-radius: 8px; }
.br-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.br-table th { position: sticky; top: 0; z-index: 1; background: var(--panel); text-align: left; font: 600 12px/1.2 var(--body); color: var(--ink-2); padding: 8px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.br-table td { padding: 4px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.br-table tr:nth-child(even) td { background: color-mix(in srgb, var(--ink) 3%, transparent); }
.br-table tr.off td { opacity: .5; }
.br-table tr.off td:first-child { opacity: 1; }
.br-table select, .br-table input[type=text] { width: 100%; min-width: 0; padding: 5px 6px; }
.br-table .br-name-in { min-width: 160px; }
.br-table .br-dev { min-width: 130px; }
.br-table .br-pin { width: 1%; min-width: 120px; }
.br-table .br-only { text-align: center; }
.br-table .br-st { max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.br-table .br-st .dot { display: inline-block; width: 8px; height: 8px; margin-right: 6px; vertical-align: middle; }
.br-table .br-act { white-space: nowrap; }
.br-table .br-act .btn { padding: 2px 7px; }
.br-dir { font-size: 20px; padding: 2px 10px; }

/* 0.99.6: the panel look — the panel's own picture under the widget frames while editing a layout drawn by a device */
.board.panel-look { background-image: none; }
.board.panel-look > .panel-canvas { position: absolute; left: 0; top: 0; z-index: 0; pointer-events: none; image-rendering: auto; }
.board.panel-look .w { background: transparent; border: 1px dashed color-mix(in srgb, var(--amber) 55%, transparent); box-shadow: none; z-index: 1; }
.board.panel-look .w:not(.w-tabs):not(.w-group) > :not(.resize):not(.w-when-tag) { opacity: 0; }
.board.panel-look .w-tabs > :not(.w-body):not(.resize):not(.w-when-tag), .board.panel-look .w-group > :not(.w-body):not(.resize):not(.w-when-tag) { opacity: 0; }
.board.panel-look .tabbar { opacity: 0; height: var(--pl-bar); box-sizing: border-box; padding: 0; gap: 0; overflow: hidden; }
/* the buttons where the panel draws its tabs (LVGL's tab view: equal widths, the whole bar's height), so a click on a tab name opens it */
.board.panel-look .tabbar .tab-btn { flex: 1 1 0; min-width: 0; height: 100%; padding: 0; }
.board.panel-look .tabsw.left .tabbar { flex-direction: column; }
.board.panel-look .tabsw.left .tabbar .tab-btn { flex: 1 1 0; width: 100%; }
.board.panel-look .tabsw.left .tabbar { height: auto; width: var(--pl-left); max-width: none; }
.board.panel-look .tab-scroll, .board.panel-look .tabsw, .board.panel-look .grp { background: transparent; border-color: transparent; }
/* the panel can't scroll a tab or a group: neither does the editor in the panel look (frames stay on the
   picture; what reaches past the bottom is cut, as on the panel, and the save says so). clip: no scrolling
   from code either (selecting or dragging a widget would scroll it into view) */
.board.panel-look .tab-scroll { overflow: clip; }
.board.panel-look .grp > :not(.tab-scroll) { opacity: 0; }
.board.panel-look .w.sel, .board.panel-look .w.selected { border: 2px solid var(--amber); }
.board.panel-look > .panel-note { position: absolute; left: 0; bottom: -28px; font: 12px var(--ui, sans-serif); color: var(--amber); white-space: nowrap; }
.panel-look-btn { display: block; width: 100%; margin: 6px 0; }
.panel-look-btn.on, .panel-look-btn.on:hover { background: var(--amber); border-color: var(--amber); color: #1D2733; font-weight: 600; }
.panel-look-btn:not(.on) { color: var(--ink); }

/* ---- Firmware page (0.99.16) ---- */
.firmware .fw-body { display: grid; gap: 16px; }
.fw-upload-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.fw-upload-row .field { margin: 0; min-width: 140px; }
.fw-upload-row .fw-note { flex: 1 1 200px; }
.fw-table { width: 100%; border-collapse: collapse; }
.fw-table td, .fw-table th { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.fw-table th { font-weight: 500; color: var(--ink-2); font-size: 13px; }
.fw-table .dot { display: inline-block; vertical-align: 1px; }

.fw-hint { color: var(--ink-2); font-size: 12px; }
.fw-ver { font-variant-numeric: tabular-nums; font-weight: 600; }
.badge.warn { background: color-mix(in srgb, var(--bad) 22%, var(--panel-2)); color: var(--ink); }
.fw-actions { text-align: right; white-space: nowrap; }
.fw-actions .btn { margin-left: 6px; }
.fw-group h3 { font-size: 14px; margin: 14px 0 4px; color: var(--ink-2); }
.fw-job { border-top: 1px solid var(--line); padding: 10px 0; }
.fw-job:first-of-type { border-top: none; }
.fw-job-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 6px; }
.fw-job-head .btn { margin-left: auto; }
.fw-job-head .btn + .btn { margin-left: 6px; }
.fw-job-state.running { color: var(--accent); }
.fw-job-state.done { color: var(--ok); }
.fw-job-state.stopped, .fw-job-state.cancelled { color: var(--bad); }
.fw-job-dev { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 3px 0 3px 12px; font-size: 14px; }
.fw-dev-name { min-width: 140px; font-weight: 500; }
.fw-job-dev.done .fw-state { color: var(--ok); }
.fw-job-dev.failed .fw-state, .fw-job-dev.cancelled .fw-state { color: var(--bad); }
.fw-job-dev.sending .fw-state, .fw-job-dev.restarting .fw-state { color: var(--accent); }
.fw-err { flex-basis: 100%; color: var(--ink-2); font-size: 13px; padding-left: 2px; }
.fw-bar { position: relative; display: inline-block; width: 160px; height: 16px; border-radius: 4px; background: var(--panel-2); overflow: hidden; }
.fw-bar i { position: absolute; inset: 0 auto 0 0; background: var(--accent); }
.fw-bar b { position: relative; display: block; text-align: center; font: 600 11px/16px var(--display); color: var(--ink); }
.fw-dialog { width: min(640px, calc(100vw - 32px)); }
.fw-picks { display: grid; gap: 4px; max-height: 40vh; overflow: auto; margin-bottom: 10px; }
.fw-mode { display: grid; gap: 6px; border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; }
.fw-mode select { margin-left: 4px; }
@media (max-width: 640px) {
  .fw-table td:nth-child(4), .fw-table th:nth-child(4) { display: none; }
  .fw-actions { white-space: normal; }
}
.br-table tr.dup td { background: color-mix(in srgb, var(--bad) 14%, transparent); }
.br-dups { margin: 6px 0; }

/* busy (0.99.47): a spinner while something is on its way */
.spin { display: inline-block; width: 1em; height: 1em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -0.15em; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 2.4s; } }
.busy { display: flex; align-items: center; gap: 10px; padding: 18px 4px; color: var(--m-ink, #888); }
.btn.is-busy { display: inline-flex; align-items: center; gap: 6px; cursor: progress; }
.ok-line { color: var(--ok); font-weight: 600; margin: 0 0 8px; }

/* S7 PLCs (0.99.50) */
.s7-table .s7-addr { width: 11em; font-family: var(--mono, ui-monospace, monospace); }
.s7-table tr.s7-bad td { background: color-mix(in srgb, var(--bad, #c2412d) 9%, transparent); }
.s7-rowerr { color: var(--bad, #c2412d); font-size: 12px; max-width: 22em; white-space: normal; }
.s7-rowerr:empty { display: none; }
.s7-len { display: inline-flex; align-items: center; gap: 2px; margin-left: 4px; }
.s7-len input { width: 4.5em; }

/* paused devices (0.99.52) */
.dot.paused { background: transparent; border: 2px solid var(--m-ink, #888); box-sizing: border-box; }
.badge.paused { background: color-mix(in srgb, var(--m-ink, #888) 22%, transparent); }

/* linked servers (0.99.53) */
.lk-list { display: flex; flex-direction: column; gap: 6px; max-height: 55vh; overflow: auto; }
.lk-row { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; padding: 6px 0; border-bottom: 1px solid var(--line); }
.lk-row.lk-col { flex-direction: column; align-items: stretch; }
.lk-row .check { flex: 1 1 200px; }
.lk-pins { width: 14em; }
.lk-pinlist { display: flex; flex-wrap: wrap; gap: 2px 14px; padding-left: 26px; font-size: 13px; }
.mono { font-family: var(--mono, ui-monospace, monospace); }
.lk-edit { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.lk-edit select { max-width: 24em; }
.lk-edit .btn { flex: none; }
.lk-sum { padding-left: 26px; font-size: 13px; }

/* camera pictures (0.99.54) */
.pict.cam { position: relative; }
.cam-stamp { position: absolute; right: 6px; bottom: 6px; padding: 1px 6px; border-radius: 4px; font-size: 12px; font-variant-numeric: tabular-nums; background: rgba(0,0,0,.55); color: #fff; }
.cam-note { position: absolute; left: 6px; right: 6px; top: 6px; padding: 3px 8px; border-radius: 4px; font-size: 12px; background: rgba(160,40,30,.85); color: #fff; }
.cam-test, .cam-live { max-width: 100%; max-height: 50vh; border-radius: 6px; display: block; background: #000; }
.cam-testbox { margin-top: 8px; }

/* graph min / max in the head (0.99.55) */
.g-mm { font-size: 11px; color: var(--ink-2); margin-left: 6px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.g-mm1 { margin-right: auto; align-self: center; }

/* project sharing (0.99.59) */
.tab-owner { font: 500 11px/1 var(--body, system-ui); color: var(--ink-3, var(--ink-2)); margin-left: 6px; padding: 2px 5px; border-radius: 8px; background: color-mix(in srgb, var(--ink-2) 12%, transparent); }
.people { margin-bottom: 8px; }
.people-list { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.people-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; }
.people-who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.people-devs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.people-row select { flex: none; width: auto; }
.people-add input { flex: 1; min-width: 120px; }
.people-add select, .people-add button { flex: none; width: auto; }

/* the formula box (0.99.60): a textarea over its coloured copy */
:root { --c-pin: #1F78C8; --c-fn: #8E3FC0; --c-num: #B35C00; --c-str: #2E8540; --c-op: #C0392B; }
:root[data-theme="dark"] { --c-pin: #6CB4F5; --c-fn: #C99BEA; --c-num: #F0A35C; --c-str: #7BCB8A; --c-op: #F08A7E; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --c-pin: #6CB4F5; --c-fn: #C99BEA; --c-num: #F0A35C; --c-str: #7BCB8A; --c-op: #F08A7E; } }
.calc-ed { position: relative; }
.calc-ed .calc-hl, .calc-ed .calc-formula { font: 14px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; padding: 7px 10px; margin: 0; border: 1px solid transparent; border-radius: 6px; white-space: pre-wrap; overflow-wrap: anywhere; tab-size: 2; box-sizing: border-box; width: 100%; letter-spacing: 0; }
.calc-ed .calc-hl { position: absolute; inset: 0; overflow: hidden; pointer-events: none; color: var(--ink); background: var(--bg); }
.calc-ed .calc-formula { position: relative; display: block; resize: vertical; min-height: 36px; overflow: hidden; color: transparent; caret-color: var(--ink); background: transparent; border-color: var(--line); outline: none; }
.calc-ed .calc-formula:focus { border-color: var(--ink); }
.calc-ed .calc-formula::placeholder { color: var(--ink-2); }
.calc-ed .calc-formula::selection { background: color-mix(in srgb, var(--amber) 35%, transparent); color: transparent; }
.c-pin { color: var(--c-pin); font-weight: 600; } .c-fn { color: var(--c-fn); font-weight: 600; } .c-num { color: var(--c-num); }
.c-str { color: var(--c-str); } .c-note { color: var(--ink-2); font-style: italic; } .c-op, .c-kw { color: var(--c-op); } .c-br { color: var(--ink-2); }
.c-bad { text-decoration: underline wavy var(--c-op); text-underline-offset: 3px; }
.calc-sig { font-size: 12.5px; min-height: 17px; margin-top: 3px; color: var(--ink-2); }
.calc-sig code b { color: var(--ink); background: color-mix(in srgb, var(--amber) 30%, transparent); border-radius: 3px; padding: 0 2px; }
.calc-pop { position: absolute; left: 0; top: calc(100% + 2px); z-index: 30; min-width: 280px; max-width: 100%; max-height: 240px; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.18); }
.calc-pi { display: flex; flex-direction: column; gap: 1px; padding: 5px 10px; cursor: pointer; }
.calc-pi.on, .calc-pi:hover { background: color-mix(in srgb, var(--amber) 18%, transparent); }
.calc-pi small, .calc-fnitem small { color: var(--ink-2); }
.calc-fnlist { position: absolute; z-index: 30; margin-top: 4px; width: min(520px, 92vw); max-height: 360px; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.2); padding: 6px; }
.calc-fnitem { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; text-align: left; padding: 6px 8px; border: 0; background: none; color: var(--ink); border-radius: 6px; cursor: pointer; font: inherit; }
.calc-fnitem:hover { background: color-mix(in srgb, var(--amber) 15%, transparent); }
.calc-ex { font-family: ui-monospace, monospace; font-size: 11.5px; }
.calc-tools-row { position: relative; } .calc-fnlist { top: 100%; left: 0; }

/* DryIoT's own colour picker (0.99.62) */
.cpk { position: fixed; z-index: 1000; width: 236px; padding: 10px; background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.28); display: flex; flex-direction: column; gap: 8px; }
.cpk-sv { position: relative; height: 140px; border-radius: 6px; cursor: crosshair; touch-action: none; outline-offset: 2px; }
.cpk-dot { position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px rgba(0,0,0,.5); pointer-events: none; }
.cpk-hue { position: relative; height: 14px; border-radius: 7px; cursor: pointer; touch-action: none; background: linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00); outline-offset: 2px; }
.cpk-knob { position: absolute; top: -2px; width: 8px; height: 18px; margin-left: -4px; border: 2px solid #fff; border-radius: 4px; box-shadow: 0 0 0 1px rgba(0,0,0,.5); pointer-events: none; }
.cpk-row { display: flex; align-items: center; gap: 6px; }
.cpk-now { flex: none; width: 26px; height: 26px; border-radius: 6px; border: 1px solid var(--line); overflow: hidden;
  background: repeating-conic-gradient(#c8c8c8 0 25%, #fff 0 50%) 0 0 / 10px 10px; }
.cpk-now > span { display: block; width: 100%; height: 100%; }
/* opacity bar (0.99.77): the colour from see-through to solid over a checkerboard */
.cpk-arow { display: flex; align-items: center; gap: 8px; }
.cpk-alpha { position: relative; flex: 1; height: 14px; border-radius: 7px; cursor: pointer; touch-action: none; outline-offset: 2px;
  background: repeating-conic-gradient(#c8c8c8 0 25%, #fff 0 50%) 0 0 / 10px 10px; }
.cpk-afill { position: absolute; inset: 0; border-radius: 7px; pointer-events: none; }
.cpk-pct { flex: none; width: 3.4em; text-align: right; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cpk-a .cpk-hex { width: 6.6em; }
.cpk-hex { flex: 1; min-width: 0; width: auto; font-family: ui-monospace, monospace; text-transform: uppercase; }
.cpk-quick { display: grid; grid-template-columns: repeat(12, 1fr); gap: 3px; }
.cpk-q { aspect-ratio: 1; padding: 0; border: 1px solid rgba(127,127,127,.45); border-radius: 4px; cursor: pointer; min-width: 0; }
.cpk { width: 264px; } .cpk-hex { padding: 4px 6px; font-size: 13px; min-width: 84px; } .cpk-row .btn.small { padding: 4px 8px; }

/* Sensor: pictures by value (0.99.62) */
.pic-steps { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 6px; }
.pic-step { display: flex; align-items: center; gap: 6px; }
.pic-step-at { display: flex; align-items: center; gap: 4px; flex: 0 0 132px; font-size: 13px; color: var(--ink-2); }
.pic-step-at input { width: 72px; min-width: 0; }
.pic-step .pic-step-btn { flex: 1; min-width: 0; justify-content: flex-start; }
.pic-step-btn .pic-art svg, .pic-step-btn .pic-art img { width: 26px; height: 26px; }
.ti-bolt { fill: #F2C230; stroke: none; animation: ti-bolt 7s ease-in-out infinite; }
@keyframes ti-bolt { 0%, 90%, 100% { opacity: .85; } 92% { opacity: .25; } 94% { opacity: 1; filter: drop-shadow(0 0 4px #F2C230); } }
@media (prefers-reduced-motion: reduce) { .ti-bolt { animation: none; } }

/* batch pins (0.99.65) */
.batch-card .bt-item { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin: 8px 0; }
.bt-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.bt-head .btn { margin-left: auto; }
.bt-on { color: var(--amber); font-weight: 600; }
.bt-recent { width: 100%; border-collapse: collapse; margin-top: 6px; font-size: 13px; font-variant-numeric: tabular-nums; }
.bt-recent th { text-align: left; color: var(--ink-2); font-weight: 500; padding: 2px 6px; }
.bt-recent td { padding: 2px 6px; border-top: 1px solid var(--line); }
.bt-edit { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.bt-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.bt-f { flex: 0 0 auto; min-width: 120px; }
.bt-f input[type=number] { width: 90px; }
.bt-src { flex: 1 1 260px; }
.bt-pin { display: inline-flex; align-items: center; gap: 2px; }
.bt-pin input { width: 64px !important; }

/* a pin's history keep times (0.99.75) */
.keep-row { display: grid; grid-template-columns: 170px 1fr 90px; gap: 8px; align-items: center; margin: 6px 0; }
.keep-row .keep-label { font-weight: 600; }
.keep-btn.own { color: var(--accent); }
@media (max-width: 520px) { .keep-row { grid-template-columns: 1fr 90px; } .keep-row .keep-label { grid-column: 1 / -1; } }

/* Reports: running hours (0.99.79) */
.rp-hours h3 { margin: 14px 0 6px; font-size: 15px; }
.rp-hours h3:first-of-type { margin-top: 4px; }
.rp-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.rp-table tr.rp-muted th, .rp-table tr.rp-muted td { color: var(--ink-2); font-weight: normal; }

/* Hours in ranges: counted before, total to a pin (0.99.81) */
.range-row .hours-extra { grid-column: 1 / -1; grid-row: 3; display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: 12.5px; color: var(--ink-2); padding-bottom: 6px; border-bottom: 1px dashed var(--line); }
.hours-extra label { display: inline-flex; align-items: center; gap: 5px; }
.hours-extra input, .hours-extra select { padding: 3px 6px; font-size: 13px; }
.hours-extra .hrs-before { width: 8.5em; }
.hours-extra select { max-width: 16em; }
.hours-extra select.hrs-tpin { max-width: 18em; }

/* Text widget tables (0.99.81) */
.tx-table { border-collapse: collapse; width: 100%; margin: 2px 0; font-variant-numeric: tabular-nums; }
.tx-table th, .tx-table td { padding: .18em .5em; border-bottom: 1px solid var(--line); text-align: left; vertical-align: baseline; }
.tx-table th { font-weight: 700; color: var(--ink-2); font-size: .85em; }
.tx-table tbody tr:last-child td { border-bottom: none; }
.tx-a-center .tx-table, .tx-a-right .tx-table { margin-left: auto; margin-right: auto; }
.tx .tx-v.tx-bad { color: #C2412D; cursor: help; }
.hours-extra label > span { white-space: nowrap; }
.hours-extra label:has(.hrs-tdev) { flex: 1 1 100%; min-width: 0; }
.hours-extra label:has(.hrs-tpin) .hrs-tdev { flex: 0 1 40%; min-width: 0; }
.hours-extra label:has(.hrs-tpin) .hrs-tpin { flex: 1 1 60%; min-width: 0; max-width: none; }

/* Pins list: a summary and one button per pin; a pin's own page (0.99.91) */
.pin-chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 2px 0; }
.pin-chip { font-size: 12px; line-height: 1.3; padding: 2px 7px; border-radius: 10px; background: var(--panel-2); color: var(--ink-2); border: 1px solid var(--line); }
.pin-open { margin-top: 4px; padding: 5px 12px; font-size: 14px; align-self: flex-start; }
.pin-page .pin-sec { margin-bottom: 14px; }
/* a page's own heading stays under the top bar while its sections scroll */
.sticky-head { position: sticky; top: var(--bar-h, 56px); z-index: 10; background: var(--bg); margin: 0 -4px 14px; padding: 8px 4px 10px; border-bottom: 1px solid var(--line); }
.sticky-head h1 { margin: 2px 0; }
.sticky-head .lead { margin: 0; }
.sticky-head .ago { color: var(--ink-2); font-size: .85em; }
.pin-page section.pin-sec > form.card { margin: 0; }
.pin-page .card h2 { margin-top: 0; }
.pin-page .field { max-width: 520px; }
.pin-page .drawer-actions { justify-content: flex-start; flex-direction: row-reverse; align-items: center; gap: 10px; }
.sec-ok { color: var(--ok, #2E9E5B); font-weight: 600; margin-left: 4px; }
