@import url("./health-eye-tokens.css");
@import url("./health-eye-auto-layout.css");
@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&family=Manrope:wght@500;600;700;800&display=swap");

@layer he-reset, he-components, he-utilities;

@layer he-reset {
  :where([data-he-root], .he-root),
  :where([data-he-root], .he-root) *,
  :where([data-he-root], .he-root) *::before,
  :where([data-he-root], .he-root) *::after {
    box-sizing: border-box;
  }

  :where([data-he-root], .he-root) {
    color: var(--he-color-text-primary);
    background: var(--he-color-background-canvas);
    font-family: var(--he-font-family-body), sans-serif;
    font-size: var(--he-font-size-md);
    line-height: var(--he-font-line-height-normal);
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
  }

  :where([data-he-root], .he-root) :is(button, input, select, textarea) {
    color: inherit;
    font: inherit;
  }

  :where([data-he-root], .he-root) :focus-visible {
    outline: var(--he-border-width-focus) solid var(--he-color-focus-ring);
    outline-offset: 2px;
  }

  :where([data-he-root], .he-root) :disabled,
  :where([data-he-root], .he-root) [aria-disabled="true"] {
    cursor: not-allowed;
    opacity: var(--he-opacity-disabled);
  }
}

@layer he-components {
  /* Canonical Phase 3 aliases. */
  .he-alert-banner { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--he-space-3); align-items: start; padding: var(--he-space-4); border: 1px solid var(--he-color-status-info-border); border-radius: var(--he-radius-xl); background: var(--he-color-status-info-background); color: var(--he-color-status-info-text); }
  .he-alert-banner--critical { border-color: var(--he-color-status-critical-border); background: var(--he-color-status-critical-background); color: var(--he-color-status-critical-text); }
  .he-toast { display: grid; width: min(100%, var(--he-component-toast-width)); grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: var(--he-space-3); padding: var(--he-space-4); border: 1px solid var(--he-color-border-subtle); border-radius: var(--he-component-toast-radius); background: var(--he-color-surface-raised); color: var(--he-color-text-primary); box-shadow: var(--he-component-toast-shadow); }
  .he-progress { display: grid; gap: var(--he-space-2); }
  .he-progress__meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--he-space-2); font-size: var(--he-font-size-sm); }
  .he-progress__track { height: 8px; overflow: hidden; border-radius: var(--he-radius-pill); background: var(--he-color-surface-secondary); }
  .he-progress__value { width: var(--he-progress, 0%); height: 100%; border-radius: inherit; background: var(--he-color-brand-primary); transition: width var(--he-motion-duration-standard) var(--he-motion-easing-standard); }
  .he-progress[aria-busy="true"] .he-progress__value { width: 38%; animation: he-progress-indeterminate 1.4s ease-in-out infinite; }
  .he-status-badge { display: inline-flex; inline-size: max-content; min-inline-size: max-content; min-height: var(--he-component-badge-height); flex: 0 0 auto; align-items: center; gap: var(--he-component-badge-gap); padding-inline: var(--he-component-badge-padding-x); border: 1px solid var(--he-color-border-default); border-radius: var(--he-component-badge-radius); background: var(--he-color-surface-secondary); color: var(--he-color-text-secondary); font-size: var(--he-component-badge-font-size); font-weight: var(--he-font-weight-bold); line-height: 1; white-space: nowrap; }
  .he-status-badge::before { width: var(--he-component-device-state-dot-size); height: var(--he-component-device-state-dot-size); flex: 0 0 auto; border-radius: 50%; background: currentColor; content: ""; }
  .he-status-badge--healthy { border-color: var(--he-color-status-healthy-border); background: var(--he-color-status-healthy-background); color: var(--he-color-status-healthy-text); }
  .he-status-badge--review { border-color: var(--he-color-status-review-border); background: var(--he-color-status-review-background); color: var(--he-color-status-review-text); }
  .he-status-badge--critical { border-color: var(--he-color-status-critical-border); background: var(--he-color-status-critical-background); color: var(--he-color-status-critical-text); }
  .he-tag { max-width: 100%; }
  .he-avatar { font-size: var(--he-font-size-sm); }
  .he-avatar img { width: 100%; height: 100%; object-fit: cover; }
  .he-data-table { width: 100%; border-collapse: collapse; background: var(--he-color-surface-primary); font-size: var(--he-font-size-sm); }
  .he-data-table :is(th, td) { padding: var(--he-space-3) var(--he-space-4); border-bottom: 1px solid var(--he-color-border-subtle); text-align: left; }
  .he-data-table th { color: var(--he-color-text-tertiary); font-size: var(--he-font-size-xs); letter-spacing: var(--he-font-letter-spacing-wide); text-transform: uppercase; }
  .he-description-list { display: grid; grid-template-columns: minmax(9rem, .7fr) minmax(0, 1.3fr); gap: var(--he-space-3) var(--he-space-6); margin: 0; }
  .he-description-list dt { color: var(--he-color-text-tertiary); }
  .he-description-list dd { min-width: 0; margin: 0; color: var(--he-color-text-primary); font-weight: var(--he-font-weight-medium); overflow-wrap: anywhere; }
  .he-timeline { display: grid; margin: 0; padding: 0; list-style: none; }
  .he-timeline__item { position: relative; display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: var(--he-space-3); padding-bottom: var(--he-space-5); }
  .he-timeline__item::before { z-index: 1; width: 12px; height: 12px; margin: 5px 0 0 6px; border: 2px solid var(--he-color-brand-strong); border-radius: 50%; background: var(--he-color-surface-primary); content: ""; }
  .he-timeline__item::after { position: absolute; top: 20px; bottom: 0; left: 11px; width: 1px; background: var(--he-color-border-default); content: ""; }
  .he-timeline__item:last-child::after { display: none; }
  .he-chart-frame { display: grid; min-height: var(--he-component-chart-min-height); grid-template-rows: auto minmax(12rem, 1fr) auto; gap: var(--he-space-4); padding: var(--he-space-5); border: 1px solid var(--he-color-border-subtle); border-radius: var(--he-radius-xl); background: var(--he-color-surface-primary); }
  .he-sparkline { display: block; width: 100%; min-width: 5rem; height: 2.5rem; fill: none; stroke: var(--he-color-data-categorical-1); stroke-width: var(--he-component-chart-stroke-width); vector-effect: non-scaling-stroke; }
  .he-legend { display: flex; flex-wrap: wrap; gap: var(--he-space-3) var(--he-space-5); margin: 0; padding: 0; list-style: none; }
  .he-legend__item { display: inline-flex; min-height: var(--he-size-control-sm); align-items: center; gap: var(--he-space-2); color: var(--he-color-text-secondary); font-size: var(--he-font-size-sm); }
  .he-legend__swatch { width: 12px; height: 12px; flex: 0 0 auto; border-radius: 3px; background: var(--he-legend-color, var(--he-color-data-categorical-1)); }

  /* Canonical Phase 4 operations and domain organisms. */
  .he-fleet-health-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr)); gap: var(--he-space-3); }
  .he-heartbeat-indicator { display: inline-flex; min-height: var(--he-size-control-md); align-items: center; gap: var(--he-space-2); color: var(--he-color-text-secondary); font-size: var(--he-font-size-sm); }
  .he-heartbeat-indicator::before { width: var(--he-component-device-state-dot-size); height: var(--he-component-device-state-dot-size); flex: 0 0 auto; border-radius: 50%; background: var(--he-color-status-healthy-border); content: ""; animation: he-pulse 2s infinite; }
  .he-heartbeat-indicator[data-state="missed"]::before { background: var(--he-color-status-critical-border); animation: none; }
  .he-service-health-row, .he-health-signal-row { display: grid; grid-template-columns: minmax(8rem, 1fr) auto minmax(10rem, 1.5fr); align-items: center; gap: var(--he-space-4); padding-block: var(--he-space-3); border-bottom: 1px solid var(--he-color-border-subtle); }
  .he-alert-card { border-left: 4px solid var(--he-color-status-review-border); }
  .he-alert-card--critical { border-left-color: var(--he-color-status-critical-border); }
  .he-live-session-control { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--he-space-4); padding: var(--he-space-4); border: 1px solid var(--he-color-border-subtle); border-radius: var(--he-radius-xl); background: var(--he-color-surface-primary); }
  .he-telemetry-quality { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 8rem), 1fr)); gap: var(--he-space-3); }
  .he-telemetry-quality__item { padding: var(--he-space-3); border-radius: var(--he-radius-lg); background: var(--he-color-surface-secondary); }
  .he-cow-card { min-width: 0; }
  .he-cow-profile-header { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--he-space-4); padding-block: var(--he-space-5); }
  .he-herd-distribution { display: grid; gap: var(--he-space-3); }
  .he-herd-distribution__bar { display: flex; height: 18px; overflow: hidden; border-radius: var(--he-radius-pill); background: var(--he-color-surface-secondary); }
  .he-herd-distribution__segment { width: var(--he-segment, 0%); background: var(--he-segment-color, var(--he-color-data-categorical-1)); }
  .he-calibration-panel { display: grid; gap: var(--he-space-5); padding: var(--he-space-5); border: 1px solid var(--he-color-border-subtle); border-radius: var(--he-radius-xl); background: var(--he-color-surface-primary); }
  .he-camera-viewer { width: 100%; min-height: 12rem; }
  .he-pose-overlay { position: relative; width: 100%; aspect-ratio: var(--he-component-camera-view-aspect-ratio); overflow: hidden; border-radius: var(--he-component-camera-view-radius); background: var(--he-color-surface-inverted); }
  .he-pose-overlay svg { position: absolute; inset: 0; width: 100%; height: 100%; fill: none; stroke: var(--he-color-brand-primary); vector-effect: non-scaling-stroke; }
  .he-model-insight-card { display: grid; gap: var(--he-space-4); padding: var(--he-space-5); border: 1px solid var(--he-color-border-subtle); border-left: 4px solid var(--he-color-data-categorical-3); border-radius: var(--he-radius-xl); background: var(--he-color-surface-primary); }
  .he-confidence-indicator { display: grid; gap: var(--he-space-2); }
  .he-confidence-indicator__track { height: 8px; overflow: hidden; border-radius: var(--he-radius-pill); background: var(--he-color-surface-secondary); }
  .he-confidence-indicator__value { width: var(--he-confidence, 0%); height: 100%; border-radius: inherit; background: var(--he-color-data-categorical-3); }
  .he-data-provenance { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--he-space-2) var(--he-space-3); color: var(--he-color-text-secondary); font-size: var(--he-font-size-sm); }
  .he-permission-state { display: grid; max-width: var(--he-layout-content-reading); justify-items: start; gap: var(--he-space-4); padding: var(--he-space-6); border: 1px dashed var(--he-color-border-default); border-radius: var(--he-radius-xl); background: var(--he-color-background-subtle); }
  .he-audit-event { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--he-space-3); padding-block: var(--he-space-3); border-bottom: 1px solid var(--he-color-border-subtle); }
  .he-budget-meter { display: grid; gap: var(--he-space-3); padding: var(--he-space-4); border: 1px solid var(--he-color-border-subtle); border-radius: var(--he-radius-xl); background: var(--he-color-surface-primary); }
  .he-integration-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--he-space-4); padding: var(--he-space-4); border: 1px solid var(--he-color-border-subtle); border-radius: var(--he-radius-xl); background: var(--he-color-surface-primary); }

  @keyframes he-progress-indeterminate { from { transform: translateX(-110%); } to { transform: translateX(290%); } }
}

@layer he-utilities {
  @media (max-width: 639px) {
    .he-alert-banner, .he-toast { grid-template-columns: auto minmax(0, 1fr); }
    .he-alert-banner > :last-child, .he-toast > :last-child { grid-column: 2; }
    .he-description-list { grid-template-columns: 1fr; gap: var(--he-space-1); }
    .he-description-list dd { margin-bottom: var(--he-space-3); }
    .he-service-health-row, .he-health-signal-row { grid-template-columns: minmax(0, 1fr) auto; }
    .he-service-health-row > :last-child, .he-health-signal-row > :last-child { grid-column: 1 / -1; }
    .he-live-session-control, .he-cow-profile-header, .he-integration-card { grid-template-columns: 1fr; align-items: start; }
    .he-audit-event { grid-template-columns: auto minmax(0, 1fr); }
    .he-audit-event > :last-child { grid-column: 2; }
    .he-camera-viewer__controls { position: static; z-index: 1; width: 100%; flex-wrap: wrap; padding: var(--he-space-3); }
  }
}

@layer he-components {
  .he-display,
  .he-heading,
  .he-title {
    margin: 0;
    font-family: var(--he-font-family-display), sans-serif;
    letter-spacing: var(--he-font-letter-spacing-tight);
  }

  .he-display { font-size: clamp(var(--he-font-size-5xl), 7vw, var(--he-font-size-8xl)); line-height: var(--he-font-line-height-tight); font-weight: var(--he-font-weight-extrabold); }
  .he-heading { font-size: clamp(var(--he-font-size-3xl), 4vw, var(--he-font-size-5xl)); line-height: var(--he-font-line-height-snug); font-weight: var(--he-font-weight-bold); }
  .he-title { font-size: var(--he-font-size-xl); line-height: var(--he-font-line-height-snug); font-weight: var(--he-font-weight-bold); }
  .he-eyebrow { margin: 0; color: var(--he-color-text-tertiary); font: var(--he-font-weight-bold) var(--he-font-size-xs)/1 var(--he-font-family-body), sans-serif; letter-spacing: var(--he-font-letter-spacing-caps); text-transform: uppercase; }
  .he-body { margin: 0; color: var(--he-color-text-secondary); }
  .he-caption { margin: 0; color: var(--he-color-text-tertiary); font-size: var(--he-font-size-sm); }
  .he-mono { font-family: var(--he-font-family-mono), monospace; font-variant-numeric: tabular-nums; }

  .he-icon {
    display: block;
    width: var(--he-size-icon-md);
    height: var(--he-size-icon-md);
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
  }
  .he-icon--sm { width: var(--he-size-icon-sm); height: var(--he-size-icon-sm); }
  .he-icon--lg { width: var(--he-size-icon-lg); height: var(--he-size-icon-lg); }

  .he-button,
  .he-icon-button {
    display: inline-flex;
    min-height: var(--he-component-button-height-md);
    align-items: center;
    justify-content: center;
    gap: var(--he-component-button-gap);
    border: var(--he-border-width-default) solid transparent;
    border-radius: var(--he-component-button-radius);
    background: var(--he-color-action-primary-background);
    color: var(--he-color-action-primary-text);
    font-size: var(--he-component-button-font-size);
    font-weight: var(--he-component-button-font-weight);
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    transition: background var(--he-motion-duration-fast) var(--he-motion-easing-standard), border-color var(--he-motion-duration-fast) var(--he-motion-easing-standard), transform var(--he-motion-duration-fast) var(--he-motion-easing-standard);
  }

  .he-button { padding-inline: var(--he-component-button-padding-x-md); }
  .he-button:hover { background: var(--he-color-action-primary-hover); }
  .he-button:active { background: var(--he-color-action-primary-pressed); transform: translateY(1px); }
  .he-button--sm { min-height: max(var(--he-component-button-height-sm), var(--he-size-target-minimum)); padding-inline: var(--he-component-button-padding-x-sm); }
  .he-button--lg { min-height: var(--he-component-button-height-lg); padding-inline: var(--he-component-button-padding-x-lg); font-size: var(--he-font-size-md); }
  .he-button--secondary { border-color: var(--he-color-border-strong); background: var(--he-color-action-secondary-background); color: var(--he-color-action-secondary-text); }
  .he-button--secondary:hover { background: var(--he-color-action-secondary-hover); }
  .he-button--tertiary { background: transparent; color: var(--he-color-text-primary); }
  .he-button--tertiary:hover { background: var(--he-color-action-secondary-hover); }
  .he-button--danger { background: var(--he-color-action-danger-background); color: var(--he-color-action-danger-text); }
  .he-button--danger:hover { background: var(--he-color-action-danger-hover); }
  .he-button--inverse { border-color: var(--he-color-border-inverse); background: transparent; color: var(--he-color-text-inverse); }
  .he-button[aria-busy="true"]::before { width: 1em; height: 1em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; content: ""; animation: he-spin 700ms linear infinite; }
  .he-icon-button {
    width: var(--he-component-icon-button-size-md);
    min-width: var(--he-component-icon-button-size-md);
    height: var(--he-component-icon-button-size-md);
    min-height: var(--he-component-icon-button-size-md);
    flex: 0 0 var(--he-component-icon-button-size-md);
    padding: 0;
    border-color: var(--he-color-border-default);
    border-radius: var(--he-component-icon-button-radius);
    background: var(--he-color-surface-primary);
    color: var(--he-color-icon-primary);
    line-height: 0;
  }
  .he-icon-button > .he-icon { width: var(--he-component-icon-button-glyph-size-md); height: var(--he-component-icon-button-glyph-size-md); }
  .he-icon-button--sm { width: max(var(--he-component-icon-button-size-sm), var(--he-size-target-minimum)); min-width: max(var(--he-component-icon-button-size-sm), var(--he-size-target-minimum)); height: max(var(--he-component-icon-button-size-sm), var(--he-size-target-minimum)); min-height: max(var(--he-component-icon-button-size-sm), var(--he-size-target-minimum)); flex-basis: max(var(--he-component-icon-button-size-sm), var(--he-size-target-minimum)); }
  .he-icon-button--sm > .he-icon { width: var(--he-component-icon-button-glyph-size-sm); height: var(--he-component-icon-button-glyph-size-sm); }
  .he-icon-button--lg { width: var(--he-component-icon-button-size-lg); min-width: var(--he-component-icon-button-size-lg); height: var(--he-component-icon-button-size-lg); min-height: var(--he-component-icon-button-size-lg); flex-basis: var(--he-component-icon-button-size-lg); }
  .he-icon-button--lg > .he-icon { width: var(--he-component-icon-button-glyph-size-lg); height: var(--he-component-icon-button-glyph-size-lg); }
  .he-icon-button:hover { background: var(--he-color-action-secondary-hover); }
  .he-link { color: var(--he-color-text-link); font-weight: var(--he-font-weight-semibold); text-decoration-line: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
  .he-link--standalone { display: inline-flex; min-height: var(--he-size-target-minimum); align-items: center; gap: var(--he-component-link-gap); }
  .he-link--inverse { color: var(--he-color-text-inverse); }
  .he-link[aria-disabled="true"] { pointer-events: none; text-decoration: none; }

  .he-split-button { display: inline-grid; min-height: var(--he-component-split-button-height); grid-template-columns: minmax(0, auto) var(--he-component-split-button-menu-width); gap: 0; overflow: clip; border: var(--he-border-width-default) solid transparent; border-radius: var(--he-component-button-radius); isolation: isolate; background: var(--he-color-action-primary-background); }
  .he-split-button > .he-button { min-width: 0; border: 0; border-radius: 0; }
  .he-split-button > .he-button:first-child { border-inline-end: var(--he-component-split-button-divider-width) solid color-mix(in srgb, currentColor 28%, transparent); }
  .he-split-button > .he-button.he-split-button__menu { width: auto; min-width: 0; margin: 0; padding: 0; border: 0; border-radius: 0; }
  .he-split-button__menu > .he-icon { width: var(--he-size-icon-sm); height: var(--he-size-icon-sm); }
  .he-split-button > .he-button:focus-visible { position: relative; z-index: 1; outline: 0; box-shadow: inset 0 0 0 var(--he-border-width-focus) var(--he-color-focus-ring); }
  .he-split-button--secondary { border-color: var(--he-color-border-strong); background: var(--he-color-action-secondary-background); }
  .he-split-button--secondary > .he-button { background: transparent; color: var(--he-color-text-primary); }

  .he-field { display: grid; gap: var(--he-space-2); }
  .he-field__label { color: var(--he-color-text-primary); font-size: var(--he-component-input-label-size); font-weight: var(--he-font-weight-semibold); }
  .he-field__control,
  select.he-select,
  .he-textarea {
    width: 100%;
    min-height: var(--he-component-input-height);
    padding-inline: var(--he-component-input-padding-x);
    border: var(--he-component-input-border-width) solid var(--he-color-border-default);
    border-radius: var(--he-component-input-radius);
    background: var(--he-color-surface-primary);
    color: var(--he-color-text-primary);
    transition: border-color var(--he-motion-duration-fast), box-shadow var(--he-motion-duration-fast);
  }
  select.he-select {
    appearance: none;
    padding-inline-end: calc(var(--he-component-input-padding-x) + 24px);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23102A43' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--he-space-3) center;
    background-size: 20px;
  }
  .he-select:not(select) { position: relative; width: 100%; min-width: 0; color: var(--he-color-text-primary); }
  .he-select__native { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); border: 0; white-space: nowrap; }
  .he-select__trigger {
    display: flex;
    width: 100%;
    min-height: var(--he-component-input-height);
    align-items: center;
    justify-content: space-between;
    gap: var(--he-space-3);
    padding: 0 calc(var(--he-component-input-padding-x) + 24px) 0 var(--he-component-input-padding-x);
    border: var(--he-component-input-border-width) solid var(--he-color-border-default);
    border-radius: var(--he-component-input-radius);
    background-color: var(--he-color-surface-primary);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23102A43' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--he-space-3) center;
    color: inherit;
    font: inherit;
    text-align: start;
    cursor: pointer;
    transition: border-color var(--he-motion-duration-fast), box-shadow var(--he-motion-duration-fast), background-color var(--he-motion-duration-fast);
  }
  .he-select__trigger:hover { border-color: var(--he-color-border-strong); background-color: var(--he-color-action-secondary-hover); }
  .he-select[data-open="true"] .he-select__trigger { border-color: var(--he-color-border-focus); box-shadow: var(--he-shadow-focus); }
  .he-select__trigger:focus-visible { border-color: var(--he-color-border-focus); outline: var(--he-border-width-focus) solid var(--he-color-focus-ring); outline-offset: 2px; box-shadow: none; }
  .he-select__trigger[aria-invalid="true"] { border-color: var(--he-color-status-critical-border); }
  .he-select__listbox {
    position: absolute;
    z-index: 40;
    top: calc(100% + var(--he-space-2));
    right: 0;
    left: 0;
    display: grid;
    max-height: min(288px, 45vh);
    gap: var(--he-space-1);
    margin: 0;
    padding: var(--he-space-2);
    overflow-y: auto;
    overscroll-behavior: contain;
    border: var(--he-border-width-default) solid var(--he-color-border-default);
    border-radius: var(--he-radius-xl);
    background: var(--he-color-surface-raised);
    box-shadow: var(--he-shadow-xl);
    list-style: none;
  }
  .he-select[data-placement="top"] .he-select__listbox { top: auto; bottom: calc(100% + var(--he-space-2)); }
  .he-select__listbox[hidden] { display: none; }
  .he-select__option { position: relative; display: flex; min-height: var(--he-size-target-minimum); align-items: center; padding: var(--he-space-2) calc(var(--he-space-3) + 24px) var(--he-space-2) var(--he-space-3); border-radius: var(--he-radius-lg); color: var(--he-color-text-primary); cursor: pointer; }
  .he-select__option--active { background: var(--he-color-action-secondary-hover); outline: 2px solid var(--he-color-focus-ring); outline-offset: -2px; }
  .he-select__option[aria-selected="true"] { background-color: var(--he-color-brand-subtle); font-weight: var(--he-font-weight-bold); }
  .he-select__option[aria-selected="true"]::after { position: absolute; right: var(--he-space-3); width: 14px; height: 8px; border-bottom: 2px solid currentColor; border-left: 2px solid currentColor; content: ""; transform: rotate(-45deg) translateY(-2px); }
  .he-select__option[aria-disabled="true"] { cursor: not-allowed; opacity: var(--he-opacity-disabled); }
  .he-select[data-disabled="true"] .he-select__trigger { cursor: not-allowed; opacity: var(--he-opacity-disabled); }
  .he-textarea { min-height: 120px; padding-block: var(--he-space-3); resize: vertical; }
  .he-field__control:hover, select.he-select:hover, .he-textarea:hover { border-color: var(--he-color-border-strong); }
  .he-field__control:focus, select.he-select:focus, .he-textarea:focus { border-color: var(--he-color-border-focus); box-shadow: var(--he-shadow-focus); outline: none; }
  .he-field__control:focus-visible, select.he-select:focus-visible, .he-textarea:focus-visible { outline: none; }
  .he-field__help { color: var(--he-color-text-tertiary); font-size: var(--he-component-input-helper-size); }
  .he-field--error .he-field__control { border-color: var(--he-color-status-critical-border); }
  .he-field--error .he-field__help { color: var(--he-color-status-critical-text); }
  .he-checkbox, .he-radio, .he-switch { display: inline-flex; min-height: var(--he-size-control-md); align-items: center; gap: var(--he-space-3); color: var(--he-color-text-primary); cursor: pointer; }
  .he-switch__track { position: relative; width: 44px; height: 24px; border-radius: var(--he-radius-pill); background: var(--he-color-border-strong); transition: background var(--he-motion-duration-fast); }
  .he-switch__track::after { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--he-color-surface-raised); box-shadow: var(--he-shadow-sm); content: ""; transition: transform var(--he-motion-duration-fast); }
  .he-switch input:checked + .he-switch__track { background: var(--he-color-brand-strong); }
  .he-switch input:checked + .he-switch__track::after { transform: translateX(20px); }
  .he-switch input { position: absolute; opacity: 0; }

  .he-checkbox input,
  .he-radio input {
    width: var(--he-component-checkbox-control-size);
    height: var(--he-component-checkbox-control-size);
    margin: 0;
    accent-color: var(--he-color-brand-strong);
  }
  .he-radio input { width: var(--he-component-radio-control-size); height: var(--he-component-radio-control-size); }
  .he-choice-group { display: grid; gap: var(--he-space-2); margin: 0; padding: 0; border: 0; }
  .he-choice-group legend { margin-bottom: var(--he-space-2); font-size: var(--he-font-size-sm); font-weight: var(--he-font-weight-bold); }

  .he-multi-select { display: flex; min-height: var(--he-component-multi-select-min-height); flex-wrap: wrap; align-items: center; gap: var(--he-component-multi-select-tag-gap); padding: var(--he-space-2); border: var(--he-component-input-border-width) solid var(--he-color-border-default); border-radius: var(--he-component-input-radius); background: var(--he-color-surface-primary); }
  .he-multi-select__tag { display: inline-flex; min-height: 28px; align-items: center; gap: var(--he-space-1); padding-inline: var(--he-space-3); border: 1px solid var(--he-color-border-default); border-radius: var(--he-radius-pill); background: var(--he-color-brand-subtle); color: var(--he-color-text-primary); font-size: var(--he-font-size-xs); font-weight: var(--he-font-weight-bold); }
  .he-multi-select__remove { display: grid; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; place-items: center; }
  .he-multi-select__input { min-width: 120px; flex: 1; border: 0; outline: 0; background: transparent; }

  .he-slider { display: grid; gap: var(--he-space-2); }
  .he-slider__meta { display: flex; align-items: center; justify-content: space-between; gap: var(--he-space-3); font-size: var(--he-font-size-sm); }
  .he-slider input[type="range"] { width: 100%; min-height: var(--he-component-slider-target); margin: 0; accent-color: var(--he-color-brand-strong); cursor: pointer; }
  .he-slider output { font-family: var(--he-font-family-mono), monospace; font-variant-numeric: tabular-nums; }

  .he-date-time { display: grid; gap: var(--he-component-date-time-field-timezone-gap); }
  .he-date-time__row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--he-space-2); align-items: center; }
  .he-date-time__zone { color: var(--he-color-text-tertiary); font: var(--he-font-weight-medium) var(--he-font-size-xs)/1 var(--he-font-family-mono), monospace; }

  .he-file-upload { position: relative; display: grid; min-height: var(--he-component-file-upload-min-height); place-items: center; gap: var(--he-space-2); padding: var(--he-component-file-upload-padding); border: 2px dashed var(--he-color-border-default); border-radius: var(--he-component-file-upload-radius); background: var(--he-color-background-subtle); text-align: center; transition: border-color var(--he-motion-duration-fast), background var(--he-motion-duration-fast); }
  .he-file-upload:hover,
  .he-file-upload[data-drag-over="true"] { border-color: var(--he-color-brand-strong); background: var(--he-color-brand-subtle); }
  .he-file-upload input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .he-file-upload__title { font-weight: var(--he-font-weight-bold); }
  .he-file-upload__meta { color: var(--he-color-text-tertiary); font-size: var(--he-font-size-xs); }

  .he-search { position: relative; display: flex; width: min(100%, var(--he-component-search-field-max-width)); align-items: center; }
  .he-search > .he-search__icon { position: absolute; z-index: 1; left: var(--he-space-4); width: var(--he-size-icon-md); height: var(--he-size-icon-md); color: var(--he-color-icon-secondary); pointer-events: none; }
  .he-search .he-field__control { min-height: var(--he-component-search-field-height); padding-left: var(--he-space-10); padding-right: var(--he-space-10); }
  .he-search__clear { position: absolute; right: var(--he-space-2); display: grid; width: 32px; height: 32px; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--he-color-icon-secondary); cursor: pointer; }

  .he-card {
    padding: var(--he-component-card-padding-default);
    border: var(--he-component-card-border-width) solid var(--he-color-border-subtle);
    border-radius: var(--he-component-card-radius);
    background: var(--he-color-surface-primary);
    box-shadow: var(--he-shadow-sm);
  }
  .he-card--compact { padding: var(--he-component-card-padding-compact); }
  .he-card--spacious { padding: var(--he-component-card-padding-spacious); }
  .he-card--raised { border-color: transparent; box-shadow: var(--he-component-card-shadow); }
  .he-card--interactive { color: inherit; text-decoration: none; transition: transform var(--he-motion-duration-standard), box-shadow var(--he-motion-duration-standard); }
  .he-card--interactive:hover { transform: translateY(-2px); box-shadow: var(--he-shadow-md); }
  .he-card--inverse { border-color: var(--he-color-border-inverse); background: var(--he-color-surface-inverted); color: var(--he-color-text-inverse); }

  .he-badge,
  .he-tag {
    display: inline-flex;
    min-height: var(--he-component-badge-height);
    align-items: center;
    gap: var(--he-component-badge-gap);
    padding-inline: var(--he-component-badge-padding-x);
    border: var(--he-border-width-default) solid var(--he-color-border-default);
    border-radius: var(--he-component-badge-radius);
    background: var(--he-color-surface-secondary);
    color: var(--he-color-text-secondary);
    font-size: var(--he-component-badge-font-size);
    font-weight: var(--he-font-weight-bold);
    line-height: 1;
    white-space: nowrap;
  }
  .he-badge::before { width: var(--he-component-device-state-dot-size); height: var(--he-component-device-state-dot-size); border-radius: 50%; background: currentColor; content: ""; }
  .he-badge--healthy { border-color: var(--he-color-status-healthy-border); background: var(--he-color-status-healthy-background); color: var(--he-color-status-healthy-text); }
  .he-badge--review { border-color: var(--he-color-status-review-border); background: var(--he-color-status-review-background); color: var(--he-color-status-review-text); }
  .he-badge--critical { border-color: var(--he-color-status-critical-border); background: var(--he-color-status-critical-background); color: var(--he-color-status-critical-text); }
  .he-badge--info { border-color: var(--he-color-status-info-border); background: var(--he-color-status-info-background); color: var(--he-color-status-info-text); }
  .he-badge--offline { border-color: var(--he-color-status-offline-border); background: var(--he-color-status-offline-background); color: var(--he-color-status-offline-text); }

  .he-alert { display: grid; grid-template-columns: auto 1fr auto; gap: var(--he-space-3); align-items: start; padding: var(--he-space-4); border: 1px solid var(--he-color-status-info-border); border-radius: var(--he-radius-xl); background: var(--he-color-status-info-background); color: var(--he-color-status-info-text); }
  .he-alert--healthy { border-color: var(--he-color-status-healthy-border); background: var(--he-color-status-healthy-background); color: var(--he-color-status-healthy-text); }
  .he-alert--warning { border-color: var(--he-color-status-review-border); background: var(--he-color-status-review-background); color: var(--he-color-status-review-text); }
  .he-alert--critical { border-color: var(--he-color-status-critical-border); background: var(--he-color-status-critical-background); color: var(--he-color-status-critical-text); }
  .he-alert--offline { border-color: var(--he-color-status-offline-border); background: var(--he-color-status-offline-background); color: var(--he-color-status-offline-text); }
  .he-alert__title { margin: 0 0 var(--he-space-1); font-weight: var(--he-font-weight-bold); }
  .he-alert__body { margin: 0; font-size: var(--he-font-size-sm); }

  .he-topbar { display: flex; min-height: var(--he-component-navigation-top-bar-height); align-items: center; justify-content: space-between; gap: var(--he-space-4); padding-inline: var(--he-layout-gutter-mobile); border-bottom: 1px solid var(--he-color-border-subtle); background: color-mix(in srgb, var(--he-color-surface-primary) 92%, transparent); backdrop-filter: blur(16px); }
  .he-topbar a { display: inline-flex; min-height: var(--he-size-target-minimum); align-items: center; }
  .he-brand { display: inline-flex; align-items: center; gap: var(--he-space-3); color: var(--he-color-text-primary); font-family: var(--he-font-family-display), sans-serif; font-weight: var(--he-font-weight-extrabold); text-decoration: none; }
  .he-brand__mark { display: grid; width: 36px; height: 36px; place-items: center; border-radius: var(--he-radius-lg); background: var(--he-color-brand-primary); color: var(--he-color-action-primary-text); }
  .he-sidenav { display: grid; width: var(--he-component-navigation-side-rail-width-expanded); align-content: start; gap: var(--he-space-2); padding: var(--he-space-4); border-right: 1px solid var(--he-color-border-subtle); background: var(--he-color-surface-primary); }
  .he-sidenav__item { display: flex; min-height: var(--he-component-navigation-item-height); align-items: center; gap: var(--he-space-3); padding-inline: var(--he-space-3); border-radius: var(--he-component-navigation-item-radius); color: var(--he-color-text-secondary); font-weight: var(--he-font-weight-semibold); text-decoration: none; }
  .he-sidenav__item:hover { background: var(--he-color-action-secondary-hover); }
  .he-sidenav__item[aria-current="page"] { background: var(--he-color-brand-subtle); color: var(--he-color-text-primary); }
  .he-breadcrumb { display: flex; flex-wrap: wrap; gap: var(--he-space-2); align-items: center; color: var(--he-color-text-tertiary); font-size: var(--he-font-size-sm); }
  .he-breadcrumb a { color: inherit; }
  .he-tabs { display: flex; gap: var(--he-space-1); overflow-x: auto; border-bottom: 1px solid var(--he-color-border-default); }
  .he-tab { min-height: var(--he-size-control-md); padding-inline: var(--he-space-4); border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--he-color-text-tertiary); font-weight: var(--he-font-weight-semibold); cursor: pointer; }
  .he-tab[aria-selected="true"] { border-color: var(--he-color-brand-strong); color: var(--he-color-text-primary); }

  .he-pagination { display: flex; flex-wrap: wrap; align-items: center; gap: var(--he-component-pagination-gap); }
  .he-pagination a,
  .he-pagination button { display: grid; min-width: var(--he-component-pagination-item-size); min-height: var(--he-component-pagination-item-size); place-items: center; padding-inline: var(--he-space-2); border: 1px solid transparent; border-radius: var(--he-radius-lg); background: transparent; color: var(--he-color-text-secondary); font-weight: var(--he-font-weight-semibold); text-decoration: none; cursor: pointer; }
  .he-pagination :is(a, button):hover { background: var(--he-color-action-secondary-hover); }
  .he-pagination [aria-current="page"] { border-color: var(--he-color-brand-strong); background: var(--he-color-brand-subtle); color: var(--he-color-text-primary); }

  .he-stepper { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(120px, 1fr); gap: 0; margin: 0; padding: 0; overflow-x: auto; list-style: none; }
  .he-stepper__step { position: relative; display: grid; gap: var(--he-space-2); padding-right: var(--he-space-4); color: var(--he-color-text-tertiary); font-size: var(--he-font-size-sm); }
  .he-stepper__step::after { position: absolute; z-index: 0; top: calc(var(--he-component-stepper-marker-size) / 2); right: 0; left: var(--he-component-stepper-marker-size); height: var(--he-component-stepper-connector-width); background: var(--he-color-border-default); content: ""; }
  .he-stepper__step:last-child::after { display: none; }
  .he-stepper__marker { z-index: 1; display: grid; width: var(--he-component-stepper-marker-size); height: var(--he-component-stepper-marker-size); place-items: center; border: 1px solid var(--he-color-border-default); border-radius: 50%; background: var(--he-color-surface-primary); font: var(--he-font-weight-bold) var(--he-font-size-xs)/1 var(--he-font-family-mono), monospace; }
  .he-stepper__step[aria-current="step"] { color: var(--he-color-text-primary); }
  .he-stepper__step[aria-current="step"] .he-stepper__marker { border-color: var(--he-color-brand-strong); background: var(--he-color-brand-primary); color: var(--he-color-action-primary-text); }
  .he-stepper__step[data-complete="true"] .he-stepper__marker { border-color: var(--he-color-status-healthy-border); background: var(--he-color-status-healthy-background); color: var(--he-color-status-healthy-text); }

  .he-command-palette { width: min(var(--he-component-command-palette-width), calc(100vw - 2 * var(--he-space-4))); max-height: min(var(--he-component-command-palette-max-height), calc(100vh - 2 * var(--he-space-4))); overflow: hidden auto; border: 1px solid var(--he-color-border-subtle); border-radius: var(--he-component-command-palette-radius); background: var(--he-color-surface-raised); box-shadow: var(--he-shadow-xl); }
  .he-command-palette__search { position: sticky; z-index: 1; top: 0; padding: var(--he-space-4); border-bottom: 1px solid var(--he-color-border-subtle); background: inherit; }
  .he-command-palette__list { display: grid; gap: var(--he-space-1); margin: 0; padding: var(--he-space-2); list-style: none; }
  .he-command-palette__option { display: flex; min-height: var(--he-size-target-minimum); align-items: center; justify-content: space-between; gap: var(--he-space-4); padding-inline: var(--he-space-3); border-radius: var(--he-radius-lg); }
  .he-command-palette__option[aria-selected="true"] { background: var(--he-color-brand-subtle); }
  .he-command-palette kbd { padding: var(--he-space-1) var(--he-space-2); border: 1px solid var(--he-color-border-default); border-radius: var(--he-radius-sm); background: var(--he-color-background-subtle); font-family: var(--he-font-family-mono), monospace; }

  .he-page-header { display: flex; align-items: end; justify-content: space-between; gap: var(--he-space-6); padding-block: var(--he-space-8); }
  .he-page-header__copy { display: grid; max-width: var(--he-layout-content-reading); gap: var(--he-space-2); }
  .he-section-header { display: flex; align-items: center; justify-content: space-between; gap: var(--he-space-4); margin-bottom: var(--he-space-4); }
  .he-section-header > .he-link { display: inline-flex; min-height: var(--he-size-target-minimum); align-items: center; }
  .he-divider { display: flex; align-items: center; gap: var(--he-component-divider-gap); margin-block: var(--he-space-4); border: 0; color: var(--he-color-text-tertiary); font-size: var(--he-font-size-xs); }
  .he-divider::before,
  .he-divider::after { height: var(--he-component-divider-width); flex: 1; background: var(--he-color-border-default); content: ""; }
  .he-divider:not([data-label])::after { display: none; }
  .he-divider--vertical { width: var(--he-component-divider-width); min-height: var(--he-size-target-minimum); margin: 0 var(--he-space-2); background: var(--he-color-border-default); }
  .he-divider--vertical::before,
  .he-divider--vertical::after { display: none; }

  .he-accordion { border-block: 1px solid var(--he-color-border-default); }
  .he-accordion + .he-accordion { border-top: 0; }
  .he-accordion__trigger,
  .he-accordion > summary { display: flex; min-height: var(--he-component-accordion-trigger-height); align-items: center; justify-content: space-between; gap: var(--he-space-4); padding: var(--he-space-3) 0; color: var(--he-color-text-primary); font-weight: var(--he-font-weight-bold); cursor: pointer; list-style: none; }
  .he-accordion > summary::-webkit-details-marker { display: none; }
  .he-accordion > summary::after { content: "+"; font-size: var(--he-size-icon-md); }
  .he-accordion[open] > summary::after { content: "−"; }
  .he-accordion__content { display: grid; gap: var(--he-component-accordion-content-gap); padding: 0 0 var(--he-space-4); color: var(--he-color-text-secondary); }
  .he-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--he-space-6); }
  .he-stack { display: grid; gap: var(--he-space-4); }
  .he-cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--he-space-3); }

  .he-metric-card { display: grid; min-height: var(--he-component-metric-card-min-height); align-content: space-between; gap: var(--he-space-4); padding: var(--he-component-card-padding-default); border: 1px solid var(--he-color-border-subtle); border-radius: var(--he-component-card-radius); background: var(--he-color-surface-primary); }
  .he-metric-card__label { color: var(--he-color-text-tertiary); font-size: var(--he-font-size-sm); font-weight: var(--he-font-weight-semibold); }
  .he-metric-card__value { color: var(--he-color-text-primary); font-family: var(--he-font-family-display), sans-serif; font-size: var(--he-component-metric-card-value-size); font-weight: var(--he-font-weight-bold); letter-spacing: var(--he-font-letter-spacing-tight); line-height: 1; }
  .he-metric-card__unit { color: var(--he-color-text-tertiary); font-size: var(--he-font-size-sm); font-weight: var(--he-font-weight-medium); }
  .he-metric-card__trend { color: var(--he-color-text-secondary); font-size: var(--he-font-size-sm); }

  .he-table-wrap { overflow: auto; border: 1px solid var(--he-color-border-subtle); border-radius: var(--he-radius-xl); background: var(--he-color-surface-primary); }
  .he-table { width: 100%; border-collapse: collapse; font-size: var(--he-font-size-sm); }
  .he-table th { height: var(--he-component-table-header-height); padding-inline: var(--he-component-table-cell-padding-x); background: var(--he-color-surface-secondary); color: var(--he-color-text-tertiary); font-size: var(--he-font-size-xs); letter-spacing: var(--he-font-letter-spacing-wide); text-align: left; text-transform: uppercase; }
  .he-table td { height: var(--he-component-table-row-height); padding: var(--he-component-table-cell-padding-y) var(--he-component-table-cell-padding-x); border-top: 1px solid var(--he-color-border-subtle); color: var(--he-color-text-secondary); }
  .he-table tbody tr:hover { background: var(--he-color-background-subtle); }

  .he-device-card, .he-cow-card, .he-model-insight, .he-alert-card { display: grid; gap: var(--he-space-4); padding: var(--he-space-5); border: 1px solid var(--he-color-border-subtle); border-radius: var(--he-radius-xl); background: var(--he-color-surface-primary); }
  .he-device-card__header, .he-cow-card__header, .he-model-insight__header { display: flex; flex-wrap: wrap; align-items: start; justify-content: space-between; gap: var(--he-space-3); }
  .he-device-card__identity, .he-cow-card__identity { display: flex; align-items: center; gap: var(--he-space-3); }
  .he-avatar { display: grid; width: var(--he-component-cow-avatar-size-md); height: var(--he-component-cow-avatar-size-md); flex: 0 0 auto; place-items: center; overflow: hidden; border-radius: var(--he-component-cow-avatar-radius); background: var(--he-color-brand-subtle); color: var(--he-color-icon-brand); font-weight: var(--he-font-weight-bold); }
  .he-key-value { display: grid; grid-template-columns: minmax(110px, 1fr) 2fr; gap: var(--he-space-2) var(--he-space-4); margin: 0; font-size: var(--he-font-size-sm); }
  .he-key-value dt { color: var(--he-color-text-tertiary); }
  .he-key-value dd { margin: 0; color: var(--he-color-text-primary); font-weight: var(--he-font-weight-medium); }
  .he-heartbeat { display: inline-flex; align-items: center; gap: var(--he-space-2); color: var(--he-color-text-secondary); font-size: var(--he-font-size-sm); }
  .he-heartbeat::before { width: var(--he-component-device-state-dot-size); height: var(--he-component-device-state-dot-size); border-radius: 50%; background: var(--he-color-status-healthy-border); box-shadow: 0 0 0 0 color-mix(in srgb, var(--he-color-status-healthy-border) 35%, transparent); content: ""; animation: he-pulse 2s infinite; }
  .he-heartbeat--missed::before { background: var(--he-color-status-critical-border); animation: none; }

  .he-chart { display: grid; min-height: var(--he-component-chart-min-height); grid-template-rows: auto 1fr auto; gap: var(--he-space-4); padding: var(--he-space-5); border: 1px solid var(--he-color-border-subtle); border-radius: var(--he-radius-xl); background: var(--he-color-surface-primary); }
  .he-chart__plot { position: relative; min-height: 180px; overflow: hidden; border-bottom: 1px solid var(--he-color-data-grid); background-image: linear-gradient(var(--he-color-data-grid) 1px, transparent 1px); background-size: 100% 25%; }
  .he-chart__line { position: absolute; inset: 15% 0 8%; width: 100%; height: 77%; overflow: visible; fill: none; stroke: var(--he-color-data-categorical-1); stroke-width: var(--he-component-chart-stroke-width); vector-effect: non-scaling-stroke; }
  .he-chart__area { fill: color-mix(in srgb, var(--he-color-data-categorical-1) 14%, transparent); stroke: none; }

  .he-camera-viewer { position: relative; display: grid; aspect-ratio: var(--he-component-camera-view-aspect-ratio); place-items: center; overflow: hidden; border-radius: var(--he-component-camera-view-radius); background: var(--he-color-surface-inverted); color: var(--he-color-text-inverse); }
  .he-camera-viewer__grid { position: absolute; inset: 0; opacity: 0.2; background-image: linear-gradient(var(--he-color-border-inverse) 1px, transparent 1px), linear-gradient(90deg, var(--he-color-border-inverse) 1px, transparent 1px); background-size: 10% 10%; }
  .he-camera-viewer__subject { position: relative; width: 42%; aspect-ratio: 1.45; border: 2px solid var(--he-color-brand-primary); border-radius: 48% 42% 35% 42%; filter: drop-shadow(0 0 12px color-mix(in srgb, var(--he-color-brand-primary) 40%, transparent)); }
  .he-camera-viewer__status { position: absolute; top: var(--he-space-4); left: var(--he-space-4); }
  .he-camera-viewer__controls { position: absolute; right: var(--he-space-4); bottom: var(--he-space-4); left: var(--he-space-4); display: flex; justify-content: space-between; gap: var(--he-space-3); }
  .he-model-insight { border-left: 4px solid var(--he-color-data-categorical-3); }
  .he-confidence { display: grid; gap: var(--he-space-2); }
  .he-confidence__track { height: 8px; overflow: hidden; border-radius: var(--he-radius-pill); background: var(--he-color-surface-secondary); }
  .he-confidence__value { width: var(--he-confidence, 0%); height: 100%; border-radius: inherit; background: var(--he-color-data-categorical-3); }

  .he-dialog { width: min(var(--he-component-dialog-width-md), calc(100vw - 2 * var(--he-space-4))); padding: 0; border: 0; border-radius: var(--he-component-dialog-radius); background: var(--he-color-surface-raised); color: var(--he-color-text-primary); box-shadow: var(--he-component-dialog-shadow); }
  .he-dialog::backdrop { background: var(--he-color-background-scrim); backdrop-filter: blur(3px); }
  .he-dialog__body { display: grid; gap: var(--he-space-4); padding: var(--he-component-dialog-padding); }
  .he-dialog__footer { display: flex; justify-content: flex-end; gap: var(--he-space-3); padding: var(--he-space-4) var(--he-component-dialog-padding); border-top: 1px solid var(--he-color-border-subtle); }
  .he-drawer { position: fixed; z-index: var(--he-z-index-modal); top: 0; right: 0; display: grid; width: min(var(--he-component-drawer-width), 100vw); height: 100dvh; grid-template-rows: auto minmax(0, 1fr) auto; border-left: 1px solid var(--he-color-border-subtle); background: var(--he-color-surface-raised); color: var(--he-color-text-primary); box-shadow: var(--he-shadow-xl); }
  .he-drawer--left { right: auto; left: 0; border-right: 1px solid var(--he-color-border-subtle); border-left: 0; }
  .he-drawer--bottom { top: auto; bottom: 0; width: 100%; height: min(70dvh, 640px); border-top: 1px solid var(--he-color-border-subtle); border-left: 0; border-radius: var(--he-radius-2xl) var(--he-radius-2xl) 0 0; }
  .he-drawer__header,
  .he-drawer__footer { display: flex; min-height: var(--he-component-drawer-header-height); align-items: center; justify-content: space-between; gap: var(--he-space-4); padding: var(--he-space-4) var(--he-component-drawer-padding); border-bottom: 1px solid var(--he-color-border-subtle); }
  .he-drawer__body { overflow: auto; padding: var(--he-component-drawer-padding); }
  .he-drawer__footer { border-top: 1px solid var(--he-color-border-subtle); border-bottom: 0; }

  .he-popover { width: min(var(--he-component-popover-width), calc(100vw - 2 * var(--he-space-4))); padding: var(--he-component-popover-padding); border: 1px solid var(--he-color-border-subtle); border-radius: var(--he-component-popover-radius); background: var(--he-color-surface-raised); color: var(--he-color-text-primary); box-shadow: var(--he-shadow-lg); }
  .he-tooltip { width: max-content; max-width: var(--he-component-tooltip-max-width); padding: var(--he-component-tooltip-padding-y) var(--he-component-tooltip-padding-x); border-radius: var(--he-component-tooltip-radius); background: var(--he-color-surface-inverted); color: var(--he-color-text-inverse); font-size: var(--he-font-size-xs); box-shadow: var(--he-shadow-md); }
  .he-skeleton { height: var(--he-component-skeleton-height); overflow: hidden; border-radius: var(--he-component-skeleton-radius); background: var(--he-color-surface-secondary); }
  .he-skeleton::after { display: block; width: 45%; height: 100%; background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--he-color-surface-raised) 70%, transparent), transparent); content: ""; animation: he-shimmer 1.4s infinite; }
  .he-empty-state { display: grid; max-width: var(--he-component-empty-state-max-width); justify-items: center; gap: var(--he-component-empty-state-gap); margin-inline: auto; padding: var(--he-space-12) var(--he-space-6); text-align: center; }
  .he-empty-state__icon { display: grid; width: calc(var(--he-component-empty-state-icon-size) * 1.5); height: calc(var(--he-component-empty-state-icon-size) * 1.5); place-items: center; border-radius: var(--he-radius-pill); background: var(--he-color-brand-subtle); color: var(--he-color-icon-brand); font-size: var(--he-component-empty-state-icon-size); }

  @keyframes he-spin { to { transform: rotate(1turn); } }
  @keyframes he-pulse { 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
  @keyframes he-shimmer { from { transform: translateX(-120%); } to { transform: translateX(240%); } }
}

@layer he-utilities {
  .he-sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
  .he-span-3 { grid-column: span 3; }
  .he-span-4 { grid-column: span 4; }
  .he-span-6 { grid-column: span 6; }
  .he-span-8 { grid-column: span 8; }
  .he-span-9 { grid-column: span 9; }
  .he-span-12 { grid-column: 1 / -1; }
  .he-text-critical { color: var(--he-color-status-critical-text); }
  .he-text-healthy { color: var(--he-color-status-healthy-text); }

  @media (max-width: 1023px) {
    .he-span-3, .he-span-4 { grid-column: span 6; }
    .he-span-8, .he-span-9 { grid-column: 1 / -1; }
  }

  @media (max-width: 639px) {
    .he-grid { grid-template-columns: 1fr; gap: var(--he-space-4); }
    .he-grid > [class*="he-span-"] { grid-column: 1; }
    .he-page-header { align-items: start; flex-direction: column; }
    .he-sidenav { width: 100%; border-right: 0; border-bottom: 1px solid var(--he-color-border-subtle); }
    .he-topbar { padding-inline: var(--he-space-4); }
    .he-table--responsive thead { display: none; }
    .he-table--responsive tr { display: grid; padding: var(--he-space-3); border-top: 1px solid var(--he-color-border-subtle); }
    .he-table--responsive td { display: grid; height: auto; grid-template-columns: 42% 1fr; gap: var(--he-space-2); padding: var(--he-space-2); border: 0; }
    .he-table--responsive td::before { color: var(--he-color-text-tertiary); content: attr(data-label); font-size: var(--he-font-size-xs); font-weight: var(--he-font-weight-bold); text-transform: uppercase; }
  }

  @media (prefers-reduced-motion: reduce) {
    :where([data-he-root], .he-root) *,
    :where([data-he-root], .he-root) *::before,
    :where([data-he-root], .he-root) *::after { scroll-behavior: auto !important; animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
  }

  @media (forced-colors: active) {
    .he-select__trigger, .he-select__listbox { border: 1px solid ButtonText; background: Canvas; color: CanvasText; forced-color-adjust: auto; }
    .he-select__option--active { outline-color: Highlight; }
    .he-select__option[aria-selected="true"] { background: Highlight; color: HighlightText; }
  }

  @media print {
    .he-button, .he-icon-button, .he-sidenav, .he-topbar { display: none !important; }
    .he-card, .he-metric-card, .he-chart { break-inside: avoid; box-shadow: none; }
  }
}
