/* Kill theme chrome above the dashboard on mobile so the SPA sits flush
   with the top of the viewport (the shortcode tags <body> via the
   hp-ai-dashboard-page class filter). Scope all overrides to that class
   so we don't touch pages that don't host the shortcode. */
@media (max-width: 900px) {
  body.hp-ai-dashboard-page .entry-title,
  body.hp-ai-dashboard-page .page-title,
  body.hp-ai-dashboard-page .entry-header,
  body.hp-ai-dashboard-page .et_post_meta_wrapper { display: none !important; }
  body.hp-ai-dashboard-page .entry-content,
  body.hp-ai-dashboard-page article .entry-content,
  body.hp-ai-dashboard-page .et_pb_section:first-of-type,
  body.hp-ai-dashboard-page .et_pb_row:first-of-type,
  body.hp-ai-dashboard-page #main-content,
  body.hp-ai-dashboard-page #page,
  body.hp-ai-dashboard-page .site-content,
  body.hp-ai-dashboard-page main { padding-top: 0 !important; margin-top: 0 !important; }
}

/* HP AI Dashboard — dark theme matching the camera's detection-plot
   dashboard: deep indigo base with Acaris green accent, soft ambient
   radial glows, dark translucent cards. */
#hp-ai-dashboard-root {
  --hp-bg:          #060718;
  --hp-bg-soft:     #0b0e2b;
  --hp-surface:     rgba(16, 18, 52, 0.78);
  --hp-text:        #EDF9FF;
  --hp-muted:       #8890b8;
  --hp-faint:       #6a70a8;
  --hp-line:        rgba(42, 42, 130, 0.6);
  --hp-accent:      #00B488;
  --hp-accent-soft: rgba(0, 180, 136, 0.15);
  --hp-ink:         #060718;
  --hp-ok:          #00B488;
  --hp-warn:        #f4c430;
  --hp-err:         #b01e23;
  --hp-radius:      18px;
  --hp-radius-sm:   12px;
  --hp-pad:         18px;
  --hp-shadow:      0 4px 28px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.05);
  --hp-shadow-lg:   0 10px 40px rgba(0,0,0,0.6), 0 0 0 1px rgba(0,180,136,0.3), inset 0 1px 0 rgba(255,255,255,0.08);

  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--hp-text);
  background:
    radial-gradient(ellipse at 20% 20%, rgba(29,112,183,0.12) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 80%, rgba(0,180,136,0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 50% 50%, rgba(42,42,130,0.15) 0%, transparent 70%),
    var(--hp-bg);
  padding: 24px;
  border-radius: 24px;
  font-size: 14px;
  line-height: 1.45;
  box-shadow: inset 0 0 0 1px rgba(42,42,130,0.25);

  /* Crucial for narrow viewports: when the surrounding theme container
     is narrower than the dashboard's content, every flex/grid child
     would otherwise blow the layout out to the right (default min-width
     of grid/flex items is auto = content size). Constraining the root
     and adding min-width:0 to children below contains the overflow.
     Use `clip` not `hidden` — `overflow-x: hidden` implicitly promotes
     overflow-y to `auto` (per CSS spec), turning the root into a scroll
     container that on mobile steals touch-scroll from the page on
     content-heavy tabs like Quick Settings. `clip` hides the overflow
     without creating a scroll container. */
  box-sizing: border-box;
  max-width: 100%;
  overflow-x: clip;
}
#hp-ai-dashboard-root *,
#hp-ai-dashboard-root *::before,
#hp-ai-dashboard-root *::after { box-sizing: border-box; }

/* ---- light theme ----
   Flips the palette via CSS vars + tweaks a handful of hard-coded
   dark-only decorations. Toggled by the SPA via the .hp-theme-light
   class on #hp-ai-dashboard-root; default (no class) is the dark theme. */
#hp-ai-dashboard-root.hp-theme-light {
  --hp-bg:          #f2f5f9;
  --hp-bg-soft:     #e8edf4;
  --hp-surface:     #ffffff;
  --hp-text:        #111827;
  --hp-muted:       #475569;
  --hp-faint:       #64748b;
  --hp-line:        #e2e8f0;
  --hp-accent:      #00967a;
  --hp-accent-soft: rgba(0, 180, 136, 0.12);
  --hp-ink:         #0f172a;
  --hp-ok:          #059669;
  --hp-warn:        #b45309;
  --hp-err:         #b91c1c;
  --hp-shadow:      0 1px 2px rgba(15,23,42,0.04), 0 8px 24px rgba(15,23,42,0.06);
  --hp-shadow-lg:   0 2px 4px rgba(15,23,42,0.06), 0 14px 36px rgba(15,23,42,0.08), 0 0 0 1px rgba(0,180,136,0.2);
  background:
    radial-gradient(ellipse at 20% 20%, rgba(0,180,136,0.06) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 80%, rgba(29,112,183,0.05) 0%, transparent 60%),
    var(--hp-bg);
  box-shadow: inset 0 0 0 1px rgba(15,23,42,0.04);
}
/* Light-theme-specific overrides for decorations that use literal colors
   baked for the dark palette. */
#hp-ai-dashboard-root.hp-theme-light .hp-header-logo { box-shadow: 0 0 0 1px rgba(0,180,136,0.25), 0 0 10px rgba(0,180,136,0.15); }
#hp-ai-dashboard-root.hp-theme-light .hp-header-logout { background: #ffffff; color: var(--hp-text); border-color: var(--hp-line); }
#hp-ai-dashboard-root.hp-theme-light .hp-header-logout:hover { background: var(--hp-accent-soft); border-color: var(--hp-accent); box-shadow: 0 0 10px rgba(0,180,136,0.25); }
#hp-ai-dashboard-root.hp-theme-light .hp-pill-ok    { background: #d1fae5; color: #047857; }
#hp-ai-dashboard-root.hp-theme-light .hp-pill-warn  { background: #fef3c7; color: #b45309; }
#hp-ai-dashboard-root.hp-theme-light .hp-pill-err   { background: #fee2e2; color: #b91c1c; }
#hp-ai-dashboard-root.hp-theme-light .hp-pill-muted { background: #eef0f4; color: #475569; }
#hp-ai-dashboard-root.hp-theme-light .hp-quick-pill[data-state="saving"] { background: rgba(0,180,136,0.12); color: #047857; }
#hp-ai-dashboard-root.hp-theme-light .hp-quick-pill[data-state="saved"]  { background: #d1fae5; color: #047857; }
#hp-ai-dashboard-root.hp-theme-light .hp-quick-pill[data-state="error"]  { background: #fee2e2; color: #b91c1c; }
#hp-ai-dashboard-root.hp-theme-light .hp-quick-warning { background: #fef3c7; color: #92400e; }
#hp-ai-dashboard-root.hp-theme-light .hp-adminbar { background: #fef3c7; border-color: #fcd34d; }
#hp-ai-dashboard-root.hp-theme-light .hp-adminbar-done { background: #d1fae5; border-color: #6ee7b7; }
#hp-ai-dashboard-root.hp-theme-light .hp-adminbar-btn { color: #ffffff; }
#hp-ai-dashboard-root.hp-theme-light .hp-adminbar-btn-quiet { background: #ffffff; color: var(--hp-muted); border-color: var(--hp-line); }
#hp-ai-dashboard-root.hp-theme-light .hp-toggle-track { background: #cbd5e1; border-color: #e2e8f0; }
#hp-ai-dashboard-root.hp-theme-light .hp-text-input:disabled { background: #f8fafc; color: var(--hp-faint); }
#hp-ai-dashboard-root.hp-theme-light .hp-footer { border-top-color: var(--hp-line); }
#hp-ai-dashboard-root.hp-theme-light .hp-footer-logo { filter: none; opacity: 0.8; }
#hp-ai-dashboard-root.hp-theme-light .hp-horse-tile-offline { border-color: rgba(148,163,184,0.6); }
#hp-ai-dashboard-root.hp-theme-light .hp-detection-frame,
#hp-ai-dashboard-root.hp-theme-light .hp-settings-frame { background: #ffffff; }
#hp-ai-dashboard-root.hp-theme-light .hp-live-wrap { background: #0b1220; }
/* Messages bell — same 32px circular affordance as the theme/width toggles,
   with an unread counter pinned to its top-right corner. */
.hp-header-msg {
  position: relative;
  appearance: none; -webkit-appearance: none;
  width: 32px; height: 32px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--hp-line);
  background: rgba(42,42,130,0.35);
  color: var(--hp-text);
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.hp-header-msg:hover { background: var(--hp-accent-soft); border-color: var(--hp-accent); color: var(--hp-accent); }
.hp-header-msg-unread { border-color: var(--hp-accent); color: var(--hp-accent); }
.hp-header-msg-badge {
  position: absolute;
  top: -5px; right: -5px;
  min-width: 17px; height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--hp-err);
  color: #fff;
  font: 700 10px/17px system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  text-align: center;
  box-shadow: 0 0 0 2px var(--hp-bg);
  pointer-events: none;
}
.hp-header-msg-badge.hp-hidden { display: none; }
#hp-ai-dashboard-root.hp-theme-light .hp-header-msg { background: #ffffff; }

/* Help "?" icon — same 32 px circular affordance as the bell / theme /
   width buttons. On /hp-help/ this element becomes a "back" arrow, so
   we share the base styling. */
.hp-header-help {
  appearance: none; -webkit-appearance: none;
  width: 32px; height: 32px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--hp-line);
  background: rgba(42,42,130,0.35);
  color: var(--hp-text);
  text-decoration: none;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 14px; font-weight: 600;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.hp-header-help:hover { background: var(--hp-accent-soft); border-color: var(--hp-accent); color: var(--hp-accent); }
#hp-ai-dashboard-root.hp-theme-light .hp-header-help { background: #ffffff; }

/* Language selector — pill-shaped <select> so it visually reads as part
   of the same button row as bell/help/theme. On mobile widths (≤ 480 px)
   the header collapses so the width toggle hides and this stays visible. */
.hp-header-lang {
  appearance: none; -webkit-appearance: none;
  height: 32px;
  padding: 0 24px 0 12px;
  border-radius: 999px;
  border: 1px solid var(--hp-line);
  background: rgba(42,42,130,0.35) no-repeat right 8px center /
              14px 14px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='%23fff' d='M2 4l4 4 4-4z'/%3E%3C/svg%3E");
  color: var(--hp-text);
  font: 600 12.5px system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  letter-spacing: 0.02em;
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.hp-header-lang:hover { border-color: var(--hp-accent); color: var(--hp-accent); }
.hp-header-lang:focus { outline: none; border-color: var(--hp-accent); box-shadow: 0 0 0 3px var(--hp-accent-soft); }
#hp-ai-dashboard-root.hp-theme-light .hp-header-lang {
  background-color: #ffffff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='%23111' d='M2 4l4 4 4-4z'/%3E%3C/svg%3E");
}

/* Toggle button inline with the logout pill. */
.hp-header-theme-toggle {
  appearance: none; -webkit-appearance: none;
  width: 32px; height: 32px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--hp-line);
  background: rgba(42,42,130,0.35);
  color: var(--hp-text);
  font-size: 14px; line-height: 1;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}
.hp-header-theme-toggle:hover { background: var(--hp-accent-soft); border-color: var(--hp-accent); transform: rotate(-12deg); }
#hp-ai-dashboard-root.hp-theme-light .hp-header-theme-toggle { background: #ffffff; }
/* Width toggle — same shape as the theme toggle; sits to the left of it.
   Hidden on mobile where the dashboard is already edge-to-edge. */
.hp-header-width-toggle {
  appearance: none; -webkit-appearance: none;
  height: 32px; min-width: 32px; padding: 0 8px; border-radius: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--hp-line);
  background: rgba(42,42,130,0.35);
  color: var(--hp-text);
  font-size: 14px; line-height: 1;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.hp-header-width-toggle:hover { background: var(--hp-accent-soft); border-color: var(--hp-accent); }
#hp-ai-dashboard-root.hp-theme-light .hp-header-width-toggle { background: #ffffff; }
@media (max-width: 900px) { .hp-header-width-toggle { display: none; } }

/* Full-width mode — escape the WP theme's content container so the
   dashboard fills the viewport. Scoped to body.hp-ai-dashboard-fullwidth
   so non-dashboard pages and the narrow default are untouched. The
   `calc(50% - 50vw)` margins pull each ancestor wrapper out to the
   viewport edges regardless of its own max-width cap, without needing
   JS to walk the DOM. */
body.hp-ai-dashboard-fullwidth #hp-ai-dashboard-root { max-width: 100vw; }
body.hp-ai-dashboard-fullwidth .entry-content,
body.hp-ai-dashboard-fullwidth article .entry-content,
body.hp-ai-dashboard-fullwidth .et_pb_row,
body.hp-ai-dashboard-fullwidth .et_pb_section,
body.hp-ai-dashboard-fullwidth #main-content,
body.hp-ai-dashboard-fullwidth .site-content,
body.hp-ai-dashboard-fullwidth main {
  max-width: 100vw !important;
  width: 100vw !important;
  margin-left: calc(50% - 50vw) !important;
  margin-right: calc(50% - 50vw) !important;
  padding-left: 16px !important;
  padding-right: 16px !important;
}

/* ---- brand header (logo + logout) ---- */
.hp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 2px 0;
  min-height: 44px;
}
.hp-header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.hp-header-logo {
  width: 32px; height: 32px;
  border-radius: 8px;
  box-shadow: 0 0 0 1px rgba(0,180,136,0.25), 0 0 18px rgba(0,180,136,0.18);
  object-fit: cover;
  flex-shrink: 0;
}
.hp-header-brandname {
  font: 700 15px/1 'Inter', system-ui, sans-serif;
  letter-spacing: 0.12em;
  color: var(--hp-text);
  text-transform: uppercase;
}
.hp-header-user {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.hp-header-username {
  font-size: 12px;
  color: var(--hp-muted);
  max-width: 22ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hp-header-logout {
  font: 600 11px/1 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 7px 12px;
  border-radius: 999px;
  color: var(--hp-text);
  background: rgba(42,42,130,0.5);
  border: 1px solid var(--hp-line);
  text-decoration: none;
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
  white-space: nowrap;
}
.hp-header-logout:hover {
  background: var(--hp-accent-soft);
  border-color: var(--hp-accent);
  box-shadow: 0 0 10px rgba(0,180,136,0.25);
}

/* ---- brand footer ---- */
.hp-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 22px 16px 10px;
  margin-top: 12px;
  border-top: 1px solid rgba(42,42,130,0.3);
  color: var(--hp-faint);
  font-size: 11px;
  letter-spacing: 0.04em;
}
.hp-footer-logo {
  height: 18px;
  width: auto;
  opacity: 0.7;
  filter: brightness(1.3) saturate(0.8);
}
.hp-footer-text { white-space: nowrap; }
.hp-footer-switch {
  font: 600 11px/1 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--hp-text);
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--hp-line);
  background: rgba(42,42,130,0.3);
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.hp-footer-switch:hover {
  background: var(--hp-accent-soft);
  border-color: var(--hp-accent);
  box-shadow: 0 0 10px rgba(0,180,136,0.25);
}
#hp-ai-dashboard-root.hp-theme-light .hp-footer-switch { background: #ffffff; }

/* Grid + every direct child: hand-clamp to the available column width */
.hp-shell { display: grid; gap: 18px; min-width: 0; max-width: 100%; }
.hp-shell > * { min-width: 0; max-width: 100%; }
.hp-row   { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; min-width: 0; }
.hp-muted { color: var(--hp-muted); }
.hp-error { color: var(--hp-err); }

/* ---- cards ---- */
.hp-card {
  background: var(--hp-surface);
  border: 0;
  border-radius: var(--hp-radius);
  padding: 20px;
  box-shadow: var(--hp-shadow);
  transition: box-shadow .15s ease, transform .15s ease;
}
.hp-card h3 {
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--hp-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ---- admin bar: open cam has no tile in the picker ---- */
/* Sits between the header and the picker. Amber by default (an action is
   waiting), green once the cam has been added. Admins only — the SPA
   never builds it for anyone else. */
.hp-adminbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  width: 100%;
  min-width: 0;
  padding: 10px 14px;
  border-radius: var(--hp-radius-sm);
  border: 1px solid rgba(244,196,48,0.42);
  background: rgba(244,196,48,0.10);
}
.hp-adminbar.hp-hidden { display: none; }
.hp-adminbar-done {
  border-color: rgba(0,180,136,0.45);
  background: rgba(0,180,136,0.10);
}
.hp-adminbar-msg {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  flex: 1 1 240px;
}
.hp-adminbar-icon { color: var(--hp-warn); font-size: 14px; line-height: 1; flex-shrink: 0; }
.hp-adminbar-done .hp-adminbar-icon { color: var(--hp-ok); }
.hp-adminbar-text { font-size: 13px; font-weight: 500; color: var(--hp-text); }
.hp-adminbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.hp-adminbar-days {
  appearance: none; -webkit-appearance: none;
  font: 600 11px/1 system-ui, sans-serif;
  padding: 7px 28px 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--hp-line);
  background: var(--hp-surface) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'><path d='M2 4l4 4 4-4' stroke='%238890b8' stroke-width='1.5' fill='none' stroke-linecap='round'/></svg>") no-repeat right 10px center;
  color: var(--hp-text);
  cursor: pointer;
}
.hp-adminbar-btn {
  appearance: none; -webkit-appearance: none;
  font: 700 11px/1 system-ui, sans-serif;
  letter-spacing: 0.03em;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--hp-accent);
  background: var(--hp-accent);
  color: var(--hp-ink);
  cursor: pointer;
  transition: filter .15s ease, opacity .15s ease;
}
.hp-adminbar-btn:hover:not(:disabled) { filter: brightness(1.1); }
.hp-adminbar-btn:disabled { opacity: 0.6; cursor: default; }
.hp-adminbar-btn-quiet {
  background: transparent;
  border-color: var(--hp-line);
  color: var(--hp-muted);
}
.hp-adminbar-btn-quiet:hover:not(:disabled) { color: var(--hp-text); border-color: var(--hp-accent); }
.hp-adminbar-note { font-size: 11px; color: var(--hp-err); }
@media (max-width: 640px) {
  .hp-adminbar-actions { flex: 1 1 100%; }
  .hp-adminbar-btn { flex: 1 1 auto; }
}

/* ---- horse picker (single flattened strip) ---- */
.hp-picker { gap: 10px; flex-wrap: wrap; width: 100%; min-width: 0; flex-direction: column; align-items: stretch; }

/* Summary bar — total + tappable chips for Alarms / Offline counts. */
.hp-picker-summary {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 0 2px;
}
.hp-picker-chip {
  appearance: none; -webkit-appearance: none;
  display: inline-flex; align-items: center; gap: 6px;
  font: 600 11px/1 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  letter-spacing: 0.03em;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--hp-line);
  background: var(--hp-surface);
  color: var(--hp-muted);
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.hp-picker-chip:hover { color: var(--hp-text); border-color: var(--hp-accent); }
.hp-picker-chip-active {
  background: var(--hp-accent-soft);
  border-color: var(--hp-accent);
  color: var(--hp-text);
}
.hp-picker-chip-label { text-transform: uppercase; }
.hp-picker-chip-count {
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(42,42,130,0.35);
  color: var(--hp-text);
  min-width: 18px; text-align: center;
}
.hp-picker-chip-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.hp-picker-chip-dot.hp-picker-chip-alarm   { background: var(--hp-err); box-shadow: 0 0 6px rgba(176,30,35,0.5); }
.hp-picker-chip-dot.hp-picker-chip-offline { background: var(--hp-faint); }
.hp-picker-chip-tone-alarm   { border-color: rgba(176,30,35,0.4); }
.hp-picker-chip-tone-alarm.hp-picker-chip-active   { background: rgba(176,30,35,0.14); border-color: var(--hp-err); }
.hp-picker-chip-tone-offline { border-color: rgba(100,116,139,0.4); }
.hp-picker-chip-tone-offline.hp-picker-chip-active { background: rgba(100,116,139,0.15); border-color: rgba(148,163,184,0.7); }

/* Tools row — search box + sort menu, only shown at 8+ guards. */
.hp-picker-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 2px;
}
.hp-picker-search {
  flex: 1;
  min-width: 0;
  font: 500 13px/1 system-ui, sans-serif;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--hp-line);
  background: var(--hp-surface);
  color: var(--hp-text);
}
.hp-picker-search:focus { outline: 0; border-color: var(--hp-accent); box-shadow: 0 0 0 3px var(--hp-accent-soft); }
.hp-picker-sort {
  appearance: none; -webkit-appearance: none;
  font: 600 11px/1 system-ui, sans-serif;
  padding: 7px 28px 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--hp-line);
  background: var(--hp-surface) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'><path d='M2 4l4 4 4-4' stroke='%238890b8' stroke-width='1.5' fill='none' stroke-linecap='round'/></svg>") no-repeat right 10px center;
  color: var(--hp-text);
  cursor: pointer;
}
.hp-horse-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 2px;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}
.hp-horse-row::-webkit-scrollbar { height: 6px; }
.hp-horse-row::-webkit-scrollbar-thumb { background: var(--hp-line); border-radius: 999px; }

.hp-horse-tile {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--hp-surface);
  border: 1px solid var(--hp-line);
  border-radius: 999px;
  padding: 4px 14px 4px 4px;
  box-shadow: var(--hp-shadow);
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease, background .15s ease;
  min-width: 0;
}
.hp-horse-tile:hover {
  transform: translateY(-1px);
  box-shadow: var(--hp-shadow-lg);
}

/* State: online — subtle green border tint (default, when no alarm). */
.hp-horse-tile-online {
  border-color: rgba(0,180,136,0.35);
  box-shadow: 0 0 10px rgba(0,180,136,0.12), var(--hp-shadow);
}
.hp-horse-tile-online:hover {
  border-color: rgba(0,180,136,0.55);
  box-shadow: 0 0 14px rgba(0,180,136,0.25);
}

/* State: offline — desaturated and dim so it recedes visually. */
.hp-horse-tile-offline {
  opacity: 0.55;
  filter: grayscale(0.85);
  border-color: rgba(100,116,139,0.35);
}
.hp-horse-tile-offline:hover { opacity: 0.8; filter: grayscale(0.4); }

/* State: alarm — red glow with a gentle pulse to draw attention. */
.hp-horse-tile-alarm {
  border-color: var(--hp-err);
  background: rgba(176,30,35,0.12);
  box-shadow: 0 0 0 1px rgba(176,30,35,0.5), 0 0 16px rgba(176,30,35,0.45);
  animation: hp-tile-alarm-pulse 1.8s ease-in-out infinite;
}
@keyframes hp-tile-alarm-pulse {
  0%, 100% { box-shadow: 0 0 0 1px rgba(176,30,35,0.5),  0 0 16px rgba(176,30,35,0.45); }
  50%      { box-shadow: 0 0 0 1px rgba(176,30,35,0.75), 0 0 26px rgba(176,30,35,0.7);  }
}

/* Selected tile — green outline wins over the state tint so it's clear
   which tile is currently active; alarm still pulses on top. */
.hp-horse-tile-active {
  border-color: var(--hp-accent);
  background: var(--hp-accent-soft);
  box-shadow: 0 0 0 2px rgba(0,180,136,0.55), 0 0 18px rgba(0,180,136,0.3);
}
.hp-horse-tile-active.hp-horse-tile-offline { opacity: 1; filter: none; }

.hp-horse-tile:focus-visible { border-color: var(--hp-accent); outline: 0; }

/* Category accent — thin coloured left edge on the tile so the three
   sources (owned / shared / care) stay distinguishable without a
   separate heading. Owned uses accent green (default & most common);
   shared uses brand blue; care uses amber. */
.hp-horse-tile-cat-owned       { border-left: 3px solid rgba(0,180,136,0.55); }
.hp-horse-tile-cat-shared      { border-left: 3px solid rgba(29,112,183,0.7); }
.hp-horse-tile-cat-specialCare { border-left: 3px solid rgba(244,196,48,0.75); }
/* Let the active/alarm border still read clearly: keep the left edge
   pronounced on those, but match the overall border colour when active. */
.hp-horse-tile-active { border-left-color: var(--hp-accent); }
.hp-horse-tile-alarm  { border-left-color: var(--hp-err); }

.hp-horse-avatar {
  position: relative;
  flex: 0 0 auto;
  width: 32px; height: 32px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  background-color: var(--hp-line);
}
.hp-horse-dot {
  position: absolute;
  bottom: -2px; right: -2px;
  width: 12px; height: 12px;
  border-radius: 50%;
  border: 2px solid var(--hp-surface);
  box-sizing: border-box;
}
.hp-horse-tile-active .hp-horse-dot { border-color: var(--hp-accent-soft); }
.hp-dot-on    { background: var(--hp-ok);  }
.hp-dot-off   { background: var(--hp-faint); }
.hp-dot-alarm {
  background: var(--hp-err);
  box-shadow: 0 0 0 2px rgba(176,30,35,0.3);
  animation: hp-dot-alarm-pulse 1.2s ease-in-out infinite;
}
@keyframes hp-dot-alarm-pulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(176,30,35,0.3); }
  50%      { box-shadow: 0 0 0 5px rgba(176,30,35,0.15); }
}

.hp-horse-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 180px;
  line-height: 1.1;
}
.hp-horse-tile .hp-horse-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--hp-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hp-horse-id {
  font-size: 10.5px;
  color: var(--hp-faint);
  font-weight: 500;
  letter-spacing: 0.04em;
  margin-top: 2px;
}

/* ---- tabs (pill bar like the Dribbble nav) ----
   Always a real (block) flex container with overflow-x:auto so it never
   blows out the grid track on narrow viewports. Hide the scrollbar but
   keep the swipe ability. align-self lets it stay start-aligned within
   the parent grid cell. */
.hp-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 2px;
  padding: 4px;
  background: var(--hp-surface);
  border-radius: 999px;
  border: 0;
  box-shadow: var(--hp-shadow);
  align-self: flex-start;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.hp-tabs::-webkit-scrollbar { display: none; }
.hp-tab {
  padding: 9px 18px;
  cursor: pointer;
  border: 0;
  border-radius: 999px;
  color: var(--hp-muted);
  font-size: 13px;
  font-weight: 500;
  transition: background .15s ease, color .15s ease;
  white-space: nowrap;
  flex-shrink: 0;
}
.hp-tab:hover { color: var(--hp-text); }
.hp-tab.active {
  background: linear-gradient(135deg, #00B488, #00967a);
  color: #ffffff;
  box-shadow: 0 0 10px rgba(0,180,136,0.35);
}
.hp-tab-body { padding-top: 4px; }

/* ---- status row ---- */
.hp-status-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items: stretch;
}
.hp-status-row > .hp-card {
  height: 280px;
  padding: 22px;
  display: flex;
  flex-direction: column;
}

/* Left: status card */
.hp-status-grid {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 18px;
  align-items: start;
}
.hp-avatar {
  width: 80px; height: 80px; border-radius: 22px;
  background-size: cover; background-position: center;
  background-color: var(--hp-accent-soft);
  box-shadow: inset 0 0 0 1px rgba(15,23,42,0.04);
}
.hp-status-meta { min-width: 0; }
.hp-status-meta h3 {
  margin: 2px 0 14px;
  font-size: 22px;
  font-weight: 700;
  color: var(--hp-text);
  text-transform: none;
  letter-spacing: -0.01em;
  line-height: 1.15;
}
.hp-status-meta dl {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 8px 14px;
  margin: 0;
  font-size: 13px;
}
.hp-status-meta dt {
  color: var(--hp-faint);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 11px;
  align-self: center;
}
.hp-status-meta dd { margin: 0; }

/* Right: overview chart card. Hide the shortcode's own h5 + container chrome
   so we don't double-title. Constrain canvas so Chart.js stops growing.
   For foal-mode horses (3 charts) we render a switcher row in the header. */
.hp-overview-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 8px;
}
.hp-overview-head h3 { margin: 0; }
.hp-overview-switcher {
  display: inline-flex;
  background: var(--hp-line);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.hp-overview-tab {
  appearance: none; -webkit-appearance: none;
  border: 0; background: transparent;
  color: var(--hp-muted);
  font: 600 11px/1 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.hp-overview-tab:hover { color: var(--hp-text); }
.hp-overview-tab.hp-active {
  background: linear-gradient(135deg, #00B488, #00967a);
  color: #ffffff;
  box-shadow: 0 0 8px rgba(0,180,136,0.3);
}
.hp-overview-inner { flex: 1; display: flex; flex-direction: column; min-height: 0; position: relative; }
.hp-overview-inner .horse_status_main_top_title,
.hp-overview-inner .horse_status_main { display: none; }
.hp-overview-inner .horse_status_main_container { margin: 0; }
.hp-overview-inner h5 {
  margin: 0 0 4px;
  font-size: 11px; font-weight: 600;
  color: var(--hp-faint);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.hp-overview-panel {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
}
.hp-overview-panel-hidden { display: none !important; }
.hp-overview-inner canvas {
  width: 100% !important;
  height: 100% !important;
  max-height: 220px;
  flex: 1;
}

/* ---- pills ---- */
.hp-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.hp-pill::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.8;
}
.hp-pill-ok    { background: rgba(0,180,136,0.15);  color: #5ee2b4; }
.hp-pill-warn  { background: rgba(244,196,48,0.15); color: #ffe48a; }
.hp-pill-err   { background: rgba(176,30,35,0.22);  color: #ff9ca0; }
.hp-pill-muted { background: rgba(42,42,130,0.35);  color: var(--hp-muted); }

/* ---- date picker ---- */
.hp-dates {
  display: flex; gap: 10px; align-items: center; margin-bottom: 16px;
}
.hp-dates label { color: var(--hp-muted); font-size: 13px; }
.hp-dates select {
  appearance: none;
  -webkit-appearance: none;
  padding: 8px 32px 8px 12px;
  border-radius: 10px;
  border: 0;
  background: var(--hp-surface) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M2 4l4 4 4-4' stroke='%2364748b' stroke-width='1.5' fill='none' stroke-linecap='round'/></svg>") no-repeat right 10px center;
  font-family: inherit;
  font-size: 13px;
  color: var(--hp-text);
  box-shadow: var(--hp-shadow);
  cursor: pointer;
}

/* ---- videos grid ---- */
.hp-hour-block { margin-bottom: 22px; }
.hp-hour-head {
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--hp-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.hp-hour-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 12px;
}
.hp-video-item {
  position: relative;
  display: block;
  border-radius: var(--hp-radius-sm);
  overflow: hidden;
  background: #0b1220;
  aspect-ratio: 16 / 9;
  text-decoration: none;
  box-shadow: var(--hp-shadow);
  transition: transform .15s ease, box-shadow .15s ease;
}
.hp-video-item:hover { transform: translateY(-2px); box-shadow: var(--hp-shadow-lg); }
.hp-video-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hp-video-item .hp-time {
  position: absolute; right: 8px; bottom: 8px;
  background: rgba(15,23,42,0.7);
  color: #fff;
  padding: 3px 8px; border-radius: 999px; font-size: 11px;
  font-weight: 600; letter-spacing: 0.02em;
  backdrop-filter: blur(4px);
}
.hp-empty {
  text-align: center;
  color: var(--hp-muted);
  padding: 32px 12px;
  font-size: 13px;
}

/* ---- live activity freshness chip (status card) ---- */
.hp-status-activity-time {
  margin-left: 8px;
  font: 500 11px/1.1 system-ui, sans-serif;
  color: var(--hp-faint);
  white-space: nowrap;
}
.hp-status-activity-time.hp-stale { color: #b45309; }

/* ---- live preview tile ---- */
.hp-live-card { padding: 22px; }
.hp-live-card h3 { margin-bottom: 14px; }
.hp-live-wrap {
  position: relative;
  width: 100%;
  max-width: none;
  aspect-ratio: 16 / 9;
  background: #0b1220;
  border-radius: var(--hp-radius-sm);
  overflow: hidden;
  box-shadow: var(--hp-shadow);
}
.hp-live-mjpeg,
.hp-live-webrtc,
.hp-live-frozen { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
.hp-live-webrtc { position: absolute; inset: 0; }
.hp-live-stopped .hp-live-webrtc { filter: brightness(0.55); }
.hp-live-error .hp-live-webrtc { /* keep visible; webrtc may have recovered */ }
.hp-live-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  gap: 14px;
  background: linear-gradient(180deg, rgba(0,0,0,0.0) 55%, rgba(0,0,0,0.55) 100%);
  color: #fff;
  text-align: center;
  transition: background .2s ease;
}
.hp-live-wrap:not(.hp-live-streaming):hover .hp-live-overlay,
.hp-live-stopped .hp-live-overlay { background: rgba(8,12,28,0.55); }
.hp-live-error .hp-live-overlay { background: #1f2937; }
.hp-live-stopped .hp-live-mjpeg { filter: brightness(0.55); }
.hp-live-error .hp-live-mjpeg { display: none; }

/* While streaming: no overlay dim — the image plays clean. Buttons still
   appear on hover (handled below). */
.hp-live-streaming .hp-live-overlay { background: transparent; }

/* Action cluster — hover-revealed regardless of stream state so the
   operator can stop a live stream or toggle fullscreen at any time. */
.hp-live-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease;
}
.hp-live-wrap:hover .hp-live-actions,
.hp-live-wrap:focus-within .hp-live-actions,
.hp-live-stopped .hp-live-actions,
.hp-live-error  .hp-live-actions { opacity: 1; pointer-events: auto; }

.hp-live-action {
  appearance: none; -webkit-appearance: none;
  border: 0;
  font-family: inherit;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.hp-live-action:hover { transform: translateY(-1px); }

/* Shared circular pill — same dimensions for both action buttons. */
.hp-live-toggle, .hp-live-fs {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.95);
  color: #0b1220;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  font-size: 18px; line-height: 1;
}
.hp-live-toggle:hover, .hp-live-fs:hover {
  box-shadow: 0 12px 32px rgba(0,0,0,0.45), 0 0 0 3px rgba(255,255,255,0.15);
}
.hp-live-toggle-icon::before { content: '\25A0'; font-size: 16px; }     /* ■ when running */
.hp-live-stopped .hp-live-toggle-icon::before { content: '\25B6'; margin-left: 2px; }  /* ▶ when stopped */
.hp-live-fs-icon { font-size: 20px; }

/* Activity tile under the Live view — three panels (heatmap | trail |
   meta) instead of the multicam grid's two. Sits flush under the 16:9
   stream with a small gap. Not interactive here (the user is already on
   the status tab — no jump-target). */
.hp-live-card > .hp-live-activity {
  margin-top: 10px;
  width: 100%;
  max-width: none;
  cursor: default;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.2fr) minmax(150px, 1fr);
}
.hp-live-card > .hp-live-activity:hover { border-color: var(--hp-tile-border, var(--hp-line)); }

/* Trail panel — same shell as .hp-activity-map so the row reads as one. */
.hp-activity-trail {
  position: relative;
  border-radius: 4px;
  overflow: hidden;
  background: var(--hp-heat-bg, #080810);
  min-width: 0;
}
.hp-activity-trail canvas { display: block; width: 100%; height: auto; }
/* Trail panel label reuses .hp-activity-map-label styling via shared class. */

/* Fullscreen PiP overlays — visible ONLY when the wrap is fullscreened
   (toggled via the .hp-live-fullscreen class set by the JS fullscreenchange
   listener, plus the native :fullscreen pseudo for redundancy). */
.hp-live-pip {
  display: none;
  position: absolute;
  bottom: 10px;
  width: 160px;
  height: 90px;
  border-radius: 6px;
  background: #000;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  z-index: 6;
  pointer-events: none;
}
.hp-live-pip-heatmap { right: 10px;  }
.hp-live-pip-trail   { right: 180px; }
.hp-live-wrap.hp-live-fullscreen .hp-live-pip,
.hp-live-wrap:fullscreen .hp-live-pip,
.hp-live-wrap:-webkit-full-screen .hp-live-pip { display: block; }

/* ↔ toggle — bottom-right corner above the PiPs. Only visible in
   fullscreen (same condition as the PiPs themselves). */
.hp-live-pip-toggle {
  display: none;
  position: absolute;
  bottom: 110px;
  right: 10px;
  width: 28px; height: 28px;
  border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: #0b1220;
  font-size: 14px; line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  z-index: 7;
}
.hp-live-wrap.hp-live-fullscreen .hp-live-pip-toggle,
.hp-live-wrap:fullscreen .hp-live-pip-toggle,
.hp-live-wrap:-webkit-full-screen .hp-live-pip-toggle { display: block; }

/* Left mode — flip PiPs + toggle to the bottom-left corner. */
.hp-live-wrap.hp-pip-left .hp-live-pip-heatmap { right: auto; left: 10px;  }
.hp-live-wrap.hp-pip-left .hp-live-pip-trail   { right: auto; left: 180px; }
.hp-live-wrap.hp-pip-left .hp-live-pip-toggle  { right: auto; left: 10px;  }

/* Mobile: stack the activity tile as a vertical column instead of three
   side-by-side panels (160px-wide cells are too cramped for canvases). */
@media (max-width: 640px) {
  .hp-live-card > .hp-live-activity { grid-template-columns: 1fr; }
  .hp-live-pip-heatmap { right: 8px;  width: 120px; height: 68px; }
  .hp-live-pip-trail   { right: 136px; width: 120px; height: 68px; }
  .hp-live-pip-toggle  { bottom: 86px; }
  .hp-live-wrap.hp-pip-left .hp-live-pip-heatmap { right: auto; left: 8px;  }
  .hp-live-wrap.hp-pip-left .hp-live-pip-trail   { right: auto; left: 136px; }
}

/* Wrap goes fullscreen when the user hits the ⛶ button — render the
   media flush to the viewport edges and let the actions/badge float on top. */
.hp-live-wrap:fullscreen,
.hp-live-wrap:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  max-width: none;
  aspect-ratio: auto;
  background: #000;
}
.hp-live-wrap:fullscreen .hp-live-mjpeg,
.hp-live-wrap:fullscreen .hp-live-webrtc,
.hp-live-wrap:-webkit-full-screen .hp-live-mjpeg,
.hp-live-wrap:-webkit-full-screen .hp-live-webrtc {
  object-fit: contain;
}

/* ---- centered iframe overlay ---- */
body.hp-overlay-open { overflow: hidden; }
.hp-overlay {
  position: fixed; inset: 0;
  background: rgba(8,12,28,0.78);
  z-index: 99999;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  backdrop-filter: blur(6px);
}
.hp-overlay[hidden] { display: none; }
.hp-overlay-inner {
  position: relative;
  width: 95vw; height: 90vh;
  background: #0b1220;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,0.5);
}
.hp-overlay-iframe { width: 100%; height: 100%; border: 0; display: block; }
.hp-overlay-close {
  position: absolute; top: 12px; right: 16px;
  z-index: 2;
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 0;
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-size: 22px; line-height: 1;
  cursor: pointer;
  transition: background .15s ease;
}
.hp-overlay-close:hover { background: rgba(255,255,255,0.25); }
.hp-overlay-spinner {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; color: #fff; background: #0b1220;
  transition: opacity .35s ease; pointer-events: none;
}
.hp-overlay-spinner.hp-fade-out { opacity: 0; }
.hp-spin {
  width: 52px; height: 52px;
  border: 4px solid rgba(255,255,255,0.12);
  border-top-color: var(--hp-accent);
  border-radius: 50%;
  animation: hp-spin 0.9s linear infinite;
}
.hp-spin-text { font-size: 13px; color: rgba(255,255,255,0.75); }
@keyframes hp-spin { to { transform: rotate(360deg); } }

/* ---- shortcode section tabs (Images / Reports / Monitors) ---- */
.hp-section-card { padding: 18px; }
.hp-section-inner { font-size: 14px; }
.hp-section-inner img { max-width: 100%; height: auto; }
.hp-section-inner canvas { max-width: 100%; }

/* ---- Quick Settings tab ---- */
.hp-quick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--hp-pad);
}
.hp-quick-card { padding: 22px; min-height: 180px; }
.hp-quick-card-wide { grid-column: 1 / -1; }
.hp-quick-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 6px;
}
.hp-quick-head h3 {
  margin: 0; text-transform: none; letter-spacing: 0;
  font-size: 15px; font-weight: 700; color: var(--hp-text);
}
.hp-quick-pill {
  font: 600 11px/1 system-ui, sans-serif;
  padding: 5px 10px; border-radius: 999px;
  background: transparent; color: transparent;
  transition: background .15s ease, color .15s ease;
  min-height: 22px; min-width: 0;
}
.hp-quick-pill[data-state="saving"] { background: rgba(29,112,183,0.18); color: #7fb8e8; }
.hp-quick-pill[data-state="saved"]  { background: rgba(0,180,136,0.18); color: #5ee2b4; }
.hp-quick-pill[data-state="error"]  { background: rgba(176,30,35,0.22); color: #ff9ca0; }
.hp-quick-hint {
  position: relative;
  margin: 6px 0 16px;
  padding: 10px 12px 10px 36px;
  color: var(--hp-text);
  background: linear-gradient(180deg, rgba(0,180,136,0.08) 0%, rgba(0,180,136,0.03) 100%);
  border: 1px solid rgba(0,180,136,0.22);
  border-left: 3px solid var(--hp-accent);
  border-radius: 10px;
  font-size: 12.5px;
  line-height: 1.55;
}
.hp-quick-hint::before {
  content: 'i';
  position: absolute;
  left: 10px; top: 11px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--hp-accent);
  color: #fff;
  font: 700 11px/16px 'Times New Roman', serif;
  text-align: center;
  font-style: italic;
}
.hp-quick-subtitle {
  font: 600 11px/1.2 system-ui, sans-serif;
  color: var(--hp-faint);
  text-transform: uppercase; letter-spacing: 0.06em;
  margin: 4px 0 8px;
}

/* Modern toggle (iOS-style) */
.hp-toggle {
  display: inline-flex; align-items: center; gap: 12px;
  cursor: pointer; user-select: none;
  margin: 4px 0 14px;
}
.hp-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.hp-toggle-track {
  position: relative;
  width: 42px; height: 24px;
  background: rgba(42,42,130,0.6); border-radius: 999px;
  transition: background .2s ease;
  flex-shrink: 0;
  border: 1px solid rgba(42,42,130,0.8);
}
.hp-toggle-knob {
  position: absolute; top: 2px; left: 2px;
  width: 20px; height: 20px;
  background: #fff; border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  transition: transform .2s ease;
}
.hp-toggle input:checked + .hp-toggle-track { background: var(--hp-accent); }
.hp-toggle input:checked + .hp-toggle-track .hp-toggle-knob { transform: translateX(18px); }
.hp-toggle-label { font-size: 13px; font-weight: 600; color: var(--hp-text); }

/* Pill button group (segmented control) */
.hp-pill-group {
  display: inline-flex;
  background: var(--hp-line);
  border-radius: 999px;
  padding: 4px;
  gap: 2px;
  margin: 0 0 4px;
}
.hp-pill-group-2,
.hp-pill-group-3,
.hp-pill-group-4 { display: flex; }
.hp-pill-group-2 .hp-pill-btn { flex: 1 1 0; }
.hp-pill-btn {
  appearance: none; -webkit-appearance: none;
  border: 0; background: transparent;
  color: var(--hp-muted);
  font: 600 12px/1 system-ui, sans-serif;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
  flex: 1;
  white-space: nowrap;
}
.hp-pill-btn:hover { color: var(--hp-text); }
.hp-pill-btn.hp-active {
  background: linear-gradient(135deg, #00B488, #00967a);
  color: #ffffff;
  box-shadow: 0 0 10px rgba(0,180,136,0.35);
}
.hp-pill-btn.hp-pill-warn.hp-active {
  background: linear-gradient(135deg, #b01e23, #8a181d);
  color: #ffffff;
  box-shadow: 0 0 8px rgba(176,30,35,0.35);
}

.hp-quick-sens { margin-top: 6px; transition: opacity .15s ease, max-height .25s ease; }
.hp-quick-sens.hp-hidden { display: none; }

/* Birth Center — inline warning shown when the user picks a birth-alarm
   preset while Contact 1 isn't set to "Call". Non-blocking: save still
   happens, the notice just flags that the user may not be reachable. */
.hp-quick-warning {
  margin: 8px 0 0;
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(176,30,35,0.18);
  color: #ff9ca0;
  font-size: 12.5px;
  line-height: 1.35;
}
.hp-quick-warning.hp-hidden { display: none; }

/* Language card — segmented toggle on the left, "Apply now" reload
   button inline to the right once a change has been saved. */
.hp-lang-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.hp-apply-now-btn {
  appearance: none; -webkit-appearance: none;
  border: 1px solid rgba(0,180,136,0.35);
  background: linear-gradient(135deg, #00B488, #00967a);
  color: #ffffff;
  font: 600 12px/1 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
  box-shadow: 0 0 10px rgba(0,180,136,0.35);
  white-space: nowrap;
}
.hp-apply-now-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 0 16px rgba(0,180,136,0.45); }
.hp-apply-now-btn:disabled { opacity: 0.45; cursor: default; transform: none; box-shadow: none; }
.hp-apply-now-btn.hp-hidden { display: none; }
/* Anchor rendered with the same pill style — kill the default underline
   and inline layout the browser adds. */
a.hp-apply-now-btn { display: inline-block; text-decoration: none; }

/* Troubleshooting entry point inside the status tile.
   Compact when online (quiet ghost pill) and loud when offline (full
   CTA with a hint line). Keeps the operator's eye on the diagnostic
   link exactly when it's needed. */
.hp-troubleshoot { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.hp-troubleshoot-btn {
  display: inline-block;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease, border-color .15s ease;
  font: 600 12px/1 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  letter-spacing: 0.04em;
  border-radius: 999px;
}
/* Online: small ghost pill, aligns visually with the other info rows. */
.hp-troubleshoot-compact .hp-troubleshoot-btn-ghost {
  align-self: flex-start;
  padding: 4px 10px;
  border: 1px solid var(--hp-line);
  background: transparent;
  color: var(--hp-faint);
  text-transform: none;
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.02em;
}
.hp-troubleshoot-compact .hp-troubleshoot-btn-ghost:hover {
  color: var(--hp-text);
  border-color: var(--hp-accent);
  box-shadow: 0 0 0 3px var(--hp-accent-soft);
}
/* Offline: full-width, brand-accent CTA with a supporting hint line. */
.hp-troubleshoot-loud .hp-troubleshoot-hint {
  margin: 0;
  color: var(--hp-warn, #b45309);
  font-size: 13px;
  line-height: 1.4;
}
.hp-troubleshoot-loud .hp-troubleshoot-btn-loud {
  align-self: stretch;
  text-align: center;
  padding: 12px 18px;
  text-transform: uppercase;
  font-size: 13px;
  color: #ffffff;
  border: 1px solid rgba(0,180,136,0.35);
  background: linear-gradient(135deg, #00B488, #00967a);
  box-shadow: 0 0 14px rgba(0,180,136,0.45);
}
.hp-troubleshoot-loud .hp-troubleshoot-btn-loud:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 20px rgba(0,180,136,0.55);
}

/* Horse-name tile: input grows, save button keeps its natural width and
   drops under the field once the card gets narrow. */
.hp-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.hp-name-row .hp-text-input { flex: 1 1 160px; width: auto; min-width: 0; }
@media (max-width: 480px) {
  .hp-name-row .hp-apply-now-btn { flex: 1 1 100%; }
}

/* Time row (security warning) */
.hp-quick-times {
  display: flex; align-items: center; gap: 10px;
  margin: 4px 0;
}
.hp-time-label { color: var(--hp-faint); font-size: 12px; }
.hp-time-input {
  font: 500 14px system-ui, sans-serif;
  padding: 6px 10px;
  border: 1px solid var(--hp-line);
  border-radius: 8px;
  background: var(--hp-surface);
  color: var(--hp-text);
}
.hp-time-input:focus { outline: 0; border-color: var(--hp-accent); box-shadow: 0 0 0 3px var(--hp-accent-soft); }

/* Contacts grid */
.hp-contacts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.hp-contact-row { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.hp-contact-row .hp-pill-group { width: fit-content; }
.hp-text-input {
  font: 500 14px system-ui, sans-serif;
  padding: 8px 12px;
  border: 1px solid var(--hp-line);
  border-radius: 10px;
  background: var(--hp-surface);
  color: var(--hp-text);
  width: 100%;
  box-sizing: border-box;
}
.hp-text-input:focus { outline: 0; border-color: var(--hp-accent); box-shadow: 0 0 0 3px var(--hp-accent-soft); }
.hp-text-input:disabled { background: rgba(16,18,52,0.5); color: var(--hp-faint); cursor: not-allowed; }
/* RTSP link — monospace so users can spot typos in the URL */
.hp-text-input.hp-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  letter-spacing: 0;
}
/* Admin-override badge (IP-cam tile shown on non-qualifying hardware) */
.hp-admin-badge {
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--hp-warn, #b45309);
  background: rgba(180, 83, 9, 0.12);
  border: 1px solid rgba(180, 83, 9, 0.25);
}

/* ---- Retraining requests tile (admin + level≥3) ---- */
.hp-quick-retrain-form {
  display: flex; flex-direction: column; gap: 8px;
  margin-top: 4px;
}
.hp-quick-retrain-models {
  display: flex; flex-wrap: wrap; gap: 12px 20px;
  margin: 0 0 8px;
}
.hp-quick-retrain-model-row {
  display: inline-flex; align-items: center; gap: 6px;
  cursor: pointer; user-select: none;
  font-size: 14px;
}
.hp-quick-retrain-model-row input[type="radio"] {
  width: 16px; height: 16px; accent-color: var(--hp-brand, #aecb37);
  margin: 0;
}
.hp-quick-retrain-textarea {
  width: 100%;
  min-height: 72px;
  resize: vertical;
  font: inherit;
  padding: 8px 10px;
}
.hp-quick-retrain-error {
  color: var(--hp-danger, #b91c1c);
  font-size: 12px;
  margin: -4px 0 4px;
}
.hp-quick-retrain-submit {
  align-self: flex-start;
  padding: 8px 16px;
  background: var(--hp-brand, #aecb37);
  color: #14202b;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: filter 0.15s ease, opacity 0.15s ease;
}
.hp-quick-retrain-submit:hover:not(:disabled) { filter: brightness(1.05); }
.hp-quick-retrain-submit:disabled { opacity: 0.55; cursor: not-allowed; }

.hp-quick-retrain-history {
  margin-top: 18px;
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 12px;
}
.hp-quick-retrain-history-head {
  display: flex; align-items: baseline; gap: 4px;
}
.hp-quick-retrain-history-count {
  font-size: 12px; color: var(--hp-faint);
}
.hp-quick-retrain-history-body {
  display: flex; flex-direction: column; gap: 6px;
}
.hp-quick-retrain-empty {
  font-size: 13px; color: var(--hp-faint);
  padding: 6px 0;
  font-style: italic;
}
.hp-quick-retrain-row {
  display: grid;
  grid-template-columns: 12px 90px 1fr 1fr 100px;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 13px;
}
.hp-quick-retrain-row:last-child { border-bottom: none; }
.hp-quick-retrain-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: #94a3b8;
}
.hp-quick-retrain-row-pending      .hp-quick-retrain-dot { background: #f59e0b; }
.hp-quick-retrain-row-in_progress  .hp-quick-retrain-dot { background: #3b82f6; }
.hp-quick-retrain-row-done         .hp-quick-retrain-dot { background: var(--hp-brand, #aecb37); }
.hp-quick-retrain-date {
  font-variant-numeric: tabular-nums;
  color: var(--hp-faint);
}
.hp-quick-retrain-model {
  font-weight: 600;
}
.hp-quick-retrain-by {
  color: var(--hp-faint);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.hp-quick-retrain-status {
  font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--hp-faint);
  text-align: right;
}
.hp-quick-retrain-row-pending     .hp-quick-retrain-status { color: #f59e0b; }
.hp-quick-retrain-row-in_progress .hp-quick-retrain-status { color: #3b82f6; }
.hp-quick-retrain-row-done        .hp-quick-retrain-status { color: var(--hp-brand, #aecb37); }
.hp-quick-retrain-reason-text {
  grid-column: 2 / -1;
  color: var(--hp-faint);
  font-size: 12px;
  margin-top: 2px;
  white-space: normal;
  line-height: 1.4;
}
.hp-quick-retrain-showall {
  margin-top: 8px;
  padding: 6px 12px;
  background: transparent;
  color: var(--hp-brand, #aecb37);
  border: 1px solid var(--hp-brand, #aecb37);
  border-radius: 6px;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  align-self: flex-start;
}
.hp-quick-retrain-showall:hover { background: rgba(174,203,55,0.1); }

@media (max-width: 800px) {
  .hp-quick-grid     { grid-template-columns: 1fr; }
  .hp-contacts-grid  { grid-template-columns: 1fr; }
  .hp-quick-retrain-row {
    grid-template-columns: 12px 80px 1fr;
  }
  .hp-quick-retrain-by     { grid-column: 2 / -1; font-size: 12px; }
  .hp-quick-retrain-status { grid-column: 2 / -1; text-align: left; }
}

/* ---- detection iframe tab ---- */
.hp-detection-frame-card { padding: 0; overflow: hidden; position: relative; }
.hp-detection-open-tab {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  background: rgba(15, 22, 33, 0.85);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 6px;
  backdrop-filter: blur(4px);
  transition: background 0.15s ease, transform 0.15s ease;
}
.hp-detection-open-tab:hover {
  background: rgba(15, 22, 33, 0.95);
  transform: translateY(-1px);
}
.hp-detection-frame {
  width: 100%;
  height: 80vh;
  min-height: 540px;
  border: 0;
  display: block;
  background: #0b1220;
}

/* ---- settings iframe tab ---- */
.hp-settings-frame-card {
  padding: 0;
  overflow: hidden;
  position: relative;       /* anchor for the loading spinner overlay */
}
.hp-settings-frame {
  width: 100%;
  height: 85vh;
  min-height: 600px;
  border: 0;
  display: block;
  background: var(--hp-bg-soft);
}
.hp-settings-spinner {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px;
  background: var(--hp-bg-soft);
  z-index: 1;
  transition: opacity .35s ease;
  pointer-events: none;
}
.hp-settings-spinner.hp-fade-out { opacity: 0; }

/* ---- offline banner ---- */
.hp-offline-banner {
  background: #fef3c7;
  color: #92400e;
  border: 0;
  padding: 12px 16px;
  border-radius: var(--hp-radius-sm);
  margin-bottom: 12px;
  font-size: 13px;
}

/* ---- responsive ---- */
@media (max-width: 900px) {
  .hp-status-row { grid-template-columns: 1fr; }
  .hp-status-row > .hp-card { height: auto; min-height: 240px; }

  /* Edge-to-edge on tablet + mobile. The outer shortcode chrome (padding,
     rounded corners, soft shadow) makes sense in a desktop article but
     wastes horizontal space on phones/tablets. Full-bleed horizontally
     with width:100vw + negative L/R margins so the dashboard spans the
     viewport regardless of the WP theme's article side-padding. We
     intentionally DON'T pull up vertically — negative margin-top would
     tuck the logo behind the browser address bar or the WP admin bar
     on mobile. Theme chrome above us is already killed by the body
     class rule higher up in this file. */
  #hp-ai-dashboard-root {
    padding: 10px 0 14px;
    border-radius: 0;
    box-shadow: none;
    width: 100vw;
    max-width: 100vw;
    position: relative;
    left: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    margin-top: 0;
  }
}

/* Tab bar is always horizontally scrollable now (see .hp-tabs above).
   No tablet-specific override needed. */

/* Phone */
@media (max-width: 640px) {
  /* Root chrome is already flattened to edge-to-edge in the ≤900px block;
     just tighten the inner grid gap on phones. */
  .hp-shell { gap: 14px; }

  /* Cards: shorter radius + reduced padding so content has more room */
  .hp-card                          { border-radius: 14px; padding: 16px; }
  .hp-status-row > .hp-card         { padding: 16px; min-height: 220px; }
  .hp-quick-card                    { padding: 16px; min-height: auto; }
  .hp-overview-card                 { padding: 16px; }

  /* Status header: smaller avatar + tighter dl */
  .hp-status-grid {
    grid-template-columns: 56px 1fr;
    gap: 12px;
  }
  .hp-avatar { width: 56px; height: 56px; border-radius: 14px; }
  .hp-status-meta h3 { font-size: 17px; margin-bottom: 10px; }
  .hp-status-meta dl { grid-template-columns: 70px 1fr; gap: 6px 10px; font-size: 12.5px; }
  .hp-status-meta dt { font-size: 10px; }
  .hp-status-activity-time { display: block; margin-left: 0; margin-top: 4px; }

  /* Horse picker tiles: keep the avatar but cap meta width so 3+ tiles
     are visible without each one taking half the screen. */
  .hp-horse-row { gap: 8px; }
  .hp-horse-tile { padding: 6px 12px 6px 6px; }
  .hp-horse-avatar { width: 34px; height: 34px; border-radius: 10px; }
  .hp-horse-meta { max-width: 110px; }

  /* Overview card: pill switcher under the title (instead of inline) */
  .hp-overview-head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .hp-overview-switcher { width: 100%; overflow-x: auto; }
  .hp-overview-tab { flex: 0 0 auto; padding: 6px 14px; }
  .hp-overview-inner canvas { max-height: 200px; }

  /* Quick settings: cards already drop to single column at 800px;
     here we tune the inner controls. */
  .hp-quick-card { padding: 16px; min-width: 0; overflow-wrap: anywhere; }
  .hp-quick-head { gap: 8px; flex-wrap: wrap; }
  .hp-quick-head h3 { font-size: 14px; }
  .hp-quick-hint { font-size: 12px; padding: 9px 11px 9px 32px; max-width: 100%; }
  .hp-quick-hint::before { left: 9px; top: 10px; }
  /* Pill groups (segmented controls): let them wrap instead of forcing
     the card wider than the viewport column. */
  .hp-pill-group,
  .hp-pill-group-3,
  .hp-pill-group-4 { max-width: 100%; flex-wrap: wrap; }
  .hp-pill-btn { padding: 6px 11px; font-size: 11px; }
  .hp-quick-times { flex-wrap: wrap; gap: 8px; }
  .hp-time-input { font-size: 13px; padding: 6px 8px; }

  /* Live preview tile: full width, compact aspect on phones */
  .hp-live-card { padding: 16px; }
  .hp-live-wrap { aspect-ratio: 4 / 3; }
  .hp-live-toggle, .hp-live-fs { width: 40px; height: 40px; }

  /* Videos tab grid — smaller thumbs */
  .hp-hour-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
  .hp-video-item { border-radius: 10px; }
  .hp-hour-block { margin-bottom: 16px; }

  /* Iframes: on phones we size to content via JS (autoResizeIframeToContent)
     so the page has a single continuous scroll instead of page + iframe.
     height:auto lets the JS-applied inline height take effect cleanly.
     Detection iframe embeds a viewport-sized Flask page whose scrollHeight
     ≈ its own viewport, so auto-resize can't grow it — give it a generous
     min-height so the internal scroll has room to reach the bottom. */
  .hp-detection-frame { height: auto; min-height: 85vh; }
  .hp-settings-frame  { height: auto; min-height: 360px; }

  /* Section cards (images / reports / monitors) — tighter padding */
  .hp-section-card { padding: 12px; }

  /* Centered iframe overlay — narrower margin, full-screen feel */
  .hp-overlay { padding: 0; }
  .hp-overlay-inner {
    width: 100vw; height: 100vh;
    border-radius: 0;
  }
  .hp-overlay-close { top: 14px; right: 14px; }
}

/* ============================================================ *
 *  v2 picker · group filter · groups tab · multi-cam tab
 *  All additions match the dark theme tokens at the top of this
 *  file. No new colours; no external font.                      *
 * ============================================================ */

/* ---- Online filter chip — mirrors -alarm / -offline ---- */
.hp-picker-chip-dot.hp-picker-chip-online { background: var(--hp-ok); box-shadow: 0 0 6px rgba(0,180,136,0.5); }
.hp-picker-chip-tone-online { border-color: rgba(0,180,136,0.4); }
.hp-picker-chip-tone-online.hp-picker-chip-active {
  background: rgba(0,180,136,0.15);
  border-color: var(--hp-accent);
}

/* ---- Group filter <select> ---- */
.hp-picker-group {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--hp-line);
  background: var(--hp-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%238890b8' d='M0 0h10L5 6z'/%3E%3C/svg%3E") no-repeat right 12px center;
  background-size: 10px 6px;
  border-radius: 999px;
  color: var(--hp-text);
  padding: 6px 32px 6px 14px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .15s ease;
  min-width: 0;
}
.hp-picker-group:hover  { border-color: var(--hp-accent); }
.hp-picker-group:focus  { outline: 0; border-color: var(--hp-accent); box-shadow: 0 0 0 3px var(--hp-accent-soft); }

/* ---- Collapse / expand toggle ----
   Lives at the end of `.hp-picker-summary` so it sits next to the
   group selector and the chip filters. Sized to match the chips. */
.hp-picker-expand-btn {
  margin-left: auto;          /* push to the far right of the chip bar */
  background: var(--hp-surface);
  border: 1px solid var(--hp-line);
  border-radius: 999px;
  color: var(--hp-muted);
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.hp-picker-expand-btn:hover {
  color: var(--hp-text);
  border-color: var(--hp-accent);
  background: var(--hp-accent-soft);
}
.hp-picker-expand-btn[aria-expanded="true"] {
  color: var(--hp-text);
  border-color: var(--hp-accent);
}

/* ---- Picker LARGE mode (no horse selected) ----
   Tiles become a responsive grid of card-shaped previews instead of
   pill rows. Avatar 80px, name + status pill underneath. */
.hp-picker-mode-large .hp-horse-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  overflow: visible;     /* override the default horizontal-scroll row */
  padding: 4px 2px;
  width: 100%;
}
.hp-picker-mode-large .hp-horse-tile {
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  border-radius: var(--hp-radius);
  padding: 16px 16px 14px;
}
.hp-picker-mode-large .hp-horse-tile .hp-horse-avatar {
  width: 80px; height: 80px;
  align-self: center;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(0,180,136,0.10);
}
.hp-picker-mode-large .hp-horse-tile .hp-horse-dot {
  width: 18px; height: 18px;
  bottom: 0; right: 4px;
  border-width: 3px;
}
.hp-picker-mode-large .hp-horse-meta {
  align-items: center;
  text-align: center;
  max-width: 100%;
  gap: 6px;
}
.hp-picker-mode-large .hp-horse-tile .hp-horse-name {
  font-size: 15px;
  white-space: normal;       /* allow wrapping in the card */
}
.hp-picker-mode-large .hp-horse-id { font-size: 11px; }

/* Stronger online glow in large mode so it pops at a glance. */
.hp-picker-mode-large .hp-horse-tile-online {
  border-color: rgba(0,180,136,0.55);
  box-shadow: 0 0 0 1px rgba(0,180,136,0.25), 0 0 18px rgba(0,180,136,0.18);
}

/* Heavier offline distinction in large mode — more grayscale, dim,
   dashed border so even a colorblind user reads "this is not live". */
.hp-picker-mode-large .hp-horse-tile-offline {
  opacity: 0.45;
  filter: grayscale(1);
  border-style: dashed;
}

/* ---- Status pill (large-mode tiles) ----
   Renders below the name, colour-matched to the state. */
.hp-horse-state-pill {
  display: inline-flex;
  align-items: center;
  align-self: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.hp-horse-state-pill.is-online  { background: rgba(0,180,136,0.18); color: #2bdfa8; }
.hp-horse-state-pill.is-offline { background: rgba(100,116,139,0.18); color: #94a3b8; }
.hp-horse-state-pill.is-alarm   { background: rgba(176,30,35,0.20);  color: #fca5a5; }

/* The pill only renders in LARGE picker mode. In COMPACT (pill row)
   mode the existing dot + state classes already convey the state and
   the pill would just bloat the tile width. */
.hp-picker-mode-compact .hp-horse-state-pill { display: none; }

/* ---- tile sub-line + badges ----------------------------------------
   The sub-line (cam_id · last-seen) and the badges row only render in
   LARGE picker mode. The compact pill row already shows the name + the
   status dot; an extra row of chips there would just bloat the strip. */
.hp-picker-mode-compact .hp-horse-sub,
.hp-picker-mode-compact .hp-horse-tile-badges { display: none; }

.hp-horse-sub {
  display: inline-flex;
  align-items: baseline;
  gap: 0;
  font-size: 11px;
  color: var(--hp-faint);
  white-space: nowrap;
}
.hp-horse-sub .hp-horse-sep { opacity: 0.55; padding: 0 4px; }
.hp-horse-sub .hp-horse-age { color: var(--hp-muted); }

.hp-horse-tile-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 2px;
}
.hp-badge {
  --hp-badge-bg: rgba(100,116,139,0.18);
  --hp-badge-fg: #cbd5e1;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font: 600 11px/1.05 'Inter', system-ui, sans-serif;
  letter-spacing: 0.02em;
  background: var(--hp-badge-bg);
  color: var(--hp-badge-fg);
  border: 1px solid color-mix(in srgb, var(--hp-badge-fg) 18%, transparent);
  white-space: nowrap;
}
.hp-badge-icon { font-size: 12px; line-height: 1; }
.hp-badge-label { letter-spacing: 0.03em; }

/* Activity palette — keyed off data-activity so future values can be
   added without touching every selector. Defaults (above) cover the
   "unknown" case. */
.hp-badge-activity[data-activity="drinking"]            { --hp-badge-bg: rgba(29,112,183,0.20);  --hp-badge-fg: #93c5fd; }
.hp-badge-activity[data-activity="feeding_heu"]         { --hp-badge-bg: rgba(217,119,6,0.22);   --hp-badge-fg: #fcd34d; }
.hp-badge-activity[data-activity="feeding_kraft-futter"]{ --hp-badge-bg: rgba(180,83,9,0.24);    --hp-badge-fg: #fbbf24; }
.hp-badge-activity[data-activity="lying"]               { --hp-badge-bg: rgba(124,58,237,0.22);  --hp-badge-fg: #c4b5fd; }
.hp-badge-activity[data-activity="awake"]               { --hp-badge-bg: rgba(0,180,136,0.20);   --hp-badge-fg: #6ee7b7; }
.hp-badge-activity[data-activity="empty_box"]           { --hp-badge-bg: rgba(100,116,139,0.20); --hp-badge-fg: #cbd5e1; }
.hp-badge-activity[data-activity="calibration"]         { --hp-badge-bg: rgba(244,196,48,0.22);  --hp-badge-fg: #fde68a; }
.hp-badge-activity[data-activity="Starting"]            { --hp-badge-bg: rgba(244,196,48,0.22);  --hp-badge-fg: #fde68a; }

/* Mode palette — distinctive but quiet. Birth is the only one that
   should grab the eye, so it gets a soft red glow. */
.hp-badge-mode[data-mode="birth"]    { --hp-badge-bg: rgba(176,30,35,0.18); --hp-badge-fg: #fca5a5; box-shadow: 0 0 0 1px rgba(176,30,35,0.30), 0 0 8px rgba(176,30,35,0.20); }
.hp-badge-mode[data-mode="foal"]     { --hp-badge-bg: rgba(236,72,153,0.18); --hp-badge-fg: #f9a8d4; }
.hp-badge-mode[data-mode="outdoor"]  { --hp-badge-bg: rgba(56,189,248,0.18); --hp-badge-fg: #7dd3fc; }
.hp-badge-mode[data-mode="no_learn"] { --hp-badge-bg: rgba(100,116,139,0.18); --hp-badge-fg: #94a3b8; }

/* Light theme softens both palettes — invert the fg/bg so the badge
   reads on the light surface. */
#hp-ai-dashboard-root.hp-theme-light .hp-badge { border-color: rgba(15,23,42,0.08); }
#hp-ai-dashboard-root.hp-theme-light .hp-badge-activity[data-activity="drinking"]            { --hp-badge-bg: #dbeafe; --hp-badge-fg: #1d4ed8; }
#hp-ai-dashboard-root.hp-theme-light .hp-badge-activity[data-activity="feeding_heu"]         { --hp-badge-bg: #fef3c7; --hp-badge-fg: #92400e; }
#hp-ai-dashboard-root.hp-theme-light .hp-badge-activity[data-activity="feeding_kraft-futter"]{ --hp-badge-bg: #fde68a; --hp-badge-fg: #78350f; }
#hp-ai-dashboard-root.hp-theme-light .hp-badge-activity[data-activity="lying"]               { --hp-badge-bg: #ede9fe; --hp-badge-fg: #5b21b6; }
#hp-ai-dashboard-root.hp-theme-light .hp-badge-activity[data-activity="awake"]               { --hp-badge-bg: #d1fae5; --hp-badge-fg: #047857; }
#hp-ai-dashboard-root.hp-theme-light .hp-badge-activity[data-activity="empty_box"]           { --hp-badge-bg: #e2e8f0; --hp-badge-fg: #475569; }
#hp-ai-dashboard-root.hp-theme-light .hp-badge-mode[data-mode="birth"]    { --hp-badge-bg: #fee2e2; --hp-badge-fg: #b91c1c; box-shadow: 0 0 0 1px rgba(176,30,35,0.18); }
#hp-ai-dashboard-root.hp-theme-light .hp-badge-mode[data-mode="foal"]     { --hp-badge-bg: #fce7f3; --hp-badge-fg: #be185d; }
#hp-ai-dashboard-root.hp-theme-light .hp-badge-mode[data-mode="outdoor"]  { --hp-badge-bg: #e0f2fe; --hp-badge-fg: #0369a1; }
#hp-ai-dashboard-root.hp-theme-light .hp-badge-mode[data-mode="no_learn"] { --hp-badge-bg: #e2e8f0; --hp-badge-fg: #475569; }

/* ---- summary-bar additions ---------------------------------------- */
.hp-picker-chip-icon { font-size: 12px; line-height: 1; }
.hp-picker-chip-tone-birth   { border-color: rgba(176,30,35,0.40); }
.hp-picker-chip-tone-birth.hp-picker-chip-active   { background: rgba(176,30,35,0.14); border-color: var(--hp-err); color: var(--hp-text); }
.hp-picker-chip-tone-foal    { border-color: rgba(236,72,153,0.40); }
.hp-picker-chip-tone-foal.hp-picker-chip-active    { background: rgba(236,72,153,0.16); border-color: #ec4899; color: var(--hp-text); }
.hp-picker-activity {
  appearance: none; -webkit-appearance: none;
  font: 600 11px/1 system-ui, sans-serif;
  padding: 7px 28px 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--hp-line);
  background: var(--hp-surface) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'><path d='M2 4l4 4 4-4' stroke='%238890b8' stroke-width='1.5' fill='none' stroke-linecap='round'/></svg>") no-repeat right 10px center;
  color: var(--hp-text);
  cursor: pointer;
}

/* ---- Groups tab ---- */
.hp-groups-tab {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}
.hp-groups-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  background: var(--hp-surface);
  border: 1px solid var(--hp-line);
  border-radius: var(--hp-radius);
}
.hp-groups-toolbar select { min-width: 200px; }
.hp-btn {
  appearance: none; -webkit-appearance: none;
  border: 1px solid var(--hp-line);
  background: var(--hp-surface);
  color: var(--hp-text);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.hp-btn:hover { border-color: var(--hp-accent); }
.hp-btn-primary {
  background: linear-gradient(135deg, #00B488, #00967a);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 0 12px rgba(0,180,136,0.30);
}
.hp-btn-primary:hover { box-shadow: 0 0 18px rgba(0,180,136,0.50); }
.hp-btn-danger {
  border-color: rgba(176,30,35,0.5);
  color: #fca5a5;
}
.hp-btn-danger:hover { background: rgba(176,30,35,0.12); border-color: var(--hp-err); }

.hp-groups-card {
  background: var(--hp-surface);
  border: 1px solid var(--hp-line);
  border-radius: var(--hp-radius);
  padding: 16px;
}
.hp-groups-card h4 {
  margin: 0 0 12px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--hp-muted);
  font-weight: 600;
}
.hp-groups-create-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.hp-groups-create-row input {
  background: var(--hp-bg-soft);
  border: 1px solid var(--hp-line);
  border-radius: 10px;
  padding: 8px 12px;
  color: var(--hp-text);
  font-size: 13px;
  min-width: 0;
  flex: 1 1 200px;
}
.hp-groups-create-row input:focus {
  outline: 0; border-color: var(--hp-accent);
  box-shadow: 0 0 0 3px var(--hp-accent-soft);
}

/* Cam rows inside a group — drag-to-reorder targets. */
.hp-group-cam-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.hp-group-cam-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--hp-bg-soft);
  border: 1px solid var(--hp-line);
  border-radius: 12px;
  cursor: grab;
  transition: border-color .15s ease, background .15s ease;
}
.hp-group-cam-row:hover { border-color: var(--hp-accent); }
.hp-group-cam-row.is-dragging { opacity: 0.4; }
.hp-group-cam-row.is-drag-over { border-color: var(--hp-accent); background: var(--hp-accent-soft); }
.hp-group-cam-handle {
  flex: 0 0 auto;
  width: 18px; height: 18px;
  color: var(--hp-faint);
  display: inline-flex; align-items: center; justify-content: center;
}
.hp-group-cam-handle svg { width: 14px; height: 14px; fill: currentColor; }
.hp-group-cam-row .hp-horse-avatar { width: 32px; height: 32px; }
.hp-group-cam-name { flex: 1 1 auto; font-size: 13px; font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hp-group-cam-id { font-size: 11px; color: var(--hp-faint); flex: 0 0 auto; }
.hp-group-cam-remove {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.4);
  font: 600 18px/1 system-ui, sans-serif;
  padding: 0;
  margin-left: 4px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.hp-group-cam-remove:hover {
  background: rgba(252, 165, 165, 0.14);
  color: #fca5a5;
  border-color: rgba(252, 165, 165, 0.35);
}
.hp-group-cam-remove:focus-visible {
  outline: 2px solid var(--hp-accent);
  outline-offset: 1px;
}
#hp-ai-dashboard-root.hp-theme-light .hp-group-cam-remove { color: rgba(0, 0, 0, 0.4); }
#hp-ai-dashboard-root.hp-theme-light .hp-group-cam-remove:hover {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fecaca;
}

/* Available-cams checkbox grid (add to group). */
.hp-group-add-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 6px;
  margin-top: 8px;
}
.hp-group-add-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px;
  background: var(--hp-bg-soft);
  border: 1px solid var(--hp-line);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color .15s ease;
}
.hp-group-add-row:hover { border-color: var(--hp-accent); }
.hp-group-add-row input { accent-color: var(--hp-accent); }
.hp-group-add-row .hp-horse-avatar { width: 28px; height: 28px; }
.hp-group-add-name { flex: 1 1 auto; font-size: 12.5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.hp-groups-empty {
  padding: 24px;
  text-align: center;
  color: var(--hp-muted);
  background: var(--hp-bg-soft);
  border: 1px dashed var(--hp-line);
  border-radius: var(--hp-radius);
}
.hp-groups-status {
  font-size: 12px;
  color: var(--hp-muted);
  min-height: 14px;
}
.hp-groups-status.is-saved { color: var(--hp-ok); }
.hp-groups-status.is-error { color: var(--hp-err); }

/* Hardware-family filter row above the Add cams picker. */
.hp-groups-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 8px 0 4px;
}
.hp-groups-filter-label { font-size: 12px; color: var(--hp-muted); }
.hp-groups-filter-hidden {
  font-size: 12px;
  color: var(--hp-muted);
  cursor: pointer;
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}
.hp-groups-filter-hidden:hover { color: var(--hp-text); }

/* Family badge — small uppercase pill next to legacy cam names. */
.hp-cam-family-badge {
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(255,180,80,0.18);
  color: #ffc77a;
  border: 1px solid rgba(255,180,80,0.4);
  text-transform: uppercase;
  line-height: 1.4;
}
.hp-cam-family-badge.hp-family-stable {
  background: rgba(148,163,184,0.18);
  color: #cbd5e1;
  border-color: rgba(148,163,184,0.4);
}
.hp-cam-family-badge.hp-family-other {
  background: rgba(252,165,165,0.16);
  color: #fca5a5;
  border-color: rgba(252,165,165,0.4);
}
#hp-ai-dashboard-root.hp-theme-light .hp-cam-family-badge {
  background: #fef3c7;
  color: #b45309;
  border-color: #fcd34d;
}
#hp-ai-dashboard-root.hp-theme-light .hp-cam-family-badge.hp-family-stable {
  background: #e2e8f0;
  color: #475569;
  border-color: #cbd5e1;
}
#hp-ai-dashboard-root.hp-theme-light .hp-cam-family-badge.hp-family-other {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fecaca;
}

/* ---- Multi-Cam tab — single bundle root ----
   The bundle's WebRTCConnectionCreator renders an outer MUI Grid2
   container with one Grid2 cell per cam. Each cell contains a
   .acaris-multivideo-video-container which the bundle styles as
   position:relative (see multiple_videos.css). Our overlays are absolute
   children of that container, injected via MutationObserver as React
   creates cells. Don't fight MUI's layout — let the bundle do its thing
   and decorate the existing per-cell box. */
.hp-multicam-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  background: var(--hp-surface);
  border: 1px solid var(--hp-line);
  border-radius: var(--hp-radius);
  margin-bottom: 12px;
}
.hp-multicam-slot { width: 100%; }

/* Full-tab loading card shown for the ~1-4 s between tab-click and the
   first cells rendering. Two phases (init / cams) share the same look —
   centered ring + label + small sub-text — so it reads as one continuous
   "loading" experience even if the underlying state actually transitions
   through both phases. */
.hp-multicam-tab-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 280px;
  padding: 60px 24px;
  background: var(--hp-bg-soft);
  border: 1px solid var(--hp-line);
  border-radius: var(--hp-radius);
  margin-bottom: 12px;
}
.hp-multicam-tab-loading-ring {
  width: 52px;
  height: 52px;
  border: 4px solid rgba(255, 255, 255, 0.12);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: hp-multicam-spin 0.9s linear infinite;
}
.hp-multicam-tab-loading-label {
  font: 600 14px/1.2 'Inter', system-ui, sans-serif;
  color: rgba(255, 255, 255, 0.92);
  letter-spacing: 0.02em;
}
.hp-multicam-tab-loading-sub {
  font: 500 12px/1.4 'Inter', system-ui, sans-serif;
  color: rgba(255, 255, 255, 0.55);
  text-align: center;
  max-width: 280px;
}

/* One-time intro banner — explains the staggered connect + retry flow
   to first-time operators. Dismissable per-tab via sessionStorage. */
.hp-multicam-intro {
  position: relative;
  padding: 14px 56px 14px 16px;
  background: var(--hp-bg-soft);
  border: 1px solid var(--hp-line);
  border-left: 4px solid var(--hp-accent, #4f6cff);
  border-radius: var(--hp-radius);
  margin-bottom: 12px;
  color: var(--hp-text);
}
.hp-multicam-intro-title {
  font: 600 13px/1.2 'Inter', system-ui, sans-serif;
  margin-bottom: 4px;
}
.hp-multicam-intro-body {
  margin: 0;
  font: 400 13px/1.45 'Inter', system-ui, sans-serif;
  color: var(--hp-muted);
}
.hp-multicam-intro-close {
  position: absolute;
  top: 8px;
  right: 8px;
  appearance: none;
  background: transparent;
  border: 1px solid var(--hp-line);
  color: var(--hp-muted);
  border-radius: 4px;
  padding: 4px 8px;
  font: 500 11px/1 'Inter', system-ui, sans-serif;
  cursor: pointer;
}
.hp-multicam-intro-close:hover {
  color: var(--hp-text);
  border-color: var(--hp-muted);
}

.hp-multicam-empty {
  padding: 32px;
  text-align: center;
  color: var(--hp-muted);
  background: var(--hp-bg-soft);
  border: 1px dashed var(--hp-line);
  border-radius: var(--hp-radius);
}

/* Phase-2 layout: the grid itself is the CSS-Grid container. Was previously
   `display: block` and the actual grid lived on the bundle's MUI Grid2
   container inside a single acaris-multiple-videos-root; that layout
   collapsed to 0/5 stream connects after a group switch (empty-MediaStream
   cliff — see task #98 sandbox findings). Now every cam is its own
   .hp-multicam-webrtc-item wrapper (real grid item); the bundle's root,
   its Grid2 container and its Grid2 item beneath the wrapper are all
   display:contents so the video cell renders directly inside the wrapper
   alongside the mini-strip / settings-tile siblings the SPA appends.
   MJPEG tiles + placeholder overflow row are direct grid items too. */
.hp-multicam-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: auto;
  align-items: start;
  gap: 10px;
  width: 100%;
  min-width: 0;
}

/* Per-cam wrapper — the real CSS-Grid item. Stacks the video cell,
   mini-strip and settings-tile vertically inside its grid cell. */
.hp-multicam-grid > .hp-multicam-webrtc-item {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 0;
}

/* Every element between the wrapper and the .acaris-multivideo-video-container
   is display:contents — the bundle's root, its MUI Grid2 container, and the
   Grid2 item. This makes the video cell render as a direct child of the
   wrapper regardless of how deeply the bundle nests it. */
.hp-multicam-grid > .hp-multicam-webrtc-item > .acaris-multiple-videos-root,
.hp-multicam-grid > .hp-multicam-webrtc-item > .acaris-multiple-videos-root-mounted,
.hp-multicam-grid > .hp-multicam-webrtc-item > .acaris-multiple-videos-root > *,
.hp-multicam-grid > .hp-multicam-webrtc-item > .acaris-multiple-videos-root-mounted > *,
.hp-multicam-grid > .hp-multicam-webrtc-item > .acaris-multiple-videos-root > * > *,
.hp-multicam-grid > .hp-multicam-webrtc-item > .acaris-multiple-videos-root-mounted > * > * {
  display: contents !important;
}

/* Pending roots stay out of layout so the bundle mount scan (which
   sweeps .acaris-multiple-videos-root only, not -pending) skips them.
   Once multiCamMountBundle promotes them to -mounted, the display:contents
   chain above applies and the cell becomes visible. */
.hp-multicam-grid > .hp-multicam-webrtc-item > .acaris-multiple-videos-root-pending {
  display: none !important;
}

/* Each per-cam cell — this is the bundle's own DOM node (we don't
   create it, just style + decorate it). It's already position:relative
   per multiple_videos.css. Add card chrome to match the rest of the
   dashboard.

   width/max-width/min-width with !important defeat any inline width
   or emotion-generated class width the bundle ships. aspect-ratio
   keeps height proportional regardless of column width so the grid
   rows are tidy even when columns are narrower at small viewports.

   Default aspect-ratio is 2:1 (twice as wide as tall) so the loading
   skeleton stays compact — half the height of the previous square
   default. Once the WebRTC stream delivers its first frame, JS reads
   the real videoWidth/videoHeight and writes an inline
   `aspect-ratio: w/h` with !important so the cell collapses to fit
   the picture exactly — no letterbox, no pillarbox. The 2:1 loading
   default is only visible for the ~1-5 s before frames arrive; once
   they do, it gets replaced anyway. */
.hp-multicam-grid .acaris-multivideo-video-container {
  position: relative !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  margin: 0 !important;
  border-radius: var(--hp-radius);
  overflow: hidden;
  background: #000;
  border: 0;             /* was 1px solid; saved 2px vertical */
  box-shadow: 0 1px 2px rgba(0,0,0,0.3);   /* slimmer than var(--hp-shadow) */
  cursor: pointer;
  transition: transform .15s ease, box-shadow .2s ease, border-color .2s ease;
  aspect-ratio: 2 / 1;
  box-sizing: border-box;
}
.hp-multicam-grid .acaris-multivideo-video-container:hover {
  transform: translateY(-1px);
  box-shadow: var(--hp-shadow-lg);
}
.hp-multicam-grid .acaris-multivideo-video-container[data-state="online"] {
  border-color: rgba(0,180,136,0.45);
}
.hp-multicam-grid .acaris-multivideo-video-container[data-state="offline"] {
  filter: saturate(0.6);
}
.hp-multicam-grid .acaris-multivideo-video-container[data-state="alarm"] {
  border-color: var(--hp-err);
  box-shadow: 0 0 0 1px rgba(176,30,35,0.55), 0 0 22px rgba(176,30,35,0.45);
  animation: hp-tile-alarm-pulse 1.8s ease-in-out infinite;
}

/* Bundle's video element — override its default height:220px AND its
   inline style="width:100%". The cell is absolute-position'd 16:9 box;
   position:absolute + inset:0 forces the video to fill it regardless
   of the inline width hint. !important on every dimension so the
   bundle's inline `width:100%` and bundle CSS `height:220px` lose.

   object-fit: contain (was: cover) so the FULL camera frame is shown
   inside the tile. Source aspect varies per device — 4:3 cameras
   get a narrow letterbox on top/bottom, but the operator never sees
   parts of the picture cut off at the edges, which the cover mode
   was doing (cropping ~12% of width on 4:3 sources in a 16:9 cell). */
.hp-multicam-grid .acaris-multivideo-video-container video {
  position: absolute !important;
  inset: 0 !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  object-fit: contain !important;
  background: #000;
  border: 0;
  display: block;
}

/* The legacy info strip (horse name) sits in the top-right by default
   — we already show name in our top overlay so suppress the duplicate. */
.hp-multicam-grid .acaris-video-player-info { display: none !important; }

/* Bundle's play/pause IconButton — keep centered, give it a z-index
   above the gradient overlays so the user can pause/resume any cell. */
.hp-multicam-grid .acaris-multivideos-button {
  position: absolute !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%);
  z-index: 4;
}
.hp-multicam-grid .acaris-multivideos-button.disconnected {
  opacity: 1;
}
/* While loading we hide the bundle's play/pause button so it doesn't
   sit under the spinner. As soon as the cell flips to connected /
   failed / stopped it comes back. */
.hp-multicam-grid .acaris-multivideo-video-container[data-hp-state="loading"] .acaris-multivideos-button {
  opacity: 0 !important;
  pointer-events: none;
}

/* ── Per-cell spinner / failed / stopped overlay ──────────────────── */
.hp-multicam-spinner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(7, 9, 28, 0.55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 5;
  pointer-events: none;
  transition: opacity .25s ease;
}
.hp-multicam-spinner-ring {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(255, 255, 255, 0.18);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: hp-multicam-spin 0.9s linear infinite;
}
.hp-multicam-spinner-label {
  font: 600 11px/1.1 'Inter', system-ui, sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.85);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}
.hp-multicam-spinner-sub {
  font: 500 11px/1.25 'Inter', system-ui, sans-serif;
  color: rgba(255, 255, 255, 0.62);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  margin-top: -4px;
  padding: 0 14px;
  text-align: center;
}
@keyframes hp-multicam-spin { to { transform: rotate(360deg); } }

/* Hide spinner once we've reached a terminal state. The bundle's
   play/pause IconButton is the visible affordance for failed/stopped
   cells (it sits at z=4 above the gradient overlays). */
.hp-multicam-grid .acaris-multivideo-video-container[data-hp-state="connected"] .hp-multicam-spinner,
.hp-multicam-grid .acaris-multivideo-video-container[data-hp-state="failed"]    .hp-multicam-spinner,
.hp-multicam-grid .acaris-multivideo-video-container[data-hp-state="stopped"]   .hp-multicam-spinner {
  display: none;
}
/* Also hide spinner while the MJPEG bridge is up — MJPEG is already
   delivering frames so the "Connecting…" overlay would just dim what
   the user can already see. Once WebRTC takes over (state="connected")
   or the bridge errors out, the normal state-based rules take over. */
.hp-multicam-grid .acaris-multivideo-video-container.hp-tile-bridge-active .hp-multicam-spinner {
  display: none;
}

/* ── MJPEG bridge overlay ─────────────────────────────────────────────
   While WebRTC negotiates, an <img> is layered above the bundle's
   empty <video>. Lower z-index than the spinner (z=5) so a future
   error state can still surface, higher than the video (z auto) so
   the negotiation never peeks through. */
.hp-mjpeg-bridge {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
  z-index: 2;
  pointer-events: none;
  display: block;
}
/* During the bridge window, hide the bundle's <video> entirely so a
   stray single-frame "first I-frame" or a black frame doesn't flash
   underneath. Revealed again the moment hp-tile-bridge-active is
   removed (first WebRTC frame or proxy error). */
.hp-multicam-grid .acaris-multivideo-video-container.hp-tile-bridge-active > video {
  visibility: hidden;
}
/* Fullscreen bridge: respect contain like the real <video> does. */
.hp-multicam-grid .acaris-multivideo-video-container:fullscreen .hp-mjpeg-bridge,
.hp-multicam-grid .acaris-multivideo-video-container:-webkit-full-screen .hp-mjpeg-bridge {
  object-fit: contain;
  background: #000;
}

/* Stream-mode status badge — small bottom-right pill that surfaces
   whether the tile is on MJPEG, MJPEG bridging to WebRTC, WebRTC, or
   has given up on WebRTC. Empty textContent collapses the box so
   tiles in non-streaming states (placeholders) don't show it. */
.hp-stream-mode-badge {
  position: absolute;
  bottom: 6px;
  right: 6px;
  z-index: 6;
  padding: 2px 7px;
  background: rgba(0, 0, 0, 0.55);
  color: rgba(255, 255, 255, 0.92);
  font: 600 9px/1.2 'Inter', system-ui, sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 4px;
  pointer-events: none;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  max-width: calc(100% - 12px);
  overflow: hidden;
  text-overflow: ellipsis;
}
.hp-stream-mode-badge:empty { display: none; }
/* Subtle colour cue per state — green for WebRTC, amber while bridging,
   red when WebRTC gave up. MJPEG-only stays neutral. */
[data-stream-mode="webrtc"] > .hp-stream-mode-badge,
.hp-live-wrap[data-stream-mode="webrtc"]  > .hp-stream-mode-badge {
  background: rgba(0, 138, 92, 0.78);
}
[data-stream-mode="bridge"] > .hp-stream-mode-badge,
.hp-live-wrap[data-stream-mode="bridge"]  > .hp-stream-mode-badge {
  background: rgba(180, 110, 0, 0.72);
}
[data-stream-mode="mjpeg-fallback"] > .hp-stream-mode-badge,
[data-stream-mode="off"]            > .hp-stream-mode-badge,
.hp-live-wrap[data-stream-mode="off"]    > .hp-stream-mode-badge {
  background: rgba(150, 35, 35, 0.78);
}

/* Failed: tint border red + grey out video area so the cell reads as
   "tried and gave up". User can still click the centered play button
   to retry — the bundle's reconnect path re-fetches credentials. */
.hp-multicam-grid .acaris-multivideo-video-container[data-hp-state="failed"] {
  border-color: var(--hp-err);
}
.hp-multicam-grid .acaris-multivideo-video-container[data-hp-state="failed"] video {
  filter: grayscale(1) brightness(0.45);
}
.hp-multicam-grid .acaris-multivideo-video-container[data-hp-state="failed"]::after {
  content: attr(data-hp-fail-label);
  position: absolute;
  left: 50%;
  bottom: 38%;
  transform: translateX(-50%);
  background: rgba(176, 30, 35, 0.85);
  color: #fff;
  font: 600 11px/1 'Inter', system-ui, sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 5px 9px;
  border-radius: 4px;
  pointer-events: none;
  z-index: 5;
}
/* Inline explanation under the red failed badge — only visible when
   the cell is in the failed state. Tells the user *how* to recover. */
.hp-multicam-fail-hint {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 14%;
  text-align: center;
  font: 500 12px/1.35 'Inter', system-ui, sans-serif;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
  pointer-events: none;
  z-index: 5;
  display: none;
}
.hp-multicam-grid .acaris-multivideo-video-container[data-hp-state="failed"] .hp-multicam-fail-hint {
  display: block;
}

/* Frozen-stream badge — appears in the top-right corner of a tile
   when video.currentTime hasn't advanced for several seconds while the
   cell is still nominally connected. Sits above all overlays so the
   operator notices a frozen frame even though the cell looks alive. */
.hp-multicam-frozen-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255, 170, 0, 0.95);
  color: #1a1300;
  font: 700 13px/24px 'Inter', system-ui, sans-serif;
  text-align: center;
  z-index: 6;
  display: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  cursor: help;
}
.hp-multicam-grid .acaris-multivideo-video-container[data-hp-frozen="1"] .hp-multicam-frozen-badge {
  display: block;
  animation: hp-multicam-frozen-pulse 1.6s ease-in-out infinite;
}
@keyframes hp-multicam-frozen-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.65; transform: scale(0.92); }
}

/* Per-cell fullscreen — clicking a tile sends THAT cell into the
   browser's fullscreen mode. The exit button is rendered on every
   cell up-front but only made visible by the :fullscreen pseudo-
   class, so it appears the moment a cell is fullscreened.

   In fullscreen the cell's aspect-ratio is dropped so the video can
   fill the entire screen instead of being constrained to the
   per-frame aspect we set during normal grid view. */
.hp-multicam-cell-exit-fs {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.35);
  font: 700 18px/1 'Inter', system-ui, sans-serif;
  cursor: pointer;
  z-index: 50;
  transition: background .15s ease, transform .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.hp-multicam-cell-exit-fs:hover {
  background: rgba(0, 0, 0, 0.8);
  transform: scale(1.05);
}

/* Show the exit button + drop aspect-ratio when the cell itself is
   the fullscreen element. Safari needs the -webkit-full-screen
   variant; Firefox uses :fullscreen (no prefix) since FF64. */
.hp-multicam-grid .acaris-multivideo-video-container:fullscreen,
.hp-multicam-grid .acaris-multivideo-video-container:-webkit-full-screen {
  aspect-ratio: auto !important;
  width: 100vw !important;
  height: 100vh !important;
  max-width: none !important;
  border-radius: 0 !important;
  border: 0 !important;
  box-shadow: none !important;
  cursor: default;
}
.hp-multicam-grid .acaris-multivideo-video-container:fullscreen .hp-multicam-cell-exit-fs,
.hp-multicam-grid .acaris-multivideo-video-container:-webkit-full-screen .hp-multicam-cell-exit-fs {
  display: flex;
}
/* Make sure the video can letterbox cleanly in fullscreen (most
   cameras aren't 16:9 so the screen ratio rarely matches). */
.hp-multicam-grid .acaris-multivideo-video-container:fullscreen video,
.hp-multicam-grid .acaris-multivideo-video-container:-webkit-full-screen video {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  background: #000;
}

/* ── Unified Activity tile under each cam ─────────────────────────
   One panel per cam: position map on the left, REST + ANOM bars +
   state pill on the right. Replaces the earlier three-panel strip.
   The data-cam-id attribute is the lookup key for applyMultiCamStats;
   data-stale + data-empty drive the overlay pseudo-elements. */
.hp-multicam-activity-tile {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(150px, 1fr);
  gap: 8px;
  margin-top: 4px;
  padding: 6px;
  background: var(--hp-tile-bg, var(--hp-bg-soft));
  border: 1px solid var(--hp-tile-border, var(--hp-line));
  border-radius: var(--hp-radius);
  cursor: pointer;
  transition: border-color .15s ease, opacity .2s ease;
  position: relative;
  box-sizing: border-box;
  width: 100%;
}
.hp-multicam-activity-tile:hover { border-color: rgba(255, 255, 255, 0.20); }
.hp-multicam-activity-tile:focus-visible {
  outline: 2px solid var(--hp-accent, #4f6cff);
  outline-offset: 1px;
}

/* Left half — position map. The canvas is 240×135; CSS scales it to
   container width with auto height so the 16:9 ratio is preserved. */
.hp-activity-map {
  position: relative;
  border-radius: 4px;
  overflow: hidden;
  background: var(--hp-heat-bg, #080810);
  min-width: 0;
}
.hp-activity-map canvas { display: block; width: 100%; height: auto; }
.hp-activity-map-label {
  position: absolute;
  left: 6px; top: 5px;
  font: 600 9px/1 'Inter', system-ui, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.8);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85), 0 0 4px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

/* Right half — head row, REST bar, ANOM bar, state pill. */
.hp-activity-meta {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  padding: 2px 2px 2px 0;
}
.hp-activity-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font: 600 10px/1 'Inter', system-ui, sans-serif;
  color: rgba(255, 255, 255, 0.7);
  letter-spacing: 0.04em;
  min-width: 0;
}
.hp-activity-horses {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hp-activity-window {
  text-transform: uppercase;
  opacity: 0.55;
  font-size: 9px;
  letter-spacing: 0.06em;
  flex: 0 0 auto;
  margin-left: 6px;
}

.hp-activity-bar-row {
  display: grid;
  /* min-content on the label column lets the widest German label
     ("BEWEGUNG", 8 chars) size itself instead of overflowing the old
     fixed-36 px column into the track. Value column widens the same way
     so "0 %" through "50 %" stay right-aligned without clipping. */
  grid-template-columns: min-content 1fr min-content;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.hp-activity-bar-label {
  font: 700 9px/1 'Inter', system-ui, sans-serif;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
  white-space: nowrap;
}
.hp-activity-bar-track {
  height: 7px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 4px;
  overflow: hidden;
  min-width: 0;
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.3);
}
.hp-activity-bar-fill {
  height: 100%;
  width: 0;
  border-radius: 4px;
  background: linear-gradient(90deg,
    var(--hp-bar-rest-low,  #00b488) 0%,
    var(--hp-bar-rest-low,  #00b488) 30%,
    var(--hp-bar-rest-mid,  #f4a020) 70%,
    var(--hp-bar-rest-high, #b01e23) 100%);
  transition: width .35s ease;
}
.hp-activity-bar-row[data-metric="anom"] .hp-activity-bar-fill {
  background: linear-gradient(90deg,
    var(--hp-bar-anom-low,  #1d70b7) 0%,
    var(--hp-bar-anom-low,  #1d70b7) 30%,
    var(--hp-bar-anom-mid,  #f4a020) 70%,
    var(--hp-bar-anom-high, #b01e23) 100%);
}
.hp-activity-bar-value {
  font: 600 11px/1 'Inter', system-ui, sans-serif;
  color: rgba(255, 255, 255, 0.95);
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.hp-activity-state {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  font: 600 10px/1 'Inter', system-ui, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.hp-activity-state-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: var(--hp-state-calm-dot, #00b488);
  box-shadow: 0 0 0 0 rgba(0, 180, 136, 0);
}
.hp-activity-state-label { color: rgba(255, 255, 255, 0.45); }
.hp-activity-state-text  { color: rgba(255, 255, 255, 0.92); text-align: right; }
.hp-activity-state-calm  .hp-activity-state-dot  { background: var(--hp-state-calm-dot,  #00b488); }
.hp-activity-state-calm  .hp-activity-state-text { color:      var(--hp-state-calm-text, #5ee2b4); }
.hp-activity-state-stir  .hp-activity-state-dot  { background: var(--hp-state-stir-dot,  #f4a020); }
.hp-activity-state-stir  .hp-activity-state-text { color:      var(--hp-state-stir-text, #ffd482); }
.hp-activity-state-alert .hp-activity-state-dot  {
  background: var(--hp-state-alert-dot, #ff5560);
  animation: hp-activity-pulse 1.2s ease-in-out infinite;
}
.hp-activity-state-alert .hp-activity-state-text { color: var(--hp-state-alert-text, #ff8a8d); }
@keyframes hp-activity-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 85, 96, 0.55); }
  50%      { box-shadow: 0 0 0 5px rgba(255, 85, 96, 0); }
}

/* Stale / unreachable overlay — fades the tile and centers the reason
   pulled from data-stale-msg. Same visual treatment as the old strip
   so unreachable cams keep their amber-on-dark badge. */
.hp-multicam-activity-tile[data-stale] { opacity: 0.65; }
.hp-multicam-activity-tile[data-stale]::before {
  content: attr(data-stale-msg);
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font: 600 11px/1.2 'Inter', system-ui, sans-serif;
  color: rgba(255, 220, 130, 0.92);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
  background: rgba(20, 16, 8, 0.62);
  letter-spacing: 0.03em;
  text-align: center;
  padding: 4px 10px;
  border-radius: var(--hp-radius);
  pointer-events: none;
  z-index: 2;
}
/* "No horse in view" — neutral hint, doesn't fade the tile because
   the device IS responding correctly. */
.hp-multicam-activity-tile[data-empty="1"]::after {
  content: attr(data-empty-msg);
  position: absolute;
  left: 8px; right: 8px;
  bottom: 5px;
  font: 500 10px/1.2 'Inter', system-ui, sans-serif;
  color: rgba(255, 255, 255, 0.62);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  letter-spacing: 0.04em;
  text-align: center;
  pointer-events: none;
  z-index: 1;
}

/* Light-mode theme overrides. The map canvas stays dark intentionally
   so the heat colors remain readable on either theme. */
#hp-ai-dashboard-root.hp-theme-light .hp-activity-bar-track { background: rgba(0, 0, 0, 0.08); }
#hp-ai-dashboard-root.hp-theme-light .hp-activity-bar-value { color: var(--hp-text); }
#hp-ai-dashboard-root.hp-theme-light .hp-activity-head      { color: rgba(0, 0, 0, 0.6); }
#hp-ai-dashboard-root.hp-theme-light .hp-activity-bar-label { color: rgba(0, 0, 0, 0.55); }
#hp-ai-dashboard-root.hp-theme-light .hp-activity-state     { background: rgba(0, 0, 0, 0.05); }
#hp-ai-dashboard-root.hp-theme-light .hp-activity-state-label { color: rgba(0, 0, 0, 0.45); }
#hp-ai-dashboard-root.hp-theme-light .hp-activity-state-text  { color: var(--hp-text); }

/* ── Settings tile under each cam ─────────────────────────────────
   Lives under the mini-stats strip, same parent (Grid2 item). Read-
   only summary of the cam's alarm / monitoring config. Click → opens
   Quick Settings in a NEW tab so the operator's multi-cam view isn't
   disrupted. Active fired alarms render in red below the settings
   row so "what's configured" and "what's firing right now" are
   visually distinct (the legacy Birth badge confused these — the
   pill says "Birth: On" = setting; the red line says "Alarm active"
   = currently firing). */
.hp-multicam-settings-tile {
  margin-top: 4px;
  padding: 6px 8px;
  background: var(--hp-bg-soft);
  border: 1px solid var(--hp-line);
  border-radius: var(--hp-radius);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.hp-multicam-settings-tile:hover {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.04);
}
.hp-multicam-settings-tile:focus-visible {
  outline: 2px solid var(--hp-accent, #4f6cff);
  outline-offset: 1px;
}
.hp-settings-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.hp-settings-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 999px;
  font: 500 11px/1.2 'Inter', system-ui, sans-serif;
  color: rgba(255, 255, 255, 0.78);
}
.hp-settings-pill-icon { font-size: 12px; line-height: 1; }
.hp-settings-pill-label {
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: 0.02em;
}
.hp-settings-pill-value { font-weight: 600; }
.hp-settings-pill-on .hp-settings-pill-value {
  color: var(--hp-ok, #00B488);
}
.hp-settings-pill-off .hp-settings-pill-value {
  color: rgba(255, 255, 255, 0.55);
}

/* Active alarms — red row below the settings pills. */
.hp-settings-alarms {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.hp-alarm-line {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: rgba(176, 30, 35, 0.12);
  border: 1px solid rgba(176, 30, 35, 0.55);
  border-radius: 6px;
  font: 600 11px/1.2 'Inter', system-ui, sans-serif;
  color: #ff7178;
}
.hp-alarm-line.is-active .hp-alarm-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #ff4753;
  box-shadow: 0 0 6px rgba(255, 71, 83, 0.7);
  flex: 0 0 auto;
  animation: hp-alarm-dot-pulse 1.6s ease-in-out infinite;
}
.hp-alarm-line .hp-alarm-time {
  margin-left: auto;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 500;
  color: rgba(255, 200, 200, 0.85);
}
@keyframes hp-alarm-dot-pulse {
  0%, 100% { opacity: 1;   transform: scale(1); }
  50%      { opacity: 0.5; transform: scale(0.85); }
}

/* Stopped (user paused) — subtler styling: leave the last frame, just
   show the play button at full opacity (default). No extra overlay. */
.hp-multicam-grid .acaris-multivideo-video-container[data-hp-state="stopped"] video {
  filter: brightness(0.65);
}

/* Placeholder + overflow tiles (cams the bundle doesn't get to stream):
   keep our standalone tile shape. */
.hp-multicam-tile-placeholder {
  position: relative;
  border-radius: var(--hp-radius);
  overflow: hidden;
  background: #0b0e2b;
  border: 1px solid var(--hp-line);
  box-shadow: var(--hp-shadow);
  cursor: pointer;
  transition: transform .15s ease, box-shadow .2s ease, border-color .2s ease;
  aspect-ratio: 16 / 9;
  display: inline-block;
  width: clamp(280px, 100%, 360px);
  margin: 6px;
  vertical-align: top;
}
.hp-multicam-tile-placeholder:hover { transform: translateY(-1px); box-shadow: var(--hp-shadow-lg); }
.hp-multicam-tile-placeholder[data-state="online"]  { border-color: rgba(0,180,136,0.45); }
.hp-multicam-tile-placeholder[data-state="offline"] { filter: saturate(0.6); }
.hp-multicam-tile-placeholder[data-state="alarm"] {
  border-color: var(--hp-err);
  box-shadow: 0 0 0 1px rgba(176,30,35,0.55), 0 0 22px rgba(176,30,35,0.45);
  animation: hp-tile-alarm-pulse 1.8s ease-in-out infinite;
}
.hp-multicam-tile-surface {
  position: absolute;
  inset: 0;
  background: #000;
}

/* MJPEG fallback tile — same chrome as a webrtc cell (overlays attach via
   appendCamOverlays) but an <img> consumes the multipart/x-mixed-replace
   stream directly. object-fit:cover matches the bundle's video cropping. */
.hp-multicam-tile-mjpeg { position: relative; }
.hp-mjpeg-cell-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #0a0a0a;
}
.hp-multicam-mjpeg-failed::after {
  content: "⚠ Stream unavailable";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f4c430;
  font-size: 13px;
  pointer-events: none;
  background: rgba(0,0,0,0.5);
}

/* Overflow row: cams beyond MULTICAM_MAX_LIVE or non-streamable cams. */
.hp-multicam-overflow {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 16px;
  /* Row spans every column of .hp-multicam-grid so its placeholder tiles
     lay out on their own baseline below the live cams. */
  grid-column: 1 / -1;
}
.hp-multicam-overflow-note {
  width: 100%;
  color: var(--hp-muted);
  font: 500 12px/1.3 'Inter', system-ui, sans-serif;
  padding-bottom: 4px;
}

/* Placeholder (no active webrtc row) */
.hp-multicam-placeholder {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column;
  gap: 10px;
  background:
    radial-gradient(ellipse at 50% 50%, rgba(42,42,130,0.25), transparent 70%),
    #0b0e2b;
}
.hp-multicam-placeholder-avatar {
  width: 72px; height: 72px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  box-shadow: 0 0 0 3px rgba(255,255,255,0.06), 0 0 20px rgba(0,0,0,0.5);
}
.hp-multicam-placeholder-label {
  color: var(--hp-faint);
  font: 600 11px/1 'Inter', system-ui, sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Top + bottom overlays with subtle gradients so badges are legible on
   any video frame. Pointer-events stay on so the SPA can hijack clicks
   in the overlays to jump to Status — clicks on the bundle's controls
   land on .acaris-multivideos-button (z-index above) and the jump
   handler ignores them. */
.hp-multicam-tile-top,
.hp-multicam-tile-bottom {
  position: absolute;
  left: 0; right: 0;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 2;
  pointer-events: auto;
}
.hp-multicam-tile-top {
  top: 0;
  justify-content: space-between;
  background: linear-gradient(180deg, rgba(0,0,0,0.62) 0%, rgba(0,0,0,0) 100%);
  color: #fff;
}
.hp-multicam-tile-bottom {
  bottom: 0;
  flex-wrap: wrap;
  background: linear-gradient(0deg, rgba(0,0,0,0.62) 0%, rgba(0,0,0,0) 100%);
}
.hp-multicam-tile-name {
  font: 600 13px/1.1 'Inter', system-ui, sans-serif;
  color: #fff;
  max-width: 70%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}
.hp-multicam-tile-name .hp-multicam-tile-id {
  font-weight: 500;
  opacity: 0.7;
}
.hp-multicam-tile-age {
  font: 600 11px/1 'Inter', system-ui, sans-serif;
  color: rgba(255,255,255,0.85);
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  white-space: nowrap;
}

.hp-badge.hp-badge-offline {
  --hp-badge-bg: rgba(100,116,139,0.55);
  --hp-badge-fg: #ffffff;
}

/* Corner alarm — uppercase ⚠ in a red disc, glows over the top-right.
   Reuses the keyframe shipped for the picker tile. */
.hp-multicam-tile-alarm {
  position: absolute;
  top: 8px; right: 8px;
  z-index: 3;
  width: 28px; height: 28px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--hp-err);
  color: #fff;
  font-size: 16px;
  box-shadow: 0 0 0 2px rgba(176,30,35,0.45), 0 0 14px rgba(176,30,35,0.65);
  animation: hp-tile-alarm-pulse 1.4s ease-in-out infinite;
}

/* Fullscreen — when the grid is the current fullscreenElement, body
   gets .hp-mcam-fs and we let the grid go edge-to-edge in dark mode. */
body.hp-mcam-fs .hp-multicam-grid {
  background: #000;
  padding: 8px;
  height: 100vh;
  overflow: auto;
}
body.hp-mcam-fs .hp-multicam-grid .acaris-multivideo-video-container { aspect-ratio: 16 / 9; }

/* ---- Mobile tweaks for the new pieces ---- */
@media (max-width: 900px) {
  .hp-picker-mode-large .hp-horse-row {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
  }
  .hp-picker-mode-large .hp-horse-tile { padding: 12px 12px 10px; }
  .hp-picker-mode-large .hp-horse-tile .hp-horse-avatar { width: 64px; height: 64px; }
  .hp-group-add-grid { grid-template-columns: 1fr; }
  .hp-multicam-tile-placeholder { width: 100%; margin: 6px 0; }
}

@media (prefers-reduced-motion: reduce) {
  .hp-horse-tile,
  .hp-btn,
  .hp-picker-group,
  .hp-picker-expand-btn,
  .hp-group-cam-row,
  .hp-group-add-row { transition: none !important; }
  .hp-horse-tile-alarm { animation: none !important; }
  .hp-dot-alarm { animation: none !important; }
  .hp-monitor-ring-fg { transition: none !important; }
}

/* ============================================================
   Monitoring tab — card grid, progress ring, edit modal.
   Mirrors the new picker-tile look (glass card + accent border +
   badge palette already shipped). No legacy Fancybox dependency;
   the modal uses its own backdrop scoped to .hp-overlay-open.
   ============================================================ */
.hp-pill-btn.hp-pill-primary {
  background: var(--hp-accent);
  color: #ffffff;
  border-color: var(--hp-accent);
  box-shadow: 0 6px 18px rgba(0,180,136,0.25);
}
.hp-pill-btn.hp-pill-primary:hover {
  box-shadow: 0 10px 24px rgba(0,180,136,0.35);
  filter: brightness(1.05);
}

.hp-monitors-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 14px;
  flex-wrap: wrap;
}
.hp-monitors-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--hp-text);
}
.hp-monitors-add-btn {
  appearance: none; -webkit-appearance: none;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--hp-accent);
  background: var(--hp-accent);
  color: #fff;
  font: 700 12px/1 'Inter', system-ui, sans-serif;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(0,180,136,0.28);
  transition: box-shadow .15s ease, transform .15s ease, filter .15s ease;
}
.hp-monitors-add-btn:hover { transform: translateY(-1px); box-shadow: 0 12px 28px rgba(0,180,136,0.40); filter: brightness(1.05); }
.hp-monitors-add-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  font-size: 14px; font-weight: 800; line-height: 1;
}

.hp-monitors-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  width: 100%;
  min-width: 0;
}

.hp-monitor-card {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 14px;
  padding: 16px 16px 12px;
  border-left: 3px solid var(--hp-line);
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}
.hp-monitor-card:hover { transform: translateY(-1px); box-shadow: var(--hp-shadow-lg); }
.hp-monitor-card[data-state="ok"]       { border-left-color: var(--hp-accent); }
.hp-monitor-card[data-state="warn"]     { border-left-color: var(--hp-warn); }
.hp-monitor-card[data-state="err"]      {
  border-left-color: var(--hp-err);
  box-shadow: 0 0 0 1px rgba(176,30,35,0.25), var(--hp-shadow);
}
.hp-monitor-card[data-state="pending"]  { border-left-color: var(--hp-faint); }
.hp-monitor-card[data-state="inactive"] {
  border-left-color: var(--hp-line);
  opacity: 0.65;
  filter: saturate(0.5);
}

/* ── head: badge + name + cog ────────────────────────────────────── */
.hp-monitor-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.hp-monitor-name {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--hp-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.005em;
  text-transform: none;
}
.hp-monitor-cog {
  appearance: none; -webkit-appearance: none;
  flex: 0 0 auto;
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1px solid var(--hp-line);
  background: rgba(42,42,130,0.30);
  color: var(--hp-muted);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s ease, color .15s ease, transform .15s ease, border-color .15s ease;
}
.hp-monitor-cog:hover {
  color: var(--hp-text);
  background: var(--hp-accent-soft);
  border-color: var(--hp-accent);
  transform: rotate(30deg);
}

/* ── body: ring + stats ─────────────────────────────────────────── */
.hp-monitor-body {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 14px;
}
.hp-monitor-ring {
  position: relative;
  width: 60px; height: 60px;
  flex: 0 0 auto;
}
.hp-monitor-ring svg { display: block; width: 100%; height: 100%; }
.hp-monitor-ring-bg { stroke: var(--hp-line); }
.hp-monitor-ring-fg { stroke: var(--hp-accent); transition: stroke-dashoffset .35s ease, stroke .2s ease; }
.hp-monitor-card[data-state="warn"]    .hp-monitor-ring-fg { stroke: var(--hp-warn); }
.hp-monitor-card[data-state="err"]     .hp-monitor-ring-fg { stroke: var(--hp-err); }
.hp-monitor-card[data-state="pending"] .hp-monitor-ring-fg { stroke: var(--hp-faint); }
.hp-monitor-card[data-state="inactive"] .hp-monitor-ring-fg { stroke: var(--hp-faint); }
.hp-monitor-ring-pct {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font: 700 13px/1 'Inter', system-ui, sans-serif;
  color: var(--hp-text);
  letter-spacing: -0.02em;
}
.hp-monitor-stats {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.hp-monitor-numbers {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--hp-text);
}
.hp-monitor-obs  { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.hp-monitor-sep  { font-size: 16px; color: var(--hp-faint); }
.hp-monitor-lim  { font-size: 16px; color: var(--hp-muted); font-weight: 600; }
.hp-monitor-unit { font-size: 12px; color: var(--hp-faint); }
.hp-monitor-meta {
  font-size: 11px;
  color: var(--hp-faint);
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hp-monitor-status {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--hp-faint);
}
.hp-monitor-card[data-state="ok"]      .hp-monitor-status { color: var(--hp-accent); }
.hp-monitor-card[data-state="warn"]    .hp-monitor-status { color: var(--hp-warn); }
.hp-monitor-card[data-state="err"]     .hp-monitor-status { color: var(--hp-err); }
.hp-monitor-card[data-state="inactive"] .hp-monitor-status,
.hp-monitor-card[data-state="pending"] .hp-monitor-status { color: var(--hp-faint); }

/* ── foot: toggle ───────────────────────────────────────────────── */
.hp-monitor-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--hp-line);
}

/* ── empty state ────────────────────────────────────────────────── */
.hp-monitor-empty {
  text-align: center;
  padding: 36px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.hp-monitor-empty h3 { margin: 0; font-size: 16px; color: var(--hp-text); text-transform: none; letter-spacing: 0; }
.hp-monitor-empty-cta {
  margin-top: 6px;
  background: var(--hp-accent);
  color: #fff;
  border-color: var(--hp-accent);
}
.hp-monitor-empty-cta:hover { filter: brightness(1.05); }

/* ── flash error ────────────────────────────────────────────────── */
.hp-monitor-flash {
  position: absolute;
  inset: auto 12px 12px 12px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(176,30,35,0.92);
  color: #fff;
  font: 600 12px/1.3 'Inter', system-ui, sans-serif;
  opacity: 1;
  transition: opacity .35s ease, transform .35s ease;
}
.hp-monitor-flash-out { opacity: 0; transform: translateY(6px); }

/* ============================================================
   Edit / create modal (no Fancybox dependency).
   Centered card on desktop; bottom sheet on mobile.
   ============================================================ */
.hp-monitor-modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(8,12,28,0.78);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: hp-monitor-fade-in .2s ease both;
}
@keyframes hp-monitor-fade-in { from { opacity: 0; } to { opacity: 1; } }

.hp-monitor-modal {
  /* Solid panel — the dark theme's --hp-surface is rgba(…,0.78) which
     lets the dim backdrop bleed through and makes the form look washed
     out. Use a fully opaque dark navy here so the modal reads as a
     proper sheet. Light theme override below keeps it pure white. */
  background: #14163a;
  color: var(--hp-text);
  border-radius: var(--hp-radius);
  box-shadow: 0 24px 60px rgba(0,0,0,0.55);
  width: 100%;
  max-width: 440px;
  max-height: calc(100dvh - 48px);
  overflow: auto;
  border: 1px solid var(--hp-line);
}
.hp-monitor-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--hp-line);
}
.hp-monitor-modal-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--hp-text);
  text-transform: none;
  letter-spacing: 0;
}
.hp-monitor-modal-close {
  appearance: none; -webkit-appearance: none;
  background: transparent; border: 0;
  color: var(--hp-muted);
  font-size: 22px; line-height: 1;
  padding: 0; width: 30px; height: 30px;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.hp-monitor-modal-close:hover { color: var(--hp-text); background: var(--hp-accent-soft); }

.hp-monitor-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
}
.hp-monitor-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.hp-monitor-field-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--hp-muted);
}
.hp-monitor-numrow {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.hp-monitor-select {
  appearance: none; -webkit-appearance: none;
  width: 100%;
  padding: 9px 36px 9px 12px;
  border-radius: 12px;
  border: 1px solid var(--hp-line);
  /* Solid background — matches the modal panel so the control reads
     as opaque on the modal instead of letting the backdrop through. */
  background: #1b1e48 url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'><path d='M2 4l4 4 4-4' stroke='%238890b8' stroke-width='1.5' fill='none' stroke-linecap='round'/></svg>") no-repeat right 10px center;
  color: var(--hp-text);
  font: 500 14px/1.2 'Inter', system-ui, sans-serif;
  cursor: pointer;
}
.hp-monitor-select:focus { outline: 0; border-color: var(--hp-accent); box-shadow: 0 0 0 3px var(--hp-accent-soft); }

/* Inputs inside the modal use a solid panel background — the global
   .hp-text-input rule uses the translucent --hp-surface, which would
   show the dim backdrop through on top of the modal sheet. Scoped
   to .hp-monitor-modal so other forms (Quick Settings, Groups) keep
   the existing translucent-on-card look. */
.hp-monitor-modal .hp-text-input { background: #1b1e48; }
#hp-ai-dashboard-root.hp-theme-light .hp-monitor-modal .hp-text-input { background: #ffffff; }

.hp-monitor-modal-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px 18px;
  border-top: 1px solid var(--hp-line);
}
.hp-monitor-modal-status {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 12px;
  color: var(--hp-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Bottom-sheet on mobile so the form is reachable with one thumb. */
@media (max-width: 640px) {
  .hp-monitor-modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }
  .hp-monitor-modal {
    max-width: 100%;
    max-height: 92dvh;
    border-radius: 18px 18px 0 0;
    animation: hp-monitor-slide-up .25s ease both;
  }
  @keyframes hp-monitor-slide-up {
    from { transform: translateY(20%); opacity: 0; }
    to   { transform: translateY(0);   opacity: 1; }
  }
  .hp-monitors-grid { grid-template-columns: 1fr; }
  .hp-monitors-add-btn { width: 100%; justify-content: center; }
  .hp-monitor-numrow { grid-template-columns: 1fr; }
}

/* ── Light-theme variants ───────────────────────────────────────── */
#hp-ai-dashboard-root.hp-theme-light .hp-monitor-card { background: var(--hp-surface); }
#hp-ai-dashboard-root.hp-theme-light .hp-monitor-cog { background: #ffffff; }
#hp-ai-dashboard-root.hp-theme-light .hp-monitor-modal {
  background: #ffffff;
  border-color: var(--hp-line);
  box-shadow: 0 24px 60px rgba(15,23,42,0.18);
}
#hp-ai-dashboard-root.hp-theme-light .hp-monitor-select { background-color: #ffffff; }
.hp-monitor-modal .hp-pill-group { background: #20234e; }
#hp-ai-dashboard-root.hp-theme-light .hp-monitor-modal .hp-pill-group { background: #eef0f4; }
#hp-ai-dashboard-root.hp-theme-light .hp-monitor-flash { background: #b91c1c; }
#hp-ai-dashboard-root.hp-theme-light .hp-monitor-ring-bg { stroke: #e2e8f0; }

/* ───────── Branding tab (admin-only customer themes + logos) ─────────
   Two-column layout: form on the left, live preview tile on the right.
   Reuses .hp-text-input, .hp-btn, .hp-groups-toolbar, .hp-groups-status
   from existing styles so the form chrome matches the Groups tab.   */
.hp-branding-tab { display: block; }
.hp-branding-tab > h3 {
  margin: 0 0 12px;
  font-size: 18px;
  color: var(--hp-fg);
}
.hp-branding-edit {
  margin-top: 16px;
}
.hp-branding-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, 1fr);
  gap: 20px;
  align-items: start;
}
@media (max-width: 900px) {
  .hp-branding-grid { grid-template-columns: 1fr; }
}
.hp-branding-left,
.hp-branding-right {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.hp-branding-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--hp-fg);
  margin: 4px 0 2px;
  letter-spacing: 0.02em;
}
.hp-branding-logo-preview {
  display: block;
  max-width: 180px;
  max-height: 60px;
  margin: 2px 0 4px;
  object-fit: contain;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--hp-line);
  border-radius: 4px;
  padding: 4px;
}
.hp-branding-logo-preview[src=""],
.hp-branding-logo-preview:not([src]) { display: none; }

/* Per-concern grouping: Tile / Heatmap / Bars / State pill. */
.hp-color-section {
  margin-top: 10px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--hp-line);
  border-radius: var(--hp-radius);
}
.hp-color-section > h4 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--hp-fg);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.hp-color-section > h5 {
  margin: 8px 0 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--hp-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* One color picker row: label + swatch. Native <input type="color">
   sizes vary across browsers; lock it down. */
.hp-color-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 3px 0;
  min-height: 28px;
}
.hp-color-label {
  flex: 1;
  font-size: 12px;
  color: var(--hp-fg);
}
.hp-color-row input[type="color"],
.hp-color-stops input[type="color"] {
  width: 36px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--hp-line);
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  flex: 0 0 auto;
}
.hp-color-row input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
.hp-color-row input[type="color"]::-webkit-color-swatch { border: none; border-radius: 2px; }

/* Heatmap 5-stop palette — the 5 swatches sit in a row, no labels;
   the visual order IS the colour-ramp order from cold to hot. */
.hp-color-stops {
  display: flex;
  gap: 6px;
  margin: 4px 0;
}
.hp-color-stops input[type="color"] { width: 44px; height: 32px; }

.hp-branding-emails {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  min-height: 110px;
  resize: vertical;
}
.hp-branding-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

/* Live preview pane — mirrors a real Activity tile so the admin sees
   exactly what their colour choices will produce. Sticks to the top of
   the right column while scrolling the long form on the left. */
.hp-branding-right > h4 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--hp-fg);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.hp-branding-preview {
  position: sticky;
  top: 12px;
  padding: 10px;
  background: rgba(255,255,255,0.02);
  border: 1px dashed var(--hp-line);
  border-radius: var(--hp-radius);
}

/* ==================================================================
   Getting Started (empty-state) + Help page
   ==================================================================
   Both share the standard header + footer via .hp-shell; the shell
   variants below just widen the body max-width and switch its layout
   away from tabs. */

.hp-shell-onboard,
.hp-shell-help { padding-bottom: 24px; }

.hp-onboard-body,
.hp-help-body {
  max-width: 960px;
  margin: 24px auto 0;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.hp-onboard-loading,
.hp-help-loading {
  padding: 32px;
  text-align: center;
  color: var(--hp-muted);
}

/* Hero */
.hp-onboard-hero,
.hp-help-hero {
  padding: 24px 28px;
  border-radius: var(--hp-radius);
  background: linear-gradient(135deg,
    var(--hp-accent-soft, rgba(42,42,130,0.16)) 0%,
    rgba(255,255,255,0.02) 100%);
  border: 1px solid var(--hp-line);
}
.hp-onboard-hero-title,
.hp-help-hero-title {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 700;
  color: var(--hp-fg);
}
.hp-onboard-hero-sub,
.hp-help-hero-sub {
  margin: 0;
  color: var(--hp-muted);
  line-height: 1.5;
  max-width: 68ch;
}

/* Primary two-tile row */
.hp-onboard-primary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 780px) {
  .hp-onboard-primary { grid-template-columns: 1fr; }
}
.hp-onboard-tile {
  padding: 22px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--hp-line);
  border-radius: var(--hp-radius);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.hp-onboard-tile-eyebrow {
  font-size: 11px;
  font-weight: 700;
  color: var(--hp-accent, #2A2A82);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.hp-onboard-tile-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--hp-fg);
}
.hp-onboard-tile-lead {
  margin: 0;
  color: var(--hp-muted);
  font-size: 13.5px;
  line-height: 1.5;
}
.hp-onboard-tile-activate .hp-onboard-activate-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}
.hp-onboard-activate-form input {
  padding: 10px 12px;
  border-radius: var(--hp-radius);
  border: 1px solid var(--hp-line);
  background: var(--hp-bg);
  color: var(--hp-fg);
  font: 14px system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}
.hp-onboard-activate-form input:focus {
  outline: none;
  border-color: var(--hp-accent);
  box-shadow: 0 0 0 3px var(--hp-accent-soft);
}
.hp-onboard-activate-btn,
.hp-onboard-buy-btn,
.hp-onboard-ptz-btn {
  align-self: flex-start;
  padding: 11px 22px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font: 700 14px system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: #fff;
  background: linear-gradient(120deg, var(--hp-accent, #2A2A81) 0%, var(--hp-accent-2, #3a3aa8) 100%);
  box-shadow: 0 4px 12px rgba(42,42,129,.24);
  transition: transform .12s ease, box-shadow .12s ease;
}
.hp-onboard-activate-btn:hover,
.hp-onboard-buy-btn:hover,
.hp-onboard-ptz-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(42,42,129,.32); }
.hp-onboard-activate-btn:disabled { opacity: 0.55; cursor: progress; transform: none; box-shadow: none; }

.hp-onboard-activate-note {
  min-height: 18px;
  font-size: 13px;
  color: var(--hp-muted);
}
.hp-onboard-activate-note.hp-onboard-activate-err { color: var(--hp-err, #c33); }
.hp-onboard-activate-note.hp-onboard-activate-ok  { color: var(--hp-ok,  #2b8a3e); }

/* Share-my-email chip */
.hp-onboard-share {
  padding: 18px 22px;
  border-radius: var(--hp-radius);
  border: 1px solid var(--hp-line);
  background: rgba(255,255,255,0.02);
}
.hp-onboard-share-title {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 700;
  color: var(--hp-fg);
}
.hp-onboard-share-lead {
  margin: 0 0 12px;
  color: var(--hp-muted);
  font-size: 13.5px;
  line-height: 1.5;
}
.hp-onboard-email-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px 6px 14px;
  border: 1px solid var(--hp-line);
  border-radius: 999px;
  background: var(--hp-bg);
}
.hp-onboard-email-val {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13.5px;
  color: var(--hp-fg);
}
.hp-onboard-email-copy {
  appearance: none; -webkit-appearance: none;
  padding: 6px 12px;
  border: 0;
  border-radius: 999px;
  background: var(--hp-accent-soft, rgba(42,42,130,0.16));
  color: var(--hp-accent, #2A2A82);
  font: 600 12px system-ui, sans-serif;
  cursor: pointer;
}
.hp-onboard-email-copy:hover { background: var(--hp-accent, #2A2A82); color: #fff; }

/* PTZ CTA — restyled to match the tile look, but uses the same colour as
   the legacy no_camera_text() card so the CHIO branding stays recognisable. */
.hp-onboard-ptz {
  padding: 18px 22px;
  border-radius: var(--hp-radius);
  border: 1px solid #e3e3f3;
  background: #f4f4fb;
  color: #2A2A81;
  text-align: center;
}
.hp-onboard-ptz-title { font-weight: 700; font-size: 15px; margin-bottom: 10px; }
.hp-onboard-ptz .hp-onboard-ptz-btn { display: inline-block; }

/* Support strip + legal footer */
.hp-onboard-support {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-top: 1px solid var(--hp-line);
  color: var(--hp-muted);
  font-size: 13.5px;
}
.hp-onboard-support-lead { font-weight: 600; color: var(--hp-fg); }
.hp-onboard-support-link {
  color: var(--hp-accent, #2A2A82);
  text-decoration: none;
  border-bottom: 1px dashed var(--hp-accent, #2A2A82);
}
.hp-onboard-support-link:hover { border-bottom-style: solid; }
.hp-onboard-legal {
  font-size: 12px;
  color: var(--hp-muted);
  text-align: center;
  padding: 4px 0 16px;
}
.hp-onboard-legal a { color: var(--hp-muted); }

/* ===== Help videos ===== */

/* Small strip used inside the empty-state page (top 4 videos) */
.hp-help-strip {
  padding: 18px 22px;
  border-radius: var(--hp-radius);
  border: 1px solid var(--hp-line);
  background: rgba(255,255,255,0.02);
}
.hp-help-strip-title {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 700;
  color: var(--hp-fg);
}
.hp-help-strip-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
@media (max-width: 780px) {
  .hp-help-strip-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.hp-help-tile {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border-radius: var(--hp-radius);
  text-decoration: none;
  color: inherit;
  border: 1px solid transparent;
  transition: border-color .12s ease, background .12s ease;
}
.hp-help-tile:hover { border-color: var(--hp-line); background: rgba(255,255,255,0.02); }
.hp-help-tile-thumb {
  aspect-ratio: 16 / 9;
  background-size: cover;
  background-position: center;
  border-radius: calc(var(--hp-radius) - 2px);
  background-color: rgba(255,255,255,0.04);
  display: flex; align-items: center; justify-content: center;
  color: var(--hp-muted);
  font-size: 22px;
}
.hp-help-tile-thumb-blank { background: rgba(255,255,255,0.05); }
.hp-help-tile-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--hp-fg);
  line-height: 1.3;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.hp-help-strip-more {
  display: inline-block;
  margin-top: 12px;
  color: var(--hp-accent, #2A2A82);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}
.hp-help-strip-more:hover { text-decoration: underline; }

/* Full help page — search + responsive grid */
.hp-help-searchbar { padding: 0 4px; }
.hp-help-search {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--hp-radius);
  border: 1px solid var(--hp-line);
  background: var(--hp-bg);
  color: var(--hp-fg);
  font: 14px system-ui, sans-serif;
}
.hp-help-search:focus {
  outline: none;
  border-color: var(--hp-accent);
  box-shadow: 0 0 0 3px var(--hp-accent-soft);
}
.hp-help-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}
.hp-help-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--hp-line);
  border-radius: var(--hp-radius);
  background: rgba(255,255,255,0.02);
  color: inherit;
  text-decoration: none;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.hp-help-card:hover {
  transform: translateY(-2px);
  border-color: var(--hp-accent);
  box-shadow: 0 4px 14px rgba(0,0,0,0.10);
}
.hp-help-card-thumb {
  aspect-ratio: 16 / 9;
  background-size: cover;
  background-position: center;
  border-radius: calc(var(--hp-radius) - 2px);
  background-color: rgba(255,255,255,0.04);
  display: flex; align-items: center; justify-content: center;
  color: var(--hp-muted);
  font-size: 26px;
}
.hp-help-card-thumb-blank { background: rgba(255,255,255,0.05); }
.hp-help-card-meta { padding: 4px 4px 6px; }
.hp-help-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--hp-fg);
  line-height: 1.35;
}
.hp-help-card-topic {
  margin-top: 4px;
  font-size: 11px;
  color: var(--hp-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.hp-help-empty {
  padding: 24px;
  text-align: center;
  color: var(--hp-muted);
}
.hp-help-resources {
  padding: 18px 22px;
  border-top: 1px solid var(--hp-line);
  margin-top: 8px;
}
.hp-help-resources-title {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--hp-fg);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.hp-help-resources-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.hp-help-resources-list a { color: var(--hp-accent, #2A2A82); text-decoration: none; }
.hp-help-resources-list a:hover { text-decoration: underline; }

/* ==========================================================================
   Branded login card — shown by hp_ai_dashboard_login_box() when an
   anonymous visitor lands on /hp-advanced-dashboard/, /hp-help/ or
   /field-of-view-updated/. Mirrors cow-ai's .cad-login-* structure but
   paints in HP brand green (#aecb37) instead of cow-ai blue.
   ========================================================================== */
.hp-login-shell {
  --hp-lg-primary:   #aecb37;
  --hp-lg-primary-2: #f3f7e1;
  --hp-lg-primary-h: #94b02c;
  --hp-lg-surface:   #ffffff;
  --hp-lg-text:      #0f172a;
  --hp-lg-text-2:    #64748b;
  --hp-lg-border:    #e2e8f0;
  --hp-lg-danger:    #dc2626;
  --hp-lg-radius:    14px;
  min-height: 70vh;
  display: grid;
  place-items: center;
  padding: 48px 16px;
  font-family: system-ui, -apple-system, Segoe UI, sans-serif;
  background: linear-gradient(180deg, #f8fafc 0%, #eef4e0 100%);
}
.hp-login-card {
  width: 100%;
  max-width: 420px;
  background: var(--hp-lg-surface);
  border: 1px solid var(--hp-lg-border);
  border-radius: var(--hp-lg-radius);
  padding: 32px 28px 26px;
  box-shadow: 0 14px 40px rgba(15, 23, 42, 0.10);
  color: var(--hp-lg-text);
}
.hp-login-brand {
  text-align: center;
  margin-bottom: 22px;
}
.hp-login-brand__logo {
  display: block;
  width: 72px;
  height: 72px;
  max-width: 72px;
  border-radius: 50%;
  margin: 0 auto 12px;
  object-fit: contain;
  background: var(--hp-lg-primary-2);
}
.hp-login-brand__title {
  margin: 0 0 4px;
  font-size: 22px;
  letter-spacing: -0.01em;
  font-weight: 700;
  color: var(--hp-lg-primary-h);
}
.hp-login-brand__tag {
  margin: 0;
  font-size: 13px;
  color: var(--hp-lg-text-2);
}
.hp-login-heading {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 600;
  color: var(--hp-lg-text);
  text-align: center;
}
.hp-login-error {
  background: #fef2f2;
  color: var(--hp-lg-danger);
  border: 1px solid #fecaca;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
  margin-bottom: 14px;
}
/* Style wp_login_form()'s native markup without changing its HTML shape
   so any plugin's login_form_top/_middle/_bottom filters keep working. */
.hp-login-formwrap #hp-loginform {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0;
}
.hp-login-formwrap #hp-loginform p {
  margin: 0 0 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.hp-login-formwrap #hp-loginform label {
  font-size: 12px;
  font-weight: 500;
  color: var(--hp-lg-text-2);
}
.hp-login-formwrap #hp-loginform input[type="text"],
.hp-login-formwrap #hp-loginform input[type="password"],
.hp-login-formwrap #hp-loginform input[type="email"] {
  border: 1px solid var(--hp-lg-border);
  border-radius: 10px;
  padding: 9px 11px;
  font-size: 14px;
  color: var(--hp-lg-text);
  background: #fff;
  transition: border-color 120ms ease, box-shadow 120ms ease;
  font-family: inherit;
  width: 100%;
  box-sizing: border-box;
}
.hp-login-formwrap #hp-loginform input[type="text"]:focus,
.hp-login-formwrap #hp-loginform input[type="password"]:focus,
.hp-login-formwrap #hp-loginform input[type="email"]:focus {
  border-color: var(--hp-lg-primary);
  box-shadow: 0 0 0 3px rgba(174, 203, 55, 0.20);
  outline: none;
}
.hp-login-formwrap #hp-loginform p.login-remember {
  flex-direction: row;
  align-items: center;
  font-size: 13px;
  color: var(--hp-lg-text-2);
}
.hp-login-formwrap #hp-loginform p.login-remember label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--hp-lg-text-2);
  font-weight: 400;
  cursor: pointer;
}
.hp-login-formwrap #hp-loginform p.login-submit {
  margin-top: 6px;
  margin-bottom: 0;
}
.hp-login-formwrap #hp-loginform input[type="submit"] {
  width: 100%;
  background: var(--hp-lg-primary);
  color: #1a2600;
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 120ms ease, transform 80ms ease;
  font-family: inherit;
}
.hp-login-formwrap #hp-loginform input[type="submit"]:hover  { background: var(--hp-lg-primary-h); color: #fff; }
.hp-login-formwrap #hp-loginform input[type="submit"]:active { transform: translateY(1px); }
.hp-login-link {
  display: block;
  text-align: center;
  font-size: 13px;
  color: var(--hp-lg-primary-h);
  text-decoration: none;
  margin-top: 12px;
}
.hp-login-link:hover { text-decoration: underline; }
.hp-login-link--strong {
  font-weight: 700;
  margin-top: 6px;
}
.hp-login-note {
  margin: 18px 0 0;
  font-size: 12px;
  color: var(--hp-lg-text-2);
  text-align: center;
  line-height: 1.4;
}

/* --- Register form — shares the login shell/card/brand/note/link styles.
   Only the form-scoped input styling and the terms checkbox row are
   register-specific. Kept parallel to the wp_login_form() selectors above
   so any future tweak to input paddings/colours can be replicated by
   copy/paste. */
.hp-login-card--register {
  max-width: 460px;
}
.hp-login-formwrap #hp-registerform {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0;
}
.hp-login-formwrap #hp-registerform p {
  margin: 0 0 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.hp-login-formwrap #hp-registerform label {
  font-size: 12px;
  font-weight: 500;
  color: var(--hp-lg-text-2);
}
.hp-login-formwrap #hp-registerform input[type="text"],
.hp-login-formwrap #hp-registerform input[type="password"],
.hp-login-formwrap #hp-registerform input[type="email"] {
  border: 1px solid var(--hp-lg-border);
  border-radius: 10px;
  padding: 9px 11px;
  font-size: 14px;
  color: var(--hp-lg-text);
  background: #fff;
  transition: border-color 120ms ease, box-shadow 120ms ease;
  font-family: inherit;
  width: 100%;
  box-sizing: border-box;
}
.hp-login-formwrap #hp-registerform input[type="text"]:focus,
.hp-login-formwrap #hp-registerform input[type="password"]:focus,
.hp-login-formwrap #hp-registerform input[type="email"]:focus {
  border-color: var(--hp-lg-primary);
  box-shadow: 0 0 0 3px rgba(174, 203, 55, 0.20);
  outline: none;
}
.hp-login-formwrap #hp-registerform p.hp-register-terms {
  flex-direction: row;
  align-items: flex-start;
  font-size: 12.5px;
  color: var(--hp-lg-text-2);
  margin-top: 4px;
}
.hp-login-formwrap #hp-registerform p.hp-register-terms label {
  display: inline-flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12.5px;
  color: var(--hp-lg-text-2);
  font-weight: 400;
  cursor: pointer;
  line-height: 1.4;
}
.hp-login-formwrap #hp-registerform p.hp-register-terms input[type="checkbox"] {
  margin-top: 2px;
  flex: 0 0 auto;
}
.hp-login-formwrap #hp-registerform p.hp-register-terms a {
  color: var(--hp-lg-primary-h);
  text-decoration: underline;
}
.hp-login-formwrap #hp-registerform p.login-submit {
  margin-top: 6px;
  margin-bottom: 0;
}
.hp-login-formwrap #hp-registerform input[type="submit"] {
  width: 100%;
  background: var(--hp-lg-primary);
  color: #1a2600;
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 120ms ease, transform 80ms ease;
  font-family: inherit;
}
.hp-login-formwrap #hp-registerform input[type="submit"]:hover  { background: var(--hp-lg-primary-h); color: #fff; }
.hp-login-formwrap #hp-registerform input[type="submit"]:active { transform: translateY(1px); }

/* Honeypot — hidden from humans, harvested by bots. Off-screen instead
   of display:none so screen readers ignore it but form submitters still
   see the field. */
.hp-hpot {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
.hp-login-error > div + div { margin-top: 4px; }

/* ── "Add a new guard" — dashed pill under the picker, and the ────────
   back-link that lets a user with existing guards bail out of the
   Getting Started page (which was re-used for add-a-guard mode via
   ?onboard=1). Deliberately understated so it doesn't compete with the
   guard tiles for attention. */
.hp-picker-addguard-wrap {
  display: flex;
  justify-content: center;
  padding: 10px 8px 4px;
}
.hp-picker-addguard {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px dashed rgba(148, 176, 44, 0.55);
  border-radius: 999px;
  color: #94b02c;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  background: rgba(174, 203, 55, 0.06);
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}
.hp-picker-addguard:hover {
  background: rgba(174, 203, 55, 0.14);
  border-color: rgba(148, 176, 44, 0.85);
  color: #7d961f;
}
.hp-picker-mode-large .hp-picker-addguard-wrap { padding-top: 20px; }

.hp-onboard-back {
  padding: 8px 4px 0;
}
.hp-onboard-back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--hp-text-2, #64748b);
  text-decoration: none;
}
.hp-onboard-back-link:hover {
  color: var(--hp-text, #0f172a);
  text-decoration: underline;
}

/* ── Confirmation-code card — shares the login shell/card/brand/link
   styles.  The code input renders large and centered so the 4-digit
   value is legible at a glance. */
.hp-confirm-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0 0 12px;
}
.hp-confirm-code {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--hp-lg-border, #e2e8f0);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.35em;
  text-align: center;
  color: var(--hp-lg-text, #0f172a);
  background: #fff;
  transition: border-color 120ms ease, box-shadow 120ms ease;
  font-family: system-ui, -apple-system, Segoe UI, sans-serif;
}
.hp-confirm-code:focus {
  border-color: var(--hp-lg-primary, #aecb37);
  box-shadow: 0 0 0 3px rgba(174, 203, 55, 0.20);
  outline: none;
}
.hp-confirm-submit {
  width: 100%;
  background: var(--hp-lg-primary, #aecb37);
  color: #1a2600;
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 120ms ease, transform 80ms ease;
  font-family: inherit;
}
.hp-confirm-submit:hover  { background: var(--hp-lg-primary-h, #94b02c); color: #fff; }
.hp-confirm-submit:active { transform: translateY(1px); }
.hp-confirm-submit:disabled { opacity: 0.7; cursor: wait; }
