/* ============================================================
   MSP Dashboard: Apple-inspired look
   Colours are "tokens" (variables) so light and dark mode
   each get their own values instead of an automatic flip.
   ============================================================ */

:root {
  color-scheme: light;
  --ease: cubic-bezier(.2, .8, .2, 1);   /* smooth, Apple-like easing */
  --spring: cubic-bezier(.34, 1.3, .64, 1);  /* tiny overshoot, feels 'springy' */
  --bg: #f5f5f7;
  /* colour theme (Customise page): the two corner colours. Set per user on <html>. */
  --c1: #007aff;
  --c2: #af52de;
  /* tile highlights (icons, mouse glow, open tile) use the SECOND theme colour:
     it's the one you see most, because it sits in the bottom-right behind most tiles */
  --tile-accent: var(--c2);

  /* tile sizes. Every dashboard tile is built from these, so list tiles
     (certificates, Knox) can be exactly as tall as a closed donut tile. */
  --pad: 18px;            /* inside a tile */
  --head-h: 22px;         /* tile title row */
  --head-gap: 12px;       /* space under the title */
  --donut: 132px;         /* donut size */
  --tile-h: calc(2 * var(--pad) + 2px + var(--head-h) + var(--head-gap) + var(--donut));
  --bg-glow-1: color-mix(in srgb, var(--c1) 16%, transparent);
  --bg-glow-2: color-mix(in srgb, var(--c2) 14%, transparent);
  --surface: #ffffff;
  --surface-2: #f2f2f5;
  --sidebar: rgba(250, 250, 252, 0.70);
  --sidebar-solid: #f4f5f9;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #8e8e93;
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.14);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.04);
  --accent: #007aff;
  --accent-soft: rgba(0, 122, 255, 0.12);

  /* chart & status colours (Apple system colours) */
  --blue: #007aff;
  --purple: #af52de;
  --teal: #30b0c7;
  --gold: #c69c00;
  --gray: #8e8e93;
  /* platform accents: only used to frame sections, never for data */
  --apple: #007aff;  --apple-text: #0060df;
  --android: #3ddc84;  --android-text: #13753f;
  --windows: #5856d6;  --windows-text: #4240b8;
  --green: #34c759;
  --orange: #ff9500;
  --red: #ff3b30;
  /* darker variants for TEXT so it stays readable on white */
  --green-text: #248a3d;
  --orange-text: #c93400;
  --red-text: #d70015;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #111113;
    --bg-glow-1: color-mix(in srgb, var(--c1) 22%, transparent);
    --bg-glow-2: color-mix(in srgb, var(--c2) 18%, transparent);
    --surface: #1c1c1f;
    --surface-2: #26262a;
    --sidebar: rgba(30, 30, 34, 0.62);
    --sidebar-solid: #1b1c22;
    --text: #f5f5f7;
    --text-2: #a1a1a6;
    --text-3: #7c7c82;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.16);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    --accent: #0a84ff;
    --accent-soft: rgba(10, 132, 255, 0.20);
    --blue: #0a84ff;
    --purple: #bf5af2;
    --teal: #2aa3b8;
    --gold: #b38f00;
    --gray: #8e8e93;
    --apple: #0a84ff;  --apple-text: #64aaff;
    --android: #3ddc84;  --android-text: #5ee59b;
    --windows: #5e5ce6;  --windows-text: #a5a4ff;
    --green: #30d158;
    --orange: #ff9f0a;
    --red: #ff453a;
    --green-text: #30d158;
    --orange-text: #ff9f0a;
    --red-text: #ff6961;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111113;
  --bg-glow-1: color-mix(in srgb, var(--c1) 22%, transparent);
  --bg-glow-2: color-mix(in srgb, var(--c2) 18%, transparent);
  --surface: #1c1c1f;
  --surface-2: #26262a;
  --sidebar: rgba(30, 30, 34, 0.62);
  --sidebar-solid: #1b1c22;
  --text: #f5f5f7;
  --text-2: #a1a1a6;
  --text-3: #7c7c82;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  --accent: #0a84ff;
  --accent-soft: rgba(10, 132, 255, 0.20);
  --blue: #0a84ff;
  --purple: #bf5af2;
  --teal: #2aa3b8;
  --gold: #b38f00;
  --gray: #8e8e93;
  --apple: #0a84ff;  --apple-text: #64aaff;
  --android: #3ddc84;  --android-text: #5ee59b;
  --windows: #5e5ce6;  --windows-text: #a5a4ff;
  --green: #30d158;
  --orange: #ff9f0a;
  --red: #ff453a;
  --green-text: #30d158;
  --orange-text: #ff9f0a;
  --red-text: #ff6961;
}

/* ---------------------------------------------------------- base */

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  /* system-ui = San Francisco on a Mac (allowed, it's the user's own system font) */
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background:
    radial-gradient(1500px 1000px at 0% 0%, var(--bg-glow-1), transparent 62%),
    radial-gradient(1400px 1000px at 100% 100%, var(--bg-glow-2), transparent 62%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
h1, h2 { margin: 0; }

.icon {
  width: 16px; height: 16px;
  flex: none;
  stroke-width: 1.9;
}
.icon.big { width: 28px; height: 28px; }

.subtle { color: var(--text-2); }
.block { display: block; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------------------------------------------------------- layout */

.app {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

/* Sidebar = the only "glass" layer, like Apple does for navigation */
.sidebar {
  position: sticky; top: 0;
  height: 100vh;
  display: flex; flex-direction: column;
  padding: 18px 12px 12px;
  background: var(--sidebar);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border-right: 1px solid var(--border);
  z-index: 10;
}

.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 0 4px 16px 8px;
  font-weight: 600; font-size: 15px;
  white-space: nowrap;
}
.brand .label { flex: 1; }
.sidebar-toggle {
  width: 100%; border: 0; background: none; font: inherit; text-align: left; cursor: pointer;
  color: var(--text-2);
}
.nav-item.sidebar-toggle .icon { color: var(--text-2); }
.sidebar-toggle:hover .icon { color: var(--accent); }
.sidebar-toggle .when-closed { display: none; }
.brand-icon {
  flex: none;
  display: grid; place-items: center;
  width: 28px; height: 28px; border-radius: 8px;
  background: linear-gradient(135deg, var(--c1), var(--c2));
  color: #fff;
}

.nav { flex: 1; min-height: 0; overflow-x: hidden; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }

.nav-label {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 10px 6px;
  font-size: 11px; font-weight: 600; letter-spacing: .02em;
  color: var(--text-3);
  text-transform: uppercase;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  transition: background .2s var(--ease), opacity .25s var(--ease);
}
.nav-item.tenant { overflow: visible; }
.nav-item .icon { color: var(--accent); }
.nav-item:hover { background: var(--accent-soft); }
.nav-item.is-active { background: var(--accent-soft); font-weight: 600; }
.nav-item.is-dimmed { opacity: .4; }
.nav-item.is-dimmed:hover { opacity: 1; }
.nav-item .count {
  margin-left: auto;
  font-size: 12px; font-weight: 600;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.nav-item .trail { margin-left: auto; color: var(--text-3); width: 14px; height: 14px; }

.tenant-list { overflow: hidden; }
.tenants-closed .tenant-list { display: none; }
/* the fold arrow on the "All tenants" row */
.tenant-fold {
  flex: none; display: grid; place-items: center;
  width: 30px; height: 30px; margin-right: 2px; padding: 0;
  border: 0; border-radius: 7px; background: none; color: var(--text-3); cursor: pointer;
}
.tenant-fold:hover { color: var(--text); background: var(--accent-soft); }
.tenant-fold .chev { width: 14px; height: 14px; transition: transform .3s var(--ease); }
.tenants-closed .tenant-fold .chev { transform: rotate(-90deg); }
.sidebar-collapsed .tenant-fold { display: none; }
/* "N hidden": a small fold with the tenants you hid */
.hidden-note {
  width: 100%; border: 0; background: none; font: inherit; text-align: left; cursor: pointer;
  color: var(--text-3); font-size: 12px;
}
.nav-item.hidden-note .icon { color: var(--text-3); width: 14px; height: 14px; }
.hidden-note .chev { margin-left: auto; transform: rotate(-90deg); transition: transform .3s var(--ease); }
.hidden-open .hidden-note .chev { transform: none; }
.hidden-note:hover { color: var(--text-2); }
.hidden-list { overflow: hidden; display: none; }
.hidden-open .hidden-list { display: block; }
.hidden-tenant { margin: 0; }
.hidden-tenant .tenant-link { opacity: .5; }
.unhide {
  flex: none; display: grid; place-items: center;
  width: 30px; height: 30px; margin-right: 2px; padding: 0;
  border: 0; border-radius: 7px; background: none; color: var(--text-3); cursor: pointer;
  opacity: 0; transition: opacity .2s var(--ease), background .2s var(--ease), color .2s var(--ease);
}
.hidden-tenant:hover .unhide, .unhide:focus-visible { opacity: 1; }
.unhide:hover { background: var(--accent-soft); color: var(--accent); }
.nav-item .unhide .icon { color: inherit; width: 15px; height: 15px; }
.sidebar-collapsed .unhide { display: none; }

.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }

/* tenant monogram with a status dot in the corner */
.mono {
  position: relative; flex: none;
  display: grid; place-items: center;
  width: 24px; height: 24px; border-radius: 7px;
  background: var(--surface-2); color: var(--text-2);
  font-size: 10px; font-weight: 700; letter-spacing: .02em;
}
.mono .dot {
  position: absolute; right: -2px; bottom: -2px;
  width: 9px; height: 9px;
  box-shadow: 0 0 0 2px var(--sidebar-solid);
}
.dot--good { background: var(--green); }
.dot--warning { background: var(--orange); }
.dot--critical { background: var(--red); }

/* profile + menu */
.profile { position: relative; margin-top: 12px; }
.profile summary {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: 10px;
  cursor: pointer; list-style: none;
  white-space: nowrap;
  transition: background .2s var(--ease);
}
.profile summary::-webkit-details-marker { display: none; }
.profile summary:hover { background: var(--accent-soft); }
.avatar {
  flex: none;
  display: grid; place-items: center;
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--c1), var(--c2)); color: #fff;
  font-size: 12px; font-weight: 700;
}
.who { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.2; }
.who small { color: var(--text-2); }
.muted { color: var(--text-3); }

.menu {
  position: absolute; bottom: calc(100% + 6px); left: 0; right: 0;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
  transform-origin: bottom left;
  animation: menu-in .34s var(--spring);
}
@keyframes menu-in {
  from { opacity: 0; transform: translateY(10px) scale(.94); }
  to { opacity: 1; transform: none; }
}
.menu-label { font-size: 11px; color: var(--text-3); padding: 4px 6px; }
.menu-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 7px 8px; border: 0; border-radius: 7px;
  background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.menu-item:hover { background: var(--accent-soft); }
.menu form { margin: 0; }

.segmented {
  position: relative;
  display: grid; grid-template-columns: repeat(3, 1fr);
  padding: 2px; margin: 0 0 8px;
  background: var(--surface-2); border-radius: 8px;
}
/* the white "thumb" that slides behind the chosen option */
.seg-thumb {
  position: absolute; top: 2px; bottom: 2px; left: 2px;
  width: calc((100% - 4px) / 3);
  background: var(--surface); border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .14);
  transition: transform .4s var(--spring);
}
.segmented[data-active="1"] .seg-thumb { transform: translateX(100%); }
.segmented[data-active="2"] .seg-thumb { transform: translateX(200%); }
.segmented button {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 2px; border: 0; border-radius: 6px;
  background: none; color: var(--text-2); font: inherit; font-size: 11px; cursor: pointer;
  position: relative; z-index: 1;
  transition: color .25s var(--ease);
}
.segmented button[aria-pressed="true"] { color: var(--text); }

/* main area */
.main { padding: 28px 32px 48px; min-width: 0; }

.topbar {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  margin-bottom: 22px;
}
.topbar h1 { font-size: 26px; font-weight: 700; letter-spacing: -.01em; }
.title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.title-link {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
  font-size: 12px; font-weight: 600;
  transition: filter .2s var(--ease);
}
.title-link:hover { filter: brightness(1.1); }
.title-link .icon { width: 13px; height: 13px; }
.topbar p { margin: 2px 0 0; }
.actions { display: flex; gap: 8px; }
.actions form { margin: 0; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--surface); color: var(--text);
  font: inherit; font-weight: 500; cursor: pointer;
}
.btn:hover { background: var(--surface-2); }
.btn-primary {
  justify-content: center;
  background: var(--accent); border-color: transparent; color: #fff;
}
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }

.btn-icon {
  display: inline-grid; place-items: center;
  width: 30px; height: 30px; border-radius: 7px;
  color: var(--text-2);
}
.btn-icon:hover { background: var(--accent-soft); color: var(--accent); }

.back {
  display: inline-flex; align-items: center; gap: 6px;
  margin-bottom: 14px; color: var(--accent); font-weight: 500;
}

/* ---------------------------------------------------------- cards */

.card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: var(--pad);
  box-shadow: var(--shadow);
}
a.card {
  transition: transform .45s var(--ease), box-shadow .45s var(--ease), border-color .45s var(--ease);
  will-change: transform;
}
a.card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 44px rgba(0, 0, 0, .12), 0 3px 8px rgba(0, 0, 0, .05);
  border-color: var(--border-strong);
}
a.card:active { transform: translateY(-4px) scale(.99); transition-duration: .15s; }

.card-head { display: flex; align-items: center; gap: 8px; margin-bottom: var(--head-gap); }
.grid--donuts .card-head { height: var(--head-h); }
/* certificates and Knox: exactly the height of a closed donut tile */
.grid--donuts > .tile-fixed { height: var(--tile-h); }
.card-head h2 { font-size: 15px; font-weight: 600; flex: 1; }
.card-head .icon { color: var(--tile-accent); }
.card-head .chev { color: var(--text-3); }

.grid { display: grid; gap: 16px; margin-bottom: 16px; }
.grid--donuts { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); align-items: start; }
.grid--wide { grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); align-items: start; }

/* KPI tiles */
.kpis {
  display: grid; gap: 16px; margin-bottom: 16px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}
.kpi-title { display: flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 13px; }
.kpi-title .icon { color: var(--tile-accent); }
.kpi-value {
  margin: 4px 0 2px;
  font-family: ui-rounded, system-ui, sans-serif;
  font-size: 34px; font-weight: 650; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}

.status-text { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; }
.status-text--good { color: var(--green-text); }
.status-text--warning { color: var(--orange-text); }
.status-text--critical { color: var(--red-text); }
.status-text.big .icon { width: 22px; height: 22px; }

/* donut + legend */
.donut-row { display: flex; align-items: center; gap: 20px; }
.donut { position: relative; width: var(--donut); height: var(--donut); flex: none; }
.donut--lg { width: 170px; height: 170px; }
.donut .chart { width: 100%; height: 100%; }
.donut-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  pointer-events: none; text-align: center;
}
.donut-center strong {
  font-family: ui-rounded, system-ui, sans-serif;
  font-size: 24px; font-weight: 700; line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.donut--lg .donut-center strong { font-size: 30px; }
.donut-center span { font-size: 11px; color: var(--text-2); max-width: 80px; line-height: 1.2; }

.legend { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.legend li { display: flex; align-items: center; gap: 8px; }
.legend li span:nth-child(2) { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.legend .num { color: var(--text-2); }
.swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }

.footnote { margin: 10px 0 0; font-size: 12px; color: var(--text-3); }

/* expiring list */
.expiry, .alert-list { list-style: none; margin: 0; padding: 0; }
.expiry li { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid var(--border); }
.expiry li:first-child { border-top: 0; }
.expiry-what { display: flex; flex-direction: column; flex: 1; line-height: 1.25; }
.expiry-what strong { font-weight: 500; }
.expiry-what small { color: var(--text-2); }
.expiry .num { font-size: 13px; color: var(--text-2); }
.expiry .num.status-text--warning { color: var(--orange-text); font-weight: 600; }
.expiry .num.status-text--critical { color: var(--red-text); font-weight: 600; }

/* detail page */
.detail-summary { display: flex; align-items: center; gap: 32px; margin-bottom: 16px; max-width: 560px; }

/* tables */
.table-card { padding: 4px 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  padding: 10px 16px; text-align: left;
  font-size: 12px; font-weight: 600; color: var(--text-3);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table th.num { text-align: right; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table small { font-size: 12px; }
.row-actions { white-space: nowrap; text-align: right; }

.meter {
  display: inline-block; width: 80px; height: 6px; margin-right: 8px;
  background: var(--surface-2); border-radius: 3px; overflow: hidden; vertical-align: middle;
}
.meter span { display: block; height: 100%; border-radius: 3px; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge .icon { width: 13px; height: 13px; }
.badge--good { color: var(--green-text); background: color-mix(in srgb, var(--green) 14%, transparent); }
.badge--warning { color: var(--orange-text); background: color-mix(in srgb, var(--orange) 16%, transparent); }
.badge--critical { color: var(--red-text); background: color-mix(in srgb, var(--red) 14%, transparent); }

/* alerts */
.alert-list li { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.alert-list li:last-child { border-bottom: 0; }
.alert-what { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.alert-what strong { font-weight: 600; }

.empty { text-align: center; padding: 48px; }
.empty .icon { color: var(--green); }
.empty h2 { margin: 8px 0 4px; font-size: 18px; }

/* ---------------------------------------------------------- login */

.login-bg {
  min-height: 100vh;
  display: grid; place-items: center;
  padding: 24px;
  background:
    radial-gradient(700px 500px at 20% 20%, color-mix(in srgb, var(--blue) 35%, transparent), transparent 65%),
    radial-gradient(600px 500px at 80% 30%, color-mix(in srgb, var(--purple) 28%, transparent), transparent 65%),
    radial-gradient(700px 600px at 50% 100%, color-mix(in srgb, var(--teal) 30%, transparent), transparent 65%),
    var(--bg);
}
.login-card {
  width: 100%; max-width: 360px;
  display: flex; flex-direction: column; align-items: stretch; gap: 14px;
  padding: 32px 28px;
  text-align: center;
  background: color-mix(in srgb, var(--surface) 60%, transparent);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid color-mix(in srgb, #fff 35%, transparent);
  border-radius: 28px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .15);
}
.login-card h1 { font-size: 24px; }
.login-card p { margin: -8px 0 6px; }
.app-icon {
  align-self: center;
  display: grid; place-items: center;
  width: 56px; height: 56px; border-radius: 14px;
  background: linear-gradient(135deg, var(--blue), var(--purple));
  color: #fff;
}
.app-icon .icon { width: 28px; height: 28px; }
.field { display: flex; flex-direction: column; gap: 4px; text-align: left; }
.field span { font-size: 12px; font-weight: 500; color: var(--text-2); }
.field input {
  padding: 10px 12px;
  border: 1px solid var(--border-strong); border-radius: 10px;
  background: var(--surface); color: var(--text); font: inherit;
}
.field input:focus { outline: 3px solid var(--accent-soft); border-color: var(--accent); }
.login-card .btn-primary { padding: 10px; margin-top: 4px; font-size: 15px; }
.form-error {
  display: flex; align-items: center; gap: 8px; justify-content: center;
  padding: 8px 10px; border-radius: 10px;
  color: var(--red-text); background: color-mix(in srgb, var(--red) 12%, transparent);
  font-size: 13px; font-weight: 500;
}
.login-card .footnote { margin: 0; }

/* ---------------------------------------------------------- small screens */

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .main { padding: 20px 16px 40px; }
  .grid--wide { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; }
}

.pct { display: inline-block; min-width: 3.2em; text-align: right; }
.table td:first-child { white-space: nowrap; }

/* ---------------------------------------------------------- folded sidebar (icon strip) */

.sidebar-collapsed .app { grid-template-columns: 68px minmax(0, 1fr); }
.sidebar .label { transition: opacity .2s var(--ease); }
.sidebar-collapsed .sidebar .label,
.sidebar-collapsed .sidebar .count,
.sidebar-collapsed .sidebar .trail { opacity: 0; pointer-events: none; }
.sidebar-collapsed .sidebar .count { display: none; }
.brand { overflow: hidden; }
.sidebar-collapsed .sidebar-toggle .when-open { display: none; }
.sidebar-collapsed .sidebar-toggle .when-closed { display: block; }
/* folded: section titles become thin lines, but keep their height so nothing jumps */
.nav-label { position: relative; }
.sidebar-collapsed .nav-label .chev { display: none; }
.sidebar-collapsed .nav-label::after {
  content: ""; position: absolute; left: 10px; right: 10px; top: 50%;
  height: 1px; background: var(--border);
}
.sidebar-collapsed .profile summary { padding: 8px 6px; }
.sidebar-collapsed .menu { right: auto; width: 240px; transform-origin: bottom left; }
.sidebar-collapsed .profile summary .label { display: none; }

/* ---------------------------------------------------------- less motion for people who asked for it */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
  a.card:hover { transform: none; }
}

/* ---------------------------------------------------------- device list */

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border-strong);
  font-weight: 500; font-size: 13px;
  transition: background .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease);
}
.chip:hover { background: var(--surface-2); }
.chip.is-active { background: var(--accent); border-color: transparent; color: #fff; }
.chip-count { font-variant-numeric: tabular-nums; opacity: .7; font-size: 12px; }

.devices-table td { white-space: nowrap; }
.devices-table td:first-child { white-space: nowrap; }
.status-text .icon { width: 14px; height: 14px; }

.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 16px; }

.device-link {
  display: inline-flex; align-items: center; gap: 2px; margin-right: 6px;
  color: var(--accent); font-weight: 500; font-size: 13px; vertical-align: middle;
}
.device-link .icon { width: 14px; height: 14px; }

/* ---------------------------------------------------------- multi-select in the sidebar */

.nav-item.tenant { padding: 0; gap: 0; }
.tenant-link {
  display: flex; align-items: center; gap: 10px;
  flex: 1; min-width: 0;
  padding: 7px 4px 7px 10px;
}
.pick {
  flex: none; display: grid; place-items: center;
  width: 30px; height: 30px; margin-right: 2px;
  opacity: 0;
  transition: opacity .2s var(--ease);
}
.nav-item.tenant:hover .pick, .has-selection .pick, .pick:focus-visible { opacity: 1; }
.pick-box {
  display: grid; place-items: center;
  width: 16px; height: 16px; border-radius: 5px;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  transition: background .2s var(--ease), border-color .2s var(--ease), transform .25s var(--spring);
}
.pick:hover .pick-box { border-color: var(--accent); }
.pick:active .pick-box { transform: scale(.85); }
.nav-item .pick-box .icon { width: 12px; height: 12px; stroke-width: 3; color: #fff; opacity: 0; transition: opacity .15s; }
.pick.is-on .pick-box { background: var(--accent); border-color: var(--accent); }
.pick.is-on .pick-box .icon { opacity: 1; }
.sidebar-collapsed .pick { display: none; }

/* Combined / Side by side switch */
.view-switch {
  display: inline-flex; padding: 2px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 9px;
}
.view-switch a {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 7px;
  font-weight: 500; color: var(--text-2);
  transition: background .25s var(--ease), color .25s var(--ease), box-shadow .25s var(--ease);
}
.view-switch a.is-active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }

/* ---------------------------------------------------------- tiles that fold open */

.foldable { padding: 0; transition: transform .45s var(--ease), box-shadow .45s var(--ease), border-color .45s var(--ease); }
.foldable:hover:not(.is-open) {
  transform: translateY(-8px);
  box-shadow: 0 20px 44px rgba(0, 0, 0, .12), 0 3px 8px rgba(0, 0, 0, .05);
  border-color: var(--border-strong);
}
.foldable.is-open { box-shadow: 0 16px 40px rgba(0, 0, 0, .10); border-color: color-mix(in srgb, var(--tile-accent) 45%, transparent); }
.fold-toggle {
  display: block; width: 100%;
  padding: var(--pad); margin: 0; border: 0; border-radius: 18px;
  background: none; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.fold-toggle:focus-visible { outline: 3px solid var(--accent-soft); }
.foldable .card-head .chev { transition: transform .4s var(--spring); }
.foldable.is-open .card-head .chev { transform: rotate(180deg); }
.fold-panel { overflow: hidden; }
.fold-inner { padding: 0 var(--pad) var(--pad); }
.fold-rows { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.fold-rows li { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.fold-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.fold-name:hover { color: var(--accent); }
.fold-rows .meter { width: 56px; margin-right: 0; }
.fold-rows .pct { min-width: 2.8em; font-size: 13px; font-variant-numeric: tabular-nums; }
.fold-slices .fold-name { display: inline-flex; align-items: center; gap: 8px; }
.fold-slices .swatch { flex: none; }
.fold-slices .num { margin-left: auto; font-size: 13px; font-variant-numeric: tabular-nums; }
.fold-slices .btn-icon { width: 26px; height: 26px; }
.fold-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.fold-actions .btn { font-size: 13px; padding: 6px 11px; }

/* ---------------------------------------------------------- side-by-side comparison */

.center { text-align: center !important; }
.compare-table { margin-bottom: 16px; }
.compare-table thead th a:hover { color: var(--accent); }
.compare-table thead th { color: var(--text); font-size: 13px; }
.row-title { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--text); white-space: nowrap; }
.row-title .icon { color: var(--accent); }
.row-title:hover { color: var(--accent); }
.compare-table tbody th { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.compare-table tr:last-child th { border-bottom: 0; }
.cmp-value { font-weight: 600; font-variant-numeric: tabular-nums; margin-right: 4px; }
.compare-card { margin-bottom: 16px; }
.legend--inline { display: flex; flex-wrap: wrap; gap: 4px 14px; flex: 0 1 auto; font-size: 12px; color: var(--text-2); }
.legend--inline li span:nth-child(2) { flex: none; }
.minis { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.mini { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.mini figcaption { font-size: 12px; color: var(--text-2); text-align: center; }
.donut--sm { width: 96px; height: 96px; }
.donut--sm .donut-center strong { font-size: 16px; }

/* ---------------------------------------------------------- light that follows the mouse */

.card { position: relative; }
.glow:hover {
  background-image: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%),
    color-mix(in srgb, var(--glow, var(--tile-accent)) 4%, transparent), transparent 45%);
}
.glow::before {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1px;
  background: radial-gradient(220px circle at var(--mx, 50%) var(--my, 50%),
    color-mix(in srgb, var(--glow, var(--tile-accent)) 45%, transparent), transparent 70%);
  /* only show the gradient on the 1px border */
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  opacity: 0; transition: opacity .35s var(--ease);
  pointer-events: none;
}
.glow:hover::before { opacity: 1; }

/* ---------------------------------------------------------- light/dark crossfade */

::view-transition-old(root), ::view-transition-new(root) {
  animation-duration: .45s;
  animation-timing-function: cubic-bezier(.4, 0, .2, 1);
}

/* max selection reached */
.pick.is-disabled { cursor: not-allowed; }
.pick.is-disabled .pick-box { opacity: .4; }

/* ---------------------------------------------------------- device list: filter bar + sorting */

.filterbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 10px; margin-bottom: 16px;
}
.search {
  display: flex; align-items: center; gap: 6px;
  flex: 1 1 220px; min-width: 180px;
  padding: 0 10px; height: 34px;
  border: 1px solid var(--border-strong); border-radius: 9px; background: var(--surface);
  color: var(--text-3);
}
.search:focus-within { border-color: var(--accent); outline: 3px solid var(--accent-soft); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--text); font: inherit; }
.select select {
  height: 34px; padding: 0 30px 0 10px;
  border: 1px solid var(--border-strong); border-radius: 9px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center;
  color: var(--text); font: inherit; font-size: 13px;
  appearance: none; -webkit-appearance: none; cursor: pointer;
  transition: border-color .2s var(--ease), background-color .2s var(--ease);
}
.select select:hover { border-color: var(--accent); }
.select.is-set select { border-color: var(--accent); background-color: var(--accent-soft); color: var(--accent); font-weight: 600; }
.filter-note { font-size: 13px; color: var(--text-2); padding: 0 6px; }
.btn-quiet { border-color: transparent; background: none; color: var(--accent); }
.btn-quiet:hover { background: var(--accent-soft); }
.link { color: var(--accent); font-weight: 500; }

.table th .sort { display: inline-flex; align-items: center; gap: 4px; color: inherit; }
.table th .sort:hover { color: var(--text); }
.table th .sort.is-sorted { color: var(--accent); }
.table th .sort .icon { width: 12px; height: 12px; }
.table th .sort .faint { opacity: 0; transition: opacity .2s; }
.table th:hover .sort .faint { opacity: .6; }
.table th.num .sort { justify-content: flex-end; }

/* donut slices are clickable */
.chart svg path { cursor: pointer; }

/* ---------------------------------------------------------- platform switch + sections */

.fam-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.fam-dot--apple { background: var(--apple); }
.fam-dot--android { background: var(--android); }
.fam-dot--windows { background: var(--windows); }

.platform { --sec: var(--apple); --sec-text: var(--apple-text); margin: 30px 0 16px; }
.platform--android { --sec: var(--android); --sec-text: var(--android-text); }
.platform--windows { --sec: var(--windows); --sec-text: var(--windows-text); }

.platform-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.platform-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 14px 5px 11px; border-radius: 999px;
  font-size: 15px; font-weight: 700; letter-spacing: -.01em;
  color: var(--sec-text);
  background: color-mix(in srgb, var(--sec) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--sec) 30%, transparent);
}
.platform-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--sec); box-shadow: 0 0 0 3px color-mix(in srgb, var(--sec) 25%, transparent); }
.platform-rule { flex: 1; min-width: 40px; height: 1px; background: linear-gradient(90deg, color-mix(in srgb, var(--sec) 55%, transparent), transparent); }
.platform-title { margin: 0; font-size: inherit; }
a.platform-chip { transition: background .25s var(--ease), transform .25s var(--spring); }
a.platform-chip:hover { background: color-mix(in srgb, var(--sec) 24%, transparent); }
a.platform-chip:active { transform: scale(.96); }

/* the "v" that folds a whole platform section */
.section-toggle {
  display: grid; place-items: center;
  width: 30px; height: 30px; border: 0; border-radius: 8px;
  background: none; color: var(--sec-text); cursor: pointer;
  transition: background .2s var(--ease);
}
.section-toggle:hover { background: color-mix(in srgb, var(--sec) 16%, transparent); }
.section-toggle .icon { width: 18px; height: 18px; transition: transform .4s var(--spring); }
.platform.is-closed .section-toggle .icon { transform: rotate(-90deg); }
.platform-body { overflow: visible; }
.platform.is-closed .platform-body { display: none; }
/* folded state is applied before the page paints (see base.html), so nothing jumps */
.sec-closed-apple .platform--apple .platform-body,
.sec-closed-android .platform--android .platform-body,
.sec-closed-windows .platform--windows .platform-body { display: none; }
.sec-closed-apple .platform--apple .section-toggle .icon,
.sec-closed-android .platform--android .section-toggle .icon,
.sec-closed-windows .platform--windows .section-toggle .icon { transform: rotate(-90deg); }

/* the platform colour stays on the divider only; tiles look the same everywhere,
   so green in a tile always means "OK" */

/* keep top-right buttons on one line; wrap the whole group instead */
.btn, .view-switch a { white-space: nowrap; }
.actions { flex-wrap: wrap; justify-content: flex-end; align-items: center; }

/* ---------------------------------------------------------- Knox seats + health chips */

.seat-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.seat-rows li { display: grid; gap: 6px; }
.seat-top { display: flex; align-items: center; gap: 8px; }
.seat-top strong { flex: 1; font-weight: 500; }
.seat-top .num { font-size: 13px; color: var(--text-2); }
.meter--wide { width: 100%; margin: 0; height: 7px; }

.health { white-space: nowrap; }
.hchip {
  display: inline-flex; align-items: center; gap: 3px;
  margin-right: 4px; padding: 2px 7px; border-radius: 999px;
  font-size: 12px; font-variant-numeric: tabular-nums;
  background: var(--surface-2); color: var(--text-2);
}
.hchip .icon { width: 12px; height: 12px; }
.hchip--warning { color: var(--orange-text); background: color-mix(in srgb, var(--orange) 14%, transparent); }
.hchip--critical { color: var(--red-text); background: color-mix(in srgb, var(--red) 14%, transparent); }

/* ---------------------------------------------------------- smooth page-to-page transitions
   Safari 18.2+ / Chrome: when you click to another page (e.g. switch platform), tiles that exist
   on both pages slide to their new place, new ones fade in, and the switch "thumb" slides along. */

@view-transition { navigation: auto; }
::view-transition-group(*) { animation-duration: .5s; animation-timing-function: cubic-bezier(.2, .8, .2, 1); }
::view-transition-old(*), ::view-transition-new(*) { animation-duration: .35s; }
::view-transition-group(sidebar) { animation-duration: 0s; }       /* the sidebar stays put */

/* tiles that only exist on the NEW page (e.g. Apple coming back when you go to "All"):
   they rise into place instead of just appearing */
::view-transition-new(*):only-child {
  animation: vt-enter .55s cubic-bezier(.2, .8, .2, 1) .12s both;
}
/* tiles that only exist on the OLD page: they sink away */
::view-transition-old(*):only-child {
  animation: vt-exit .3s cubic-bezier(.4, 0, 1, 1) both;
}
@keyframes vt-enter {
  from { opacity: 0; transform: translateY(24px) scale(.96); }
  to { opacity: 1; transform: none; }
}
@keyframes vt-exit {
  from { opacity: 1; transform: none; }
  to { opacity: 0; transform: translateY(12px) scale(.97); }
}

/* the platform switch: one white pill that slides to the option you click */
.family-switch { position: relative; isolation: isolate; }
.family-switch a { position: relative; z-index: 1; }
.family-switch a.is-active { background: none; box-shadow: none; }
.switch-indicator {
  position: absolute; top: 2px; bottom: 2px; left: 0; width: 0; z-index: 0;
  border-radius: 7px; background: var(--surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
  view-transition-name: family-thumb;
}
.family-switch.is-ready .switch-indicator {
  transition: transform .32s var(--spring), width .32s var(--spring);
}

@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
}

/* ---------------------------------------------------------- frosted tiles
   Tiles are slightly see-through, so the page's colour glow shines through them:
   bluish near the top-left, purplish near the bottom-right (follows the colour theme). */
:root { --card-glass: 62%; }
:root[data-theme="dark"] { --card-glass: 58%; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --card-glass: 58%; } }
.card {
  background-color: color-mix(in srgb, var(--surface) var(--card-glass), transparent);
  /* No backdrop-filter (blur) here on purpose: behind the tiles is only the soft colour glow,
     so blurring it changes nothing you can see, but it made the page-to-page animation flash
     square, extra-frosted tiles (the browser can't take a proper "picture" of blurred glass). */
}

/* compact certificates tile: summary chips + two most urgent items */
.expiry-counts { display: flex; flex-wrap: nowrap; gap: 6px; margin: -2px 0 6px; overflow: hidden; }
.expiry-counts .hchip { margin: 0; font-weight: 600; white-space: nowrap; flex: none; }
.expiry--compact li { padding: 6px 0; }
.expiry--compact + .footnote { margin-top: 4px; }

/* list tiles (certificates, Knox) get exactly the height of a closed donut tile (set in ui.js) */
.tile-fixed { overflow: hidden; }

/* the page background fades smoothly when you try another colour theme */
@property --c1 { syntax: "<color>"; inherits: true; initial-value: #007aff; }
@property --c2 { syntax: "<color>"; inherits: true; initial-value: #af52de; }
html { transition: --c1 .6s var(--ease), --c2 .6s var(--ease); }

/* ---------------------------------------------------------- compact density */
.density-compact .main { padding: 20px 24px 40px; }
.density-compact .topbar { margin-bottom: 16px; }
.density-compact .grid, .density-compact .kpis { gap: 12px; margin-bottom: 12px; }
.density-compact .grid--donuts { grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }
.density-compact { --pad: 14px; --head-gap: 8px; --donut: 92px; }
.density-compact .card { border-radius: 15px; }
.density-compact .fold-toggle { border-radius: 15px; }
.density-compact .card-head h2 { font-size: 14px; }
/* compact list tiles: only the most urgent certificate, Knox without the renewal line */
.density-compact .expiry--compact li:nth-child(n+2) { display: none; }
.density-compact .seat-rows { gap: 10px; }
.density-compact .seat-rows small { display: none; }
.density-compact .donut-row { gap: 12px; }
.density-compact .donut-center strong { font-size: 17px; }
.density-compact .donut-center span { font-size: 9px; max-width: 58px; }
.density-compact .legend { gap: 5px; font-size: 12px; }
.density-compact .legend li { gap: 6px; }
.density-compact .swatch { width: 8px; height: 8px; }
.density-compact .expiry-counts .hchip { font-size: 11px; padding: 2px 7px; }
.density-compact .kpi-value { font-size: 28px; }
.density-compact .platform { margin-top: 18px; }
.density-compact .platform-head { margin-bottom: 10px; }

/* ---------------------------------------------------------- Customise page */
.notice {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; margin-bottom: 16px; border-radius: 12px;
  background: color-mix(in srgb, var(--green) 14%, transparent);
  color: var(--green-text); font-weight: 600;
  animation: notice-in .5s var(--spring);
}
@keyframes notice-in { from { opacity: 0; transform: translateY(-6px); } }

.customise {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  padding-bottom: 80px;            /* room for the save bar */
}
.set-card--tiles { grid-column: 1 / -1; }
.set-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.set-head > .icon { color: var(--tile-accent); margin-top: 2px; }
.set-head h2 { font-size: 16px; font-weight: 650; }
.set-head p { margin: 2px 0 0; font-size: 13px; }
.set-label { font-size: 12px; font-weight: 600; color: var(--text-2); margin: 16px 0 8px; }
.set-label:first-of-type { margin-top: 4px; }
.hint { font-size: 12px; margin: 6px 0 0; }

/* tile columns with draggable rows */
.tile-columns { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.tile-col-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 650; margin: 0 0 8px;
}
.tile-col-title--apple { --sec: var(--apple); color: var(--apple-text); }
.tile-col-title--android { --sec: var(--android); color: var(--android-text); }
.tile-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.tile-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 10px;
  background: color-mix(in srgb, var(--surface-2) 70%, transparent);
  border: 1px solid var(--border);
  user-select: none;
  transition: opacity .25s var(--ease), background .25s var(--ease);
}
.tile-item .grip { display: inline-flex; color: var(--text-3); cursor: grab; touch-action: none; }
.tile-item .grip .icon { width: 16px; height: 16px; }
.tile-item .tile-icon { color: var(--tile-accent); width: 16px; height: 16px; }
.tile-item .tile-name { flex: 1; min-width: 0; font-weight: 500; }
.tile-item.is-off { opacity: .55; }
.tile-item.is-off .tile-icon { color: var(--text-3); }
.tile-item.is-ghost { opacity: .35; background: var(--accent-soft); border-style: dashed; }
.tile-item.is-chosen { box-shadow: 0 10px 28px rgba(0, 0, 0, .16); background: var(--surface); }
.tile-item.is-drag { cursor: grabbing; }

/* iOS-style on/off switch */
.switch { position: relative; display: inline-flex; flex: none; cursor: pointer; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch-track {
  width: 36px; height: 22px; border-radius: 999px;
  background: var(--border-strong);
  transition: background .25s var(--ease);
  position: relative;
}
.switch-track::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  transition: transform .3s var(--spring);
}
.switch input:checked + .switch-track { background: var(--green); }
.switch input:checked + .switch-track::after { transform: translateX(14px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 14px; cursor: pointer;
}

/* colour themes */
/* the theme picker: 3 per row. Presets + "+" fill two rows; your own themes come below.
   Up to 3 rows are visible; with more, it scrolls and fades at the bottom. */
.theme-scroll {
  max-height: 262px; overflow-y: auto; overscroll-behavior: contain;   /* 3 rows */
  position: relative;
  margin: 0 -6px; padding: 2px 6px;
  scrollbar-width: thin;
}
.theme-scroll.has-more {
  -webkit-mask: linear-gradient(#000 calc(100% - 22px), transparent);
  mask: linear-gradient(#000 calc(100% - 22px), transparent);
}
.theme-grid { display: grid; gap: 6px 10px; grid-template-columns: repeat(3, 1fr); padding-bottom: 4px; }
.theme-option {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px 6px 8px; border-radius: 12px; cursor: pointer;
  border: 1px solid transparent;
  transition: background .2s var(--ease), border-color .2s var(--ease);
}
.theme-option:hover { background: var(--accent-soft); }
.theme-option input { position: absolute; opacity: 0; pointer-events: none; }
.theme-swatch {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, var(--s1), var(--s2));
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08);
  transition: transform .3s var(--spring), box-shadow .3s var(--ease);
}
.theme-name {
  font-size: 12px; color: var(--text-2);
  max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.theme-option input:checked ~ .theme-swatch {
  transform: scale(1.06);
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent);
}
.theme-option input:checked ~ .theme-name { color: var(--text); font-weight: 600; }
.theme-option input:focus-visible ~ .theme-swatch { outline: 2px solid var(--accent); outline-offset: 4px; }

/* pill-shaped radio buttons */
.pill-group { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { position: relative; cursor: pointer; }
.pill input { position: absolute; opacity: 0; pointer-events: none; }
.pill > span {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 13px; border-radius: 999px;
  border: 1px solid var(--border-strong);
  font-size: 13px; font-weight: 500; color: var(--text-2);
  transition: background .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease);
}
.pill > span .icon { width: 14px; height: 14px; }
.pill:hover > span { background: var(--surface-2); }
.pill input:checked + span { background: var(--accent); border-color: transparent; color: #fff; }
.pill input:checked + span .fam-dot { box-shadow: 0 0 0 1.5px #fff; }
.pill input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* pinned tenants */
.pin-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.check-row { display: flex; align-items: center; gap: 9px; padding: 5px 6px; border-radius: 8px; cursor: pointer; }
.check-row:hover { background: var(--surface-2); }
.check-row input { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }
.mono--sm { width: 22px; height: 22px; font-size: 9px; }

/* "+" new theme */
.theme-add {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px 6px 8px; border: 0; border-radius: 12px; background: none;
  font: inherit; cursor: pointer;
}
.theme-add:hover { background: var(--accent-soft); }
.theme-add:disabled { opacity: .4; cursor: default; background: none; }
.theme-swatch--add {
  display: grid; place-items: center;
  background: none; color: var(--text-2);
  box-shadow: inset 0 0 0 1.5px var(--border-strong);
  border: 0;
}
.theme-add:hover .theme-swatch--add { color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); transform: rotate(90deg); }
.theme-add:focus-visible .theme-swatch--add { outline: 2px solid var(--accent); outline-offset: 4px; }

/* editor for your own themes: slides open only when one of them is selected */
.theme-editor {
  position: relative; height: 52px; margin-top: 8px;
  transition: height .4s var(--spring), opacity .3s var(--ease), margin .4s var(--ease);
}
.theme-editor[data-mode="preset"] { height: 0; margin-top: 0; opacity: 0; visibility: hidden; transition: height .35s var(--ease), opacity .2s var(--ease), margin .35s var(--ease), visibility 0s linear .35s; }
.theme-editor-fields { position: absolute; inset: 0; display: flex; align-items: center; gap: 10px; }
.theme-name-field { flex: 1; min-width: 90px; }
.theme-name-field input {
  width: 100%; padding: 7px 10px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: inherit;
}
.theme-name-field input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.colour-dot {
  flex: none; width: 30px; height: 30px; padding: 0; border-radius: 50%; cursor: pointer;
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border-strong);
  transition: transform .3s var(--spring), box-shadow .2s var(--ease);
}
.colour-dot:hover { transform: scale(1.08); }
.colour-dot.is-editing { box-shadow: 0 0 0 2px var(--accent); transform: scale(1.08); }

/* the colour wheel pop-up */
.wheel-pop {
  position: absolute; top: calc(100% + 8px); right: 40px; z-index: 30;
  width: 220px; padding: 14px; border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: blur(24px) saturate(170%);
  backdrop-filter: blur(24px) saturate(170%);
  border: 1px solid var(--border-strong);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .22);
  display: grid; gap: 12px;
  transform-origin: top right;
  animation: wheel-in .32s var(--spring);
}
.wheel-pop[hidden] { display: none; }
.wheel-pop.is-up { top: auto; bottom: calc(100% + 8px); transform-origin: bottom right; }
@keyframes wheel-in { from { opacity: 0; transform: scale(.9) translateY(-4px); } }
.wheel-title { font-size: 12px; font-weight: 600; color: var(--text-2); }
.wheel {
  position: relative; width: 190px; height: 190px; border-radius: 50%; margin: 0 auto;
  cursor: crosshair; touch-action: none;
  /* colour all around, white in the middle */
  background:
    radial-gradient(circle closest-side, #fff, rgba(255, 255, 255, 0) 100%),
    conic-gradient(#f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08);
}
.wheel-dim { position: absolute; inset: 0; border-radius: 50%; background: #000; opacity: 0; pointer-events: none; }
.wheel-handle {
  position: absolute; left: -9px; top: -9px; width: 18px; height: 18px; border-radius: 50%;
  border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .35);
  pointer-events: none;
}
.wheel-row { display: flex; align-items: center; gap: 10px; }
.wheel-bright {
  width: 100%; height: 14px; margin: 0; border-radius: 999px; cursor: pointer;
  -webkit-appearance: none; appearance: none;
  background: linear-gradient(90deg, #000, var(--full, #fff));
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1);
}
.wheel-bright::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; border: 0; box-shadow: 0 1px 4px rgba(0, 0, 0, .35);
}
.wheel-bright::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 1px 4px rgba(0, 0, 0, .35); }
.wheel-preview { width: 28px; height: 28px; border-radius: 8px; flex: none; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1); }
.wheel-hex { flex: 1; }
.wheel-hex input {
  width: 100%; padding: 6px 9px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: 13px ui-monospace, SFMono-Regular, Menlo, monospace; text-transform: uppercase;
}
.btn-icon--danger { border: 0; background: none; cursor: pointer; }
.btn-icon--danger:hover { background: color-mix(in srgb, var(--red) 14%, transparent); color: var(--red-text); }

/* swatches popping in and out */
@keyframes swatch-in { from { opacity: 0; transform: scale(.4); } }
.theme-option.is-new { animation: swatch-in .5s var(--spring); }

/* ---------------------------------------------------------- donut centre: one live example */
.centre-preview { display: flex; align-items: center; gap: 22px; padding: 6px 4px 14px; }
.ex-donut { position: relative; width: 150px; height: 150px; flex: none; }
.ex-donut svg { width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.ex-seg {
  fill: none; stroke-width: 12; stroke-linecap: butt;
  transition: stroke-dasharray .9s var(--ease), stroke-width .5s var(--spring), opacity .5s var(--ease);
}
.ex-seg--good { stroke: var(--green); }
.ex-seg--bad { stroke: var(--red); }
/* the part the number is about stands out; the other part steps back */
.centre-preview.is-count .ex-seg--good,
.centre-preview:not(.is-count) .ex-seg--bad { opacity: .35; stroke-width: 10; }
.centre-preview.is-count .ex-seg--bad,
.centre-preview:not(.is-count) .ex-seg--good { stroke-width: 15; }
.ex-centre {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; line-height: 1.1;
}
.ex-centre strong {
  font-family: ui-rounded, system-ui, sans-serif;
  font-size: 30px; font-weight: 700; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
/* the two captions sit on top of each other and swap with a little slide */
.ex-caption { position: relative; display: block; height: 15px; width: 100px; margin-top: 2px; }
.ex-caption span, .centre-hint span {
  position: absolute; left: 0; right: 0;
  transition: opacity .35s var(--ease), transform .45s var(--spring);
}
.ex-caption span { font-size: 11px; color: var(--text-2); }
.centre-preview:not(.is-count) [data-cap="count"],
.centre-preview.is-count [data-cap="percent"] { opacity: 0; transform: translateY(6px); }
.ex-legend { max-width: 220px; }

/* % / # switch with a sliding thumb */
.seg-control {
  position: relative; display: grid; grid-template-columns: 1fr 1fr;
  padding: 3px; border-radius: 10px; background: var(--surface-2);
}
.seg-control-thumb {
  position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc(50% - 3px);
  border-radius: 8px; background: var(--surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .14), 0 0 0 .5px rgba(0, 0, 0, .04);
  transition: transform .45s var(--spring);
}
.seg-control:has(label:nth-of-type(2) input:checked) .seg-control-thumb { transform: translateX(100%); }
.seg-control label { position: relative; z-index: 1; cursor: pointer; }
.seg-control input { position: absolute; opacity: 0; pointer-events: none; }
.seg-control label > span {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 10px; font-size: 13px; font-weight: 500; color: var(--text-2);
  transition: color .25s var(--ease);
}
.seg-control label > span .icon { width: 14px; height: 14px; }
.seg-control input:checked + span { color: var(--text); font-weight: 600; }
.seg-control input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 8px; }
.centre-hint { position: relative; height: 34px; }
.centre-hint span { top: 0; }
.centre-preview:not(.is-count) ~ .centre-hint [data-hint="count"],
.centre-preview.is-count ~ .centre-hint [data-hint="percent"] { opacity: 0; transform: translateY(4px); }

@media (prefers-reduced-motion: reduce) {
  .ex-seg, .ex-caption span, .centre-hint span, .seg-control-thumb, .theme-editor { transition: none; }
  .wheel-pop { animation: none; }
  .theme-option.is-new { animation: none; }
}

/* save bar floating at the bottom */
.save-bar {
  position: fixed; bottom: 18px; right: 32px; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 8px 8px 16px; border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  -webkit-backdrop-filter: blur(20px) saturate(170%);
  backdrop-filter: blur(20px) saturate(170%);
  border: 1px solid var(--border-strong);
  box-shadow: 0 12px 36px rgba(0, 0, 0, .16);
}
.save-bar.is-dirty .save-state { color: var(--orange-text); font-weight: 600; }
.save-bar .btn-primary { transition: transform .3s var(--spring); }
.save-bar.is-dirty .btn-primary { animation: save-nudge .5s var(--spring); }
@keyframes save-nudge { 50% { transform: scale(1.06); } }
@media (max-width: 700px) {
  .save-bar { left: 16px; right: 16px; justify-content: flex-end; }
  .save-bar .save-state { margin-right: auto; }
}

/* density switch on the Customise page: cards morph smoothly to their new size */
.vt-density::view-transition-group(*) {
  animation-duration: .55s;
  animation-timing-function: cubic-bezier(.2, .8, .2, 1);
}
.vt-density::view-transition-old(*),
.vt-density::view-transition-new(*) {
  animation-duration: .35s;
  height: 100%;              /* stretch the pictures with the card, instead of jumping */
}
.vt-density::view-transition-old(root),
.vt-density::view-transition-new(root) { animation: none; }

/* ---------------------------------------------------------- Customise: hide or pin tenants */
.tenant-prefs { list-style: none; margin: 0; padding: 0; }
.tenant-prefs-head, .tenant-prefs li {
  display: grid; grid-template-columns: 1fr 34px; align-items: center; gap: 6px;
}
.tenant-prefs-head { padding: 0 6px 4px; font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .02em; }
.tenant-prefs-head span:not(:first-child) { text-align: center; }
.tenant-prefs li { padding: 3px 6px; border-radius: 8px; transition: opacity .25s var(--ease), background .2s var(--ease); }
.tenant-prefs li:hover { background: var(--surface-2); }
.tenant-prefs .who-row { display: flex; align-items: center; gap: 9px; min-width: 0; }
.tenant-prefs .who-row span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tenant-prefs li.is-hidden .who-row { opacity: .45; }

/* round icon buttons that work like checkboxes */
.icon-toggle { position: relative; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; cursor: pointer; color: var(--text-3); transition: background .2s var(--ease), color .2s var(--ease); }
.icon-toggle input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.icon-toggle:hover { background: var(--accent-soft); color: var(--text-2); }
.icon-toggle .icon { width: 16px; height: 16px; transition: transform .3s var(--spring); }
.icon-toggle input:focus-visible ~ .icon { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }
.icon-toggle .when-on { display: none; }
.icon-toggle input:checked ~ .when-on { display: block; }
.icon-toggle input:checked ~ .when-off { display: none; }
.icon-toggle--eye input:checked ~ .icon { color: var(--orange-text); }
.icon-toggle input:disabled { cursor: default; }
.icon-toggle:has(input:disabled) { opacity: .3; background: none; }

/* ---------------------------------------------------------- pin / hide from anywhere */
.inline-form { display: inline-block; margin: 0; }
.row-actions .inline-form .btn-icon { border: 0; background: none; cursor: pointer; vertical-align: middle; }
.row-actions .inline-form .btn-icon:hover { background: color-mix(in srgb, var(--orange) 14%, transparent); color: var(--orange-text); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-quiet .icon { width: 14px; height: 14px; }

/* "Hidden tenants" card under detail pages and the tenant table */
.hidden-card { margin-top: 16px; }
.hidden-card .card-head .icon { color: var(--text-3); }
.hidden-card-note { font-size: 12px; margin-left: auto; }
.hidden-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.hidden-chips li {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 4px 4px 6px; border-radius: 10px;
  border: 1px dashed var(--border-strong);
}
.hidden-chip-name { color: var(--text-2); font-weight: 500; }



/* ---------------------------------------------------------- device list: "+ Filter" and filter pills */
.filterbar { position: relative; z-index: 5; }          /* its pop-up menu must float above the table */
.btn-ghost { border-style: dashed; background: none; color: var(--text-2); }
.btn-ghost:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.filter-add-btn { height: 34px; font-size: 13px; }
.filter-add-btn .icon { width: 14px; height: 14px; }

.filter-pill {
  display: inline-flex; align-items: center; height: 34px;
  border-radius: 9px; overflow: hidden;
  background: var(--accent-soft); color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  animation: pill-in .35s var(--spring);
}
@keyframes pill-in { from { opacity: 0; transform: scale(.85); } }
.filter-pill button { height: 100%; border: 0; background: none; color: inherit; font: inherit; font-size: 13px; cursor: pointer; }
.filter-pill-edit { display: inline-flex; align-items: center; gap: 4px; padding: 0 6px 0 11px; }
.filter-pill-edit .icon { width: 12px; height: 12px; opacity: .7; }
.filter-pill-remove { display: grid; place-items: center; width: 28px; border-left: 1px solid color-mix(in srgb, var(--accent) 25%, transparent) !important; }
.filter-pill-remove .icon { width: 13px; height: 13px; }
.filter-pill button:hover { background: color-mix(in srgb, var(--accent) 14%, transparent); }

.filter-add { position: relative; }
.filter-pop {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 50;
  width: 230px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .2);
  transform-origin: top left;
  animation: tenant-menu-in .28s var(--spring);
}
.filter-pop[hidden] { display: none; }
@keyframes tenant-menu-in { from { opacity: 0; transform: translateY(-6px) scale(.95); } }
.filter-pop.is-right { left: auto; right: 0; transform-origin: top right; }
.filter-pop .menu-item { font-size: 13px; }
.filter-pop .menu-item .trail { margin-left: auto; width: 14px; height: 14px; color: var(--text-3); }
.filter-pop .menu-item.is-current { font-weight: 600; color: var(--accent); }
.filter-pop .menu-item.is-current .trail { color: var(--accent); }
.filter-step-title { font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .02em; padding: 6px 8px 4px; }

/* a subject in the filter menu; its values fold out to the side on hover */
.filter-sub { position: relative; }
.filter-sub > .menu-item { position: relative; }
.filter-sub.is-open > .menu-item { background: var(--accent-soft); }
.filter-sub.is-active > .menu-item { font-weight: 600; }
.filter-sub-value { margin-left: auto; font-size: 12px; font-weight: 500; color: var(--accent); }
.filter-sub-value + .trail { margin-left: 4px !important; }
.filter-values {
  position: absolute; top: -6px; left: calc(100% + 4px); z-index: 2;
  min-width: 190px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .2);
  opacity: 0; visibility: hidden; transform: translateX(-6px);
  transition: opacity .16s var(--ease), transform .22s var(--ease), visibility 0s linear .16s;
}
.subs-left .filter-values { left: auto; right: calc(100% + 4px); transform: translateX(6px); }
.subs-left .filter-sub > .menu-item .trail { transform: rotate(180deg); }   /* arrow points where the values open */
.filter-sub.is-open > .filter-values { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.filter-clear { color: var(--text-2); }
.filter-clear .icon { width: 13px; height: 13px; }

/* tenant picker (device list): a dropdown with a checkbox per tenant */
.tenant-picker { position: relative; }
.picker-btn {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 10px;
  border: 1px solid var(--border-strong); border-radius: 9px; background: var(--surface);
  color: var(--text); font: inherit; font-size: 13px; cursor: pointer; max-width: 240px;
}
.picker-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-btn .icon { width: 14px; height: 14px; color: var(--text-3); flex: none; }
.picker-btn:hover { border-color: var(--accent); }
.picker-btn.is-set { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.picker-btn.is-set .icon { color: var(--accent); }
.picker-pop {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 50;
  width: 260px; max-height: 400px; overflow-y: auto; padding: 6px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .2);
  transform-origin: top left; animation: tenant-menu-in .28s var(--spring);
}
.picker-pop[hidden] { display: none; }
.picker-pop.is-right { left: auto; right: 0; transform-origin: top right; }
.picker-row { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: 7px; cursor: pointer; font-size: 13px; }
.picker-row:hover { background: var(--accent-soft); }
.picker-row input { position: absolute; opacity: 0; pointer-events: none; }
.picker-box {
  flex: none; display: grid; place-items: center; width: 16px; height: 16px; border-radius: 5px;
  border: 1.5px solid var(--border-strong); background: var(--surface);
  transition: background .15s var(--ease), border-color .15s var(--ease), transform .25s var(--spring);
}
.picker-box .icon { width: 11px; height: 11px; stroke-width: 3; color: #fff; opacity: 0; }
.picker-row input:checked + .picker-box { background: var(--accent); border-color: var(--accent); }
.picker-row input:checked + .picker-box .icon { opacity: 1; }
.picker-row input:focus-visible + .picker-box { outline: 2px solid var(--accent); outline-offset: 2px; }
.picker-row:active .picker-box { transform: scale(.85); }
.picker-row:has(input:disabled) { opacity: .4; cursor: default; }
.picker-all { font-weight: 600; }
.picker-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-row .mono .dot { box-shadow: 0 0 0 2px var(--surface); width: 8px; height: 8px; }
.picker-sep { height: 1px; background: var(--border); margin: 4px 6px; }
.picker-foot {
  position: sticky; bottom: -6px; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin: 6px -6px -6px; padding: 8px 10px; border-top: 1px solid var(--border);
  background: var(--surface); border-radius: 0 0 12px 12px; font-size: 12px;
}
@media (prefers-reduced-motion: reduce) { .filter-pill, .filter-pop, .picker-pop { animation: none; } }

/* hide button on a tenant in the sidebar: takes no room until you hover */
.tenant-hide { flex: none; width: 0; overflow: hidden; transition: width .2s var(--ease); }
.nav-item.tenant:hover .tenant-hide, .tenant-hide:focus-within { width: 28px; }
.tenant-hide-btn {
  display: grid; place-items: center; width: 28px; height: 30px; padding: 0;
  border: 0; border-radius: 7px; background: none; color: var(--text-3); cursor: pointer;
}
.nav-item .tenant-hide-btn .icon { color: inherit; width: 15px; height: 15px; }
.tenant-hide-btn:hover { background: color-mix(in srgb, var(--orange) 14%, transparent); color: var(--orange-text); }
.sidebar-collapsed .tenant-hide { display: none; }

/* "... is hidden · Undo" message, bottom centre */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 60;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 8px 8px 14px; border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  -webkit-backdrop-filter: blur(20px) saturate(170%); backdrop-filter: blur(20px) saturate(170%);
  border: 1px solid var(--border-strong); box-shadow: 0 14px 40px rgba(0, 0, 0, .2);
  font-size: 13px;
  transform: translateX(-50%);
  animation: toast-in .45s var(--spring);
}
.toast > .icon { color: var(--text-3); }
.toast.is-leaving { animation: toast-out .25s var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 16px) scale(.96); } }
@keyframes toast-out { to { opacity: 0; transform: translate(-50%, 10px); } }
.toast-undo { display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border: 0; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; }
.toast-undo .icon { width: 13px; height: 13px; }
.toast-undo:hover { filter: brightness(1.1); }
.toast-close { display: grid; place-items: center; width: 26px; height: 26px; border: 0; border-radius: 7px; background: none; color: var(--text-3); cursor: pointer; }
.toast-close:hover { background: var(--surface-2); color: var(--text); }
.toast-close .icon { width: 13px; height: 13px; }
@media (prefers-reduced-motion: reduce) { .toast, .toast.is-leaving { animation: none; } }

/* ---------------------------------------------------------- tables: clickable rows, order note, hidden group */
.row-link { cursor: pointer; }
.row-title-link { color: inherit; }
.row-link:hover .row-title-link { color: var(--accent); }
.table-order { font-size: 12px; margin: -8px 0 10px; }
.hidden-rows .group-head td {
  padding: 14px 16px 8px; font-size: 12px; font-weight: 600; color: var(--text-2);
  border-top: 1px solid var(--border-strong); background: none;
}
.hidden-rows .group-head .icon { width: 14px; height: 14px; vertical-align: -2px; margin-right: 6px; color: var(--text-3); }
.hidden-rows .group-head:hover { background: none; }
.is-hidden-row td:not(.row-actions) { opacity: .5; }

/* live search: the list fades a little while new results load */
[data-live-results] { transition: opacity .15s var(--ease); }
[data-live-results].is-loading { opacity: .55; }
/* the tenant table has many columns: a bit tighter so everything (incl. the buttons) fits */
.tenant-table th, .tenant-table td { padding-left: 10px; padding-right: 10px; }
.tenant-table th:first-child, .tenant-table td:first-child { padding-left: 16px; }
.tenant-table .row-actions { padding-right: 12px; width: 1%; }
.tenant-table .badge { white-space: nowrap; }
.row-actions > .btn-icon, .row-actions > .inline-form { vertical-align: middle; }

/* "Last sync: 09:00" in small letters under the Refresh button */
/* the time hangs below the button without pushing it up, so all buttons stay on one line */
.refresh-form { position: relative; }
.last-sync {
  position: absolute; top: calc(100% + 4px); right: 2px;
  font-size: 11px; color: var(--text-3); white-space: nowrap; cursor: default;
}
.actions { align-items: center; }

/* ---------------------------------------------------------- device detail panel (slides in from the right) */
.panel-backdrop { position: fixed; inset: 0; z-index: 70; background: rgba(0, 0, 0, .12); }
.panel-backdrop[hidden], .device-panel[hidden] { display: none; }
.device-panel {
  position: fixed; top: 12px; right: 12px; bottom: 12px; z-index: 71;
  width: min(420px, calc(100vw - 24px)); overflow-y: auto;
  padding: 20px; border-radius: 20px;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  -webkit-backdrop-filter: blur(30px) saturate(170%); backdrop-filter: blur(30px) saturate(170%);
  border: 1px solid var(--border-strong);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .25);
}
.dp-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.dp-type { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); }
.dp-type .icon { width: 22px; height: 22px; }
.dp-title { flex: 1; min-width: 0; }
.dp-title h2 { font-size: 19px; font-weight: 700; letter-spacing: -.01em; overflow-wrap: anywhere; }
.dp-title p { margin: 2px 0 0; font-size: 13px; }
.dp-close { border: 0; background: none; cursor: pointer; }
.dp-summary {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px; margin-bottom: 14px;
  border-radius: 12px; font-size: 13px; font-weight: 600;
  background: color-mix(in srgb, currentColor 10%, transparent);
}
.dp-facts { margin: 0 0 6px; display: grid; gap: 6px; font-size: 13px; }
.dp-facts div { display: grid; grid-template-columns: 110px 1fr; gap: 8px; }
.dp-facts dt { color: var(--text-2); }
.dp-facts dd { margin: 0; }
.dp-section { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .02em; color: var(--text-2); margin: 18px 0 6px; }
.dp-rows { list-style: none; margin: 0; padding: 0; }
.dp-rows li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.dp-rows li:last-child { border-bottom: 0; }
.dp-rows li > span:first-child { flex: 1; color: var(--text-2); }
.dp-value { font-weight: 500; text-align: right; }
.dp-meter { width: 80px; margin: 0; }
.dp-foot {
  display: flex; gap: 8px; flex-wrap: wrap;
  position: sticky; bottom: -20px; margin: 20px -20px -20px; padding: 12px 20px 20px;
  background: color-mix(in srgb, var(--surface) 96%, transparent); border-top: 1px solid var(--border);
}
tr[data-device] { cursor: pointer; }
tr[data-device]:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ---------------------------------------------------------- quick search (Cmd+K) */
.search-trigger { width: 100%; border: 0; background: none; font: inherit; text-align: left; cursor: pointer; color: var(--text-2); }
.search-trigger kbd, .search-box kbd {
  margin-left: auto; padding: 1px 6px; border-radius: 5px; font: 11px/1.5 system-ui, sans-serif;
  color: var(--text-3); background: var(--surface-2); border: 1px solid var(--border);
}
.search-backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(0, 0, 0, .2); }
.search-backdrop[hidden], .search-box[hidden] { display: none; }
.search-box {
  position: fixed; top: 12vh; left: 50%; z-index: 81; transform: translateX(-50%);
  width: min(620px, calc(100vw - 32px));
  border-radius: 18px; overflow: hidden;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: blur(30px) saturate(170%); backdrop-filter: blur(30px) saturate(170%);
  border: 1px solid var(--border-strong); box-shadow: 0 30px 80px rgba(0, 0, 0, .3);
}
.search-field { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); color: var(--text-3); }
.search-field .icon { width: 18px; height: 18px; }
.search-field input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--text); font: inherit; font-size: 16px; }
.search-results { list-style: none; margin: 0; padding: 6px; max-height: min(420px, 60vh); overflow-y: auto; }
.search-group { padding: 8px 10px 4px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .02em; color: var(--text-3); }
.search-item { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 10px; cursor: pointer; }
.search-item > .icon { width: 18px; height: 18px; color: var(--text-2); flex: none; }
.search-item.is-active { background: var(--accent); color: #fff; }
.search-item.is-active .icon, .search-item.is-active small { color: rgba(255, 255, 255, .85); }
.search-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.search-text span, .search-text small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-text small { color: var(--text-2); font-size: 12px; }
.search-enter { width: 14px !important; height: 14px !important; opacity: 0; }
.search-item.is-active .search-enter { opacity: 1; }
.search-empty { padding: 18px; text-align: center; color: var(--text-2); }
.search-foot { display: flex; gap: 16px; justify-content: flex-end; padding: 8px 14px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-3); }
.search-foot kbd { margin: 0 2px 0 0; }

/* ---------------------------------------------------------- "New" alerts */
.new-badge {
  display: inline-block; padding: 1px 7px; border-radius: 999px; vertical-align: 1px;
  font-size: 11px; font-weight: 700; color: #fff; background: var(--accent);
}
.alerts-note { display: flex; align-items: center; gap: 8px; margin: -6px 0 12px; font-size: 13px; color: var(--text-2); }
.alert-list li.is-new { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.new-dot { display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; background: var(--accent); vertical-align: 1px; }

/* ---------------------------------------------------------- keyboard & readability */
/* a clear ring around whatever has keyboard focus (mouse clicks don't show it) */
a:focus-visible, button:focus-visible, summary:focus-visible, [tabindex]:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px;
}
.main:focus { outline: none; }
.skip-link { position: fixed; top: 8px; left: 8px; z-index: 100; padding: 8px 12px; border-radius: 8px; background: var(--accent); color: #fff; font-weight: 600; transform: translateY(-150%); transition: transform .2s var(--ease); }
.skip-link:focus { transform: none; }
/* small grey text a bit darker, so it stays readable on the see-through tiles */
:root { --text-3: #737378; }
:root[data-theme="dark"] { --text-3: #8e8e93; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --text-3: #8e8e93; } }
/* hover-only buttons also appear when you tab to them */
.nav-item.tenant:focus-within .pick, .nav-item.tenant:focus-within .tenant-hide { opacity: 1; width: 28px; }

/* ---------------------------------------------------------- phone & small tablet */
.mobile-bar, .mobile-shade { display: none; }
@media (max-width: 900px) {
  .mobile-bar {
    position: sticky; top: 0; z-index: 30;
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 8px 12px; border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface) 80%, transparent);
    -webkit-backdrop-filter: blur(20px) saturate(170%); backdrop-filter: blur(20px) saturate(170%);
  }
  .mobile-bar .btn-icon { border: 0; background: none; cursor: pointer; width: 38px; height: 38px; }
  .mobile-brand { display: flex; align-items: center; gap: 8px; font-weight: 600; }
  .app, .sidebar-collapsed .app { grid-template-columns: 1fr; }
  /* the sidebar slides in from the left */
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; height: auto; width: min(290px, 86vw); z-index: 90;
    background: var(--sidebar-solid);
    transform: translateX(-105%); transition: transform .35s var(--ease);
  }
  .nav-open .sidebar { transform: none; box-shadow: 0 0 60px rgba(0, 0, 0, .3); }
  .sidebar-toggle { display: none; }
  .sidebar-collapsed .sidebar .label { opacity: 1; pointer-events: auto; }
  .mobile-shade { position: fixed; inset: 0; z-index: 89; background: rgba(0, 0, 0, .3); opacity: 0; pointer-events: none; transition: opacity .3s var(--ease); display: block; }
  .nav-open .mobile-shade { opacity: 1; pointer-events: auto; }
  .main { padding: 18px 14px 40px; }
  .grid--wide { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; gap: 12px; }
  .topbar h1 { font-size: 22px; }
  .actions { width: 100%; justify-content: space-between; }
  .last-sync { position: static; display: block; text-align: right; margin-top: 3px; }
  .refresh-form { display: flex; flex-direction: column; align-items: flex-end; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .kpi-value { font-size: 26px; }
  /* tiles show the tenant hide/select buttons always (no hover on a phone) */
  .nav-item.tenant .tenant-hide { width: 28px; }
  .nav-item.tenant .pick { opacity: 1; }
}
@media (max-width: 640px) {
  .sm-hide { display: none; }                 /* less important table columns: tap a row for details */
  .grid--donuts, .density-compact .grid--donuts { grid-template-columns: 1fr; }
  .customise { grid-template-columns: 1fr; }
  .tile-columns { grid-template-columns: 1fr; }
  .filterbar .search { flex-basis: 100%; }
  .save-bar { left: 12px; right: 12px; bottom: 12px; }
  .search-box { top: 8px; }
  .device-panel { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; max-height: 85vh; }
  .chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
  .chip { flex: none; }
}

/* ---------------------------------------------------------- device table: columns that fill the width
   Percentages, so the table always fills its card (no empty strip on the right). */
@media (min-width: 1100px) {
  .devices-table { table-layout: fixed; min-width: 1000px; }
  .devices-table .col-name { width: 20%; }
  .devices-table .col-tenant { width: 14%; }
  .devices-table .col-os { width: 10%; }
  .devices-table .col-checkin { width: 13%; }
  .devices-table .col-type { width: 8%; }
  .devices-table .col-enc { width: 7%; }
  .devices-table .col-managed { width: 7%; }
  .devices-table .col-failed { width: 6%; }
  .devices-table th:nth-last-child(2) { width: 11%; }      /* Health */
  .devices-table th:nth-last-child(1) { width: 4%; }       /* open in Jamf */
  .devices-table th, .devices-table td { padding-left: 12px; padding-right: 12px; }
  .devices-table th:first-child, .devices-table td:first-child { padding-left: 16px; }
  .devices-table th { white-space: normal; line-height: 1.2; }
  .devices-table td { overflow: hidden; text-overflow: ellipsis; }
  .devices-table td.col-name strong, .devices-table td.col-name small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .devices-table td.health, .devices-table td.row-actions { overflow: visible; white-space: normal; }
  /* with the panel open, the page is narrower: wide tables scroll sideways inside their card */
  .panel-push .table-card { overflow-x: auto; }
  .panel-push .device-panel { width: 420px; box-shadow: 0 16px 50px rgba(0, 0, 0, .16); }
}
.table tbody tr.is-current, .table tbody tr.is-current:hover { background: var(--accent-soft); }
.table tbody tr.is-current td:first-child { box-shadow: inset 3px 0 0 var(--accent); }

/* ---------------------------------------------------------- Connections (admins) */
.conn-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -6px 0 14px; flex-wrap: wrap; }
.conn-head p { margin: 0; }
.secret-dots { letter-spacing: 2px; color: var(--text-2); }
.conn-log-title { font-size: 13px; color: var(--text-2); margin: 22px 0 8px; }
.conn-log { list-style: none; margin: 0; padding: 0; font-size: 13px; display: grid; gap: 4px; }
.conn-layout { display: grid; grid-template-columns: minmax(0, 520px) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .conn-layout { grid-template-columns: 1fr; } }
.conn-form { display: grid; gap: 14px; }
.conn-form .field input { width: 100%; padding: 9px 11px; border-radius: 9px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; }
.conn-form .field input:focus { outline: 3px solid var(--accent-soft); border-color: var(--accent); }
.conn-form .field small { font-size: 12px; }
.conn-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }
.form-errors { padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--red) 12%, transparent); color: var(--red-text); font-size: 13px; }
.form-errors p { display: flex; align-items: center; gap: 6px; margin: 2px 0; }
.conn-side { display: grid; gap: 16px; }
.conn-results h2, .conn-help h2 { font-size: 15px; margin-bottom: 10px; }
.conn-results ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.conn-results li { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; }
.conn-results li > .icon { margin-top: 2px; }
.conn-results li span { display: flex; flex-direction: column; }
.conn-results li small { color: var(--text-2); }
.conn-results .is-ok > .icon { color: var(--green-text); }
.conn-results .is-warn > .icon { color: var(--orange-text); }
.conn-results .is-bad > .icon { color: var(--red-text); }
.conn-note { font-size: 12px; margin: 12px 0 0; }
.conn-help ol { margin: 0; padding-left: 18px; font-size: 13px; display: grid; gap: 6px; color: var(--text-2); }
.conn-help strong { color: var(--text); }
.conn-remove { color: var(--red-text); justify-self: start; }

.examples-form { margin: 0; }
.examples-form .switch-row { margin: 0; gap: 14px; justify-content: flex-start; }
.conn-buttons { display: flex; gap: 8px; }
.conn-buttons form { margin: 0; }
/* made-up example tenants (only marked when real ones exist too): dashed monogram, slightly faded name */
.mono--example { background: none; box-shadow: inset 0 0 0 1px var(--border-strong); border: 0; outline: 1px dashed var(--text-3); outline-offset: -1px; }
.tenant-link:has(.mono--example) .label { color: var(--text-2); }

/* ---------------------------------------------------------- certificates & tokens tile (foldable) */
/* closed: exactly the height of a closed donut tile */
.foldable--list > .fold-toggle { height: calc(var(--tile-h) - 2px); overflow: hidden; display: flex; flex-direction: column; }
/* rows: icon, name + tenant, days; everything on one centre line and the same height */
.expiry-row { display: grid !important; grid-template-columns: 18px 1fr auto; align-items: center; column-gap: 10px; min-height: 44px; }
.expiry-row > .status-text { display: flex; align-items: center; justify-content: center; }
.expiry-row > .status-text .icon { width: 16px; height: 16px; }
.expiry-row .expiry-what { min-width: 0; }
.expiry-row .expiry-what strong, .expiry-row .expiry-what small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.expiry-row .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.foldable--list .fold-rows.expiry li { border-top: 0; }
.foldable--list .fold-rows { border-top: 1px solid var(--border); }
.compact-only { display: none !important; }
.density-compact .compact-only { display: grid !important; }
/* the two closed rows fill the tile, so the folded-open rows follow straight after them (no gap) */
.foldable--list > .fold-toggle { padding-bottom: 4px; }
.foldable--list > .fold-toggle > .expiry--compact { flex: 1; display: flex; flex-direction: column; }
.foldable--list > .fold-toggle > .expiry--compact > li { flex: 1; max-height: 64px; }
.foldable--list .fold-inner { padding-top: 0; }
.expiry li.expiry-row, .fold-rows li.expiry-row { column-gap: 10px; gap: 0 10px; padding: 8px 0; }
.foldable--list > .fold-toggle > .card-head, .foldable--list > .fold-toggle > .expiry-counts { flex: none; }
.foldable--list > .fold-toggle > .expiry--compact { min-height: 0; }
.density-compact .expiry--compact li.expiry-row:nth-child(n+2) { display: none !important; }
.density-compact .foldable--list > .fold-toggle > .expiry--compact { justify-content: flex-end; }
.density-compact .foldable--list > .fold-toggle > .expiry--compact > li { flex: none; }

/* ========================================================== Customise: layout from the sketch
   top: Tiles (full width) · bottom: Start view (1/3) + Look & feel (2/3) */
.customise { grid-template-columns: minmax(280px, 1fr) minmax(0, 2fr); align-items: start; }
.set-card--tiles { grid-column: 1 / -1; }
@media (max-width: 1000px) { .customise { grid-template-columns: 1fr; } }

/* header: title left, light/dark/system as three small icons on the right */
.set-card--look .set-head > div:first-of-type { flex: 1; }
.appearance-switch { display: flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--surface-2); flex: none; }
.appearance-switch label { cursor: pointer; position: relative; }
.appearance-switch input { position: absolute; opacity: 0; pointer-events: none; }
.appearance-switch label > span { display: grid; place-items: center; width: 30px; height: 26px; border-radius: 7px; color: var(--text-2); transition: background .25s var(--ease), color .25s var(--ease); }
.appearance-switch .icon { width: 15px; height: 15px; }
.appearance-switch input:checked + span { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .14); }
.appearance-switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------------------------------------------------------- the live preview: a small Overview */
.pv {
  --pc1: var(--c1); --pc2: var(--c2);         /* hovering a colour changes only these */
  --pp: 9px; --pg: 8px; --pd: 46px;           /* padding, gap, donut size (Comfortable) */
  position: relative; display: flex; gap: 0; height: 290px; overflow: hidden;
  border-radius: 14px; border: 1px solid var(--border);
  background:
    radial-gradient(420px 300px at 0% 0%, color-mix(in srgb, var(--pc1) 24%, transparent), transparent 70%),
    radial-gradient(420px 300px at 100% 100%, color-mix(in srgb, var(--pc2) 22%, transparent), transparent 70%),
    var(--bg);
  transition: --pc1 .5s var(--ease), --pc2 .5s var(--ease);
  user-select: none;
}
@property --pc1 { syntax: "<color>"; inherits: true; initial-value: #007aff; }
@property --pc2 { syntax: "<color>"; inherits: true; initial-value: #af52de; }
.pv--compact { --pp: 6px; --pg: 5px; --pd: 36px; }

.pv-side { width: 74px; flex: none; display: flex; flex-direction: column; gap: 6px; padding: 10px 8px; background: var(--sidebar); border-right: 1px solid var(--border); }
.pv-logo { width: 18px; height: 18px; border-radius: 5px; background: linear-gradient(135deg, var(--pc1), var(--pc2)); margin-bottom: 4px; }
.pv-nav { height: 7px; border-radius: 4px; background: var(--border-strong); width: 80%; }
.pv-nav.is-on { background: color-mix(in srgb, var(--accent) 40%, transparent); width: 100%; }
.pv-gap { height: 6px; }
.pv-ten { display: flex; align-items: center; gap: 4px; height: 9px; }
.pv-ten::before { content: ""; width: 9px; height: 9px; border-radius: 3px; background: var(--border-strong); }
.pv-ten::after { content: ""; height: 5px; flex: 1; border-radius: 3px; background: var(--border); }
.pv-ten i { order: 2; width: 4px; height: 4px; border-radius: 50%; background: var(--green); margin-left: -6px; margin-top: 6px; }
.pv-ten i.o { background: var(--orange); }
.pv-ten i.r { background: var(--red); }

.pv-main { flex: 1; min-width: 0; padding: calc(var(--pp) + 4px); display: flex; flex-direction: column; gap: var(--pg); transition: padding .45s var(--ease), gap .45s var(--ease); }
.pv-top { display: flex; align-items: center; gap: 6px; }
.pv-top b { font-size: 13px; font-weight: 700; flex: 1; transition: font-size .45s var(--ease); }
.pv--compact .pv-top b { font-size: 11px; }
.pv-chip { width: 34px; height: 12px; border-radius: 6px; background: var(--surface); border: 1px solid var(--border); }

.pv-card { background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: var(--pp); min-width: 0;
  transition: padding .45s var(--ease), border-radius .45s var(--ease), flex-grow .45s var(--ease), max-width .45s var(--ease), opacity .3s var(--ease), margin .45s var(--ease); }
.pv--compact .pv-card { border-radius: 7px; }
.pv-card small { display: block; font-size: 9px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv-kpis { display: flex; gap: var(--pg); transition: gap .45s var(--ease); }
.pv-kpi { flex: 1; }
.pv-kpi b { display: block; font-size: 17px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; transition: font-size .45s var(--ease); }
.pv--compact .pv-kpi b { font-size: 14px; }

.pv-tiles { display: flex; gap: var(--pg); flex: 1; min-height: 0; transition: gap .45s var(--ease); }
.pv-tile { flex: 1 1 0; display: flex; flex-direction: column; gap: 6px; overflow: hidden; max-width: 400px; }
/* the 4th tile: only in Compact (that's the point: more fits) */
.pv-tile.pv-extra { flex-grow: 0; max-width: 0; padding-left: 0; padding-right: 0; opacity: 0; border-width: 0; margin-left: calc(-1 * var(--pg)); }
.pv--compact .pv-tile.pv-extra { flex-grow: 1; max-width: 400px; padding: var(--pp); opacity: 1; border-width: 1px; margin-left: 0; }
.pv-donut-row { display: flex; align-items: center; gap: 8px; flex: 1; }
.pv-donut { position: relative; width: var(--pd); height: var(--pd); flex: none; transition: width .45s var(--ease), height .45s var(--ease); }
.pv-donut svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.pv-ring { fill: none; stroke: color-mix(in srgb, var(--red) 75%, transparent); stroke-width: 5; }
.pv-seg { fill: none; stroke: var(--green); stroke-width: 5; transition: stroke-dasharray .8s var(--ease); }
.pv-num { position: absolute; inset: 0; display: grid; place-items: center; font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pv--compact .pv-num { font-size: 9.5px; }
.pv-legend { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.pv-legend i { height: 4px; border-radius: 2px; background: var(--border-strong); width: 80%; position: relative; margin-left: 7px; }
.pv-legend i::before { content: ""; position: absolute; left: -7px; top: -0.5px; width: 5px; height: 5px; border-radius: 1.5px; background: var(--green); }
.pv-legend i.r::before { background: var(--red); }
.pv-legend i.s { width: 55%; }
.pv-legend i.s::before { background: var(--orange); }

/* "Preview: Compact" label while you hover an option */
.pv-hint {
  position: absolute; right: 10px; bottom: 10px; padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 600; color: #fff; background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  opacity: 0; transform: translateY(4px); transition: opacity .2s var(--ease), transform .2s var(--ease); pointer-events: none;
}
.pv-hint.is-on { opacity: 1; transform: none; }

/* ---------------------------------------------------------- the row under the preview */
.look-row { display: flex; align-items: flex-start; gap: 18px; margin-top: 14px; }
.look-colours { flex: 1; min-width: 0; position: relative; }
.look-choice { flex: none; }
.look-row .set-label { margin: 0 0 8px; }
.look-choice .seg-control { min-width: 200px; }
.look-choice .seg-control--icons { min-width: 92px; }
.look-choice .seg-control label > span { padding: 7px 12px; }
@media (max-width: 760px) { .look-row { flex-wrap: wrap; } .look-colours { flex-basis: 100%; } }

/* colours: one row that scrolls sideways; about 6 visible; fades at the edge where there's more */
.theme-strip {
  overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain;
  scrollbar-width: none; scroll-behavior: smooth; scroll-snap-type: x proximity;
  max-width: calc(6 * 64px + 5 * 4px + 12px);
  margin: -4px -6px 0; padding: 4px 6px 2px;
  --fade-l: 0px; --fade-r: 0px;
  -webkit-mask: linear-gradient(90deg, transparent, #000 var(--fade-l), #000 calc(100% - var(--fade-r)), transparent);
  mask: linear-gradient(90deg, transparent, #000 var(--fade-l), #000 calc(100% - var(--fade-r)), transparent);
}
.theme-strip::-webkit-scrollbar { display: none; }
.theme-strip.has-left { --fade-l: 36px; }
.theme-strip.has-right { --fade-r: 36px; }
.theme-row { display: flex; align-items: flex-start; gap: 4px; width: max-content; }
.theme-row .theme-option, .theme-row .theme-add { width: 64px; flex: none; padding: 6px 2px 4px; scroll-snap-align: start; gap: 5px; }
.theme-row .theme-swatch { width: 36px; height: 36px; }
.theme-row .theme-name { font-size: 11px; max-width: 60px; }
/* the thin line between the standard themes and your own */
.theme-divider { flex: none; width: 1px; height: 40px; margin: 6px 6px 0; background: var(--border-strong); border-radius: 1px; }

/* own theme editor under the strip; the colour wheel opens upwards */
.look-colours .theme-editor { margin-top: 10px; }
.look-colours .wheel-pop { right: auto; left: 0; }
/* preview: tiles get their natural height; "Needs attention" fills the rest (in Compact it shows one bar more) */
.pv { height: 272px; }
.pv-tiles { flex: none; }
.pv-tile { gap: 8px; }
.pv-attn { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 7px; overflow: hidden; }
.pv--compact .pv-attn { gap: 5px; }
.pv-bar { display: block; height: 7px; width: var(--w); border-radius: 4px; background: color-mix(in srgb, var(--col) 80%, transparent); flex: none; transition: height .45s var(--ease); }
.pv--compact .pv-bar { height: 6px; }
.pv-bar--more { opacity: 0; transition: opacity .3s var(--ease), height .45s var(--ease); }
.pv--compact .pv-bar--more { opacity: 1; }
.pv-card small { flex: none; }
.pv { height: 284px; }
@media (max-width: 1000px) { .customise { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 700px) { .tile-columns { grid-template-columns: minmax(0, 1fr) !important; } }
@media (max-width: 600px) { .pv-side { display: none; } .pv { height: 250px; } }

/* colour strip fades: explicit per side, so at the far left (or right) there is no fade at all */
.theme-strip { -webkit-mask: none; mask: none; }
.theme-strip.has-left:not(.has-right) { -webkit-mask: linear-gradient(90deg, transparent, #000 36px); mask: linear-gradient(90deg, transparent, #000 36px); }
.theme-strip.has-right:not(.has-left) { -webkit-mask: linear-gradient(90deg, #000 calc(100% - 36px), transparent); mask: linear-gradient(90deg, #000 calc(100% - 36px), transparent); }
.theme-strip.has-left.has-right {
  -webkit-mask: linear-gradient(90deg, transparent, #000 36px, #000 calc(100% - 36px), transparent);
  mask: linear-gradient(90deg, transparent, #000 36px, #000 calc(100% - 36px), transparent);
}
.theme-row .theme-add { margin-left: 2px; }

/* explanation under density / donut centre */
.look-hint { font-size: 12px; margin: 8px 2px 0; max-width: 200px; line-height: 1.35; }
.look-choice .seg-control--icons ~ .look-hint { max-width: 92px; }
.look-hint [hidden] { display: none; }
.look-hint span { animation: notice-in .3s var(--ease); }

/* bottom row: both cards equally tall; the tenant list scrolls inside Start view */
.customise { align-items: stretch; }
.set-card--tiles { align-self: start; }
.set-card--start { display: flex; flex-direction: column; min-height: 0; }
.set-card--start .tenant-prefs { flex: 1 1 0; height: 0; min-height: 160px; overflow-y: auto; overscroll-behavior: contain;
  margin: 0 -6px; padding: 0 6px; scrollbar-width: thin; }
@media (max-width: 1000px) { .set-card--start .tenant-prefs { flex: none; height: auto; max-height: 320px; } }
.theme-strip { scroll-padding-inline: 6px; }
.look-choice .seg-control--icons { min-width: 120px; }
.look-choice .seg-control--icons ~ .look-hint { max-width: 140px; }
/* own-theme editor: its own full-width line under the three choices (only for your own themes) */
.theme-editor--wide { margin-top: 14px; }
.theme-editor--wide:not([data-mode="preset"]) { padding-top: 14px; border-top: 1px solid var(--border); height: 67px; }
.theme-editor--wide .theme-editor-fields { top: auto; }
.theme-editor--wide:not([data-mode="preset"]) .theme-editor-fields { inset: 14px 0 0 0; }
.theme-editor--wide .theme-name-field { flex: 0 1 320px; }
.theme-editor--wide .wheel-pop { right: auto; left: 330px; }
.look-row { align-items: flex-end; }

/* tenant list in Start view: scrolls inside the card, and shows it */
.set-card--start .tenant-scroll { position: relative; flex: 1 1 0; height: 0; min-height: 160px; display: flex; flex-direction: column; }
.set-card--start .tenant-scroll .tenant-prefs { flex: 1; height: auto; min-height: 0; scrollbar-width: thin; scrollbar-color: transparent transparent; transition: scrollbar-color .3s; }
.set-card--start .tenant-scroll:hover .tenant-prefs { scrollbar-color: var(--border-strong) transparent; }
/* soft fade at the edge where there's more */
.tenant-scroll.more-below .tenant-prefs { -webkit-mask: linear-gradient(#000 calc(100% - 40px), transparent); mask: linear-gradient(#000 calc(100% - 40px), transparent); }
.tenant-scroll.more-above .tenant-prefs { -webkit-mask: linear-gradient(transparent, #000 28px); mask: linear-gradient(transparent, #000 28px); }
.tenant-scroll.more-above.more-below .tenant-prefs { -webkit-mask: linear-gradient(transparent, #000 28px, #000 calc(100% - 40px), transparent); mask: linear-gradient(transparent, #000 28px, #000 calc(100% - 40px), transparent); }
/* small round arrow at the bottom while you hover and there's more below */
.scroll-cue {
  position: absolute; left: 50%; bottom: 2px; translate: -50% 0;
  display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border-strong); box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
  color: var(--text-2); opacity: 0; transform: translateY(4px); pointer-events: none;
  transition: opacity .25s var(--ease), transform .25s var(--ease);
}
.scroll-cue .icon { width: 15px; height: 15px; }
.tenant-scroll.more-below:hover .scroll-cue { opacity: 1; transform: none; pointer-events: auto; animation: cue-nudge 1.6s var(--ease) .3s infinite; }
@keyframes cue-nudge { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(3px); } }
@media (prefers-reduced-motion: reduce) { .tenant-scroll.more-below:hover .scroll-cue { animation: none; } }
@media (max-width: 1000px) { .set-card--start .tenant-scroll { flex: none; height: auto; } .set-card--start .tenant-scroll .tenant-prefs { max-height: 320px; } }

/* folded sidebar: icons exactly in the middle (same line as the tenant monograms) */
.nav-item { transition: padding .3s var(--ease), background .2s var(--ease); }
.sidebar-collapsed .sidebar .nav-item:not(.tenant) { padding-left: 14px; padding-right: 0; }
.sidebar-collapsed .sidebar .tenant-link:has(> .icon) { padding-left: 14px; padding-right: 0; }
.attention-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 4px; }
.attention-legend span { display: inline-flex; align-items: center; gap: 6px; }

/* ---------------------------------------------------------- Look & feel: Overview / Devices */
.look-tabs { display: inline-grid; width: 280px; margin: -2px 0 14px; }
.look-pane[hidden] { display: none; }
.look-pane { animation: notice-in .3s var(--ease); }

/* preview of the device list */
.dc-preview { border: 1px solid var(--border); border-radius: 14px; overflow-x: auto; background: var(--surface); margin-bottom: 14px; }
.dc-table { width: 100%; border-collapse: collapse; font-size: 12px; white-space: nowrap; }
.dc-table th { text-align: left; font-weight: 600; color: var(--text-2); padding: 9px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.dc-table td { padding: 8px 12px; border-bottom: 1px solid var(--border); }
.dc-table tr:last-child td { border-bottom: 0; }
.dc-table td small { display: block; color: var(--text-3); font-size: 11px; }
.dc-table [hidden] { display: none; }
.dc-ok { color: var(--green-text); font-weight: 600; }
.dc-bad { color: var(--orange-text); font-weight: 600; }

/* the column chips: one row that wraps; drag them left / right */
.dc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.dc-item {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 6px; border-radius: 10px; cursor: grab;
  background: var(--surface); border: 1px solid var(--border); user-select: none;
  transition: opacity .2s var(--ease), border-color .2s var(--ease);
}
.dc-item:hover { border-color: var(--border-strong); }
.dc-item .grip { color: var(--text-3); display: grid; }
.dc-item .grip .icon { width: 14px; height: 14px; }
.dc-name { font-size: 13px; font-weight: 500; }
.dc-item.is-off .dc-name, .dc-item.is-off .grip { opacity: .45; }
.dc-item.is-ghost { opacity: .35; }
.dc-item.is-chosen { cursor: grabbing; box-shadow: 0 8px 24px rgba(0, 0, 0, .14); }
.set-label .subtle { font-weight: 400; }

/* the logo goes to the Overview (sidebar and phone bar) */
a.brand, a.mobile-brand { color: inherit; text-decoration: none; }
a.brand:hover .label, a.mobile-brand:hover { color: var(--accent); }
.mobile-actions { display: flex; align-items: center; gap: 2px; }
.mobile-actions form { display: contents; }
.nav-instant .sidebar, .nav-instant .mobile-shade { transition: none !important; animation: none !important; }
@media (max-width: 900px) {
  /* refresh lives in the phone bar (top right); here only the time of the last sync stays */
  .topbar .refresh-form .btn { display: none; }
  /* key figures: one per row, all the same height (no squeezed, wrapping titles) */
  .kpis { grid-template-columns: 1fr !important; }
  .kpi-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
@media (max-width: 900px) {
  /* each key figure as one compact row: title + status left, the number right */
  .kpis { gap: 10px; }
  .kpi { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "t v" "s v"; align-items: center; column-gap: 12px; padding: 14px 16px; }
  .kpi .kpi-title { grid-area: t; margin: 0; }
  .kpi .kpi-value { grid-area: v; font-size: 30px; line-height: 1; }
  .kpi .status-text { grid-area: s; margin-top: 4px; }
}

/* ---------------------------------------------------------- device table: as many columns as you like
   Every column takes the room it needs (headers never overlap); if they don't fit, the table scrolls
   sideways inside its card. The device name stays in view while you scroll. */
@media (min-width: 1100px) {
  .devices-table { table-layout: auto; width: max-content; min-width: 100%; }
  .devices-table th, .devices-table .col-name, .devices-table .col-tenant, .devices-table .col-os,
  .devices-table .col-checkin, .devices-table .col-type, .devices-table .col-enc, .devices-table .col-managed,
  .devices-table .col-failed, .devices-table th:nth-last-child(2), .devices-table th:nth-last-child(1) { width: auto; }
  .devices-table th { white-space: nowrap; }
  .devices-table td { overflow: visible; }
  .devices-table td.col-name strong, .devices-table td.col-name small { max-width: 260px; }
  .devices-table td.health { white-space: nowrap; }
}
.table-card:has(.devices-table) { overflow-x: auto; overscroll-behavior-x: contain; }
.devices-table th:first-child, .devices-table td:first-child {
  position: sticky; left: 0; z-index: 1; background: var(--surface);
}
.devices-table tbody tr:hover td:first-child, .devices-table tbody tr.is-current td:first-child { background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
/* column chips: the switch and the faded name change smoothly */
.dc-item { transition: opacity .25s var(--ease), border-color .2s var(--ease), background .25s var(--ease); }
.dc-item .dc-name, .dc-item .grip { transition: opacity .25s var(--ease); }
.dc-item.is-off { background: var(--surface-2); }
.dc-table th, .dc-table td { will-change: transform; }
.tenant-search-count { font-size: 12px; margin-left: auto; padding-right: 6px; }
.filterbar .search:only-child, .filterbar .search:has(+ .tenant-search-count) { flex: 1; }

/* ---------------------------------------------------------- two-step login */
.login-card--wide { width: min(440px, calc(100vw - 32px)); }
.code-input { font-size: 22px !important; letter-spacing: .25em; text-align: center; font-variant-numeric: tabular-nums; }
.mfa-steps { margin: 0; padding-left: 20px; display: grid; gap: 10px; text-align: left; font-size: 14px; }
.qr { width: 184px; height: 184px; margin: 10px auto 4px; padding: 6px; border-radius: 14px; background: #fff; }
.qr svg { width: 100%; height: 100%; display: block; }
.mfa-help { text-align: left; font-size: 13px; }
.mfa-help summary { cursor: pointer; color: var(--accent); font-weight: 500; }
.mfa-help p { margin: 6px 0 0 !important; }
.mfa-key { user-select: all; font-size: 13px; word-break: break-all; }
.mfa-signout { display: flex; justify-content: center; margin-top: 12px; }
.backup-codes { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.backup-codes code { display: block; padding: 8px; border-radius: 8px; background: var(--surface-2); font-size: 15px; letter-spacing: .05em; text-align: center; }
.login-card form { display: contents; }
.login-bg:has(.mfa-signout) { align-content: center; gap: 4px; }
.mfa-signout { margin-top: 0; }

/* ---------------------------------------------------------------- Report branding page */
.brand-form select, .brand-form input[type="file"] { width: 100%; padding: 8px 10px; border-radius: 9px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; }
.brand-colors { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .brand-colors { grid-template-columns: 1fr; } }
.field .brand-color { display: flex; gap: 8px; align-items: center; font-size: inherit; color: inherit; }
.brand-color input[type="color"] { width: 42px; height: 38px; padding: 2px; border-radius: 9px; border: 1px solid var(--border-strong); background: var(--surface); flex: none; cursor: pointer; }
.brand-color input[type="text"] { font-variant-numeric: tabular-nums; text-transform: uppercase; }
.brand-current { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border: 1px dashed var(--border-strong); border-radius: 9px; }
.brand-current img { max-height: 40px; max-width: 160px; object-fit: contain; background: #fff; padding: 4px; border-radius: 6px; }
.field .brand-remove { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; font-size: 13px; color: var(--text); }
.brand-preview { display: grid; gap: 12px; justify-items: start; }
.brand-preview h2 { margin: 0; }
.bp-sheet { justify-self: stretch; background: #fff; color: #1d1d1f; border-radius: 10px; padding: 16px; box-shadow: 0 6px 24px rgba(0,0,0,.12); display: grid; gap: 10px; font-size: 12px; }
.bp-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding-bottom: 8px; border-bottom: 3px solid var(--brand); }
.bp-head img { max-height: 34px; max-width: 120px; object-fit: contain; }
.bp-kicker { margin: 0; font-size: 9px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--brand); }
.bp-title { margin: 2px 0 0; font-size: 18px; font-weight: 700; letter-spacing: -.02em; }
.bp-logo-empty { font-size: 10px; color: #8e8e93; border: 1px dashed #c7c7cc; border-radius: 6px; padding: 8px 14px; }
.bp-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.bp-kpis span { border: 1px solid #e5e5ea; border-top: 3px solid var(--brand); border-radius: 8px; padding: 6px 8px; font-size: 16px; font-weight: 700; }
.bp-kpis small { display: block; font-size: 9px; font-weight: 400; color: #6e6e73; }
.bp-summary { border-left: 3px solid var(--accent); background: #fafafa; padding: 6px 10px; border-radius: 0 8px 8px 0; color: #6e6e73; }
.bp-bars { display: flex; align-items: flex-end; gap: 3px; height: 56px; }
.bp-bars i, .bp-bars b { flex: 1; border-radius: 2px 2px 0 0; }
.bp-bars i { background: var(--brand); } .bp-bars b { background: var(--accent); }
.bp-foot { margin: 0; font-size: 9px; color: #6e6e73; border-top: 1px solid #e5e5ea; padding-top: 6px; }

/* ---------------------------------------------------------------- two-step login: remembered devices */
.login-card .remember-row { align-items: flex-start; text-align: left; padding: 6px 2px; }
.login-card .remember-row input { margin-top: 3px; }
.login-card .remember-row small { font-size: 12px; margin-top: 2px; }
.trusted-devices { text-align: left; border-top: 1px solid var(--border); padding-top: 12px; display: grid; gap: 8px; }
.trusted-devices h2 { font-size: 15px; margin: 0; }
.trusted-devices ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.trusted-devices li { padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; }
.trusted-devices .pill-mini { font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.trusted-actions { display: flex; flex-wrap: wrap; gap: 8px; }
