/* ClayGen RMM console. Dark by default; the Theme button switches to light. */
:root {
  color-scheme: dark;
  /* Neutral charcoal surfaces; the accent blues and the silver come from the ClayGen logo. */
  --bg: #0e1013; --bg-glow: rgba(22, 150, 232, .10); --panel: #15181c; --panel-2: #1a1e23; --raised: #22272e;
  --text: #e9ebee; --muted: #8d949d; --line: #252a31; --line-strong: #353b44;
  --accent: #1695e8; --accent-2: #3ccdf0; --accent-soft: rgba(22, 149, 232, .16); --on-accent: #03111c;
  --ok: #34d399; --ok-soft: rgba(52, 211, 153, .13); --off: #6b727c; --off-soft: rgba(107, 114, 124, .18);
  --warn: #fbbf24; --warn-soft: rgba(251, 191, 36, .12); --bad: #f87171; --bad-soft: rgba(248, 113, 113, .13);
  --violet: #b9bec6; --violet-soft: rgba(185, 190, 198, .13);
  --shadow: 0 10px 30px rgba(0, 0, 0, .4); --radius: 14px;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f1f3f5; --bg-glow: rgba(22, 149, 232, .10); --panel: #ffffff; --panel-2: #f6f7f9; --raised: #eceff2;
  --text: #171b21; --muted: #5f6873; --line: #e1e4e8; --line-strong: #cbd0d7;
  --accent: #0a7fd6; --accent-2: #17b3e0; --accent-soft: rgba(10, 127, 214, .10); --on-accent: #ffffff;
  --ok: #059669; --ok-soft: rgba(5, 150, 105, .11); --off: #8b929c; --off-soft: rgba(139, 146, 156, .16);
  --warn: #b45309; --warn-soft: rgba(217, 119, 6, .12); --bad: #dc2626; --bad-soft: rgba(220, 38, 38, .09);
  --violet: #6b7480; --violet-soft: rgba(107, 116, 128, .12);
  --shadow: 0 10px 30px rgba(20, 30, 60, .10);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; font: 14px/1.5 "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif; color: var(--text);
  background: radial-gradient(1100px 520px at 78% -8%, var(--bg-glow), transparent 62%), var(--bg);
  background-attachment: fixed; -webkit-font-smoothing: antialiased;
}
h1 { font-size: 24px; font-weight: 650; letter-spacing: -.02em; margin: 0; line-height: 1.2; }
h2 { font-size: 15px; font-weight: 650; margin: 0; }
h3 { font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 22px 0 10px; }
p { margin: 0; }
.muted { color: var(--muted); }
.center { text-align: center; }
.spacer { flex: 1; }
.row { display: flex; align-items: center; gap: 8px; }
.error { color: var(--bad); }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon.sm { width: 15px; height: 15px; }
.icon.lg { width: 22px; height: 22px; }

/* Controls */
button, input, select { font: inherit; color: inherit; }
button {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap;
  background: var(--panel-2); border: 1px solid var(--line-strong); border-radius: 9px; padding: 7px 13px; cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s;
}
button:hover { background: var(--raised); border-color: var(--accent); }
button:active { transform: translateY(1px); }
button.primary { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 50%, transparent); color: var(--text); font-weight: 600; }
button.primary .icon { color: var(--accent); }
button.primary:hover { background: color-mix(in srgb, var(--accent) 26%, transparent); border-color: var(--accent); }
button.ghost { background: none; border-color: transparent; color: var(--muted); }
button.ghost:hover { background: var(--raised); color: var(--text); border-color: transparent; }
button.danger { color: var(--bad); }
button.danger:hover { border-color: var(--bad); background: var(--bad-soft); }
button.block { width: 100%; padding: 10px; }
button.iconbtn { padding: 7px; }
input, select { background: var(--panel-2); border: 1px solid var(--line-strong); border-radius: 9px; padding: 8px 11px; outline: none; }
input:focus, select:focus, button:focus-visible, a:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); outline: none; }
label { display: grid; gap: 5px; font-size: 13px; font-weight: 600; }
label input { font-weight: 400; }

/* Brand */
.logo { display: block; width: 100%; height: auto; }
.logo.big { width: 290px; max-width: 100%; margin: 0 auto; }
.product { font-size: 9.5px; font-weight: 650; letter-spacing: .07em; white-space: nowrap; text-transform: uppercase; color: var(--muted); text-align: center; }
.brandlink { display: grid; gap: 7px; padding: 0 6px 16px; margin-bottom: 8px; border-bottom: 1px solid var(--line); text-decoration: none; }

/* Sign-in */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 370px; padding: 34px 30px; display: grid; gap: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }

/* Layout */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.rail { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; padding: 20px 12px 14px; background: var(--panel); border-right: 1px solid var(--line); }
.rail a[data-page] { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 10px; color: var(--muted); text-decoration: none; font-weight: 550; border: 1px solid transparent; }
.rail a[data-page]:hover { background: var(--raised); color: var(--text); }
.rail a.active { background: var(--accent-soft); color: var(--text); border-color: var(--line-strong); }
.rail a.active .icon { color: var(--accent); }
.rail a em { margin-left: auto; font-style: normal; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--raised); border-radius: 999px; padding: 0 8px; }
.rail a em:empty { display: none; }
.rail-foot { margin-top: auto; display: grid; gap: 2px; border-top: 1px solid var(--line); padding-top: 10px; }
.rail-foot button { justify-content: flex-start; gap: 11px; padding: 8px 11px; }
.who { display: flex; align-items: center; gap: 11px; padding: 8px 11px; color: var(--muted); }

.main { min-width: 0; padding: 26px 30px 40px; }
.pagehead { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.live { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; color: var(--ok); background: var(--ok-soft); padding: 4px 11px; border-radius: 999px; }
.live i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 var(--ok); } 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@media (prefers-reduced-motion: reduce) { .live i { animation: none !important; } }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.panel-head { display: flex; align-items: center; gap: 9px; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.panel-head .icon { color: var(--muted); }
.split { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; align-items: start; }

/* Stat tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 16px; }
.tile { justify-content: flex-start; gap: 14px; padding: 16px 18px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); text-align: left; }
.tile:hover { border-color: var(--line-strong); background: var(--panel-2); }
.tile .chip { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.tile .value { display: block; font-size: 28px; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.tile .label { display: block; color: var(--muted); font-size: 12.5px; }
.tile.ok .chip { background: var(--ok-soft); color: var(--ok); }
.tile.off .chip { background: var(--off-soft); color: var(--off); }
.tile.violet .chip { background: var(--violet-soft); color: var(--violet); }
.tile.warn .chip { background: var(--warn-soft); color: var(--warn); }
.tile.warn.hot { border-color: var(--warn); }
.tile.warn.hot .value { color: var(--warn); }

/* Lists on the dashboard */
.list-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 18px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: none; text-align: left; justify-content: flex-start; }
.list-row:last-child { border-bottom: 0; border-radius: 0 0 var(--radius) var(--radius); }
.list-row:hover { background: var(--panel-2); border-color: var(--line); }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .title { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.list-row .sub { display: block; font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.list-row .chev { color: var(--muted); }
.list-row .health { margin-top: 6px; }
.allclear { display: grid; justify-items: center; gap: 8px; padding: 34px 18px; color: var(--muted); text-align: center; }
.allclear .icon { width: 34px; height: 34px; color: var(--ok); }

.avatar { width: 36px; height: 36px; border-radius: 10px; flex: none; display: grid; place-items: center; background: var(--raised); color: var(--muted); position: relative; }
.avatar.on { color: var(--accent); background: var(--accent-soft); }
.avatar .state { position: absolute; right: -3px; bottom: -3px; width: 11px; height: 11px; border-radius: 50%; background: var(--off); border: 2px solid var(--panel); }
.avatar.on .state { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.avatar.lg { width: 48px; height: 48px; border-radius: 14px; }
.avatar.org { color: var(--violet); background: var(--violet-soft); }

.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.off { background: var(--off-soft); color: var(--muted); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.plain { background: var(--raised); color: var(--muted); }

.health { display: block; height: 6px; border-radius: 3px; background: var(--off-soft); overflow: hidden; }
.health span { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--ok), var(--accent-2)); }

/* Devices table */
.filters { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.searchbox { flex: 1; min-width: 220px; max-width: 420px; position: relative; display: flex; align-items: center; }
.searchbox .icon { position: absolute; left: 11px; color: var(--muted); pointer-events: none; }
.searchbox input { width: 100%; padding-left: 36px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 650; user-select: none; }
th[data-sort] { cursor: pointer; }
th[data-sort]:hover { color: var(--text); }
th .icon { width: 12px; height: 12px; margin-left: 4px; vertical-align: -1px; color: var(--accent); }
th.asc .icon { transform: rotate(180deg); }
tbody tr { cursor: pointer; transition: background .12s; }
tbody tr:hover { background: var(--panel-2); }
tbody tr:last-child td { border-bottom: 0; }
#audit-rows tr { cursor: default; }
#audit-rows td:last-child { white-space: normal; overflow-wrap: anywhere; }
.devcell { display: flex; align-items: center; gap: 12px; }
.devcell .name { font-weight: 650; }
.devcell .sub { font-size: 12.5px; color: var(--muted); }
.evcell { display: flex; align-items: center; gap: 9px; }
.evcell .icon { color: var(--muted); }
.evcell.warn .icon { color: var(--warn); }
.evcell.ok .icon { color: var(--ok); }
.empty { display: grid; justify-items: center; gap: 10px; padding: 46px 20px; color: var(--muted); text-align: center; }
.empty .icon { width: 36px; height: 36px; }

.meter { display: inline-flex; align-items: center; gap: 9px; font-variant-numeric: tabular-nums; }
.meter .track { width: 50px; height: 6px; border-radius: 3px; background: var(--raised); overflow: hidden; }
.meter .fill { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--accent-2), var(--accent)); }
.meter.hot { color: var(--warn); font-weight: 650; }
.meter.hot .fill { background: var(--warn); }

/* Organization cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.orgcard { padding: 18px; display: grid; gap: 14px; }
.org-top { display: flex; align-items: center; gap: 12px; min-width: 0; }
.org-top h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.org-top .grow { flex: 1; min-width: 0; }
.org-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.org-stats div { background: var(--panel-2); border-radius: 10px; padding: 8px 10px; }
.org-stats b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; }
.org-stats span { font-size: 12px; color: var(--muted); }
.orgcard .row { flex-wrap: nowrap; }
.orgcard .row button { flex: 1; padding: 7px 8px; }

/* Device page */
.banner { display: flex; gap: 10px; align-items: flex-start; background: var(--warn-soft); color: var(--warn); border-radius: 10px; padding: 10px 13px; margin-top: 16px; font-weight: 550; }
.gauges { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 18px; }
.gauge { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px 8px 12px; display: grid; justify-items: center; gap: 6px; }
.ring { position: relative; width: 92px; height: 92px; }
.ring svg { width: 100%; height: 100%; }
.ring .track { fill: none; stroke: var(--raised); stroke-width: 8; }
.ring .value { fill: none; stroke: var(--accent); stroke-width: 8; stroke-linecap: round; }
.ring.mem .value { stroke: var(--violet); }
.ring.disk .value { stroke: var(--accent-2); }
.ring.hot .value { stroke: var(--warn); }
.ring .center { position: absolute; inset: 0; display: grid; place-items: center; font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.gauge .cap { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }

.chart { width: 100%; height: 130px; display: block; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; }
.chart polyline { fill: none; stroke-width: 1.8; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.chart .cpu { stroke: var(--accent); }
.chart .mem { stroke: var(--violet); }
.chart .area { fill: var(--accent); opacity: .13; stroke: none; }
.chart .grid { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.legend .cpu { background: var(--accent); }
.legend .mem { background: var(--violet); }

.disk { display: grid; grid-template-columns: minmax(70px, max-content) 1fr max-content; align-items: center; gap: 12px; margin-bottom: 9px; }
.disk .track { height: 8px; border-radius: 4px; background: var(--raised); overflow: hidden; }
.disk .fill { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--accent-2), var(--accent)); }
.disk.hot .fill { background: var(--warn); }
.disk .cap { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 7px 18px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }

/* Dialogs */
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line-strong); border-radius: 16px; padding: 24px; width: min(480px, calc(100vw - 32px)); box-shadow: var(--shadow); }
dialog.wide { width: min(780px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(4, 8, 16, .6); backdrop-filter: blur(2px); }
dialog h2 { font-size: 18px; margin-bottom: 10px; }
dialog form { display: grid; gap: 14px; }
dialog p + p, dialog .code + p { margin-top: 12px; }
.actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 18px; }
.code { font: 12.5px/1.55 "Cascadia Mono", Consolas, monospace; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; overflow-wrap: anywhere; user-select: all; margin-top: 12px; }
.policy-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-top: 16px; }
.policy { border: 1px solid var(--line); background: var(--panel-2); border-radius: 12px; padding: 16px; display: grid; gap: 11px; }
.policy-title { display: flex; align-items: center; gap: 9px; font-weight: 650; font-size: 15px; }
.policy label { grid-template-columns: 1fr 92px; align-items: center; font-weight: 400; }
.policy input { background: var(--panel); }
.policy .saved { color: var(--ok); font-size: 12.5px; }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brandlink { padding: 0 8px 0 0; margin: 0; border: 0; }
  .brandlink .logo { width: 120px; }
  .brandlink .product { display: none; }
  .rail a span, .rail a em, .rail-foot span, .who { display: none; }
  .rail-foot { margin: 0 0 0 auto; display: flex; border: 0; padding: 0; }
  .main { padding: 18px 16px 30px; }
  .gauges { gap: 8px; }
}

/* ---- Device page: status header, section list, detail cards ---- */
.hero { padding: 20px 22px; margin-bottom: 16px; background: linear-gradient(135deg, var(--accent-soft), transparent 45%), var(--panel); }
.hero-top { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.hero-top h1 { overflow-wrap: anywhere; }
.hero-top .grow { flex: 1; min-width: 200px; }
.hero-top .pills { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.vitals { display: grid; grid-template-columns: repeat(3, minmax(150px, 190px)) 1fr; gap: 12px; margin-top: 18px; }
.vital { display: flex; align-items: center; gap: 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.vital .ring { width: 68px; height: 68px; flex: none; }
.vital .ring .center { font-size: 15px; }
.vital b { display: block; font-size: 14px; }
.vital span.sub { display: block; font-size: 12.5px; color: var(--muted); }
.vital.info { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 18px; align-items: start; }
.vital.info div { min-width: 0; }
.vital.info b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.devgrid { display: grid; grid-template-columns: 208px 1fr; gap: 16px; align-items: start; }
.secnav { position: sticky; top: 16px; padding: 8px; display: grid; gap: 2px; }
.secnav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; color: var(--muted); text-decoration: none; font-weight: 550; border: 1px solid transparent; }
.secnav a:hover { background: var(--raised); color: var(--text); }
.secnav a.active { background: var(--accent-soft); color: var(--text); border-color: var(--line-strong); }
.secnav a.active .icon { color: var(--accent); }
.secnav em { margin-left: auto; font-style: normal; font-size: 11.5px; font-weight: 600; background: var(--raised); border-radius: 999px; padding: 0 7px; }
.secnav em.warn { background: var(--warn-soft); color: var(--warn); }
.secbody { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; min-width: 0; }
.secbody > .full { grid-column: 1 / -1; }
.card-body { padding: 16px 18px; }
.card-body.flush { padding: 0; }
.panel-head .note { margin-left: auto; font-size: 12px; color: var(--muted); }
.waiting { grid-column: 1 / -1; }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.stat { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; min-width: 0; }
.stat b { display: block; font-size: 16px; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat span { font-size: 12px; color: var(--muted); }
.subhead { font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 18px 0 8px; }
.subhead:first-child { margin-top: 0; }

.dtools { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.dtools input { width: 260px; max-width: 100%; padding: 6px 10px; }
.dtools select { padding: 6px 10px; }
table.compact th, table.compact td { padding: 8px 12px; }
table.compact th:first-child, table.compact td:first-child { padding-left: 18px; }
table.compact tbody tr { cursor: default; }
table.compact th { cursor: pointer; }
table.compact th.sorted { color: var(--accent); }
td.r, th.r { text-align: right; font-variant-numeric: tabular-nums; }
td.wrap { white-space: normal; overflow-wrap: anywhere; min-width: 260px; max-width: 560px; font-size: 13px; }
td.mono { font-family: "Cascadia Mono", Consolas, monospace; font-size: 12.5px; }

.tiles2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.mini { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; min-width: 0; }
.mini-head { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; min-width: 0; }
.mini-head b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-head .pill { margin-left: auto; }
.mini .sub { font-size: 12.5px; color: var(--muted); margin: -6px 0 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini .facts { font-size: 13px; gap: 5px 14px; }
.mini .track { display: block; height: 8px; border-radius: 4px; background: var(--raised); overflow: hidden; margin: 4px 0 10px; }
.mini .fill { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--accent-2), var(--accent)); }
.mini.hot .fill { background: var(--warn); }
.issue { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.issue:last-child { border-bottom: 0; }
.issue .icon { color: var(--warn); }
.hint { display: flex; gap: 10px; align-items: flex-start; background: var(--accent-soft); border-radius: 10px; padding: 10px 13px; font-size: 13px; }
.hint .icon { color: var(--accent); margin-top: 1px; }

@media (max-width: 1100px) { .secbody { grid-template-columns: 1fr; } .vitals { grid-template-columns: repeat(3, 1fr); } .vital.info { grid-column: 1 / -1; } }
@media (max-width: 860px) {
  .devgrid { grid-template-columns: 1fr; }
  .secnav { position: static; display: flex; overflow-x: auto; }
  .secnav a { white-space: nowrap; }
  .vitals { grid-template-columns: 1fr; }
}

.backlink { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; color: var(--muted); }
.backlink:hover { background: var(--raised); color: var(--text); }
button:disabled { opacity: .55; cursor: default; }

.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
td.wrap { width: 55%; }

.formrow { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.formrow input { width: 100%; }
.card-body .actions { flex-wrap: wrap; }

.serial { display: inline-flex; align-items: center; gap: 6px; }
.serial a { color: var(--accent); text-decoration: none; font-weight: 600; }
.serial a:hover { text-decoration: underline; }
.copybtn { padding: 3px; border-radius: 6px; }

/* ---- Scripts page and remote shell ---- */
.segmented { display: inline-flex; gap: 4px; padding: 4px; margin-bottom: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.segmented button { border: 1px solid transparent; background: none; color: var(--muted); font-weight: 550; }
.segmented button:hover { background: var(--raised); color: var(--text); border-color: transparent; }
.segmented button.active { background: var(--accent-soft); color: var(--text); border-color: var(--line-strong); }
.segmented em { font-style: normal; font-size: 11.5px; font-weight: 600; background: var(--raised); border-radius: 999px; padding: 0 7px; }
.scriptgrid { display: grid; grid-template-columns: 290px 1fr; gap: 16px; align-items: start; }
.scriptlist { overflow: hidden; }
.scriptlist .list-row.selected { background: var(--accent-soft); }
.scriptlist .list-row.selected .avatar { color: var(--accent); }
.editor { padding: 18px; display: grid; gap: 14px; }
.editor-fields { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 12px; }
.editor input, .editor select { width: 100%; }
.fix-box { border: 1px solid var(--line); background: var(--panel-2); border-radius: 12px; padding: 14px 16px; display: grid; gap: 12px; }
.fix-box .switch input { width: auto; }
.fix-box .switch .sub { display: block; color: var(--muted); font-size: 12.5px; }
.fix-fields { display: grid; gap: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.fix-fields textarea { width: 100%; resize: vertical; }
.fix-fields input, .fix-fields select, .fix-fields textarea { background: var(--panel); }
.fix-row { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; }
.fixpill { background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
@media (max-width: 1000px) { .fix-row { grid-template-columns: 1fr; } }
.code-edit { width: 100%; resize: vertical; min-height: 260px; font: 13px/1.55 "Cascadia Mono", Consolas, monospace; tab-size: 4; white-space: pre; overflow: auto;
  background: #0a0c0f; color: #d9dee4; border: 1px solid var(--line-strong); border-radius: 10px; padding: 12px 14px; outline: none; }
.code-edit:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.small { font-size: 12.5px; }
tbody.static tr { cursor: default; }
label.check { display: flex; grid-template-columns: none; align-items: center; gap: 9px; font-weight: 400; cursor: pointer; }
.policy label.check { display: flex; }
label.check input { width: 16px; height: 16px; accent-color: var(--accent); }
#run-dialog select, #run-dialog input { width: 100%; }
#run-dialog .hint { margin: 0; }
.dialog-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.dialog-head h2 { margin: 0; }
details { margin-top: 14px; }
summary { cursor: pointer; color: var(--muted); font-weight: 600; margin-bottom: 8px; }

/* The shell is always dark, in both themes. */
.term-out { margin: 0; height: 430px; overflow: auto; padding: 14px 16px; background: #0a0c0f; color: #d9dee4;
  font: 13px/1.5 "Cascadia Mono", Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; outline: none; }
.term-out.result { height: auto; max-height: 340px; border: 1px solid var(--line); border-radius: 10px; }
.term-note { color: #6fb7ff; }
.term-err { color: #ff8f8f; }
.term-echo { color: #8d949d; }
.term-line { display: flex; align-items: center; gap: 10px; padding: 0 16px; background: #0a0c0f; border-top: 1px solid #1e2228; }
.term-prompt { color: #3ccdf0; font: 600 13px "Cascadia Mono", Consolas, monospace; }
.term-in { flex: 1; background: none; border: 0; border-radius: 0; padding: 12px 0; color: #e9ebee; font: 13px "Cascadia Mono", Consolas, monospace; }
.term-in:focus { box-shadow: none; }
.term-in::placeholder { color: #5d646d; }
.term-foot { padding: 10px 18px 14px; }
.terminal { overflow: hidden; }
.terminal .panel-head { flex-wrap: wrap; }

@media (max-width: 1000px) { .scriptgrid { grid-template-columns: 1fr; } .editor-fields { grid-template-columns: 1fr; } }

.buttonlink { display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: 9px; text-decoration: none; font-weight: 650; }
.buttonlink { font-weight: 600; border: 1px solid transparent; }
.buttonlink.primary { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 50%, transparent); color: var(--text); }
.buttonlink.primary .icon { color: var(--accent); }
.buttonlink.primary:hover { background: color-mix(in srgb, var(--accent) 26%, transparent); border-color: var(--accent); }
.actions.start { justify-content: flex-start; margin-top: 12px; flex-wrap: wrap; }
#enroll-dialog { width: min(600px, calc(100vw - 32px)); }

/* ---- Organizations: one full-width row per organization ---- */
.orglist { overflow: hidden; }
.orgrow { display: grid; grid-template-columns: minmax(180px, 1.4fr) minmax(110px, .8fr) 62px 96px minmax(150px, 1fr) 104px 292px; align-items: center; gap: 14px; padding: 13px 18px; border-bottom: 1px solid var(--line); }
.orgrow:last-child { border-bottom: 0; }
.orgrow:not(.orghead):hover { background: var(--panel-2); }
.orghead { padding-top: 10px; padding-bottom: 10px; font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.orgrow .num { text-align: right; font-variant-numeric: tabular-nums; }
.orgrow:not(.orghead) .num { font-size: 15px; font-weight: 600; }
.orgname { display: flex; align-items: center; gap: 12px; min-width: 0; }
.orgname > div { min-width: 0; }
.orgname b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14.5px; }
.orgrow .sub { display: block; font-size: 12.5px; color: var(--muted); }
.orghealth { display: grid; gap: 5px; }
.orgactions { display: flex; gap: 6px; justify-content: flex-end; }
.orgactions button { padding: 6px 10px; }
@media (max-width: 1240px) {
  .orgrow { grid-template-columns: minmax(170px, 1fr) minmax(110px, 150px) 110px 292px; }
  .orgrow > :nth-child(3), .orgrow > :nth-child(4) { display: none; }
}
@media (max-width: 760px) {
  .orghead { display: none; }
  .orgrow { grid-template-columns: 1fr auto; }
  .orgrow > .orghealth { display: none; }
  .orgactions { grid-column: 1 / -1; justify-content: flex-start; flex-wrap: wrap; }
}

/* ---- Patching ---- */
.tile.static { cursor: default; display: flex; align-items: center; }
.tile.static:hover { background: var(--panel); border-color: var(--line); }
.kblink { color: var(--accent); text-decoration: none; font-weight: 600; }
.kblink:hover { text-decoration: underline; }
td .sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.patchmeta { margin-top: 10px; }
.dtools button { padding: 6px 10px; }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); padding: 0; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.policy .checks label.check { font-size: 13px; }
.fieldlabel { font-size: 13px; color: var(--muted); margin-top: 2px; }
.policy label.wide { grid-template-columns: 1fr 150px; }
.policy select, .policy input[type="time"] { width: 100%; background: var(--panel); }
.policy .subhead { margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
#policy-dialog { width: min(920px, calc(100vw - 32px)); }
.policy-grid { grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); }

.panel.below { margin-top: 16px; }
.empty.small { padding: 22px 18px; }
.panel-head .note { max-width: 46%; text-align: right; }
button.choice { display: flex; width: 100%; justify-content: flex-start; text-align: left; gap: 12px; padding: 12px 14px; margin-top: 10px; white-space: normal; }
button.choice .grow { flex: 1; min-width: 0; }
button.choice b { display: block; }
button.choice .sub { display: block; font-size: 12.5px; color: var(--muted); }
button.choice .avatar { color: var(--accent); background: var(--accent-soft); }

.stack { display: grid; gap: 16px; }
.wraprow { flex-wrap: wrap; gap: 5px; }
#patch-view { margin-bottom: 14px; }

.agentbanner { display: flex; align-items: center; gap: 14px; padding: 13px 18px; margin-bottom: 16px; border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.agentbanner .grow { flex: 1; min-width: 0; }
.agentbanner b { display: block; }
.agentbanner .sub { display: block; font-size: 12.5px; color: var(--muted); }
button.small { padding: 3px 9px; font-size: 12.5px; }

/* ---- Set-up after first sign-in, and Settings ---- */
#setup-card { width: 100%; max-width: 430px; }
#setup-card .login-card { max-width: none; }
#setup-card h1 { text-align: center; font-size: 20px; }
#setup-card p { text-align: center; }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.keybox { list-style: none; margin: 2px 0 2px -20px; text-align: center; font-size: 15px; letter-spacing: .06em; }
.recovery { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; font-size: 14px; text-align: center; margin-top: 0; }
.formrow.three { grid-template-columns: repeat(3, 1fr); }
.accountform { display: block; }
.accountform .facts { margin-bottom: 4px; }
.row.end { justify-content: flex-end; }
@media (max-width: 860px) { .formrow.three { grid-template-columns: 1fr; } }

/* ---- Remote control ---- */
.remote { overflow: hidden; }
.remote .panel-head { flex-wrap: wrap; }
.remote-stats { font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: pre; }
.remote-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.remote-tools select, .remote-tools button { padding: 6px 10px; }
.remote-tools label.check { margin-left: auto; font-size: 13px; }
.remote-stage { position: relative; background: #05070a; display: grid; place-items: center; min-height: 360px; overflow: hidden; }
.remote-screen { display: block; max-width: 100%; max-height: 76vh; height: auto; outline: none; cursor: default; }
.remote-stage.actual { overflow: auto; place-items: start; max-height: 76vh; }
.remote-stage.actual .remote-screen { max-width: none; max-height: none; }
.remote-stage.viewonly .remote-screen { cursor: not-allowed; }
.remote-screen:focus { box-shadow: inset 0 0 0 2px var(--accent); }
.remote-overlay { position: absolute; inset: 0; display: grid; align-content: center; justify-items: center; gap: 12px; padding: 30px 20px; color: #9aa1aa; text-align: center; }
.remote-overlay .icon { width: 38px; height: 38px; }
.remote-overlay button .icon { width: 15px; height: 15px; }

/* The viewer in its own window: nothing but the session. */
body.standalone .rail { display: none; }
body.standalone .app { grid-template-columns: 1fr; }
body.standalone .main { padding: 0; }
.remote.standalone { border: 0; border-radius: 0; min-height: 100vh; display: flex; flex-direction: column; }
.remote.standalone .remote-stage { flex: 1; min-height: 0; }
.remote.standalone .remote-screen { max-height: calc(100vh - 104px); }
.remote.standalone .remote-stage.actual { max-height: calc(100vh - 104px); }

/* ---- Files ---- */
.crumbs { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.crumbs .chev { color: var(--muted); }
button.crumb { background: none; border-color: transparent; padding: 4px 8px; font-weight: 600; }
button.crumb:hover { background: var(--raised); border-color: transparent; }
button.filelink { background: none; border: 0; padding: 2px 0; gap: 10px; font-weight: 550; }
button.filelink:hover { background: none; color: var(--accent); }
button.filelink:disabled { opacity: 1; cursor: default; color: var(--text); font-weight: 400; }
button.filelink .icon { color: var(--accent); }
button.filelink:disabled .icon { color: var(--muted); }
table.files td { padding-top: 6px; padding-bottom: 6px; }
tr.dim td { opacity: .6; }
.buttonlink.plain { padding: 7px; border: 1px solid var(--line-strong); background: var(--panel-2); color: var(--text); }
.buttonlink.plain:hover { border-color: var(--accent); background: var(--raised); }
.icon.up { transform: rotate(180deg); }
.dtools.foot { border-bottom: 0; border-top: 1px solid var(--line); min-height: 0; }
.dtools.foot:has(span:empty) { display: none; }

/* Full screen: the whole viewer, toolbar included, fills the display. */
.remote:fullscreen { border: 0; border-radius: 0; display: flex; flex-direction: column; background: var(--panel); }
.remote:fullscreen .remote-stage { flex: 1; min-height: 0; }
.remote:fullscreen .remote-screen, .remote:fullscreen .remote-stage.actual { max-height: calc(100vh - 104px); }
.remote:fullscreen .term-foot { display: none; }

/* ---- Policies and organization settings ---- */
.orgpolicies { display: grid; gap: 3px; font-size: 12.5px; min-width: 0; }
.orgpolicies span { display: flex; align-items: center; gap: 6px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.orgpolicies .icon { color: var(--muted); }
@media (max-width: 1240px) {
  .orgrow { grid-template-columns: minmax(160px, 1fr) minmax(140px, 1fr) 104px 292px; }
  .orgrow > :nth-child(2), .orgrow > :nth-child(3), .orgrow > :nth-child(4) { display: none; }
}
.policyrow { display: grid; grid-template-columns: minmax(200px, 1fr) minmax(280px, 2fr) 130px auto; align-items: center; gap: 16px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.policyrow:last-child { border-bottom: 0; }
.policyrow:hover { background: var(--panel-2); }
.policyname { display: flex; align-items: center; gap: 12px; min-width: 0; }
.policyname > div { min-width: 0; }
.policyname b, .policyuse b { display: block; }
.policyrow .sub { display: block; font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.policyname .avatar { color: var(--accent); background: var(--accent-soft); }
@media (max-width: 1100px) { .policyrow { grid-template-columns: 1fr; } .policyrow .orgactions { justify-content: flex-start; } }

#policy-dialog { width: min(1040px, calc(100vw - 32px)); padding: 0; }
.policyeditor { display: block; padding: 22px 24px 0; }
.policyeditor h2 { margin-bottom: 12px; }
.policy-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 0 22px; margin-top: 14px; }
.policysection { border: 1px solid var(--line); background: var(--panel-2); border-radius: 12px; padding: 14px 16px; margin-bottom: 14px; display: grid; gap: 10px; }
.policysection label { grid-template-columns: 1fr 96px; align-items: center; font-weight: 400; }
.policysection label.wide { grid-template-columns: 1fr 190px; }
.policysection label.stacked { grid-template-columns: 1fr; }
.policysection input, .policysection select { width: 100%; background: var(--panel); }
.policysection .subhead { margin: 8px 0 0; padding-top: 12px; border-top: 1px solid var(--line); }
.policyfields { display: grid; gap: 10px; }
.policyfields.disabled { opacity: .45; }
.actions.sticky { position: sticky; bottom: 0; background: var(--panel); margin: 0 -24px; padding: 14px 24px; border-top: 1px solid var(--line); }

/* An on/off switch */
label.switch { display: flex !important; align-items: center; gap: 12px; cursor: pointer; font-weight: 400; }
label.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
label.switch .track { flex: none; width: 38px; height: 22px; border-radius: 999px; background: var(--raised); border: 1px solid var(--line-strong); position: relative; transition: background .15s, border-color .15s; }
label.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transition: transform .15s, background .15s; }
label.switch input:checked + .track { background: var(--accent); border-color: var(--accent); }
label.switch input:checked + .track::after { transform: translateX(16px); background: #fff; }
label.switch input:focus-visible + .track { box-shadow: 0 0 0 3px var(--accent-soft); }

#org-dialog { width: min(520px, calc(100vw - 32px)); }
#org-dialog select, #org-dialog input, #org-dialog textarea { width: 100%; }
#org-dialog .row select { flex: 1; }
textarea { font: inherit; color: inherit; background: var(--panel-2); border: 1px solid var(--line-strong); border-radius: 9px; padding: 8px 11px; outline: none; resize: vertical; }
textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---- Alerts and notification settings ---- */
.rail a em.hot { background: var(--warn-soft); color: var(--warn); }
.notifyform { display: block; }
.notify-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 0 18px; }
.notifyform .policysection label:not(.switch) { grid-template-columns: 1fr; }
.notifyform .formrow { gap: 10px; }
.notifyform .policy-title:not(:first-child) { margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--line); }

/* ---- Live tools (services, processes, event log), applications, device actions ---- */
.pill.bad { background: var(--bad-soft); color: var(--bad); }
/* What just happened, as a strip under a card's heading or a box in a dialog. */
.toolnote { display: flex; align-items: flex-start; gap: 9px; padding: 9px 18px; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.toolnote .icon { margin-top: 2px; color: var(--ok); }
.toolnote.working .icon { color: var(--muted); }
.toolnote.bad { color: var(--bad); background: var(--bad-soft); }
.toolnote.bad .icon { color: var(--bad); }
dialog .toolnote { border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; margin-top: 12px; background: var(--panel-2); }
dialog .toolnote.bad { background: var(--bad-soft); border-color: transparent; }
dialog form .toolnote { margin-top: 0; }
select.small { padding: 3px 6px; font-size: 12.5px; border-radius: 7px; }
table.fixedhead th { cursor: default; }
.eventmsg { cursor: pointer; white-space: pre-line; }
.arrowed { display: inline-flex; align-items: center; gap: 6px; }
.arrowed .icon { width: 12px; height: 12px; color: var(--muted); }
.dtools.topline { border-top: 1px solid var(--line); }
.secbody > .hint { align-items: center; }

.fieldstack { display: grid; gap: 10px; }
.fieldstack .subhead { margin: 8px 0 0; }
.fieldstack .subhead:first-child { margin-top: 0; }
.searchrow { display: flex; align-items: center; gap: 8px; }
.searchrow .searchbox { max-width: none; min-width: 0; }
.quickpicks { display: flex; flex-wrap: wrap; gap: 7px; }
.quickpicks button { padding: 4px 12px; border-radius: 999px; font-size: 13px; }
.quickpicks button.active { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 50%, transparent); font-weight: 600; }
.picklist { max-height: 236px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); }
.pickrow { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.pickrow:last-child { border-bottom: 0; }
.pickrow .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.pickrow b { display: block; font-weight: 600; }
.pickrow .sub { display: block; font-size: 12.5px; color: var(--muted); }
.pill .copybtn { padding: 0 1px; margin-right: -4px; }

#action-dialog { width: min(520px, calc(100vw - 32px)); }
#action-dialog select, #action-dialog textarea { width: 100%; font-weight: 400; }
#install-dialog { width: min(640px, calc(100vw - 32px)); }
#install-dialog select, #install-dialog input[type="search"] { width: 100%; }
.policysection textarea { width: 100%; background: var(--panel); font: 12.5px/1.5 "Cascadia Mono", Consolas, monospace; }

/* Settings: one panel at a time, chosen by the tabs (the page's data-tab) */
#page-settings .stack > .panel { display: none; }
#page-settings[data-tab="account"] #settings-account:not([hidden]),
#page-settings[data-tab="account"] #settings-desktop:not([hidden]),
#page-settings[data-tab="users"] #settings-users:not([hidden]),
#page-settings[data-tab="notifications"] #settings-notify:not([hidden]),
#page-settings[data-tab="integrations"] #settings-integrations:not([hidden]) { display: block; }
#settings-integrations .policysection + .policysection { margin-top: 16px; }
#settings-integrations td select { min-width: 220px; }
#settings-integrations .policysection label:not(.switch) { grid-template-columns: 1fr; }
#settings-integrations .policysection .actions.start { margin-top: 10px; }

/* Device tables: a long name, path or account is cut with an ellipsis instead of pushing the other columns off screen */
#dev-body table.compact td:not(.wrap) { max-width: 250px; overflow: hidden; text-overflow: ellipsis; }
#dev-body table.compact td:not(.wrap) > div { overflow: hidden; text-overflow: ellipsis; }
#dev-body table.compact td.mono { max-width: 170px; }

/* Two-step sign-in set-up: the QR code, and the key for typing by hand */
.qrbox { width: 196px; margin: 10px auto 12px; padding: 8px; background: #fff; border-radius: 12px; }
.qrbox svg { display: block; width: 100%; height: auto; }
.manualkey { margin: 0 0 12px; }
.manualkey summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.manualkey summary:hover { color: var(--text); }
.manualkey .keybox { margin: 8px 0; }
.login-card .center { text-align: center; }

/* Dashboard: a full-width row and two columns of panels. Each panel moves by dragging its top bar. */
.dashzone { display: flex; flex-direction: column; gap: 16px; min-width: 0; container-type: inline-size; }
.dashzone[data-zone="top"] { margin-bottom: 16px; }
.dashzone[data-zone="top"]:empty { margin-bottom: 0; }
.dashcols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.widget > .panel-head { cursor: grab; user-select: none; }
.widget > .panel-head:active { cursor: grabbing; }
.widget > .panel-head .grip { margin-left: -6px; margin-right: -4px; opacity: .35; }
.widget > .panel-head:hover .grip { opacity: .9; }
.widget.dragging { opacity: .35; }
.arranging .dashzone { min-height: 70px; border-radius: var(--radius); outline: 1px dashed var(--line-strong); outline-offset: 5px; }
.dropmark { height: 6px; margin: -5px 0; border-radius: 999px; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }

.dashhealth { display: grid; grid-template-columns: auto minmax(240px, 1fr) auto; gap: 26px; align-items: center; padding: 18px 22px; }
.dashscore { display: flex; align-items: center; gap: 14px; }
.dashscore .big { font-size: 42px; font-weight: 750; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.dashscore b { display: block; font-weight: 600; }
.dashscore .sub { display: block; color: var(--muted); font-size: 12.5px; }
.hbar { display: flex; gap: 3px; height: 12px; border-radius: 999px; overflow: hidden; background: var(--raised); }
.hbar span { min-width: 6px; flex-basis: 0; }
.hbar .ok, .hlegend i.ok { background: var(--ok); } .hbar .warn, .hlegend i.warn { background: var(--warn); }
.hbar .bad, .hlegend i.bad { background: var(--bad); } .hbar .off, .hlegend i.off { background: var(--off); }
.hlegend { display: flex; flex-wrap: wrap; gap: 4px 6px; margin-top: 10px; }
.hlegend button { gap: 7px; padding: 3px 8px; color: var(--muted); font-size: 12.5px; }
.hlegend button b { color: var(--text); font-variant-numeric: tabular-nums; }
.hlegend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.dashstats { display: grid; grid-template-columns: repeat(4, auto); }
.dashstat { flex-direction: column; align-items: flex-start; gap: 0; padding: 6px 18px; background: none; border: 0; border-left: 1px solid var(--line); border-radius: 0; }
.dashstat:hover { background: var(--panel-2); border-color: var(--line); }
.dashstat b { font-size: 22px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.dashstat span { color: var(--muted); font-size: 12px; }
@container (max-width: 900px) {
  .dashhealth { grid-template-columns: 1fr; gap: 16px; }
  .dashstats { grid-template-columns: repeat(4, 1fr); }
  .dashstat:first-child { border-left: 0; padding-left: 0; }
}

.issuegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; padding: 14px 16px 16px; }
.issuechip { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 46px; padding: 6px 12px; text-align: left; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; }
.issuechip .n { font-size: 20px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; text-align: center; }
.issuechip .what { color: var(--text); font-size: 13px; font-weight: 500; line-height: 1.25; white-space: normal; }
.issuechip .icon { color: var(--muted); }
.issuegrid.bad .issuechip:not(.zero) { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); background: var(--bad-soft); }
.issuegrid.bad .issuechip:not(.zero) .n, .issuegrid.bad .issuechip:not(.zero) .icon { color: var(--bad); }
.issuegrid.warn .issuechip:not(.zero) { border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); background: var(--warn-soft); }
.issuegrid.warn .issuechip:not(.zero) .n, .issuegrid.warn .issuechip:not(.zero) .icon { color: var(--warn); }
.issuechip.zero .n, .issuechip.zero .what { color: var(--muted); }
.issuechip.zero .icon { opacity: .5; }

.scrolllist { max-height: 520px; overflow-y: auto; }
.widget .dtools { padding: 10px 16px; border-bottom: 1px solid var(--line); }
.searchbox.slim { min-width: 0; width: 100%; }
.orgline { border-left: 3px solid transparent; }
.orgline.bad { border-left-color: var(--bad); } .orgline.warn { border-left-color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.quiet { display: flex; align-items: center; gap: 9px; padding: 16px 18px; color: var(--muted); }
.quiet .icon { color: var(--ok); }
.actrow { display: flex; align-items: center; gap: 12px; padding: 9px 18px; border-top: 1px solid var(--line); }
.actrow:first-child { border-top: 0; }
.actrow .evcell { flex: none; }
.actrow .grow { min-width: 0; }
.actrow .title { display: block; font-weight: 550; }
.actrow .sub { display: block; color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.actrow .when { flex: none; display: flex; flex-direction: column; align-items: flex-end; color: var(--muted); font-size: 12px; line-height: 1.4; }
.actrow .when b { color: var(--text); font-weight: 550; }
.spin { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); flex: none; }
.spin:not(.still) .icon { animation: dashspin 1.6s linear infinite; }
@keyframes dashspin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin .icon { animation: none; } }
@media (max-width: 1100px) { .dashcols { grid-template-columns: 1fr; } }

/* BitLocker recovery keys */
.keycell { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.recoverykey { font: 600 13px/1.4 ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .02em; padding: 5px 9px; border-radius: 8px; background: var(--raised); border: 1px solid var(--line-strong); user-select: all; }
#dev-body table.keytable td.wrap { max-width: none; white-space: normal; }
.keynote { padding: 10px 18px 14px; margin: 0; }
#dev-body table.keytable td.mono { max-width: none; }

/* Devices page: tick boxes and the bar of actions for what is ticked */
th.tick, td.tick { width: 36px; padding-right: 0; cursor: default; }
td.tick input, th.tick input { width: 16px; height: 16px; cursor: pointer; }
tr.picked td { background: var(--accent-soft); }
.bulkbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 10px 14px; margin-bottom: 12px; border-color: var(--line-strong); position: sticky; top: 8px; z-index: 5; box-shadow: var(--shadow); }
.bulkbar[hidden] { display: none; }
.bulkbar b { margin-right: 2px; }
.pre { white-space: pre-wrap; }

/* Settings > Integrations: Microsoft 365 email */
#settings-integrations .mailform, #m365-outbox, #m365-problem { display: grid; gap: 10px; }
#m365-problem:empty { display: none; }
#settings-integrations details { margin-top: 0; }
#settings-integrations details .hint { margin-top: 12px; }
#settings-integrations .mailtest input { max-width: 320px; }
#m365-outbox .policy-title { flex-wrap: wrap; margin-top: 4px; padding-top: 14px; border-top: 1px solid var(--line); }
#m365-outbox td.mailsubject, #m365-outbox td.mailstate { white-space: normal; overflow-wrap: anywhere; min-width: 200px; }
#m365-outbox td.mailstate .small { margin-top: 3px; max-width: 460px; }
#m365-outbox table.compact th { cursor: default; }

/* ==================================================================================================
   Helpdesk (helpdesk.js, helpdesk-people.js): the queue, the ticket workspace, people, portal access,
   settings, and the helpdesk's pieces on the device page and in an organization's settings.
   ================================================================================================== */
.pill.info { background: var(--accent-soft); color: var(--accent); }
.pill.violet { background: var(--violet-soft); color: var(--violet); }
.rail a em.new { background: var(--accent); color: var(--on-accent); }
#hd-tabs { margin-bottom: 16px; max-width: 100%; overflow-x: auto; scrollbar-width: thin; }
#hd-tabs button { flex: none; white-space: nowrap; }
.hd-link { border: 1px solid var(--line-strong); background: var(--panel-2); color: var(--text); white-space: nowrap; }
.hd-link:hover { border-color: var(--accent); background: var(--raised); }
a.list-row { text-decoration: none; color: inherit; }

/* Someone's initials */
.hd-face { width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 12px; font-weight: 700; letter-spacing: .02em; background: var(--violet-soft); color: var(--violet); }
.hd-face.staff { background: var(--accent-soft); color: var(--accent); }
.hd-face.sm { width: 24px; height: 24px; font-size: 10px; }
.hd-face.lg { width: 42px; height: 42px; font-size: 14px; }

/* Priority as four bars */
.hd-prio { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.hd-prio .bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 13px; }
.hd-prio .bars i { width: 3px; border-radius: 1.5px; background: var(--line-strong); }
.hd-prio .bars i:nth-child(1) { height: 4px; } .hd-prio .bars i:nth-child(2) { height: 7px; }
.hd-prio .bars i:nth-child(3) { height: 10px; } .hd-prio .bars i:nth-child(4) { height: 13px; }
.hd-prio .bars i.on { background: var(--muted); }
.hd-prio.p3 { color: var(--warn); font-weight: 600; } .hd-prio.p3 .bars i.on { background: var(--warn); }
.hd-prio.p4 { color: var(--bad); font-weight: 650; } .hd-prio.p4 .bars i.on { background: var(--bad); }
.pill .hd-prio { gap: 0; }

/* ---- The queue ---- */
.hd-tiles { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.hd-tile { padding: 13px 14px; gap: 12px; min-width: 0; white-space: normal; }
.hd-tile .chip { width: 36px; height: 36px; border-radius: 10px; flex: none; }
.hd-tile .value { font-size: 24px; }
.hd-tile .label { line-height: 1.25; }
.hd-tile.lit .value { color: var(--accent); }
.hd-tile.lit.warn .value { color: var(--warn); }
.hd-tile.active, .hd-tile.active:hover { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }

.hd-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.hd-bar .segmented { margin-bottom: 0; }
.hd-bar .searchbox { flex: 1 1 240px; max-width: 340px; min-width: 200px; }
.hd-bar select { max-width: 220px; }
.hd-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.hd-chip { display: inline-flex; align-items: center; gap: 7px; max-width: 100%; padding: 3px 6px 3px 10px; border-radius: 999px; font-size: 13px; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 38%, transparent); }
.hd-chip > .icon { color: var(--accent); }
.hd-chip .text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 280px; }
.hd-chip.bad { background: var(--bad-soft); border-color: var(--bad); }
.hd-chip.bad > .icon { color: var(--bad); }
.hd-count { margin-top: 10px; padding-left: 4px; min-height: 19px; }

.hd-list { overflow: hidden; transition: opacity .15s; }
.hd-list.stale { opacity: .5; transition: opacity .2s .25s; }
.hd-row { display: grid; grid-template-columns: 36px minmax(0, 2.4fr) minmax(0, 1.1fr) 88px 158px minmax(0, 150px) 92px; align-items: center; gap: 14px;
  padding: 11px 18px 11px 15px; border-bottom: 1px solid var(--line); border-left: 3px solid transparent; color: inherit; text-decoration: none; }
.hd-row:last-child { border-bottom: 0; }
a.hd-row:hover { background: var(--panel-2); }
a.hd-row:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); border-bottom-color: var(--line); }
.hd-rowhead { padding-top: 9px; padding-bottom: 9px; font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
a.hd-row.p3 { border-left-color: var(--warn); }
a.hd-row.p4 { border-left-color: var(--bad); }
.hd-row.unread { background: color-mix(in srgb, var(--accent) 7%, transparent); }
a.hd-row.unread:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.hd-kind { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--raised); color: var(--muted); position: relative; }
.hd-row.unread .hd-kind { background: var(--accent-soft); color: var(--accent); }
.hd-kind .dot { position: absolute; top: -3px; right: -3px; width: 11px; height: 11px; border-radius: 50%; background: var(--accent); border: 2px solid var(--panel); box-shadow: 0 0 8px var(--accent); }
.hd-what { min-width: 0; display: grid; gap: 1px; }
.hd-subject { display: flex; gap: 8px; align-items: baseline; min-width: 0; }
.hd-subject .text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.hd-row.unread .hd-subject .text { font-weight: 700; }
.hd-num { flex: none; font-size: 12.5px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.hd-preview { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hd-row.unread .hd-preview { color: color-mix(in srgb, var(--text) 72%, var(--muted)); }
.hd-from { min-width: 0; display: grid; }
.hd-from b { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hd-row .sub { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hd-cell.pills { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.hd-owner { display: flex; align-items: center; gap: 8px; min-width: 0; }
.hd-owner .who-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hd-nobody { color: var(--muted); border: 1px dashed var(--line-strong); border-radius: 999px; padding: 1px 9px; font-size: 12.5px; white-space: nowrap; }
.hd-when { display: grid; text-align: right; }
.hd-when b { font-weight: 550; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hd-list .allclear .icon, .hd-list .empty .icon { margin-bottom: 2px; }

/* ---- One ticket: a header, the conversation with the composer under it, and the details beside ---- */
#hd-ticket { display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 14px; height: calc(100vh - 52px); min-height: 560px; margin-bottom: -14px; }
.hd-head { padding: 14px 18px; background: linear-gradient(135deg, var(--accent-soft), transparent 45%), var(--panel); }
.hd-headline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hd-headline > .grow { flex: 1; min-width: 280px; }
.hd-titleline { display: flex; align-items: center; gap: 10px; min-width: 0; }
.hd-titleline h1 { font-size: 20px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hd-bignum { flex: none; font-size: 13.5px; font-weight: 700; color: var(--accent); background: var(--accent-soft); border-radius: 8px; padding: 2px 9px; font-variant-numeric: tabular-nums; }
.hd-head .pills { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.hd-subjectedit { flex: 1; min-width: 0; font-size: 16px; font-weight: 600; }
.hd-steps { display: flex; align-items: center; gap: 6px; margin-right: 4px; }
.hd-step { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; color: var(--muted); border: 1px solid var(--line-strong); background: var(--panel-2); }
.hd-step:hover { color: var(--text); border-color: var(--accent); }
.hd-step.off { opacity: .35; pointer-events: none; }

.hd-work { display: grid; grid-template-columns: minmax(0, 1fr) 344px; gap: 16px; min-height: 0; }
.hd-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; min-height: 0; position: relative; }
.hd-thread { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 22px 16px; overscroll-behavior: contain; }
.hd-thread:focus-visible { outline: none; border-color: var(--line-strong); }
.hd-thread > * { max-width: 940px; margin-left: auto; margin-right: auto; }
.hd-side { display: grid; gap: 12px; align-content: start; min-height: 0; overflow-y: auto; padding-right: 2px; scrollbar-width: thin; }
.hd-main.dropping::after { content: "Drop to attach to this ticket"; position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; pointer-events: none;
  border: 2px dashed var(--accent); border-radius: var(--radius); background: color-mix(in srgb, var(--bg) 84%, transparent); font-size: 16px; font-weight: 650; }

.hd-day { display: flex; align-items: center; gap: 12px; margin-top: 16px; margin-bottom: 10px; color: var(--muted); font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .07em; }
.hd-day::before, .hd-day::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.hd-msg { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; margin-top: 12px; margin-bottom: 12px; }
.hd-bubble { min-width: 0; padding: 10px 14px 12px; background: var(--panel-2); border: 1px solid var(--line); border-left: 3px solid var(--line-strong); border-radius: 4px 12px 12px 4px; }
.hd-msg.staff .hd-bubble { border-left-color: var(--accent); }
.hd-msg.note .hd-bubble { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 26%, transparent); border-left-color: var(--warn); }
.hd-bubble header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 5px; }
.hd-bubble header b { font-weight: 650; }
.hd-bubble time, .hd-sys time { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.hd-tag { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; color: var(--muted); background: var(--raised); border-radius: 999px; padding: 1px 8px; }
.hd-msg.staff .hd-tag { color: var(--accent); background: var(--accent-soft); }
.hd-tag.note { color: var(--warn); background: none; padding: 0; }
.hd-tag .icon.sm { width: 13px; height: 13px; }
.hd-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; }
.hd-sys { display: flex; align-items: center; gap: 9px; margin-top: 8px; margin-bottom: 8px; padding-left: 46px; color: var(--muted); font-size: 12.5px; }
.hd-sys i { flex: none; width: 6px; height: 6px; margin: 0 4.5px; border-radius: 50%; background: var(--line-strong); }
.hd-sys.internal { color: color-mix(in srgb, var(--warn) 62%, var(--muted)); }
.hd-loose .hd-files { margin-top: 0; padding-left: 46px; }

.hd-files { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; margin-top: 10px; }
.hd-thumb { position: relative; padding: 0; width: 156px; height: 104px; border-radius: 10px; overflow: hidden; background: var(--bg); border: 1px solid var(--line-strong); }
.hd-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.hd-thumb .lockmark { position: absolute; left: 6px; top: 6px; display: grid; padding: 2px; border-radius: 6px; background: var(--warn); color: #1a1300; }
.hd-file { display: flex; align-items: center; gap: 10px; min-width: 0; max-width: 320px; padding: 8px 12px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line-strong); color: inherit; text-decoration: none; }
.hd-file:hover { border-color: var(--accent); }
.hd-file .grow { min-width: 0; display: grid; }
.hd-file b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hd-file .sub { font-size: 12px; color: var(--muted); }
.hd-file > .icon:first-child { color: var(--accent); }
.hd-file.internal > .icon:first-child { color: var(--warn); }
.hd-file > .icon:last-child { color: var(--muted); }

/* The composer: blue for a reply the customer reads, amber for a note that stays with the team */
.hd-composer { flex: none; display: grid; gap: 8px; padding: 10px 14px 12px; transition: border-color .15s, background .15s; }
.hd-composer.note { border-color: color-mix(in srgb, var(--warn) 55%, transparent); background: linear-gradient(var(--warn-soft), var(--warn-soft)), var(--panel); }
.hd-composetop { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.hd-modes { display: inline-flex; gap: 4px; padding: 3px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 11px; }
.hd-modes button { padding: 5px 12px; border: 1px solid transparent; background: none; color: var(--muted); font-weight: 550; }
.hd-modes button:hover { background: var(--raised); color: var(--text); border-color: transparent; }
.hd-modes button.active { background: var(--accent-soft); color: var(--text); border-color: var(--line-strong); }
.hd-modes button.active .icon { color: var(--accent); }
.hd-modes button.active.note { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 50%, transparent); }
.hd-modes button.active.note .icon { color: var(--warn); }
.hd-hint { display: inline-flex; align-items: center; gap: 7px; min-width: 0; font-size: 12.5px; color: var(--muted); }
.hd-composer.note .hd-hint { color: var(--warn); }
.hd-composer textarea { width: 100%; height: 84px; min-height: 84px; max-height: 320px; resize: none; line-height: 1.5; background: var(--panel-2); }
.hd-composer.note textarea { background: var(--panel); border-color: color-mix(in srgb, var(--warn) 45%, var(--line-strong)); }
.hd-composer.note textarea:focus { border-color: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.hd-pending { display: flex; flex-wrap: wrap; gap: 6px; }
.hd-pending .hd-chip { background: var(--panel-2); border-color: var(--line-strong); }
.hd-senderror { font-size: 13px; }
.hd-composefoot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hd-sendrow { flex-wrap: wrap; justify-content: flex-end; }
button.primary.note { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 55%, transparent); }
button.primary.note .icon { color: var(--warn); }
button.primary.note:hover { background: color-mix(in srgb, var(--warn) 22%, transparent); border-color: var(--warn); }
.hd-readonly { display: flex; align-items: center; gap: 9px; padding: 4px 2px; color: var(--muted); }

/* Beside the conversation */
.hd-side .panel-head { padding: 11px 16px; }
.hd-side .panel-head h2 { font-size: 13.5px; }
.hd-side .card-body { display: grid; gap: 10px; padding: 14px 16px; }
.hd-side .subhead { margin: 4px 0 0; }
.hd-side .facts { font-size: 13px; gap: 6px 14px; }
.hd-side .facts .sub { display: block; font-size: 12px; color: var(--muted); }
.hd-field { grid-template-columns: 88px minmax(0, 1fr); align-items: center; gap: 10px; font-weight: 400; color: var(--muted); }
.hd-field .row { min-width: 0; }
.hd-field select { flex: 1; min-width: 0; width: 100%; padding: 6px 9px; color: var(--text); }
.hd-savenote { font-size: 12.5px; min-height: 19px; }
.hd-savenote.ok { color: var(--ok); }
.hd-who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.hd-who .grow { flex: 1; min-width: 0; }
.hd-who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hd-who .sub { display: block; font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hd-contact { display: flex; align-items: center; gap: 9px; min-width: 0; font-size: 13px; }
.hd-contact > .icon { color: var(--muted); }
.hd-contact .serial { min-width: 0; }
.hd-contact a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hd-flag { display: flex; align-items: flex-start; gap: 8px; padding: 7px 10px; border-radius: 9px; font-size: 12.5px; color: var(--warn); background: var(--warn-soft); }
.hd-flag .icon { flex: none; margin-top: 2px; }
.hd-flag.quiet { color: var(--muted); background: var(--raised); }
.hd-minis { display: grid; gap: 4px; }
.hd-mini { display: flex; align-items: center; justify-content: flex-start; gap: 9px; min-width: 0; padding: 6px 9px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--line);
  color: inherit; text-decoration: none; text-align: left; font-size: 13px; font-weight: 400; }
.hd-mini:hover { border-color: var(--accent); background: var(--raised); }
.hd-mini .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hd-mini .icon { color: var(--muted); }
.hd-statusdot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.hd-statusdot.info { background: var(--accent); } .hd-statusdot.violet { background: var(--violet); }
.hd-statusdot.warn { background: var(--warn); } .hd-statusdot.ok { background: var(--ok); } .hd-statusdot.off { background: var(--off); }
.hd-all { justify-self: start; }
.hd-devlinks { display: flex; gap: 8px; flex-wrap: wrap; }
.hd-approval { display: grid; gap: 6px; justify-items: start; padding: 10px 12px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); font-size: 13px; }
.hd-approval.pending { background: var(--warn-soft); border-color: transparent; }
.hd-approval blockquote { margin: 0; padding-left: 10px; border-left: 3px solid var(--line-strong); color: var(--muted); overflow-wrap: anywhere; }
.hd-override { display: grid; gap: 6px; }
.hd-notyet { color: var(--warn); }

/* A picture from a ticket, opened */
#hd-image-dialog { width: min(1100px, calc(100vw - 32px)); }
#hd-image-dialog .grow { flex: 1; min-width: 0; }
#hd-image-dialog h2 { overflow-wrap: anywhere; }
.hd-picture { display: grid; place-items: center; max-height: 70vh; overflow: auto; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; }
.hd-picture img { display: block; max-width: 100%; max-height: 70vh; }

/* Dialogs: new ticket, a person, who uses a device */
#hd-ticket-dialog { width: min(700px, calc(100vw - 32px)); }
#hd-person-dialog { width: min(620px, calc(100vw - 32px)); }
#hd-ticket-dialog :is(select, textarea, input:not([type="checkbox"])),
#hd-person-dialog :is(select, textarea, input:not([type="checkbox"])),
#hd-small-dialog select { width: 100%; font-weight: 400; }
#hd-ticket-dialog form > p, #hd-person-dialog form > p { margin-top: 0; }
#hd-ticket-dialog form > .muted.small, #hd-person-dialog form > .muted.small { margin-top: -8px; }
.hd-wide-first { grid-template-columns: 1fr 120px; }
#hd-person-dialog .dialog-head { margin-bottom: 0; }
#hd-person-dialog .dialog-head .grow { flex: 1; min-width: 0; }
#hd-person-dialog .dialog-head h2 { margin: 0; }
.hd-section { display: grid; gap: 10px; padding-top: 14px; border-top: 1px solid var(--line); }
.hd-section .subhead { margin: 0; }
.hd-section .actions { margin-top: 0; }
.hd-saverow { margin-top: 0; }
.hd-invite { display: grid; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); }
.hd-invite .code, .hd-invite .actions, .hd-invite p { margin-top: 0; }

/* ---- People ---- */
.hd-orgpeople { overflow: hidden; }
.hd-orgpeople .panel-head .grow { flex: 1; min-width: 0; }
.hd-orgpeople .panel-head .sub { display: block; font-size: 12.5px; color: var(--muted); }
.hd-orgpeople .panel-head .avatar .icon { color: inherit; }
.hd-prow { display: grid; grid-template-columns: 34px minmax(0, 1.25fr) minmax(0, 1.3fr) 150px minmax(0, 1fr) 92px 112px; align-items: center; gap: 14px; padding: 10px 18px; border-bottom: 1px solid var(--line); }
.hd-prow:last-child { border-bottom: 0; }
.hd-prow:not(.hd-prowhead):hover { background: var(--panel-2); }
.hd-prowhead { padding-top: 8px; padding-bottom: 8px; font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.hd-prow.dim > :not(.orgactions) { opacity: .55; }
.hd-prow > div { min-width: 0; }
.hd-prow .sub { display: block; font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hd-pname .line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.hd-pname b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hd-pcontact a { display: block; color: var(--text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hd-pcontact a:hover { color: var(--accent); }
.hd-pdevices { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.hd-devchip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 2px 9px; border-radius: 999px; background: var(--raised); color: var(--text); text-decoration: none; font-size: 12.5px; white-space: nowrap; overflow: hidden; }
.hd-devchip:hover { color: var(--accent); }
.hd-devchip .icon { color: var(--muted); }
.hd-barerow { display: flex; align-items: center; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--line); }
.hd-barerow:last-child { border-bottom: 0; }
.hd-barerow .grow { flex: 1; min-width: 0; }

/* ---- Portal access, per organization ---- */
.hd-portal { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; align-items: start; }
.hd-orgpick { overflow: hidden; position: sticky; top: 16px; }
.hd-orgpick .scrolllist { max-height: calc(100vh - 250px); }
.hd-orgpick .searchbox input { width: 100%; padding-left: 36px; }
.hd-orgpick .list-row:last-child { border-radius: 0; }
.hd-orgrow.selected { background: var(--accent-soft); }
.hd-orgrow.selected .avatar { color: var(--accent); background: var(--accent-soft); }
.hd-orgrow .sub { min-height: 19px; white-space: nowrap; }
.hd-portalhead .grow { flex: 1; min-width: 0; }
.hd-portalhead .sub { display: block; font-size: 12.5px; color: var(--muted); }
.hd-portalhead .avatar .icon { color: inherit; }
.hd-portalstats { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin-bottom: 10px; }
.hd-portalcols { margin-top: 8px; }
label.hd-switch { align-items: flex-start; padding: 3px 0; }
.hd-switch .track { margin-top: 1px; }
.hd-switch .grow { flex: 1; min-width: 0; }
.hd-switch b { display: block; font-weight: 600; }
.hd-switch .sub { display: block; font-size: 12.5px; color: var(--muted); }
.hd-switch.moot, .hd-moot .hd-switch { opacity: .5; }
.hd-switch input:disabled ~ * { cursor: default; }
.hd-switch input:disabled + .track { opacity: .6; }

/* ---- Helpdesk settings ---- */
.hd-settings { display: grid; gap: 16px; }
.hd-settingsgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
.hd-setting { display: grid; gap: 7px; align-content: start; }
.hd-setting input { width: 100%; }
.hd-portaladdress { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 13px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); font-size: 13px; }
.hd-portaladdress .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.hd-portaladdress > .icon { color: var(--muted); }
.hd-settings .actions { margin-top: 0; min-height: 34px; }
.hd-settingsmore { border-top: 1px solid var(--line); }

/* ---- Equipment catalogue (helpdesk-catalogue.js) ---- */
.hd-cat { overflow: hidden; }
.hd-catintro { display: grid; gap: 10px; border-bottom: 1px solid var(--line); }
.hd-catintro .hint { max-width: 120ch; }
.hd-cathead { display: flex; align-items: baseline; gap: 8px; padding: 12px 18px 8px; font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: var(--panel-2); border-bottom: 1px solid var(--line); }
.hd-catgroup + .hd-catgroup .hd-cathead { border-top: 1px solid var(--line); }
.hd-catrow { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: 14px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.hd-catgroup:last-child .hd-catrow:last-child { border-bottom: 0; }
.hd-catrow:hover { background: var(--panel-2); }
.hd-catrow.dim .hd-catmain { opacity: .6; }
.hd-catmove { display: grid; gap: 2px; }
.hd-catmove button { padding: 3px 6px; }
.hd-catmove button:disabled { opacity: .3; cursor: default; }
.icon.hd-catup { transform: rotate(-90deg); }
.icon.hd-catdown { transform: rotate(90deg); }
.hd-catmain { display: grid; gap: 5px; min-width: 0; }
.hd-catmain:first-child { grid-column: 1 / 3; }
.hd-catmain .line { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; }
.hd-catmain b { font-weight: 600; font-size: 14.5px; }
.hd-catmain p { font-size: 13px; max-width: 100ch; }
.hd-catspecs { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 5px 8px; }
.hd-catspecs li { padding: 2px 9px; border-radius: 7px; background: var(--raised); font-size: 12.5px; }
.hd-catrow .orgactions { align-items: center; }
.hd-cat .empty b { color: var(--text); font-size: 15px; }
.hd-cat .empty > span { max-width: 62ch; }
#hd-catalogue-dialog { width: min(600px, calc(100vw - 32px)); }
#hd-catalogue-dialog :is(select, textarea, input:not([type="checkbox"]):not([type="radio"])) { width: 100%; font-weight: 400; }
#hd-catalogue-dialog form > p { margin-top: -8px; }
#hd-catalogue-dialog form > p.error { margin-top: 0; }
.hd-catpad { align-self: end; padding-bottom: 9px; }
/* The lists of choices ("Choices on a computer"), and what one item is offered with */
#hd-catalogue-lists .panel-head .note { max-width: none; }
.hd-catadd { margin-left: 4px; }
.hd-catchoices li { display: inline-flex; align-items: baseline; gap: 7px; }
.hd-catchoices li.start { background: var(--accent-soft); }
.hd-catstart { font-size: 11.5px; font-weight: 600; color: var(--accent); }
.hd-catnote { font-size: 11.5px; color: var(--muted); }
.hd-catwithout { display: flex; align-items: flex-start; gap: 6px; color: var(--muted); }
.hd-catwithout .icon { flex: none; margin-top: 2px; }
.hd-catkinds { margin: 0; padding: 0; border: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.hd-catkinds legend { padding: 0; margin-bottom: 6px; font-size: 13px; font-weight: 600; }
.hd-choices { display: grid; gap: 6px; }
.hd-choicehead, .hd-choicerow { display: grid; grid-template-columns: 42px minmax(0, 1fr) minmax(0, 1.2fr) auto auto auto; align-items: center; gap: 6px; }
.hd-choicehead { font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.hd-choicerows { display: grid; gap: 6px; }
.hd-choicerow input[type="radio"] { width: 16px; height: 16px; margin: 0 auto; accent-color: var(--accent); }
.hd-choicerow button { padding: 6px; }
.hd-choicerow button:disabled { opacity: .3; cursor: default; }
.hd-choices .actions { margin-top: 4px; }
.hd-catopts { display: grid; gap: 10px; padding-top: 14px; border-top: 1px solid var(--line); }
.hd-catopts .subhead { margin: 0; }
.hd-catopt { margin: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); display: grid; gap: 8px; min-width: 0; }
.hd-catopt.off .hd-catoptchoices { opacity: .5; }
.hd-catoptchoices { display: flex; flex-wrap: wrap; gap: 6px 18px; padding-left: 25px; }
.hd-catopt .hd-flag, .hd-catopt p.error { margin: 0 0 0 25px; }
@media (max-width: 560px) {
  .hd-choicehead { display: none; }
  .hd-choicerow { grid-template-columns: 28px minmax(0, 1fr) auto auto auto; }
  .hd-choicerow > input:nth-of-type(3) { grid-column: 2 / -1; grid-row: 2; }
}
@media (max-width: 760px) {
  .hd-catrow { grid-template-columns: auto minmax(0, 1fr); }
  .hd-catrow .orgactions { grid-column: 1 / -1; justify-content: flex-start; }
}

/* ---- "Equipment requested" beside a ticket (a request chosen from the catalogue) ---- */
.hd-eqlines { display: grid; gap: 8px; }
.hd-eqline { display: flex; align-items: flex-start; gap: 10px; padding: 9px 11px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); }
.hd-eqline .grow { flex: 1; min-width: 0; display: grid; gap: 2px; }
.hd-eqline b { font-weight: 600; overflow-wrap: anywhere; }
.hd-eqline .sub, .facts dd .sub { display: block; font-size: 12.5px; color: var(--muted); }
.hd-eqline .hd-eqabove { color: var(--warn); font-weight: 600; }
.hd-eqqty { flex: none; min-width: 38px; padding: 1px 7px; border-radius: 7px; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 13px; text-align: center; white-space: nowrap; }
.hd-eqlisted { margin-top: 3px; font-size: 12.5px; color: var(--muted); }
.hd-eqlisted summary { cursor: pointer; width: fit-content; border-radius: 6px; }
.hd-eqlisted summary:hover { color: var(--text); }
.hd-eqlisted p { margin-top: 5px; }
.hd-eqlisted ul { margin: 5px 0 0; padding-left: 18px; }
.hd-eqnotes { white-space: pre-line; }

/* ---- On a device's page, and in an organization's settings ---- */
.hd-devrow { display: grid; grid-template-columns: 52px minmax(0, 1fr) fit-content(150px) max-content 72px; align-items: center; gap: 14px; padding: 9px 18px; border-top: 1px solid var(--line); color: inherit; text-decoration: none; }
.hd-devtickets .panel-head + .hd-devrow { border-top: 0; }
.hd-devrow:hover { background: var(--panel-2); }
.hd-devrow .text { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hd-devrow.unread .text { font-weight: 700; }
.hd-devrow .from { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hd-devrow .pill { justify-self: start; }
.hd-devrow .when { text-align: right; white-space: nowrap; }
.hd-devtickets .quiet .icon { color: var(--ok); }
.hd-orglinks { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); }
.hd-orglinks .grow { flex: 1; min-width: 150px; }
.hd-orglinks b { display: block; font-size: 13px; }
.hd-orglinks .sub { display: block; font-size: 12.5px; color: var(--muted); }

@media (min-width: 1700px) { .hd-work { grid-template-columns: minmax(0, 1fr) 392px; } }
@media (max-width: 1560px) { .hd-keys { display: none; } }
@media (max-width: 1420px) {
  /* Priority shrinks to its bars (the coloured edge and the tooltip still say which) */
  .hd-row { grid-template-columns: 36px minmax(0, 2.4fr) minmax(0, .8fr) 20px 152px 112px 80px; gap: 12px; }
  .hd-row .hd-prio { font-size: 0; gap: 0; }
  .hd-rowhead > :nth-child(4) { visibility: hidden; }
  .hd-prow { grid-template-columns: 34px minmax(0, 1.25fr) minmax(0, 1.3fr) 138px minmax(0, .9fr) 84px 112px; gap: 12px; }
}
@media (max-width: 1100px) {
  .hd-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #hd-ticket { height: auto; min-height: 0; margin-bottom: 0; }
  .hd-work { grid-template-columns: 1fr; }
  .hd-thread, .hd-side { overflow: visible; }
  .hd-portal { grid-template-columns: 1fr; }
  .hd-orgpick { position: static; }
  .hd-orgpick .scrolllist { max-height: 260px; }
  .hd-row { grid-template-columns: 36px minmax(0, 1fr) 152px 80px; }
  .hd-row > :nth-child(3), .hd-row > :nth-child(4), .hd-row > :nth-child(6) { display: none; }
  .hd-prow { grid-template-columns: 34px minmax(0, 1fr) 138px 112px; }
  .hd-prow > :nth-child(3), .hd-prow > :nth-child(5), .hd-prow > :nth-child(6) { display: none; }
  .hd-devrow { grid-template-columns: 54px minmax(0, 1fr) auto; }
  .hd-devrow .from, .hd-devrow .when { display: none; }
}
@media (max-width: 640px) { .hd-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---- Map (map.js, map.css): the viewer in the console's colours ---- */
.cgmap {
  --cgmap-surface: var(--panel); --cgmap-surface-2: var(--panel-2); --cgmap-hover: var(--raised); --cgmap-ink: var(--text); --cgmap-muted: var(--muted);
  --cgmap-line: var(--line-strong); --cgmap-accent: var(--accent); --cgmap-ground: #23282f; --cgmap-tiles: brightness(.84) saturate(.88) contrast(1.04);
}
:root[data-theme="light"] .cgmap { --cgmap-ground: #e6e9ed; --cgmap-tiles: none; }

/* ---- A device's Location section (location.js) ---- */
.locpanel { overflow: hidden; }
.locgrid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.locgrid .cgmap { height: 380px; }
.locside { display: grid; gap: 14px; min-width: 0; }
.locwhen { padding: 11px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); }
.locwhen .sub { display: block; font-size: 12.5px; color: var(--muted); }
.locwhen b { display: block; font-size: 19px; font-weight: 650; letter-spacing: -.01em; }
.locside .facts { font-size: 13px; gap: 7px 14px; }
.locside .mono { font-family: "Cascadia Mono", Consolas, monospace; font-size: 12.5px; }
.loclinks { display: flex; gap: 8px; flex-wrap: wrap; }
.loclinks .buttonlink { flex: 1 1 auto; justify-content: center; }
.locfoot { padding: 0 18px 16px; max-width: 110ch; }
.toolnote.plainnote .icon { color: var(--muted); }
button[aria-disabled="true"] { opacity: .55; cursor: default; }
button[aria-disabled="true"]:active { transform: none; }
.toolnote.locfail { color: var(--warn); background: var(--warn-soft); }
.toolnote.locfail .icon { color: var(--warn); }
.toolnote.locfail b { font-weight: 650; }
.locpanel .empty b { color: var(--text); font-size: 15px; }
.locpanel .empty > span { max-width: 62ch; }
.locoff .buttonlink { margin-top: 4px; }
.locpanel .empty .buttonlink .icon, .locpanel .empty button .icon { width: 15px; height: 15px; }
/* Waiting for the device to answer can take most of a minute: a quiet line that keeps moving under the words. */
.toolnote.locwait { position: relative; overflow: hidden; }
.toolnote.locwait::after { content: ""; position: absolute; left: 0; bottom: 0; width: 32%; height: 2px; border-radius: 2px; background: var(--accent); animation: locwait 1.7s ease-in-out infinite; }
@keyframes locwait { from { transform: translateX(-100%); } to { transform: translateX(320%); } }
@media (prefers-reduced-motion: reduce) { .toolnote.locwait::after { animation: none; width: 100%; opacity: .5; } }
@media (max-width: 1280px) { .locgrid { grid-template-columns: 1fr; } .locgrid .cgmap { height: 340px; } }
@media (max-width: 860px) { .locgrid .cgmap { height: 280px; } }

/* ---- Desktop notifications (Settings > My account, notify.js) ---- */
.deskform { display: grid; gap: 12px; }
.deskform .actions { margin-top: 0; }
.deskform .actions .grow { flex: 1; min-width: 220px; font-size: 13px; }
.hd-flag:not(.quiet) a { color: inherit; font-weight: 600; }
