/* Sweep admin. Light theme after TaskVault (instagram.com/p/C63DvELt1Cm). Sizes in rem off a fluid root,
   so every screen fills and scales from 11" (1194x834, 1366x768) to 32" (2560x1440, 3840x2160). */

html { font-size: clamp(14px, 0.42vw + 8.6px, 24px); }

:root {
  /* Warm ivory after Wispr Flow, three clear levels: page < surface < card, inputs brightest. */
  --page: #f5f4e5;            /* main background */
  --panel: #fffdf2;           /* sidebar and content pane */
  --card: #fffef7;            /* cards, panels, tables on the surface */
  --input: #ffffff;           /* form fields stand out from cards */
  --head: #f5f3e3;            /* table header band */
  --ink: #24221f;             /* primary text */
  --muted: #777466;           /* secondary text, 4.6:1 on cards */
  --line: #e6e2ce;            /* borders */
  --line-strong: #d6d1b8;     /* input borders: a step firmer than card borders */
  --accent: #0f7d75;          /* primary accent (deep robin egg blue); white text 5.0:1 */
  --accent-rgb: 15 125 117;
  --accent-hover: #0b655f;
  --accent-soft: #96ded1;     /* lighter tint of the accent (chart "found" bars) */
  --accent-tint: #e6f7f4;     /* active nav, highlighted cards */
  --accent-tint-line: #c4ebe4;
  --accent-ring: rgb(var(--accent-rgb) / 0.2);
  --success-bg: #e3f5e8;     /* online / success background */
  --success: #167342;         /* online / success text */
  --danger-bg: #fdeeee;
  --danger: #b42318;
  --warn: #b54708;
  --focus: #0b5f59;
  --radius: 1.5rem;
  --shadow-sm: 0 1px 2px rgb(60 55 20 / 0.06);
  --shadow-md: 0 1px 2px rgb(60 55 20 / 0.06), 0 0.5rem 1.5rem rgb(60 55 20 / 0.08);
  --shadow-lg: 0 1px 2px rgb(60 55 20 / 0.06), 0 1rem 2.5rem rgb(60 55 20 / 0.11);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
  font: 1rem/1.5 ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--focus); }
h1 { font-size: 1.625rem; line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 0.375rem; }
.muted { color: var(--muted); margin: 0 0 1.5rem; }

/* ---------- Motion ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(0.75rem); } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(-0.25rem) scale(0.96); } }
@keyframes slide-in { from { opacity: 0; transform: translateY(-0.5rem); } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgb(var(--accent-rgb) / 0.45); } 100% { box-shadow: 0 0 0 0.5rem rgb(var(--accent-rgb) / 0); } }

/* ---------- Sign in ---------- */
.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem 1rem;
  background:
    radial-gradient(40rem 30rem at 15% 10%, rgb(var(--accent-rgb) / 0.08), transparent 60%),
    radial-gradient(36rem 28rem at 90% 90%, rgb(var(--accent-rgb) / 0.06), transparent 60%),
    var(--page);
}
.card {
  width: 100%;
  max-width: 26.25rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 2.5rem 2.25rem;
  box-shadow: var(--shadow-lg);
  animation: rise 0.5s var(--ease-out) both;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 1.75rem;
}
.logo-mark { width: 2.25rem; height: 2.25rem; transition: transform 0.4s var(--ease-out); }
.brand:hover .logo-mark { transform: rotate(-8deg) scale(1.06); }

form { display: grid; gap: 0.5rem; }
label { font-size: 0.875rem; font-weight: 600; margin-top: 0.5rem; }

input {
  width: 100%;
  height: 3rem;
  padding: 0 0.875rem;
  font: inherit;
  color: var(--ink);
  background: var(--input);
  border: 1px solid var(--line-strong);
  border-radius: 0.75rem;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
input:hover { border-color: #b9b497; }
input:focus { outline: none; background: var(--input); border-color: var(--accent); box-shadow: 0 0 0 0.25rem var(--accent-ring); }

/* Password field with a show/hide eye (public/password.js). */
.pw-field { position: relative; display: block; }
.pw-field input { padding-right: 3rem; }
.pw-toggle {
  position: absolute; top: 50%; right: 0.375rem; transform: translateY(-50%);
  width: 2.25rem; height: 2.25rem; margin: 0; padding: 0; display: grid; place-items: center;
  border: 0; border-radius: 0.5rem; background: transparent; color: var(--muted); cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.pw-toggle:hover { color: var(--accent); background: var(--accent-tint); }
.pw-toggle:active { transform: translateY(-50%) scale(0.94); }
.pw-toggle svg { width: 1.125rem; height: 1.125rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Buttons ---------- */
button {
  height: 3.125rem;
  margin-top: 1.25rem;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s, transform 0.2s var(--ease-out);
}
button:active { transform: scale(0.97); }
button:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0.375rem 1rem rgb(var(--accent-rgb) / 0.25);
}
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 0.5rem 1.25rem rgb(var(--accent-rgb) / 0.35); transform: translateY(-1px); }
.btn-primary:active { transform: scale(0.97); }

/* Button pairs: squarer corners, a filled primary next to a 2px accent outline that
   fills with the accent on hover with a soft accent shadow. Fast 0.15s transitions. */
.btn-small {
  height: 2.375rem;
  margin: 0;
  padding: 0 1.125rem;
  font-size: 0.875rem;
  border: 2px solid var(--accent);
  border-radius: 0.4rem;
  transition: background 0.15s ease-in-out, color 0.15s ease-in-out, box-shadow 0.15s ease-in-out, transform 0.15s var(--ease-out);
}
.btn-small.btn-primary { box-shadow: none; }
.btn-small.btn-primary:hover { box-shadow: 0 0.25rem 0.75rem rgb(var(--accent-rgb) / 0.3); transform: none; }
.btn-outline {
  display: inline-flex;
  align-items: center;
  background: var(--panel);
  color: var(--accent);
  font-weight: 650;
  cursor: pointer;
  list-style: none;
}
.btn-outline::-webkit-details-marker { display: none; }
.btn-outline:hover { background: var(--accent); color: #fff; box-shadow: 0 0.25rem 0.75rem rgb(var(--accent-rgb) / 0.3); }
.btn-outline:active { transform: scale(0.97); }
.btn-outline:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #912018; }

/* ---------- Messages ---------- */
.alert, .notice {
  margin: 0 0 1rem;
  padding: 0.75rem 0.875rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  animation: slide-in 0.35s var(--ease-out) both;
}
.alert { background: var(--danger-bg); color: var(--danger); }
.notice { background: var(--success-bg); color: var(--success); }
.card .alert { margin-bottom: 0.5rem; }

/* ---------- Toasts (public/toast.js) ---------- */
#toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.toast-notification {
  position: relative; min-width: 300px; max-width: 400px; padding: 16px 44px 16px 20px; overflow: hidden;
  background: #fff; border-radius: 14px; box-shadow: rgb(0 0 0 / 0.08) 0 2px 6px, rgb(0 0 0 / 0.16) 0 12px 32px;
  transform: translateX(28px) scale(0.96); opacity: 0; filter: blur(2px);
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s ease-out, filter 0.3s ease-out;
}
/* Coloured edge as an inset bar, so it follows the rounded corners. */
.toast-notification::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: #ccc; }
.toast-notification.show { transform: none; opacity: 1; filter: none; }
.toast-notification.hiding {
  transform: translateX(16px) scale(0.98); opacity: 0; pointer-events: none;
  transition: transform 0.25s ease-in, opacity 0.25s ease-in;
}
.toast-message { display: block; font-size: 14px; font-weight: 500; line-height: 1.4; color: #222; overflow-wrap: break-word; }
.toast-close {
  position: absolute; top: 50%; right: 12px; transform: translateY(-50%); width: 20px; height: 20px; margin: 0; padding: 0;
  display: flex; align-items: center; justify-content: center; border: 0; border-radius: 50%; background: transparent;
  color: #888; font-size: 18px; line-height: 1; cursor: pointer; transition: background-color 0.2s, color 0.2s;
}
.toast-close:hover { background: rgb(0 0 0 / 0.05); color: #333; }
.toast-close:active { transform: translateY(-50%); }
.toast-progress { position: absolute; left: 0; bottom: 0; width: 0; height: 3px; border-radius: 0 3px 3px 0; background: rgb(0 0 0 / 0.1); }
.toast-notification.show .toast-progress { animation: toast-progress 3s linear forwards; }
@keyframes toast-progress { to { width: 100%; } }
.toast-success { background: #f0faf5; }
.toast-success::before { background: #20c870; }
.toast-success .toast-progress { background: rgb(32 200 112 / 0.8); }
.toast-error { background: #fef2f2; }
.toast-error::before { background: #f0504a; }
.toast-error .toast-progress { background: rgb(240 80 74 / 0.8); }
@media (max-width: 480px) { #toast-container { left: 12px; right: 12px; } .toast-notification { min-width: 0; max-width: none; } }

/* ---------- Confirmation dialog (public/confirm.js) ---------- */
.confirm-dialog {
  width: min(26rem, calc(100vw - 2rem)); padding: 0; border: 1px solid var(--line); border-radius: 18px;
  background: var(--card); color: var(--ink); box-shadow: var(--shadow-lg);
}
.confirm-dialog[open] { animation: dialog-in 0.28s var(--ease-out) both; }
.confirm-dialog::backdrop { background: rgb(36 34 31 / 0.28); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.confirm-dialog[open]::backdrop { animation: fade 0.25s ease-out both; }
@keyframes dialog-in { from { opacity: 0; transform: translateY(0.75rem) scale(0.96); } }
.confirm-box { display: block; padding: 1.5rem 1.5rem 1.25rem; }
.confirm-title { margin: 0 0 0.5rem; font-size: 1.1875rem; letter-spacing: -0.01em; }
.confirm-text { margin: 0 0 1.25rem; color: var(--muted); font-size: 0.9375rem; line-height: 1.5; }
.confirm-text:empty { display: none; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 0.625rem; }
.confirm-actions button { margin: 0; }

/* ---------- Signed-in shell: fills the window; only the panes scroll. ---------- */
.shell {
  display: grid;
  grid-template-columns: clamp(17rem, 16vw, 19rem) 1fr;
  height: 100vh;
  height: 100dvh;
  padding: clamp(12px, 1.4vw, 36px);
}
.sidebar, .content { background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.sidebar {
  border-radius: var(--radius) 0 0 var(--radius);
  border-right: 0;
  padding: 1.75rem 1.125rem;
  display: flex;
  flex-direction: column;
  overflow: hidden auto;
  animation: fade 0.4s var(--ease-out) both;
}
.sidebar .brand { padding: 0 0.5rem; }
.sidebar nav { display: grid; gap: 0.25rem; }

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  height: 2.875rem;
  margin: 0;
  padding: 0 0.875rem;
  border-radius: 0.75rem;
  color: #5c5a4b;
  background: none;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9375rem;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s;
}
.nav-item:hover { background: rgb(230 226 206 / 0.55); color: var(--ink); }
.nav-item.active { background: var(--accent-tint); color: var(--accent); font-weight: 600; }
.icon { width: 1.25rem; height: 1.25rem; flex: none; }
.badge {
  margin-left: auto;
  min-width: 1.5rem;
  height: 1.5rem;
  padding: 0 0.4375rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  animation: pulse 1.8s var(--ease-out) 3;
}

.logout { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--line); gap: 0.25rem; }
.logout button { justify-content: flex-start; margin: 0; font-weight: 500; }
.logout button:active { transform: none; }
.who { margin: 0; padding: 0 0.875rem; font-size: 0.8125rem; color: var(--muted); overflow-wrap: anywhere; }

.content {
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 2rem 2.25rem;
  min-width: 0;
  overflow-y: auto;
}
.page-head { animation: rise 0.45s var(--ease-out) both; }
.page-head h1 { font-size: 1.75rem; }

/* ---------- Approval requests ---------- */
.requests { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
.request {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 1.125rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: 1.125rem;
  background: var(--card);
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s var(--ease-out), box-shadow 0.25s, border-color 0.25s;
  animation: rise 0.45s var(--ease-out) both;
}
/* Rows arrive one after another. */
.request:nth-child(1) { animation-delay: 0.06s; }
.request:nth-child(2) { animation-delay: 0.12s; }
.request:nth-child(3) { animation-delay: 0.18s; }
.request:nth-child(4) { animation-delay: 0.24s; }
.request:nth-child(n + 5) { animation-delay: 0.3s; }
.request:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--accent-tint-line); }

.request-title { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem; margin: 0 0 0.75rem; font-weight: 650; font-size: 1.0625rem; }
.request-title .chip { font-size: 0.75rem; padding: 0.125rem 0.5rem; }
/* Labelled fields: small label above each value. */
.meta-grid { display: flex; flex-wrap: wrap; gap: 0.5rem 2rem; margin: 0; }
.meta-grid div { min-width: 0; }
.meta-grid dt { margin: 0 0 0.125rem; font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.meta-grid dd { margin: 0; font-size: 0.9375rem; font-weight: 500; color: var(--ink); }
.meta-grid code { font-size: 0.875rem; padding: 0.0625rem 0.375rem; border-radius: 0.375rem; background: var(--head); border: 1px solid var(--line); }
.warn { color: var(--warn); font-weight: 600; }
.request-actions { display: flex; align-items: flex-start; gap: 0.625rem; flex: none; }
.request-actions form { display: block; }

.confirm { position: relative; }
.confirm form {
  position: absolute;
  right: 0;
  top: 3rem;
  z-index: 2;
  width: 16.25rem;
  padding: 0.875rem;
  border: 1px solid var(--line);
  border-radius: 0.875rem;
  background: var(--panel);
  box-shadow: var(--shadow-lg);
  transform-origin: top right;
  animation: pop 0.2s var(--ease-out) both;
}
.confirm p { margin: 0 0 0.75rem; font-size: 0.875rem; color: var(--muted); }
.confirm button { width: 100%; }

.empty {
  padding: 3rem 1.5rem;
  border: 1px dashed var(--line-strong);
  border-radius: 1.125rem;
  text-align: center;
  animation: rise 0.45s var(--ease-out) 0.06s both;
}
.empty-title { margin: 0 0 0.25rem; font-weight: 650; font-size: 1.0625rem; }
.empty .muted { margin: 0; }

/* ---------- Shared building blocks for Devices, Device detail and Settings ---------- */
.small { font-size: 0.8125rem; }
.muted-inline { color: var(--muted); }
.page-head .back-link {
  display: inline-flex; align-items: center; gap: 0.25rem; margin-bottom: 0.5rem;
  color: var(--muted); text-decoration: none; font-size: 0.875rem; font-weight: 500;
}
.back-link .icon { width: 1rem; height: 1rem; }
.back-link:hover { color: var(--accent); }
code { font: 0.8125rem ui-monospace, SFMono-Regular, Menlo, monospace; }

/* Stat cards (StockPro row): one dark card, the rest cream. */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.875rem; margin-bottom: 1.25rem; }
.stat {
  padding: 1rem 1.125rem; border: 1px solid var(--line); border-radius: 1.125rem; background: var(--card);
  animation: rise 0.45s var(--ease-out) both;
}
.stat:nth-child(2) { animation-delay: 0.05s; }
.stat:nth-child(3) { animation-delay: 0.1s; }
.stat:nth-child(4) { animation-delay: 0.15s; }
.stat-label { margin: 0 0 0.375rem; font-size: 0.8125rem; color: var(--muted); font-weight: 500; }
.stat-value { margin: 0; font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.stat-note { margin: 0.25rem 0 0; font-size: 0.8125rem; color: var(--muted); }
.stat-note a { color: var(--accent); font-weight: 600; text-decoration: none; }
/* The one highlighted KPI card per page: soft robin egg blue instead of dark. */
.stat-dark { background: #96ded1; border-color: #7ccfc0; }
.stat-dark .stat-label, .stat-dark .stat-value { color: #0d4f49; }
.stat-dark .stat-note { color: #22574f; }
.stat-accent { background: var(--accent-tint); border-color: var(--accent-tint-line); }
.stat-warn .stat-value { color: var(--warn); }
.stat .chip { font-size: 0.9375rem; }

/* Segmented filter: outline buttons, the selected one filled. */
.segmented { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.seg {
  display: inline-flex; align-items: center; height: 2.125rem; padding: 0 0.875rem;
  border: 2px solid var(--accent); border-radius: 0.4rem; color: var(--accent); background: var(--panel);
  font-size: 0.8125rem; font-weight: 600; text-decoration: none;
  transition: background 0.15s ease-in-out, color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}
.seg:hover, .seg-on { background: var(--accent); color: #fff; }
.seg:hover { box-shadow: 0 0.25rem 0.75rem rgb(var(--accent-rgb) / 0.3); }
.seg:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* Status chips with a live dot. */
.chip {
  display: inline-flex; align-items: center; gap: 0.375rem; padding: 0.1875rem 0.625rem;
  border-radius: 999px; font-size: 0.8125rem; font-weight: 600; white-space: nowrap;
}
.chip i { width: 0.4375rem; height: 0.4375rem; border-radius: 50%; background: currentColor; }
.chip-ok { background: var(--success-bg); color: var(--success); }
.chip-ok i { animation: pulse-dot 2s ease-out infinite; }
.chip-warn { background: #fdf0dc; color: #93450a; }
.chip-danger { background: var(--danger-bg); color: var(--danger); }
.chip-muted { background: #ecebdc; color: #5c5a4b; }
@keyframes pulse-dot { 0% { box-shadow: 0 0 0 0 rgb(22 115 66 / 0.45); } 70%, 100% { box-shadow: 0 0 0 0.375rem rgb(22 115 66 / 0); } }

/* Devices table. */
.table-wrap { border: 1px solid var(--line); border-radius: 1.125rem; overflow: auto; background: var(--card); animation: rise 0.45s var(--ease-out) 0.1s both; }
.table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.table th {
  position: sticky; top: 0; text-align: left; padding: 0.75rem 1rem; background: var(--head); color: var(--muted);
  font-weight: 600; font-size: 0.8125rem; white-space: nowrap; border-bottom: 1px solid var(--line);
}
.table td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr { transition: background 0.15s; }
.table tbody tr:hover { background: rgb(230 226 206 / 0.4); }
.table tbody tr:last-child td { border-bottom: 0; }
.row-link { color: var(--ink); font-weight: 650; text-decoration: none; }
.row-link:hover { color: var(--accent); }
.cell-sub { display: block; color: var(--muted); font-size: 0.8125rem; }

/* Panels and grids on Device detail / Settings. */
.panel {
  padding: 1.125rem 1.25rem; border: 1px solid var(--line); border-radius: 1.125rem; background: var(--card);
  margin-bottom: 0.875rem; animation: rise 0.45s var(--ease-out) 0.1s both;
}
.panel.narrow { max-width: 34rem; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.panel-head h2 { margin: 0; font-size: 1.0625rem; letter-spacing: -0.01em; }
.panel > form + p, .panel > p { margin: 0.5rem 0; }
.panel .btn-small + p, .panel form + .muted { margin-top: 0.5rem; }
.grid-2, .grid-3 { display: grid; gap: 0.875rem; margin-bottom: 0.875rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 .panel, .grid-3 .panel { margin-bottom: 0; }
.chart-box { position: relative; height: clamp(12rem, 24vh, 22rem); }
.legend { display: inline-flex; align-items: center; gap: 0.375rem; font-size: 0.8125rem; color: var(--muted); }
.legend i { width: 0.625rem; height: 0.625rem; border-radius: 2px; margin-left: 0.5rem; }
.legend .lg-a { background: var(--accent-soft); }
.legend .lg-b { background: var(--accent); }

.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li {
  display: flex; justify-content: space-between; gap: 1rem; padding: 0.5625rem 0;
  border-bottom: 1px solid var(--line); font-size: 0.875rem;
}
.mini-list li:last-child { border-bottom: 0; }
.mini-list time { flex: none; color: var(--muted); font-size: 0.8125rem; }

.pin { margin: 0.5rem 0 0.75rem; }
.pin summary { width: fit-content; }
.pin-digits {
  margin: 0.75rem 0 0; font: 700 1.75rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 0.3em;
  color: var(--accent); animation: pop 0.2s var(--ease-out) both;
}
.notice-inline { margin: 0 0 0.75rem; padding: 0.625rem 0.75rem; border-radius: 0.625rem; background: #fdf0dc; color: #93450a; font-size: 0.875rem; }
.warn-box { margin: 0; padding: 0.625rem 0.75rem; border-radius: 0.625rem; background: var(--danger-bg); color: var(--danger); font-size: 0.875rem; }

/* Forms on cream. */
select {
  width: 100%; height: 2.75rem; padding: 0 0.75rem; font: inherit; color: var(--ink);
  background: var(--input); border: 1px solid var(--line-strong); border-radius: 0.75rem;
}
select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 0.25rem var(--accent-ring); }
.panel input { height: 2.75rem; background: var(--input); }
.panel label { display: grid; gap: 0.375rem; }
.field-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.875rem 1rem; }
.form-actions { display: flex; justify-content: flex-end; margin-top: 1rem; }
.inline-form { display: flex; align-items: flex-end; gap: 0.625rem; margin-bottom: 0.5rem; }
.inline-form label { flex: 1; margin: 0; }
.btn-danger-outline {
  display: inline-flex; align-items: center; width: fit-content; border: 2px solid var(--danger); border-radius: 0.4rem;
  background: var(--panel); color: var(--danger); font-weight: 650; cursor: pointer; list-style: none;
  transition: background 0.15s ease-in-out, color 0.15s ease-in-out;
}
.btn-danger-outline::-webkit-details-marker { display: none; }
.btn-danger-outline:hover, .confirm[open] .btn-danger-outline { background: var(--danger); color: #fff; }
.confirm form input { margin-bottom: 0.625rem; }
/* Remote wipe: two buttons, each opening its own modal (wipeDialog in src/views-devices.js). */
.wipe-buttons { display: flex; flex-wrap: wrap; gap: 0.625rem; margin-top: 0.25rem; }
.confirm-field { display: grid; gap: 0.375rem; margin: 0 0 1.25rem; font-size: 0.875rem; font-weight: 600; }
.confirm-field input { height: 2.75rem; }
.panel .confirm { margin-top: 0.75rem; }
/* Reports page: filter bar, results bar, grid cards, pager. */
.filters {
  display: grid; grid-template-columns: minmax(14rem, 2fr) repeat(4, minmax(9rem, 1fr)) auto; gap: 0.75rem; align-items: end;
  padding: 1rem 1.125rem; margin-bottom: 1rem; border: 1px solid var(--line); border-radius: 1.125rem; background: var(--card);
}
.filters label { display: grid; gap: 0.375rem; margin: 0; }
.filters input, .filters select { height: 2.5rem; margin: 0; }
.filter-actions { display: flex; gap: 0.5rem; }
.filter-actions a, .pager a { text-decoration: none; }
.results-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.results-bar p { margin: 0 0 1rem; }
.report-text { line-height: 1.45; }
.nowrap { white-space: nowrap; }
.report-row.is-problem td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 0.875rem; }
.report-card { padding: 1rem 1.125rem; border: 1px solid var(--line); border-radius: 1.125rem; background: var(--card); animation: rise 0.45s var(--ease-out) both; }
.report-card.is-problem { border-color: var(--danger); }
.report-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; }
.report-card-type { margin: 0.5rem 0 0.375rem; font-size: 0.8125rem; color: var(--muted); }
.report-card .report-text { margin: 0; font-size: 0.875rem; }
.pager { display: flex; justify-content: space-between; margin-top: 1rem; }
@media (max-width: 1100px) { .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); } .filter-search, .filter-actions { grid-column: 1 / -1; } }
@media (max-width: 480px) { .filters { grid-template-columns: 1fr; } }
/* Enroll a phone. White quiet zone around the code so phone cameras read it on the cream card. */
.qr { width: min(18rem, 100%); padding: 0.75rem; border: 1px solid var(--line); border-radius: 0.875rem; background: #fff; }
.qr svg { display: block; width: 100%; height: auto; }
.steps { margin: 0; padding-left: 1.25rem; display: grid; gap: 0.625rem; line-height: 1.5; }
.panel form > button, .panel form > .form-actions > button { justify-self: start; width: auto; }

/* ---------- Skeleton loaders ---------- */
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.sk, .chart-box.is-loading::before {
  background: linear-gradient(90deg, var(--head) 0%, var(--line) 40%, var(--head) 80%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: 0.75rem;
}
.sk-title { width: 14rem; height: 2rem; margin-bottom: 0.625rem; }
.sk-line { width: 20rem; max-width: 70%; height: 0.875rem; margin-bottom: 1.5rem; }
.sk-stat { height: 6.5rem; border-radius: 1.125rem; }
.sk-panel { height: clamp(14rem, 28vh, 24rem); border-radius: 1.125rem; }
.sk-wide { margin-top: 0.875rem; height: 9rem; }
/* Chart boxes: shimmer until charts.js has drawn, then the canvas fades in. */
.chart-box.is-loading::before { content: ""; position: absolute; inset: 0; }
.chart-box canvas { transition: opacity 0.4s ease-out; }
.chart-box.is-loading canvas, .chart-box.is-loading .ring-center { opacity: 0; }

/* ---------- Dashboard ---------- */
.grid-dash { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-flow: dense; gap: 0.875rem; margin-bottom: 0.875rem; }
.grid-dash .panel { margin-bottom: 0; }
/* Recent activity: fixed-height box that scrolls with the scrollbar hidden, so Load more never grows the card. */
.activity-scroll { position: relative; max-height: 18.5rem; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; }
.activity-scroll::-webkit-scrollbar { display: none; }
/* The activity card stretches with its row; Load more sits at the bottom. */
.panel-activity { display: flex; flex-direction: column; }
/* Load more: looks like the card's other links (a plain underlined link), centred at the bottom of the card. */
.load-more {
  display: block; margin: auto auto 0; padding: 0.75rem 0.5rem 0; border: 0; background: none;
  color: var(--focus); font: inherit; font-size: 0.8125rem; text-decoration: underline; text-underline-offset: 0.15em; cursor: pointer;
}
.load-more:hover { color: var(--accent); }
.load-more:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 0.25rem; }
.load-more:disabled { color: var(--muted); text-decoration: none; cursor: default; }
.span-2 { grid-column: span 2; }
.chart-help { margin: -0.25rem 0 0.5rem; }
.chart-ring { position: relative; }
.ring-center {
  position: absolute; left: 0; right: 0; top: 38%; transform: translateY(-50%);
  display: grid; justify-items: center; pointer-events: none;
}
.ring-center strong { font-size: 2rem; line-height: 1; letter-spacing: -0.02em; }
.ring-center span { font-size: 0.8125rem; color: var(--muted); }
.stat-of { font-size: 1rem; font-weight: 600; color: var(--muted); }
.legend .lg-line { width: 1rem; height: 0; border-top: 2px dashed var(--muted); border-radius: 0; }
.reasons { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.25rem; }
.reasons .chip { font-size: 0.75rem; padding: 0.125rem 0.5rem; }
.all-good { margin: 0; padding: 0.75rem; border-radius: 0.625rem; background: var(--success-bg); color: var(--success); font-size: 0.875rem; font-weight: 500; }
.pair { display: inline-flex; gap: 0.375rem; flex: none; }
.pair form { display: block; }
.pair .btn-small { height: 2rem; padding: 0 0.75rem; font-size: 0.8125rem; text-decoration: none; }
.mini-list li > span:first-child { min-width: 0; }
.panel-head .badge { margin-left: 0; animation: none; }

@media (max-width: 1280px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-dash { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-dash .span-2 { grid-column: span 2; }
  .field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Narrow windows (below 11" landscape): sidebar becomes a top bar. ---------- */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; height: auto; min-height: 100dvh; padding: 0; }
  .sidebar { border-radius: 0; border: 0; border-bottom: 1px solid var(--line); padding: 1rem; }
  .sidebar .brand { margin-bottom: 0.75rem; }
  .logout { margin-top: 0.75rem; display: flex; align-items: center; justify-content: space-between; }
  .logout button { width: auto; }
  .content { border-radius: 0; border: 0; padding: 1.5rem 1rem; overflow: visible; }
  .request { flex-direction: column; align-items: stretch; }
  .request-actions > form, .request-actions .confirm { flex: 1; }
  .request-actions > form button { width: 100%; }
  .btn-outline { width: 100%; justify-content: center; }
  .confirm form { left: 0; right: auto; width: min(16.25rem, calc(100vw - 2rem)); transform-origin: top left; }
  .grid-2, .grid-3, .grid-dash, .field-grid { grid-template-columns: 1fr; }
  .grid-dash .span-2 { grid-column: auto; }
  .mini-list li { flex-wrap: wrap; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 480px) {
  .card { padding: 2rem 1.375rem; border-radius: 1.25rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Reports: run rows open a side panel (public/panel.js) ---------- */
[data-run] { cursor: pointer; }
.run-link { color: var(--accent); }
.side-panel {
  position: fixed; inset: 0 0 0 auto; width: min(32rem, 100vw); max-width: 100vw; height: 100dvh; max-height: 100dvh;
  margin: 0; padding: 0; border: 0; border-left: 1px solid var(--line); border-radius: var(--radius) 0 0 var(--radius);
  background: var(--panel); color: var(--ink); box-shadow: var(--shadow-lg); overflow: hidden auto;
}
.side-panel[open] { animation: panel-in 0.3s var(--ease-out) both; }
.side-panel::backdrop { background: rgb(36 34 31 / 0.22); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.side-panel[open]::backdrop { animation: fade 0.25s ease-out both; }
@keyframes panel-in { from { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .side-panel[open], .side-panel[open]::backdrop { animation: none; } }
.side-panel-loading { padding: 1.5rem; }
.run-panel { padding: 1.5rem 1.5rem 2rem; }
.content .run-panel { max-width: 44rem; padding: 0; }
.run-panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.run-panel-kicker { margin: 0 0 0.25rem; font-size: 0.8125rem; font-weight: 600; color: var(--accent); }
.run-panel-title { margin: 0; font-size: 1.375rem; letter-spacing: -0.01em; }
.run-panel-close {
  flex: none; width: 2.25rem; height: 2.25rem; border: 1px solid var(--line); border-radius: 0.625rem;
  background: var(--card); color: var(--muted); font-size: 1.25rem; line-height: 1; cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.run-panel-close:hover { background: var(--accent-tint); color: var(--ink); }
.run-panel-section { padding: 1rem 0; border-top: 1px solid var(--line); }
.run-panel-section h3 { margin: 0 0 0.75rem; font-size: 0.9375rem; }
/* Heartbeat timeline: vertical connected nodes, newest on top; each node opens like an accordion. */
.beat-timeline { list-style: none; margin: 0.75rem 0 0; padding: 0; }
.beat-node { position: relative; padding-left: 1.75rem; }
.beat-node::before {                      /* connector to the next node */
  content: ""; position: absolute; left: calc(0.4375rem - 1px); top: 0; bottom: 0; width: 2px; background: var(--accent-tint-line);
}
.beat-node:first-child::before { top: 1.125rem; }
.beat-node:last-child::before { bottom: auto; height: 1.125rem; }
.beat-node:only-child::before { display: none; }
.beat-node summary {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.5rem 0.625rem; margin-left: -0.625rem;
  border-radius: 0.625rem; list-style: none; cursor: pointer; font-size: 0.875rem; transition: background 0.15s;
}
.beat-node summary::-webkit-details-marker { display: none; }
.beat-node summary:hover { background: var(--accent-tint); }
.beat-node summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.beat-node summary::before {              /* the node dot */
  content: ""; position: absolute; left: 0; top: 0.75rem; width: 0.875rem; height: 0.875rem; box-sizing: border-box;
  border: 2px solid var(--accent); border-radius: 50%; background: var(--panel); transition: background 0.15s;
}
.beat-node:first-child summary::before, .beat-node details[open] summary::before { background: var(--accent); }
.beat-node.has-issue summary::before { border-color: var(--warn); }
.beat-node summary::after {               /* chevron */
  content: ""; flex: none; width: 0.4rem; height: 0.4rem; border: solid var(--muted); border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg); transition: transform 0.2s var(--ease-out);
}
.beat-node details[open] summary::after { transform: rotate(-135deg); }
.beat-node time { font-weight: 650; font-variant-numeric: tabular-nums; }
.beat-meta { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.beat-facts {
  display: grid; grid-template-columns: max-content 1fr; gap: 0.375rem 1rem; margin: 0.125rem 0 0.75rem; padding: 0.75rem 0.875rem;
  border: 1px solid var(--line); border-radius: 0.75rem; background: var(--card); font-size: 0.8125rem;
}
.beat-node details[open] .beat-facts { animation: slide-in 0.2s var(--ease-out) both; }
.beat-facts dt { color: var(--muted); }
.beat-facts dd { margin: 0; }
.beat-gap { padding-top: 0.375rem; padding-bottom: 0.375rem; font-size: 0.8125rem; color: var(--warn); font-weight: 600; }
.beat-gap::before { background: none; border-left: 2px dashed var(--warn); width: 0; }
.beat-gap span::before {                  /* hollow warning node */
  content: ""; position: absolute; left: 0.1875rem; top: 50%; width: 0.5rem; height: 0.5rem; margin-top: -0.25rem;
  border-radius: 50%; background: var(--warn);
}
@media (prefers-reduced-motion: reduce) { .beat-node details[open] .beat-facts, .beat-node summary::after { animation: none; transition: none; } }
.table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- Enroll a phone: QR, or the direct APK link, centred ---------- */
.enroll-center { display: flex; flex-direction: column; align-items: center; }
.or-divider { display: flex; align-items: center; gap: 0.75rem; width: 100%; margin: 1.25rem 0; color: var(--muted); font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.08em; }
.or-divider::before, .or-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.apk-link { font-weight: 600; overflow-wrap: anywhere; text-align: center; }

/* "Not Device Owner" help: short steps, and a command that wraps inside the box and selects in one click. */
.owner-help p { margin: 0 0 0.5rem; }
.owner-help ol { margin: 0 0 0.5rem; padding-left: 1.25rem; display: grid; gap: 0.5rem; }
.owner-help a { color: inherit; font-weight: 600; }
.owner-help .cmd {
  display: block; margin-top: 0.375rem; padding: 0.5rem 0.625rem; border-radius: 0.5rem;
  background: var(--card); color: var(--ink); font-size: 0.75rem; line-height: 1.5;
  white-space: pre-wrap; overflow-wrap: anywhere; user-select: all;
}
