:root {
  --color-primary: #00585b;
  --color-primary-dark: #003f41;
  --color-accent-cyan: #22d3ee;
  --color-panel-dark: #0f172a;
  --color-card-bg: #f9fafb;
  --color-card-border: #e5e7eb;
  --color-input-border: #d1d5db;
  --color-icon-muted: #9ca3af;
  --color-label: #4b5563;
  --color-text-body: #374151;
}

html[data-theme="dark"] {
  --color-card-bg: #1b2222;
  --color-card-border: #2c3636;
  --color-input-border: #3a4444;
  --color-icon-muted: #7a8a8a;
  --color-label: #b7c4c4;
  --color-text-body: #dbe6e6;
}

html[data-theme="dark"] .login-form-panel {
  background-color: #111616;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  color: var(--color-text-body);
}

.login-split {
  min-height: 100vh;
}

/* ---------- Left panel ----------
   Solid brand-color treatment instead of a stock photo — a subtle diagonal
   gradient (deep teal -> primary teal) plus a faint dot grid and two soft
   glow accents for depth, all CSS, no image asset. Keeps the same overlay
   element (now a decorative grid layer instead of a photo-darkening
   scrim) so the markup/DOM didn't need to change. */
.login-hero {
  position: relative;
  min-height: 100vh;
  background-color: var(--color-panel-dark);
  /* The base gradient only. The two teal glows that used to be layered in
     here are now real elements (.login-hero__glow) so they can drift. */
  background-image: linear-gradient(160deg, #003f41 0%, #00585b 55%, #007377 100%);
  overflow: hidden;
}

/* Drifting glows. Each is a big soft radial gradient (no blur filter — that
   is expensive), moved only with transform so it stays on the compositor.
   Placement here is the resting state: no JS / reduced motion = still glows.
   login-motion.js drifts them with Motion. Painted under the dot grid. */
.login-hero__glow {
  position: absolute;
  aspect-ratio: 1;
  border-radius: 50%;
  pointer-events: none;
  will-change: transform;
}
.login-hero__glow--a {
  width: 95%;
  left: -32%;
  top: -22%;
  background: radial-gradient(circle, rgba(102, 249, 228, 0.22) 0%, rgba(102, 249, 228, 0) 62%);
}
.login-hero__glow--b {
  width: 85%;
  right: -30%;
  bottom: -32%;
  background: radial-gradient(circle, rgba(102, 249, 228, 0.16) 0%, rgba(102, 249, 228, 0) 62%);
}
.login-hero__glow--c {
  width: 60%;
  left: 30%;
  top: 34%;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.13) 0%, rgba(34, 211, 238, 0) 65%);
}

/* Entrance: hidden only while login-motion.js is about to animate them in
   (the class is added in _AuthLayout's head, with a failsafe). */
.login-motion [data-enter],
.login-motion .login-card > :not(form),
.login-motion .login-card form > :not(input[type="hidden"]) {
  opacity: 0;
}

.login-hero__overlay {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.14) 1px, transparent 1px);
  background-size: 28px 28px;
  /* Fades the dot grid out toward the bottom so it doesn't compete with the
     title/subtitle text sitting there. */
  -webkit-mask-image: linear-gradient(to top, rgba(0, 0, 0, 0.15) 0%, rgba(0, 0, 0, 0.9) 60%);
  mask-image: linear-gradient(to top, rgba(0, 0, 0, 0.15) 0%, rgba(0, 0, 0, 0.9) 60%);
}

.login-hero__content {
  position: relative;
  z-index: 1;
  padding: 3rem;
}

.login-hero__title {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-weight: 700;
  font-size: clamp(2rem, 3.2vw, 3rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: #ffffff;
  margin-bottom: 1rem;
}

/* One line per word so each can rise in on its own (display:block is also
   what lets transform apply). */
.login-hero__line {
  display: block;
}
.login-hero__line--accent {
  color: #66f9e4;
}

/* Load-curve trace behind the title. Resting state = fully drawn, so no JS /
   reduced motion shows the finished picture. Fades out toward the left so it
   doesn't fight the dot grid. */
.login-hero__trace {
  position: absolute;
  left: 0;
  right: 0;
  top: 18%;
  width: 100%;
  height: 30%;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to right, transparent 0%, #000 35%);
  mask-image: linear-gradient(to right, transparent 0%, #000 35%);
}
.login-hero__trace-line {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}

.login-hero__subtitle {
  font-size: 1.125rem;
  line-height: 1.55;
  color: var(--color-accent-cyan);
  max-width: 28rem;
  margin-bottom: 0;
}

/* ---------- Right panel ---------- */
.login-form-panel {
  min-height: 100vh;
  background-color: #ffffff;
}

.login-form-panel__inner {
  width: 100%;
  max-width: 28rem;
}

.brand-logo__name {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-weight: 700;
  font-size: 1.875rem;
  letter-spacing: -0.02em;
  color: var(--color-primary);
  margin: 0;
  text-transform: uppercase;
}

.brand-logo__tagline {
  font-size: 0.875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-primary);
  margin: 0;
}

.login-card {
  background-color: var(--color-card-bg);
  border: 1px solid var(--color-card-border);
  border-radius: 0.75rem;
  padding: 2rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.form-label-custom {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-label);
  margin-bottom: 0.5rem;
}

.input-with-icon {
  position: relative;
}

.input-with-icon .form-control {
  padding-left: 2.5rem;
  border-color: var(--color-input-border);
  border-radius: 0.375rem;
  padding-top: 0.875rem;
  padding-bottom: 0.875rem;
  font-size: 0.875rem;
}

.input-with-icon .form-control::placeholder {
  color: var(--color-icon-muted);
}

.input-with-icon .form-control:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 0.2rem rgba(0, 88, 91, 0.15);
}

.input-with-icon__icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-icon-muted);
  pointer-events: none;
}

.input-with-icon__toggle {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-icon-muted);
  background: none;
  border: none;
  padding: 0;
  line-height: 0;
}

.input-with-icon__toggle:hover {
  color: var(--color-label);
}

.forgot-link {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-primary);
  text-decoration: none;
}

.forgot-link:hover {
  text-decoration: underline;
  color: var(--color-primary-dark);
}

.remember-me-label {
  font-size: 0.875rem;
  color: var(--color-text-body);
}

.form-check-input.custom-checkbox {
  border-color: var(--color-input-border);
}

.form-check-input.custom-checkbox:checked {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
}

.btn-signin {
  background-color: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
  color: #ffffff;
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.75rem 1rem;
  border-radius: 0.375rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-signin {
  transition: transform 160ms cubic-bezier(0.23, 1, 0.32, 1), background-color 150ms ease, border-color 150ms ease;
}

.btn-signin:hover,
.btn-signin:focus {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
  color: #ffffff;
}

/* The button answers the press. */
.btn-signin:active:not(:disabled) {
  transform: scale(0.97);
}

/* After submit: disabled + relabelled by login-motion.js. Keeps the brand
   colour instead of Bootstrap's washed-out disabled look. */
.btn-signin:disabled {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
  color: #ffffff;
  opacity: 0.85;
  cursor: progress;
}

#loginAlert {
  font-size: 0.875rem;
  border-radius: 0.375rem;
  margin-bottom: 1.5rem;
}

.login-footer {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-icon-muted);
}

@media (max-width: 991.98px) {
  .login-hero {
    min-height: 40vh;
  }

  .login-form-panel {
    min-height: auto;
  }
}

/* ====================================================================
   Energy & Production Analysis page (energy_production.html)
   Page-specific styles. Uses --ink / --muted / --brand-700 / --brand-900
   custom properties already defined in css/dashboard.css.
   ==================================================================== */

.ep-kpi-card {
  position: relative;
}

.ep-kpi-card__label {
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 8px;
}

.ep-kpi-card__label--caps {
  text-transform: uppercase;
  font-size: 0.6875rem;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.ep-kpi-card__value {
  font-weight: 700;
  font-size: 2.25rem;
  letter-spacing: -0.03em;
  color: var(--ink);
  line-height: 1.1;
}

.ep-kpi-card__caption {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 4px;
}

.ep-kpi-card__delta {
  font-size: 0.75rem;
  font-weight: 500;
  margin-top: 12px;
}

.ep-kpi-card__delta--up {
  color: #2e7d32;
}

.ep-kpi-card__delta--down {
  color: #c62828;
}

.ep-kpi-card__delta--warn {
  color: #fbc02d;
}

/* ---------- Chart SVG helpers ---------- */
.ep-chart-svg {
  overflow: visible;
}

.ep-chart-svg text {
  font-family: "Inter", sans-serif;
  fill: var(--muted);
}

.ep-chart-target-label {
  fill: #ba1a1a;
  font-weight: 600;
}

/* ---------- Asset Energy Contribution table ---------- */
.ep-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.ep-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.ep-table thead th {
  background-color: rgba(238, 238, 238, 0.5);
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-weight: 700;
  font-size: 0.75rem;
  text-align: right;
  padding: 8px 12px;
  white-space: nowrap;
}

.ep-table thead th:first-child {
  text-align: left;
}

.ep-table tbody td {
  border-bottom: 1px solid rgba(190, 200, 200, 0.3);
  padding: 8px 12px 9px;
  text-align: right;
  color: var(--muted);
  white-space: nowrap;
}

.ep-table tbody td:first-child {
  text-align: left;
  color: var(--ink);
}

.ep-table tbody td.ep-table__share {
  color: var(--brand-700);
  font-weight: 600;
}

.ep-table tbody tr.ep-table__row--total {
  background-color: rgba(238, 238, 238, 0.3);
}

.ep-table tbody tr.ep-table__row--total td {
  color: var(--ink);
  font-weight: 600;
  border-bottom: none;
}

.ep-table tbody tr.ep-table__row--total td.ep-table__share {
  color: var(--brand-700);
}

html[data-theme="dark"] .ep-table thead th {
  background-color: rgba(255, 255, 255, 0.04);
}

html[data-theme="dark"] .ep-table tbody tr.ep-table__row--total {
  background-color: rgba(255, 255, 255, 0.03);
}

/* ---------- Row 3 empty slot (reserved for future card) ---------- */
.ep-empty-slot {
  flex: 1 0 0;
  min-width: 0;
}

@media (max-width: 991.98px) {
  .ep-empty-slot {
    display: none;
  }
}

/* ====================================================================
   Asset Diagnostics page (assets.html)
   Page-specific styles. Uses --ink / --muted / --brand-700 / --brand-900 /
   --danger / --surface / --bg / --border custom properties already
   defined in css/dashboard.css.
   ==================================================================== */

/* ---------- Hero KPI strip ----------
   Laid out with Bootstrap's row/col-cols grid, same as the KPI row on
   overview.html, rather than a bespoke CSS grid. */
.ad-hero-kpi {
  background-color: var(--surface);
  border: 1px solid #bec8c8;
  border-radius: 4px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
  padding: 17px;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.ad-hero-kpi__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.ad-hero-kpi__label {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.ad-hero-kpi__trend-icon {
  height: 10px;
  width: auto;
  display: block;
  flex-shrink: 0;
}

.ad-hero-kpi__value {
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--ink);
  line-height: 1.1;
  margin-bottom: 16px;
}

.ad-hero-kpi__value .unit {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--muted);
  margin-left: 4px;
}

.ad-hero-kpi__spark {
  width: 100%;
  height: 32px;
  display: block;
}

/* ---------- Asset list: health-score badge (critical/warning/optimal) ----------
   Dedicated classes rather than dashboard.css's .asset-badge--warning /
   --optimal, whose colors predate this page's 3-state health model. */
.ad-badge--critical {
  color: var(--danger);
  background-color: rgba(186, 26, 26, 0.1);
  border: 1px solid rgba(186, 26, 26, 0.2);
}

.ad-badge--warning {
  color: #a16207;
  background-color: rgba(234, 179, 8, 0.1);
  border: 1px solid rgba(234, 179, 8, 0.2);
}

.ad-badge--optimal {
  color: #006a65;
  background-color: rgba(0, 106, 101, 0.1);
  border: 1px solid rgba(0, 106, 101, 0.2);
}

.ad-empty-state {
  padding: 24px 12px;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--muted);
}

/* ---------- Asset detail panel ---------- */
.ad-detail-card {
  display: flex;
  flex-direction: column;
  min-height: 640px;
}

.ad-detail-card__body {
  flex: 1;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 32px;
  overflow-y: auto;
}

.ad-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.ad-detail-header__title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ad-detail-title {
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0 0 4px;
}

.ad-area-pill {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--brand-700);
  background-color: rgba(0, 88, 91, 0.1);
  border: 1px solid rgba(0, 88, 91, 0.2);
  border-radius: 999px;
  padding: 3px 10px;
}

/* Fade/slide transition when swapping the panel between assets (see
   wwwroot/js/asset-detail-swap.js) — direction is set by the JS based on
   whether the newly-selected asset sits above or below the previous one
   in the list, so the motion reads as spatial continuity, not a random flash. */
[data-asset-detail-body] {
  transition: opacity 0.14s cubic-bezier(0.23, 1, 0.32, 1), transform 0.14s cubic-bezier(0.23, 1, 0.32, 1);
  opacity: 1;
  transform: translateY(0);
}

.ad-detail-body--leaving.ad-detail-body--leave-down {
  opacity: 0;
  transform: translateY(-8px);
}

.ad-detail-body--leaving.ad-detail-body--leave-up {
  opacity: 0;
  transform: translateY(8px);
}

[data-asset-detail-body].ad-detail-body--entering {
  opacity: 0;
  transform: translateY(6px);
}

@media (prefers-reduced-motion: reduce) {
  [data-asset-detail-body] {
    transition: opacity 0.14s ease;
  }

  .ad-detail-body--leaving.ad-detail-body--leave-down,
  .ad-detail-body--leaving.ad-detail-body--leave-up,
  [data-asset-detail-body].ad-detail-body--entering {
    transform: none;
  }
}

.ad-detail-subtitle {
  font-size: 0.875rem;
  color: var(--muted);
  margin: 0;
}

/* ---------- Detail cards: Health Score, KPIs — one uniform grid,
   all cards share the same size/chrome; only a status accent differs. ---------- */
.ad-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

html[data-theme="dark"] .ad-card {
  background-color: var(--surface);
}

.ad-card {
  /* Matches the rest of the app's card language (kpi-card/chart-card):
     white surface + subtle shadow, not a flat gray centered box — the flat
     centered version read as noticeably plainer than every other card on
     the site once this page had more than one KPI card per asset. */
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid transparent;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  padding: 20px;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: left;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.ad-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

@media (hover: hover) and (pointer: fine) {
  .ad-card:hover {
    transform: translateY(-1px);
  }
}

/* Unlike Overview's KPI/chart cards, this grid had zero page-load motion —
   every card just appeared fully formed. Same short, critically-damped
   fade+rise, staggered per card, with an opacity-only reduced-motion
   fallback (see dashboard.css .kpi-card/.chart-card for the source pattern). */
.ad-card {
  animation: ad-card-enter-fade 0.3s ease-out both;
}

@media (prefers-reduced-motion: no-preference) {
  .ad-card {
    animation-name: ad-card-enter;
    animation-duration: 0.4s;
    animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
  }

  .ad-card-grid > *:nth-child(1) { animation-delay: 0ms; }
  .ad-card-grid > *:nth-child(2) { animation-delay: 50ms; }
  .ad-card-grid > *:nth-child(3) { animation-delay: 100ms; }
  .ad-card-grid > *:nth-child(4) { animation-delay: 150ms; }
  .ad-card-grid > *:nth-child(n+5) { animation-delay: 200ms; }
}

@keyframes ad-card-enter-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes ad-card-enter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ad-card--critical {
  border-left-color: var(--danger);
}

.ad-card--warning {
  border-left-color: #eab308;
}

.ad-card--optimal {
  border-left-color: #006a65;
}

.ad-card__label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 8px;
}

.ad-card__value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 4px;
  line-height: 1.2;
}

.ad-card--critical .ad-card__value {
  color: var(--danger);
}

.ad-card--warning .ad-card__value {
  color: #a16207;
}

.ad-card--optimal .ad-card__value {
  color: #006a65;
}

.ad-card__icon-badge {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  color: var(--muted);
  background-color: rgba(63, 73, 73, 0.08);
}

.ad-card__icon-badge svg {
  width: 18px;
  height: 18px;
}

/* Per-metric-family accent — a display-only grouping (see MetricStyle in
   _AssetDetail.cshtml) so the KPI grid reads as distinct measurement types
   (temperature vs. vibration vs. pressure, etc.) instead of identical gray
   boxes with only the value text differing. */
.ad-card--temp .ad-card__icon-badge { color: #c2410c; background-color: rgba(234, 88, 12, 0.12); }
.ad-card--vibration .ad-card__icon-badge { color: #7c3aed; background-color: rgba(124, 58, 237, 0.12); }
.ad-card--pressure .ad-card__icon-badge { color: #0d6efd; background-color: rgba(13, 110, 253, 0.12); }
.ad-card--efficiency .ad-card__icon-badge { color: #006a65; background-color: rgba(0, 106, 101, 0.12); }
.ad-card--energy .ad-card__icon-badge { color: #b45309; background-color: rgba(217, 119, 6, 0.12); }
.ad-card--water .ad-card__icon-badge { color: #0e7490; background-color: rgba(8, 145, 178, 0.12); }
.ad-card--flow .ad-card__icon-badge { color: #15803d; background-color: rgba(22, 163, 74, 0.12); }
.ad-card--health .ad-card__icon-badge { color: var(--brand-700); background-color: rgba(0, 88, 91, 0.12); }

.ad-card--temp { border-left-color: #ea580c; }
.ad-card--vibration { border-left-color: #7c3aed; }
.ad-card--pressure { border-left-color: #0d6efd; }
.ad-card--efficiency { border-left-color: #006a65; }
.ad-card--energy { border-left-color: #d97706; }
.ad-card--water { border-left-color: #0891b2; }
.ad-card--flow { border-left-color: #16a34a; }

.ad-card__status-chip {
  align-self: flex-start;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: 999px;
  margin-top: 8px;
  background-color: rgba(63, 73, 73, 0.1);
  color: var(--muted);
}

.ad-card--critical .ad-card__status-chip {
  color: var(--danger);
  background-color: rgba(186, 26, 26, 0.12);
}

.ad-card--warning .ad-card__status-chip {
  color: #a16207;
  background-color: rgba(234, 179, 8, 0.12);
}

.ad-card--optimal .ad-card__status-chip {
  color: #006a65;
  background-color: rgba(0, 106, 101, 0.12);
}

.ad-card__desc {
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--muted);
  margin: 0;
}

.ad-card__chart {
  width: 100%;
  height: 40px;
  flex: 1;
}

/* ====================================================================
   Platform Management page (platform_management.html)
   Page-specific styles. Uses --ink / --muted / --brand-900 / --brand-700 /
   --mint-300 / --danger / --surface / --bg / --border custom properties
   already defined in css/dashboard.css.
   ==================================================================== */

.pm-tabs {
  display: flex;
  gap: 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.pm-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0 4px 10px;
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--muted);
  cursor: pointer;
}

.pm-tab.active {
  color: var(--brand-900);
  border-bottom-color: var(--brand-900);
}

html[data-theme="dark"] .pm-tab.active {
  color: var(--mint-300);
  border-bottom-color: var(--mint-300);
}

/* ---------- KPI cards ---------- */
.pm-kpi-card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 17px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.pm-kpi-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.pm-kpi-card__label {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-weight: 700;
  font-size: 0.6875rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.pm-kpi-card__icon {
  width: 20px;
  height: 16px;
  color: var(--muted);
  flex-shrink: 0;
}

.pm-kpi-card__value-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.pm-kpi-card__value {
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--ink);
  line-height: 1.1;
}

.pm-kpi-card__delta {
  font-size: 0.75rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pm-kpi-card__delta--up {
  color: #006a65;
}

.pm-kpi-card__delta--critical {
  color: var(--muted);
}

.pm-kpi-card__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--danger);
  display: inline-block;
}

/* ---------- Filter bar ---------- */
.pm-filter-bar {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  height: 100%;
  display: flex;
  align-items: stretch;
  padding: 9px;
  flex-wrap: wrap;
  gap: 8px;
}

.pm-filter-bar__search {
  flex: 1 1 200px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-right: 1px solid var(--border);
  min-width: 0;
}

.pm-filter-bar__search svg {
  width: 16px;
  height: 16px;
  color: var(--muted);
  flex-shrink: 0;
}

.pm-filter-bar__search input {
  border: none;
  background: none;
  font-size: 0.875rem;
  color: var(--ink);
  width: 100%;
  padding: 8px 0;
}

.pm-filter-bar__search input:focus {
  outline: none;
  box-shadow: none;
}

.pm-filter-bar__controls {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 4px;
  flex-wrap: wrap;
}

.pm-filter-select {
  background-color: var(--bg);
  border: 1px solid var(--border);
  border-radius: 2px;
  font-size: 0.75rem;
  color: var(--ink);
  padding: 6px 10px;
}

.pm-filter-icon-btn {
  border: 1px solid var(--border);
  border-radius: 2px;
  background-color: var(--surface);
  color: var(--muted);
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pm-filter-icon-btn svg {
  width: 14px;
  height: 14px;
}

.pm-filter-icon-btn:hover,
.pm-filter-icon-btn.active {
  background-color: var(--bg);
  color: var(--ink);
}

/* ---------- Users table ---------- */
.pm-table-card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.pm-table {
  width: 100%;
  border-collapse: collapse;
}

.pm-table thead th {
  background-color: var(--bg);
  border-bottom: 1px solid var(--border);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-weight: 700;
  font-size: 0.6875rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 14px 16px;
  text-align: left;
  white-space: nowrap;
}

.pm-table thead th.text-end {
  text-align: right;
}

.pm-sort-btn {
  background: none;
  border: none;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.pm-sort-btn svg {
  width: 8px;
  height: 8px;
  opacity: 0.6;
}

.pm-table tbody td {
  padding: 16px;
  border-bottom: 1px solid rgba(190, 200, 200, 0.3);
  vertical-align: middle;
  font-size: 0.875rem;
  color: var(--ink);
}

.pm-table tbody tr:last-child td {
  border-bottom: none;
}

.pm-table tbody tr:hover {
  background-color: var(--bg);
}

.pm-user-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pm-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 2px;
  background-color: #e2e2e2;
  color: var(--brand-900);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.8125rem;
  flex-shrink: 0;
}

.pm-user-avatar--alert {
  background-color: #ffdad6;
  color: #93000a;
}

.pm-user-name {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--ink);
}

.pm-user-email {
  font-size: 0.75rem;
  color: var(--muted);
}

.pm-user-alert {
  font-size: 0.75rem;
  color: var(--danger);
  display: flex;
  align-items: center;
  gap: 4px;
}

.pm-role-badge {
  display: inline-flex;
  align-items: center;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-weight: 700;
  font-size: 0.6875rem;
  letter-spacing: 0.05em;
  padding: 3px 9px;
  border-radius: 2px;
  white-space: nowrap;
}

.pm-role-badge--admin {
  background-color: var(--brand-900);
  border: 1px solid var(--brand-900);
  color: var(--mint-300);
}

.pm-role-badge--default {
  background-color: var(--bg);
  border: 1px solid var(--border);
  color: var(--ink);
}

.pm-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--ink);
}

.pm-status--suspended {
  color: var(--danger);
}

.pm-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pm-status-dot--online {
  background-color: #00b341;
}

.pm-status-dot--idle {
  background-color: var(--muted);
}

.pm-status-dot--suspended {
  background-color: var(--danger);
}

.pm-row-action-btn {
  border: none;
  background: none;
  color: var(--muted);
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.pm-row-action-btn svg {
  width: 4px;
  height: 16px;
  flex-shrink: 0;
}

.pm-row-action-btn:hover {
  background-color: var(--bg);
  color: var(--ink);
}

/* ---------- Add New dropdown ---------- */
.pm-dropdown {
  position: relative;
}

.pm-dropdown__caret {
  width: 9px;
  height: 6px;
  margin-left: 2px;
}

.pm-dropdown__menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 180px;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.15);
  padding: 6px;
  z-index: 1060;
}

.pm-dropdown__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: none;
  background: none;
  border-radius: 4px;
  font-size: 0.8125rem;
  color: var(--ink);
}

.pm-dropdown__item svg {
  width: 16px;
  height: 16px;
  color: var(--muted);
  flex-shrink: 0;
}

.pm-dropdown__item:hover {
  background-color: var(--bg);
}

/* ---------- Add User / Add Asset modals ---------- */
.pm-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 1070;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.pm-modal__dialog {
  background-color: var(--surface);
  border-radius: 8px;
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.pm-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.pm-modal__title {
  font-size: 1.125rem;
  font-weight: 700;
  margin: 0;
  color: var(--ink);
}

.pm-modal__close {
  border: none;
  background: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 0 4px;
}

.pm-modal__close:hover {
  color: var(--ink);
}

.pm-modal__body {
  padding: 24px;
}

.pm-modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

/* ---------- Table footer / pagination ---------- */
.pm-table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-top: 1px solid var(--border);
  background-color: var(--bg);
  flex-wrap: wrap;
}

.pm-table-footer__info {
  font-size: 0.75rem;
  color: var(--muted);
}

.pm-pagination {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pm-page-btn {
  min-width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background-color: var(--surface);
  color: var(--muted);
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.pm-page-btn:hover:not(:disabled) {
  background-color: var(--bg);
}

.pm-page-btn.active {
  background-color: rgba(102, 249, 228, 0.1);
  border-color: var(--mint-300);
  color: var(--ink);
}

.pm-page-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.pm-page-ellipsis {
  min-width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--muted);
}

@media (max-width: 767.98px) {
  .pm-filter-bar__search {
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
  }
}

/* ====================================================================
   Reports & Downloads page (reports.html)
   Page-specific styles. Uses --ink / --muted / --brand-900 / --brand-700 /
   --danger / --surface / --bg / --border custom properties already
   defined in css/dashboard.css. Reuses .pm-status / .pm-status-dot /
   .pm-table-card / .pm-table / .pm-table-footer / .pm-pagination /
   .pm-page-btn from the Platform Management page styles above.
   ==================================================================== */

/* ---------- Scheduled Automation cards ---------- */
.rp-automation-card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  padding: 21px;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.rp-automation-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 16px;
}

.rp-automation-card__icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background-color: var(--bg);
  color: var(--brand-700);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.rp-automation-card__icon svg {
  width: 18px;
  height: 20px;
}

.rp-automation-card__freq {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-weight: 700;
  font-size: 0.6875rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  background-color: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  white-space: nowrap;
}

.rp-automation-card__title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 8px;
  line-height: 1.3;
}

.rp-automation-card__scope {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  color: var(--muted);
  margin-bottom: 16px;
}

.rp-automation-card__scope svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

.rp-automation-card__metrics {
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.rp-automation-card__metrics-label {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 12px;
}

.rp-automation-card__metrics-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.8125rem;
  color: var(--ink);
}

.rp-automation-card__metrics-list li {
  position: relative;
  padding-left: 12px;
}

.rp-automation-card__metrics-list li::before {
  content: "\2022";
  position: absolute;
  left: 0;
  color: var(--muted);
}

.rp-automation-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-top: 1px solid var(--border);
  margin-top: 16px;
  padding-top: 16px;
}

.rp-automation-card__footer-text {
  font-size: 0.8125rem;
  color: var(--ink);
}

.rp-automation-card__edit-btn {
  border: none;
  background: none;
  color: var(--muted);
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  flex-shrink: 0;
}

.rp-automation-card__edit-btn svg {
  width: 14px;
  height: 14px;
}

.rp-automation-card__edit-btn:hover {
  background-color: var(--bg);
  color: var(--brand-700);
}

/* ---------- Insight Summary card ---------- */
.rp-insight-card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  padding: 21px;
}

.rp-insight-label {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 12px;
}

.rp-insight-critical {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--danger);
}

.rp-actions-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--ink);
}

.rp-actions-list li {
  position: relative;
  padding-left: 14px;
}

.rp-actions-list li::before {
  content: "\2022";
  position: absolute;
  left: 0;
  color: var(--muted);
}

.rp-status-overview {
  display: flex;
  gap: 32px;
}

.rp-status-stat__value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.1;
}

.rp-status-stat__label {
  font-size: 0.75rem;
  color: var(--muted);
  margin: 4px 0 0;
}

/* ---------- Reports table toolbar ---------- */
.rp-table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.rp-search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  min-width: 220px;
  max-width: 360px;
  flex: 1 1 260px;
}

.rp-search-box svg {
  width: 15px;
  height: 15px;
  color: var(--muted);
  flex-shrink: 0;
}

.rp-search-box input {
  border: none;
  background: none;
  font-size: 0.875rem;
  color: var(--ink);
  width: 100%;
  padding: 0;
}

.rp-search-box input:focus {
  outline: none;
  box-shadow: none;
}

.rp-table-toolbar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---------- Report type badges ---------- */
.rp-type-badge {
  display: inline-flex;
  align-items: center;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-weight: 700;
  font-size: 0.6875rem;
  letter-spacing: 0.05em;
  padding: 3px 9px;
  border-radius: 4px;
}

.rp-type-badge--pdf {
  background-color: rgba(186, 26, 26, 0.1);
  border: 1px solid rgba(186, 26, 26, 0.2);
  color: var(--danger);
}

.rp-type-badge--csv {
  background-color: rgba(13, 110, 253, 0.1);
  border: 1px solid rgba(13, 110, 253, 0.2);
  color: #0d6efd;
}

.rp-type-badge--xlsx {
  background-color: rgba(0, 106, 101, 0.1);
  border: 1px solid rgba(0, 106, 101, 0.2);
  color: #006a65;
}

/* ---------- Report status: processing dot (Ready/Expired reuse
   .pm-status-dot--online / --suspended from Platform Management) ---------- */
.pm-status-dot--processing {
  background-color: #0d6efd;
}

/* ---------- Muted row (expired / stale report) ---------- */
.rp-row--muted td {
  color: var(--muted);
}

.rp-row--muted td:first-child {
  color: var(--muted);
}

.rp-pending-label {
  font-size: 0.8125rem;
  color: var(--muted);
}

.rp-regenerate-link {
  border: none;
  background: none;
  padding: 0;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--brand-700);
}

.rp-regenerate-link:hover {
  text-decoration: underline;
}

/* ---------- Report row action icon buttons ---------- */
.rp-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.rp-row-icon-btn {
  border: none;
  background: none;
  color: var(--muted);
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  flex-shrink: 0;
}

.rp-row-icon-btn svg {
  width: 14px;
  height: 14px;
}

.rp-row-icon-btn:hover {
  background-color: var(--bg);
  color: var(--ink);
}

@media (max-width: 767.98px) {
  .rp-automation-card__metrics-list {
    grid-template-columns: 1fr;
  }
}

/* ====================================================================
   Insights & Actions page (insights_actions.html)
   Page-specific styles. Uses --ink / --muted / --brand-900 / --brand-700 /
   --danger / --surface / --bg / --border custom properties already
   defined in css/dashboard.css. Reuses .chart-card / .chart-legend /
   .ep-chart-svg / .btn-outline-filter / .btn-filled-export / .header-filter
   from the styles above.
   ==================================================================== */

/* ---------- Shared panel chrome (Active Insights / Asset Insight Cards) ---------- */
.ia-panel {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.ia-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.ia-panel__header--stacked {
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.ia-panel__title {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
}

.ia-panel__subtitle {
  font-size: 0.8125rem;
  color: var(--muted);
  margin: 0;
}

.ia-panel__badge {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--muted);
  background-color: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  white-space: nowrap;
}

/* ---------- Active Insights rows ---------- */
.ia-insight-list {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.ia-insight-row {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-left: 4px solid transparent;
  border-bottom: 1px solid var(--border);
  padding: 16px;
  cursor: pointer;
}

.ia-insight-row:last-child {
  border-bottom: none;
}

.ia-insight-row:hover {
  background-color: var(--bg);
}

.ia-insight-row.active {
  background-color: rgba(0, 88, 91, 0.05);
}

.ia-insight-row--critical {
  border-left-color: var(--danger);
}

.ia-insight-row--opportunity {
  border-left-color: var(--brand-700);
}

.ia-insight-row--forecast {
  border-left-color: var(--muted);
}

.ia-insight-row__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.ia-insight-row__time {
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}

.ia-insight-row__title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 4px;
  line-height: 1.35;
}

.ia-insight-row__subtitle {
  font-size: 0.8125rem;
  color: var(--muted);
  margin: 0 0 6px;
}

.ia-insight-row__confidence {
  font-size: 0.8125rem;
  color: var(--muted);
  margin: 0;
}

/* ---------- Insight type badges ---------- */
.ia-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 9px 3px 6px;
  border-radius: 999px;
}

.ia-badge svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.ia-badge--critical {
  background-color: rgba(186, 26, 26, 0.1);
  border: 1px solid rgba(186, 26, 26, 0.2);
  color: var(--danger);
}

.ia-badge--opportunity {
  background-color: rgba(0, 88, 91, 0.08);
  border: 1px solid rgba(0, 88, 91, 0.2);
  color: var(--brand-700);
}

.ia-badge--forecast {
  background-color: var(--bg);
  border: 1px solid var(--border);
  color: var(--muted);
}

/* ---------- Focus / detail card ---------- */
.ia-focus-card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-top: 4px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.ia-focus-card--critical {
  border-top-color: var(--danger);
}

.ia-focus-card--opportunity {
  border-top-color: var(--brand-700);
}

.ia-focus-card--forecast {
  border-top-color: var(--muted);
}

.ia-focus-card__header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.ia-focus-card__icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background-color: rgba(186, 26, 26, 0.1);
  color: var(--danger);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ia-focus-card__icon svg {
  width: 20px;
  height: 20px;
}

.ia-focus-card__heading {
  flex: 1;
  min-width: 0;
}

.ia-focus-card__title {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 4px;
  line-height: 1.3;
}

.ia-focus-card__subtitle {
  font-size: 0.8125rem;
  color: var(--muted);
  margin: 0;
}

.ia-focus-card__menu-btn {
  border: none;
  background: none;
  color: var(--muted);
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  flex-shrink: 0;
}

.ia-focus-card__menu-btn svg {
  width: 4px;
  height: 16px;
}

.ia-focus-card__menu-btn:hover {
  background-color: var(--bg);
  color: var(--ink);
}

/* ---------- Diagnostic alert box ---------- */
.ia-diagnostic-box {
  background-color: rgba(186, 26, 26, 0.04);
  border-bottom: 1px solid var(--border);
  padding: 16px;
}

.ia-diagnostic-section {
  border-top: 1px solid rgba(186, 26, 26, 0.15);
  padding: 14px 0;
}

.ia-diagnostic-section:first-child {
  border-top: none;
  padding-top: 0;
}

.ia-diagnostic-section:last-child {
  padding-bottom: 0;
}

.ia-diagnostic-section__label {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--danger);
  margin: 0 0 8px;
}

.ia-diagnostic-section__text {
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--ink);
  margin: 0;
}

.ia-diagnostic-evidence-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.8125rem;
  color: var(--ink);
}

.ia-diagnostic-evidence-list li {
  position: relative;
  padding-left: 14px;
}

.ia-diagnostic-evidence-list li::before {
  content: "\2022";
  position: absolute;
  left: 0;
  color: var(--muted);
}

.ia-trend-up {
  color: var(--danger);
  font-weight: 600;
}

.ia-confidence-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ia-confidence-track {
  flex: 1;
  background-color: var(--border);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
}

.ia-confidence-fill {
  height: 100%;
  background-color: var(--danger);
  border-radius: 999px;
}

.ia-confidence-value {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
}

/* ---------- Energy Prediction chart card (nested inside focus card) ---------- */
.ia-prediction-card {
  box-shadow: none;
  border-radius: 0;
  border-bottom: 1px solid var(--border);
  padding: 16px;
}

/* ---------- Recommended actions (pinned footer of focus card) ---------- */
.ia-recommended-actions {
  padding: 16px;
}

.ia-recommended-actions__label {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 12px;
}

/* ---------- Asset Insight Cards ---------- */
.ia-asset-card-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ia-asset-card {
  background-color: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px;
}

.ia-asset-card--collapsed {
  padding-bottom: 16px;
}

.ia-asset-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ia-asset-card__title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink);
}

.ia-asset-card__recommendation {
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--muted);
  margin: 8px 0 0;
}

.ia-asset-card__recommendation strong {
  color: var(--ink);
}

.ia-health-pill {
  display: inline-block;
  width: 48px;
  height: 12px;
  border-radius: 999px;
  flex-shrink: 0;
}

.ia-health-pill--optimal {
  background-color: #00b341;
}

.ia-health-pill--warning {
  background-color: #f59e0b;
}

.ia-health-pill--critical {
  background-color: var(--danger);
}

.ia-asset-card-list__footer {
  display: block;
  width: calc(100% - 32px);
  margin: 0 16px 16px;
  background-color: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--muted);
}

.ia-asset-card-list__footer:hover {
  background-color: var(--border);
  color: var(--ink);
}

/* ---------- Forecast (bottom row) chart legend ---------- */
.ia-forecast-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
  color: var(--muted);
  margin-bottom: 8px;
}

.ia-forecast-legend svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* ---------- Asset Diagnostics: empty search + small screens ---------- */
.asset-list__empty {
  margin: 0;
  padding: 24px 12px;
  text-align: center;
  font-size: 0.875rem;
  color: var(--muted);
}

/* A row's name may wrap; without min-width:0 a long name pushes the status
   badge off the edge instead of wrapping. */
.asset-item__body { min-width: 0; }

/* The list is its own scroll box inside a scrolling page: once it hits an
   end, don't hand the gesture to the page and yank it. */
.asset-list { overscroll-behavior: contain; }

/* Single-column layout (phones + tablets): the asset list becomes a compact
   horizontal switcher. Stacked, it was header + search + a 320px scroll box
   (~500px) that pushed the detail panel below the fold, and picking an asset
   changed something the user couldn't see. As a strip, the detail sits
   directly under the thing you just tapped, no scrolling required. */
@media (max-width: 1199.98px) {
  .assets-grid { gap: 12px; }
  .ad-detail-card { min-height: 0; }

  .asset-list-card__header { padding: 14px 16px 10px; border-bottom: 0; }
  .asset-search { padding: 0 16px 10px; border-bottom: 0; }

  .asset-list {
    display: flex;
    flex-direction: row;
    gap: 8px;
    max-height: none;
    padding: 2px 16px 14px;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    scroll-padding-inline: 16px;
    scrollbar-width: none;
    /* Soft edge on the right hints that the strip scrolls. */
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
            mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
  }
  .asset-list::-webkit-scrollbar { display: none; }

  .asset-item {
    flex: 0 0 auto;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin: 0;
    padding: 10px 14px;
    min-height: 44px;
    max-width: 220px;
    border: 1px solid var(--border);
    border-left-width: 1px;
    border-radius: 14px;
    scroll-snap-align: center;
  }
  .asset-item.selected {
    border-color: var(--brand-700);
    box-shadow: 0 0 0 1px var(--brand-700);
    /* Much lighter than the desktop row's 20% wash: the status badge inside
       a chip has to stay legible on it. */
    background-color: rgba(0, 88, 91, 0.06);
  }
  .asset-item__body { flex: none; max-width: 100%; }
  .asset-item__name { font-size: 0.8125rem; }
  .asset-item__meta { display: none; }
  .asset-badge { padding: 1px 6px; }
}

/* Phones: the detail panel itself. */
@media (max-width: 767.98px) {
  .ad-detail-card__body { padding: 16px; gap: 16px; }
  .ad-detail-title { font-size: 1.375rem; }
  .ad-detail-subtitle { font-size: 0.8125rem; }

  /* Two tiles per row instead of one 120px-tall card per row: a 4-5 metric
     asset fits on about one screen instead of three. */
  .ad-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .ad-card {
    padding: 14px;
    min-height: 0;
    justify-content: flex-start;
    overflow-wrap: anywhere;
  }
  .ad-card__icon-badge { width: 28px; height: 28px; margin-bottom: 8px; }
  .ad-card__icon-badge svg { width: 16px; height: 16px; }
  .ad-card__label { margin-bottom: 4px; }
  .ad-card__value { font-size: 1.375rem; }

  /* Health Score is the headline of the panel: full width, icon beside text. */
  .ad-card--health {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "icon label chip" "icon value chip";
    align-items: center;
    column-gap: 12px;
  }
  .ad-card--health .ad-card__icon-badge { grid-area: icon; margin: 0; width: 40px; height: 40px; }
  .ad-card--health .ad-card__label { grid-area: label; margin: 0; }
  .ad-card--health .ad-card__value { grid-area: value; font-size: 1.75rem; margin: 0; }
  .ad-card--health .ad-card__status-chip { grid-area: chip; align-self: center; }

  .page-header { margin-bottom: 16px; }
  .page-header h1 { font-size: 1.625rem; }
}

/* Comfortable touch targets for the page's actions. */
@media (pointer: coarse) {
  .page-header__actions .btn-filled-export,
  .page-header__actions .btn-outline-filter { min-height: 44px; }
}
