:root {
  --bg: #0b1020;
  --bg-elevated: rgba(16, 24, 40, 0.82);
  --bg-soft: rgba(148, 163, 184, 0.12);
  --text: #e5edf7;
  --text-soft: #9fb1c7;
  --border: rgba(148, 163, 184, 0.18);
  --shadow: 0 20px 45px rgba(0, 0, 0, 0.28);
  --ok: #10b981;
  --warning: #f59e0b;
  --ko: #ef4444;
  --neutral: #64748b;
  --accent: #60a5fa;
  --input-bg: rgba(15, 23, 42, 0.72);
  --compact-card-size: 36px;
  --card-min-width: 208px;
  --card-height: 188px;
  --grid-gap: 14px;
}

body[data-theme="light"] {
  --bg: #f4f7fb;
  --bg-elevated: rgba(255, 255, 255, 0.82);
  --bg-soft: rgba(15, 23, 42, 0.06);
  --text: #122033;
  --text-soft: #4f647c;
  --border: rgba(15, 23, 42, 0.1);
  --shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
  --neutral: #94a3b8;
  --accent: #2563eb;
  --input-bg: rgba(255, 255, 255, 0.86);
}

body[data-density="comfortable"] {
  --card-min-width: 208px;
  --card-height: 188px;
  --grid-gap: 14px;
}

body[data-density="compact"] {
  --card-min-width: var(--compact-card-size);
  --card-height: var(--compact-card-size);
  --grid-gap: 6px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top right, rgba(96, 165, 250, 0.16), transparent 24%),
    radial-gradient(circle at top left, rgba(16, 185, 129, 0.12), transparent 18%),
    var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease, color 120ms ease;
}

button:hover {
  transform: translateY(-1px);
  border-color: rgba(96, 165, 250, 0.42);
}

button[data-muted="true"] {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.28);
}

button[data-muted="false"] {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.18);
}

input {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  border-radius: 14px;
  padding: 12px 14px;
  outline: none;
}

input::placeholder {
  color: var(--text-soft);
}

.app-shell {
  width: min(1920px, calc(100vw - 24px));
  margin: 12px auto;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 16px;
  align-items: start;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 10px;
  z-index: 20;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: clamp(1.55rem, 2vw, 2.4rem);
  line-height: 1.05;
}

.subtitle {
  margin: 8px 0 0;
  color: var(--text-soft);
  font-size: 0.95rem;
}

.header-actions {
  display: grid;
  gap: 12px;
  justify-items: end;
}

.header-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  color: var(--text-soft);
  font-size: 0.92rem;
}

.action-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.volume-control {
  display: grid;
  gap: 6px;
  min-width: 220px;
  padding: 8px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}

.volume-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.volume-control-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.volume-slider {
  width: 100%;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  accent-color: var(--accent);
}

.volume-value {
  min-width: 48px;
  text-align: right;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.toolbar {
  margin-top: 14px;
  display: grid;
  grid-template-columns: minmax(220px, 340px) 1fr;
  gap: 12px;
  align-items: center;
}

.view-tabs {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.view-tab {
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--bg-elevated);
}

.view-tab.active {
  background: rgba(96, 165, 250, 0.18);
  border-color: rgba(96, 165, 250, 0.34);
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-chip {
  padding: 9px 12px;
  border-radius: 999px;
  background: var(--bg-elevated);
}

.filter-chip.active {
  background: rgba(96, 165, 250, 0.18);
  border-color: rgba(96, 165, 250, 0.34);
}

.filter-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
  user-select: none;
}

.filter-toggle:hover {
  border-color: rgba(96, 165, 250, 0.42);
}

.filter-toggle.active {
  background: rgba(96, 165, 250, 0.18);
  border-color: rgba(96, 165, 250, 0.34);
}

.filter-toggle input {
  width: 18px;
  min-width: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.filter-toggle span {
  white-space: nowrap;
}

.banner {
  margin-top: 14px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--text);
  border-radius: 16px;
  padding: 12px 14px;
}

.banner-alert,
.banner-warning {
  display: grid;
  gap: 4px;
}

.banner-alert {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.34);
}

.banner-warning {
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.34);
}

.banner-alert strong,
.banner-warning strong {
  font-size: 0.95rem;
}

.freshness-warning {
  position: sticky;
  top: 10px;
  z-index: 35;
  margin-top: 14px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  min-height: 96px;
  padding: 20px 24px;
  border: 4px solid rgba(255, 255, 255, 0.88);
  border-radius: 18px;
  background:
    repeating-linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.15) 0,
      rgba(255, 255, 255, 0.15) 12px,
      transparent 12px,
      transparent 24px
    ),
    linear-gradient(135deg, #b91c1c 0%, #ef4444 44%, #f59e0b 100%);
  color: #fff;
  box-shadow:
    0 0 0 5px rgba(239, 68, 68, 0.38),
    0 22px 60px rgba(127, 29, 29, 0.42);
  animation: staleWarningPulse 1.25s ease-in-out infinite;
}

.freshness-warning-icon {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border: 4px solid currentColor;
  border-radius: 999px;
  font-size: 2.6rem;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 0 24px rgba(255, 255, 255, 0.4);
}

.freshness-warning-main {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.freshness-warning-main strong {
  font-size: clamp(1.75rem, 4vw, 4.2rem);
  line-height: 0.95;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.freshness-warning-main span {
  font-size: clamp(1rem, 1.2vw, 1.3rem);
  font-weight: 800;
  line-height: 1.25;
}

.freshness-warning-threshold {
  align-self: stretch;
  display: grid;
  place-items: center;
  min-width: 128px;
  padding: 10px 14px;
  border: 2px solid rgba(255, 255, 255, 0.78);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.28);
  font-size: 1.05rem;
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
}

body.has-stale-data::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  border: 12px solid rgba(239, 68, 68, 0.95);
  box-shadow: inset 0 0 0 8px rgba(245, 158, 11, 0.85), inset 0 0 70px rgba(127, 29, 29, 0.55);
  animation: staleViewportPulse 1.25s ease-in-out infinite;
}

@keyframes staleWarningPulse {
  0%,
  100% {
    transform: scale(1);
    filter: brightness(1);
  }

  50% {
    transform: scale(1.01);
    filter: brightness(1.12);
  }
}

@keyframes staleViewportPulse {
  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.56;
  }
}

.resource-alert-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.resource-alert-heading {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.resource-alert-heading span {
  color: var(--text-soft);
  font-size: 0.84rem;
  line-height: 1.35;
}

.resource-alert-count {
  width: 42px;
  height: 42px;
  min-width: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(15, 23, 42, 0.2);
  font-size: 1.2rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.resource-alert-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 148px));
  gap: 10px;
  justify-content: start;
  align-items: start;
}

.resource-alert-tile {
  aspect-ratio: 1 / 1;
  min-height: 126px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  display: grid;
  grid-template-rows: auto auto 1fr auto auto;
  align-items: start;
  gap: 5px;
  background: var(--bg-soft);
  overflow: hidden;
}

.resource-alert-tile.tone-warning {
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.42);
}

.resource-alert-tile.tone-ko {
  background: rgba(239, 68, 68, 0.16);
  border-color: rgba(239, 68, 68, 0.46);
}

.resource-alert-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.13);
  color: currentColor;
}

.resource-icon-svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.resource-alert-level {
  color: var(--text-soft);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

.resource-alert-value {
  align-self: center;
  font-size: clamp(1.2rem, 2vw, 1.75rem);
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.resource-alert-label {
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.resource-alert-threshold {
  color: var(--text-soft);
  font-size: 0.72rem;
  line-height: 1.2;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.stats-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(5, minmax(100px, 1fr));
  gap: 10px;
}

.stat-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.stat-card.ok {
  border-color: rgba(16, 185, 129, 0.22);
}

.stat-card.warning {
  border-color: rgba(245, 158, 11, 0.22);
}

.stat-card.ko {
  border-color: rgba(239, 68, 68, 0.22);
}

.stat-label {
  display: block;
  color: var(--text-soft);
  font-size: 0.84rem;
}

.stat-value {
  display: block;
  margin-top: 8px;
  font-size: clamp(1.25rem, 1.8vw, 1.8rem);
  letter-spacing: -0.03em;
}

.operations-panel {
  margin-top: 14px;
  padding: 18px 20px 20px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.operations-panel-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}

.operations-panel h2 {
  margin: 0;
  font-size: clamp(1.15rem, 1.5vw, 1.5rem);
}

.operations-meta {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.86rem;
}

.operations-meta {
  text-align: right;
}

.operations-description {
  margin: 5px 0 0;
  color: var(--text-soft);
  font-size: 0.86rem;
}

.external-service-summary-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.external-service-summary-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 13px 15px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg-soft);
}

.external-service-summary-card.tone-ok {
  border-color: rgba(16, 185, 129, 0.3);
  background: linear-gradient(110deg, rgba(16, 185, 129, 0.1), transparent 58%), var(--bg-soft);
}

.external-service-summary-card.tone-warning {
  border-color: rgba(245, 158, 11, 0.36);
  background: linear-gradient(110deg, rgba(245, 158, 11, 0.11), transparent 58%), var(--bg-soft);
}

.external-service-summary-card.tone-ko {
  border-color: rgba(239, 68, 68, 0.4);
  background: linear-gradient(110deg, rgba(239, 68, 68, 0.12), transparent 58%), var(--bg-soft);
}

.external-service-summary-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--neutral);
  box-shadow: 0 0 0 5px rgba(100, 116, 139, 0.14);
}

.tone-ok > .external-service-summary-dot {
  background: var(--ok);
  box-shadow: 0 0 0 5px rgba(16, 185, 129, 0.14);
}

.tone-warning > .external-service-summary-dot {
  background: var(--warning);
  box-shadow: 0 0 0 5px rgba(245, 158, 11, 0.14);
}

.tone-ko > .external-service-summary-dot {
  background: var(--ko);
  box-shadow: 0 0 0 5px rgba(239, 68, 68, 0.14);
}

.external-service-summary-main {
  min-width: 0;
}

.external-service-summary-main strong {
  display: block;
  margin-top: 2px;
  overflow-wrap: anywhere;
  font-size: 1rem;
}

.external-service-summary-state {
  display: grid;
  justify-items: end;
  gap: 5px;
  color: var(--text-soft);
  font-size: 0.76rem;
  text-align: right;
}

.external-services {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.external-service-card {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) auto;
  gap: 16px;
  align-items: center;
  min-height: 122px;
  padding: 16px 18px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 18px;
  background:
    linear-gradient(110deg, rgba(100, 116, 139, 0.08), transparent 58%),
    var(--bg-soft);
}

.external-service-card::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--neutral);
}

.external-service-card.tone-ok {
  border-color: rgba(16, 185, 129, 0.32);
  background: linear-gradient(110deg, rgba(16, 185, 129, 0.13), transparent 58%), var(--bg-soft);
}

.external-service-card.tone-warning {
  border-color: rgba(245, 158, 11, 0.38);
  background: linear-gradient(110deg, rgba(245, 158, 11, 0.14), transparent 58%), var(--bg-soft);
}

.external-service-card.tone-ko {
  border-color: rgba(239, 68, 68, 0.42);
  background: linear-gradient(110deg, rgba(239, 68, 68, 0.16), transparent 58%), var(--bg-soft);
}

.external-service-card.tone-ok::after { background: var(--ok); }
.external-service-card.tone-warning::after { background: var(--warning); }
.external-service-card.tone-ko::after { background: var(--ko); }

.external-service-status-mark {
  position: relative;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(100, 116, 139, 0.14);
}

.external-service-status-mark span {
  width: 16px;
  height: 16px;
  border: 4px solid var(--bg-elevated);
  border-radius: inherit;
  background: var(--neutral);
  box-shadow: 0 0 0 5px rgba(100, 116, 139, 0.18);
}

.external-service-status-mark.status-ok span {
  background: var(--ok);
  box-shadow: 0 0 0 5px rgba(16, 185, 129, 0.18), 0 0 20px rgba(16, 185, 129, 0.42);
}

.external-service-status-mark.status-warning span {
  background: var(--warning);
  box-shadow: 0 0 0 5px rgba(245, 158, 11, 0.18), 0 0 20px rgba(245, 158, 11, 0.42);
}

.external-service-status-mark.status-ko span {
  background: var(--ko);
  box-shadow: 0 0 0 5px rgba(239, 68, 68, 0.18), 0 0 20px rgba(239, 68, 68, 0.42);
}

.external-service-main {
  min-width: 0;
}

.external-service-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.external-service-title-row h3 {
  margin: 2px 0 0;
  font-size: 1.12rem;
}

.external-service-kicker,
.server-card-kicker {
  color: var(--text-soft);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.external-service-provider,
.external-service-checked,
.external-service-error {
  margin: 6px 0 0;
  color: var(--text-soft);
  font-size: 0.82rem;
}

.external-service-error {
  color: var(--ko);
  font-weight: 700;
}

.external-service-counters {
  display: grid;
  grid-template-columns: repeat(3, minmax(72px, 1fr));
  gap: 8px;
}

.external-service-counter {
  min-width: 76px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-elevated);
  text-align: center;
}

.external-service-counter span {
  display: block;
  color: var(--text-soft);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
}

.external-service-counter strong {
  display: block;
  margin-top: 3px;
  font-size: 1.1rem;
  font-variant-numeric: tabular-nums;
}

.external-service-counter.tone-warning strong { color: var(--warning); }
.external-service-counter.tone-ko strong { color: var(--ko); }

.server-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.server-card {
  display: grid;
  gap: 14px;
  align-content: start;
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg-soft);
}

.server-card.tone-ok { border-color: rgba(16, 185, 129, 0.24); }
.server-card.tone-warning { border-color: rgba(245, 158, 11, 0.4); }
.server-card.tone-ko { border-color: rgba(239, 68, 68, 0.44); }

.server-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.server-card h3 {
  margin: 3px 0 0;
  overflow-wrap: anywhere;
  font-size: 1rem;
}

.freshness-badge {
  flex: 0 0 auto;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-soft);
  background: var(--bg-elevated);
  font-size: 0.69rem;
  font-weight: 800;
}

.freshness-fresh {
  color: var(--ok);
  border-color: rgba(16, 185, 129, 0.28);
  background: rgba(16, 185, 129, 0.1);
}

.freshness-stale {
  color: var(--warning);
  border-color: rgba(245, 158, 11, 0.3);
  background: rgba(245, 158, 11, 0.1);
}

.freshness-offline {
  color: var(--ko);
  border-color: rgba(239, 68, 68, 0.32);
  background: rgba(239, 68, 68, 0.11);
}

.server-metrics,
.server-drives {
  display: grid;
  gap: 10px;
}

.server-drives {
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.server-metric {
  display: grid;
  gap: 5px;
}

.server-metric-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-soft);
  font-size: 0.78rem;
}

.server-metric-label span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.server-metric-label strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.server-metric.tone-warning .server-metric-label strong { color: var(--warning); }
.server-metric.tone-ko .server-metric-label strong { color: var(--ko); }

.server-metric-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(100, 116, 139, 0.18);
}

.server-metric-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--ok);
  transition: width 240ms ease;
}

.server-metric.tone-warning .server-metric-track span { background: var(--warning); }
.server-metric.tone-ko .server-metric-track span { background: var(--ko); }
.server-metric.tone-neutral .server-metric-track span { background: var(--neutral); }

.server-metric small,
.server-no-drives {
  color: var(--text-soft);
  font-size: 0.7rem;
}

.server-probe-error {
  margin: 0;
  padding: 8px 10px;
  border-radius: 10px;
  color: var(--ko);
  background: rgba(239, 68, 68, 0.1);
  font-size: 0.76rem;
  font-weight: 700;
}

.server-card-footer {
  display: grid;
  gap: 3px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  color: var(--text-soft);
  font-size: 0.7rem;
}

.server-empty-state {
  grid-column: 1 / -1;
  display: grid;
  gap: 5px;
  padding: 18px;
  border: 1px dashed var(--border);
  border-radius: 14px;
  color: var(--text-soft);
  text-align: center;
}

.server-empty-state strong {
  color: var(--text);
}

.trend-panel {
  margin-top: 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.trend-panel-head {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 18px;
  align-items: start;
}

.trend-eyebrow {
  margin-bottom: 8px;
}

.trend-title-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.trend-title {
  margin: 0;
  font-size: clamp(1.1rem, 1.4vw, 1.45rem);
  line-height: 1.2;
}

.trend-meta {
  margin: 8px 0 0;
  color: var(--text-soft);
  font-size: 0.94rem;
}

.trend-panel-side {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.trend-metric-bar,
.trend-view-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.trend-metric-chip,
.trend-view-chip {
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--bg-soft);
}

.trend-metric-chip.active,
.trend-view-chip.active {
  background: rgba(96, 165, 250, 0.18);
  border-color: rgba(96, 165, 250, 0.34);
}

.trend-view-chip.readonly {
  cursor: default;
}

.trend-summary {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
}

#trendPanel[data-metric="performance"] .trend-summary,
#trendPanel[data-metric="memory"] .trend-summary {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.trend-summary-card {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 14px;
  min-width: 0;
  display: grid;
  gap: 8px;
}

.trend-summary-card-action {
  appearance: none;
  width: 100%;
  cursor: pointer;
  text-align: center;
  justify-items: center;
  align-content: center;
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}

.trend-summary-card-action:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
}

.trend-summary-card-action:focus-visible {
  outline: none;
  transform: translateY(-1px);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2), 0 10px 24px rgba(15, 23, 42, 0.16);
}

.trend-summary-card-action.tone-ok {
  border-color: rgba(16, 185, 129, 0.28);
}

.trend-summary-card-action.tone-warning {
  border-color: rgba(245, 158, 11, 0.3);
}

.trend-summary-card-action.tone-ko {
  border-color: rgba(239, 68, 68, 0.32);
}

.trend-summary-label {
  display: block;
  color: var(--text-soft);
  font-size: 0.78rem;
}

.trend-summary-value {
  display: block;
  margin-top: 6px;
  font-size: 1.08rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.trend-summary-note {
  display: block;
  color: var(--text-soft);
  font-size: 0.76rem;
  line-height: 1.45;
}

.trend-summary-health-elia {
  display: block;
  width: min(100%, 92px);
  height: 92px;
  margin: 6px auto 0;
  object-fit: contain;
  filter: drop-shadow(0 10px 22px rgba(15, 23, 42, 0.2));
}

.trend-summary-card.is-health {
  position: relative;
  overflow: hidden;
}

.trend-summary-card.is-health.tone-ok {
  border-color: rgba(16, 185, 129, 0.28);
}

.trend-summary-card.is-health.tone-warning {
  border-color: rgba(245, 158, 11, 0.3);
}

.trend-summary-card.is-health.tone-ko {
  border-color: rgba(239, 68, 68, 0.32);
}

.trend-health-gauge {
  position: relative;
  height: 18px;
  margin-top: 2px;
}

.trend-health-gauge-track {
  position: absolute;
  inset: 6px 0;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.95) 0%, rgba(245, 158, 11, 0.95) 45%, rgba(16, 185, 129, 0.95) 100%);
  opacity: 0.9;
}

.trend-health-gauge-marker {
  position: absolute;
  top: 1px;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: #fff;
  border: 2px solid rgba(15, 23, 42, 0.78);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.26);
  transform: translateX(-50%);
}

.trend-insight {
  margin-top: 14px;
}

.trend-insight:empty {
  display: none;
}

.trend-insight-stack {
  display: grid;
  gap: 12px;
}

.trend-insight-card {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px 16px;
  display: grid;
  gap: 10px;
}

.trend-insight-card.tone-ok {
  border-color: rgba(16, 185, 129, 0.24);
}

.trend-insight-card.tone-warning {
  border-color: rgba(245, 158, 11, 0.26);
}

.trend-insight-card.tone-ko {
  border-color: rgba(239, 68, 68, 0.28);
}

.trend-insight-head {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
}

.trend-insight-title {
  font-size: 0.96rem;
}

.trend-insight-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(96, 165, 250, 0.12);
  border: 1px solid rgba(96, 165, 250, 0.18);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 700;
}

.trend-insight-text,
.trend-insight-scale,
.trend-insight-footnote {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.84rem;
  line-height: 1.55;
}

.infra-metrics-grid,
.infra-alert-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.infra-metric-card,
.infra-alert-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg-soft);
  padding: 12px 14px;
  display: grid;
  gap: 6px;
}

.infra-metric-card.tone-ok,
.infra-alert-card.tone-ok {
  border-color: rgba(16, 185, 129, 0.24);
}

.infra-metric-card.tone-warning,
.infra-alert-card.tone-warning {
  border-color: rgba(245, 158, 11, 0.28);
}

.infra-metric-card.tone-ko,
.infra-alert-card.tone-ko {
  border-color: rgba(239, 68, 68, 0.32);
}

.infra-metric-label,
.infra-alert-host {
  color: var(--text-soft);
  font-size: 0.76rem;
}

.infra-metric-value,
.infra-alert-title {
  font-size: 1rem;
  font-weight: 800;
}

.infra-metric-note,
.infra-alert-values {
  color: var(--text-soft);
  font-size: 0.78rem;
  line-height: 1.4;
}

.trend-insight-formula {
  font-family: "Consolas", "Courier New", monospace;
  font-size: 0.8rem;
  line-height: 1.5;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.18);
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.reliability-board {
  min-height: 220px;
  display: grid;
  align-content: center;
  gap: 16px;
  padding: 18px 20px;
  border-radius: 22px;
  border: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(96, 165, 250, 0.05), transparent 45%),
    var(--bg-soft);
}

.reliability-board.tone-ok {
  border-color: rgba(16, 185, 129, 0.26);
}

.reliability-board.tone-warning {
  border-color: rgba(245, 158, 11, 0.28);
}

.reliability-board.tone-ko {
  border-color: rgba(239, 68, 68, 0.3);
}

.reliability-board-main {
  display: grid;
  gap: 8px;
}

.reliability-board-label {
  color: var(--text-soft);
  font-size: 0.84rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.reliability-board-value {
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1;
  letter-spacing: -0.04em;
}

.reliability-board-text {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.95rem;
}

.reliability-board-scale {
  position: relative;
  height: 16px;
  border-radius: 999px;
  overflow: hidden;
}

.reliability-board-scale-track {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.9) 0%, rgba(245, 158, 11, 0.9) 45%, rgba(16, 185, 129, 0.9) 100%);
  opacity: 0.42;
}

.reliability-board-scale-marker {
  position: absolute;
  top: 50%;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #fff;
  border: 2px solid rgba(15, 23, 42, 0.84);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.28);
  transform: translate(-50%, -50%);
}

.reliability-board-legend {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  flex-wrap: wrap;
  color: var(--text-soft);
  font-size: 0.76rem;
}


.history-section {
  margin-top: 14px;
  display: grid;
  gap: 18px;
}

.history-hero {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(300px, 520px);
  gap: 16px;
  align-items: start;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 20px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.history-hero-main {
  display: grid;
  gap: 14px;
}

.history-title {
  margin: 0;
  font-size: clamp(1.15rem, 1.5vw, 1.6rem);
  line-height: 1.15;
}

.history-meta {
  margin: 8px 0 0;
  color: var(--text-soft);
  font-size: 0.95rem;
}

.history-search-block {
  display: grid;
  gap: 10px;
}

.history-search-field {
  display: grid;
  gap: 8px;
}

.history-search-label {
  color: var(--text-soft);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.history-search-field input {
  width: 100%;
}

.history-search-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.history-search-meta {
  color: var(--text-soft);
  font-size: 0.82rem;
}

.history-search-clear {
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
}

.history-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.history-summary-card {
  background:
    linear-gradient(180deg, rgba(96, 165, 250, 0.08), transparent 65%),
    var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px 16px;
  min-width: 0;
}

.history-summary-label {
  display: block;
  color: var(--text-soft);
  font-size: 0.78rem;
}

.history-summary-value {
  display: block;
  margin-top: 6px;
  font-size: 1.3rem;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.history-day-group {
  display: grid;
  gap: 12px;
}

.history-day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.history-day-title {
  margin: 0;
  font-size: clamp(1rem, 1vw + 0.65rem, 1.28rem);
  font-weight: 800;
  letter-spacing: -0.03em;
}

.history-day-count {
  color: var(--text-soft);
  font-size: 0.84rem;
}

.history-timeline-list {
  display: grid;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 24px;
  overflow: hidden;
  background: rgba(15, 23, 42, 0.28);
  box-shadow: var(--shadow);
}

.history-timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 28px 88px minmax(0, 1fr);
  gap: 16px;
  padding: 18px 20px;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid var(--border);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.02), transparent 18%),
    linear-gradient(180deg, var(--bg-elevated), rgba(15, 23, 42, 0.76));
  transition: background 120ms ease, border-color 120ms ease;
}

.history-timeline-item:last-child {
  border-bottom: 0;
}

.history-timeline-item:hover,
.history-timeline-item:focus-visible {
  background:
    linear-gradient(90deg, rgba(96, 165, 250, 0.08), transparent 24%),
    linear-gradient(180deg, var(--bg-elevated), rgba(15, 23, 42, 0.82));
  outline: none;
}

.history-timeline-item.tone-ok {
  box-shadow: inset 3px 0 0 rgba(16, 185, 129, 0.9);
}

.history-timeline-item.tone-warning {
  box-shadow: inset 3px 0 0 rgba(245, 158, 11, 0.9);
}

.history-timeline-item.tone-ko {
  box-shadow: inset 3px 0 0 rgba(239, 68, 68, 0.9);
}

.history-timeline-item.tone-neutral {
  box-shadow: inset 3px 0 0 rgba(100, 116, 139, 0.9);
}

.history-timeline-marker {
  position: relative;
  display: flex;
  justify-content: center;
}

.history-timeline-marker::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -20px;
  bottom: -20px;
  width: 2px;
  background: rgba(148, 163, 184, 0.18);
  transform: translateX(-50%);
}

.history-timeline-item:first-child .history-timeline-marker::before {
  top: 6px;
}

.history-timeline-item:last-child .history-timeline-marker::before {
  bottom: 6px;
}

.history-timeline-dot {
  position: relative;
  z-index: 1;
  width: 12px;
  height: 12px;
  margin-top: 5px;
  border-radius: 999px;
  border: 2px solid rgba(11, 16, 32, 0.9);
}

.history-timeline-dot.tone-ok { background: var(--ok); }
.history-timeline-dot.tone-warning { background: var(--warning); }
.history-timeline-dot.tone-ko { background: var(--ko); }
.history-timeline-dot.tone-neutral { background: var(--neutral); }

.history-timeline-time {
  display: grid;
  align-content: start;
  gap: 4px;
  min-width: 0;
}

.history-timeline-clock {
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.history-timeline-age {
  color: var(--text-soft);
  font-size: 0.8rem;
}

.history-timeline-main {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.history-timeline-head,
.history-timeline-transition-row,
.history-timeline-footer {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.history-timeline-site-block {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.history-timeline-site {
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-timeline-host {
  color: var(--text-soft);
  font-size: 0.82rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-timeline-badges,
.history-timeline-details,
.history-timeline-signals {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.history-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.74rem;
  font-weight: 800;
  white-space: nowrap;
}

.history-badge.tone-ok {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
}

.history-badge.tone-warning {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
}

.history-badge.tone-ko {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
}

.history-badge.tone-neutral,
.history-badge.discord {
  background: var(--bg-soft);
  color: var(--text-soft);
}

body[data-theme="light"] .history-badge.tone-ok { color: #047857; }
body[data-theme="light"] .history-badge.tone-warning { color: #b45309; }
body[data-theme="light"] .history-badge.tone-ko { color: #b91c1c; }

.history-timeline-transition {
  font-size: 1.08rem;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.history-timeline-date {
  color: var(--text-soft);
  font-size: 0.82rem;
  text-align: right;
  white-space: nowrap;
}

.history-timeline-summary {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.9rem;
  line-height: 1.5;
}

.history-detail-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  font-size: 0.74rem;
  color: var(--text-soft);
}

.history-timeline-footer {
  align-items: center;
}

.history-timeline-tail {
  color: var(--text-soft);
  font-size: 0.78rem;
  text-align: right;
  white-space: nowrap;
}

.trend-chart-wrap {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(96, 165, 250, 0.05), transparent 45%),
    var(--bg-soft);
  padding: 14px 16px;
  min-height: 0;
}

.trend-empty {
  min-height: 180px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--text-soft);
}

.trend-chart-svg {
  display: block;
  width: 100%;
  height: 220px;
}

.trend-chart-svg text {
  fill: var(--text-soft);
  font-size: 12px;
  font-family: inherit;
}

.trend-chart-svg[data-metric="reliability"] .trend-line {
  stroke: #10b981;
}

.trend-chart-svg[data-metric="reliability"] .trend-point {
  fill: #10b981;
}

.trend-chart-svg[data-metric="reliability"] .trend-point-group:hover .trend-point,
.trend-chart-svg[data-metric="reliability"] .trend-point-group:focus-visible .trend-point {
  filter: drop-shadow(0 0 8px rgba(16, 185, 129, 0.34));
}

.trend-grid-line {
  stroke: rgba(148, 163, 184, 0.16);
  stroke-width: 1;
}

.trend-axis-line {
  stroke: rgba(148, 163, 184, 0.22);
  stroke-width: 1.2;
}

.trend-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.trend-point {
  fill: var(--accent);
  stroke: rgba(255, 255, 255, 0.92);
  stroke-width: 2;
  transition: transform 120ms ease, stroke-width 120ms ease, filter 120ms ease;
  transform-origin: center;
  transform-box: fill-box;
}

.trend-point.is-latest {
  stroke-width: 2.4;
}

.trend-point-group {
  outline: none;
}

.trend-point-group:hover .trend-point,
.trend-point-group:focus-visible .trend-point {
  stroke-width: 3;
  filter: drop-shadow(0 0 8px rgba(96, 165, 250, 0.38));
  transform: scale(1.08);
}

.trend-point-hit-area {
  fill: transparent;
  cursor: pointer;
}

.trend-point-missing {
  fill: var(--neutral);
  opacity: 0.5;
}

.trend-highlight {
  fill: rgba(96, 165, 250, 0.12);
  stroke: rgba(96, 165, 250, 0.28);
  stroke-width: 1;
}

.site-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--card-min-width), 1fr));
  gap: var(--grid-gap);
  align-items: stretch;
}

body[data-density="compact"] .site-grid {
  grid-template-columns: repeat(auto-fill, var(--compact-card-size));
  justify-content: start;
  align-items: start;
}

.site-grid.site-grid-grouped {
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: stretch;
}

body[data-density="compact"] .site-grid.site-grid-grouped {
  grid-template-columns: none;
  justify-content: stretch;
  align-items: stretch;
}

.version-group {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.version-group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.version-group-title {
  margin: 0;
  font-size: clamp(1rem, 1.2vw + 0.6rem, 1.34rem);
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.03em;
  word-break: break-word;
}

.version-group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, var(--compact-card-size));
  gap: var(--grid-gap);
  justify-content: start;
  align-items: start;
}

.site-card {
  min-height: var(--card-height);
  display: grid;
  grid-template-rows: auto 1fr auto auto auto;
  gap: 8px;
  text-decoration: none;
  color: inherit;
  background: linear-gradient(180deg, var(--bg-elevated), rgba(15, 23, 42, 0.72));
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 12px 12px 10px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
  position: relative;
  overflow: hidden;
}

.site-card::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 3px;
  opacity: 0.9;
}

.site-card.status-ok::after { background: var(--ok); }
.site-card.status-warning::after { background: var(--warning); }
.site-card.status-ko::after { background: var(--ko); }
.site-card.status-unknown::after { background: var(--neutral); }

.site-card:hover,
.site-card:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(96, 165, 250, 0.36);
  outline: none;
}

.site-card.has-resource-alert {
  border-color: rgba(239, 68, 68, 0.42);
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.16), var(--shadow);
}

.site-card.has-resource-warning:not(.has-resource-alert) {
  border-color: rgba(245, 158, 11, 0.34);
}

.site-card-compact {
  width: var(--compact-card-size);
  min-width: var(--compact-card-size);
  height: var(--compact-card-size);
  min-height: var(--compact-card-size);
  padding: 0;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 6px 16px rgba(15, 23, 42, 0.14);
  backdrop-filter: none;
}

.compact-alert-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.8);
}

.site-card-compact::after {
  display: none;
}

.site-card-compact:hover,
.site-card-compact:focus-visible {
  transform: scale(1.08);
  border-color: rgba(255, 255, 255, 0.92);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.18), 0 10px 24px rgba(15, 23, 42, 0.18);
}

.site-card-compact.status-ok {
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.96), rgba(5, 150, 105, 0.92));
  border-color: rgba(5, 150, 105, 0.9);
}

.site-card-compact.status-warning {
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.96), rgba(217, 119, 6, 0.92));
  border-color: rgba(217, 119, 6, 0.92);
}

.site-card-compact.status-ko {
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.96), rgba(220, 38, 38, 0.92));
  border-color: rgba(220, 38, 38, 0.92);
}

.site-card-compact.status-unknown {
  background: linear-gradient(180deg, rgba(148, 163, 184, 0.94), rgba(100, 116, 139, 0.9));
  border-color: rgba(100, 116, 139, 0.92);
}

.card-header,
.card-footer,
.card-signals {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-title-stack {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.site-name {
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 0.98rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-version {
  display: block;
  font-size: 0.74rem;
  color: var(--text-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
}

.status-badge.ok {
  background: rgba(16, 185, 129, 0.16);
  color: #34d399;
}

.status-badge.warning {
  background: rgba(245, 158, 11, 0.16);
  color: #fbbf24;
}

.status-badge.ko {
  background: rgba(239, 68, 68, 0.16);
  color: #f87171;
}

.status-badge.unknown {
  background: rgba(100, 116, 139, 0.16);
  color: #cbd5e1;
}

body[data-theme="light"] .status-badge.ok { color: #047857; }
body[data-theme="light"] .status-badge.warning { color: #b45309; }
body[data-theme="light"] .status-badge.ko { color: #b91c1c; }
body[data-theme="light"] .status-badge.unknown { color: #475569; }

.card-summary {
  color: var(--text-soft);
  font-size: 0.78rem;
  line-height: 1.35;
  overflow: hidden;
}

.card-errors {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.card-error {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-soft);
  padding: 8px 10px;
  min-width: 0;
}

.card-error span {
  display: block;
  color: var(--text-soft);
  font-size: 0.7rem;
}

.card-error strong {
  display: block;
  margin-top: 4px;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-error.unavailable strong {
  font-size: 0.92rem;
}

.card-resource-banner {
  border: 1px solid rgba(239, 68, 68, 0.28);
  border-radius: 12px;
  background: rgba(239, 68, 68, 0.12);
  padding: 8px 10px;
  display: grid;
  gap: 4px;
}

.card-resource-banner span {
  color: var(--text-soft);
  font-size: 0.7rem;
}

.card-resource-banner strong {
  font-size: 0.88rem;
}

.card-age,
.card-ms {
  font-size: 0.76rem;
  color: var(--text-soft);
}

.compact-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: #fff;
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 2px rgba(15, 23, 42, 0.35);
  user-select: none;
}

.compact-count.digits-1 {
  font-size: 0.88rem;
}

.compact-count.digits-2 {
  font-size: 0.82rem;
}

.compact-count.digits-3 {
  font-size: 0.68rem;
}

.compact-count.digits-4 {
  font-size: 0.54rem;
  letter-spacing: -0.03em;
}

.compact-count.unavailable {
  font-size: 0.88rem;
  opacity: 0.95;
}

.card-signals {
  flex-wrap: wrap;
  justify-content: flex-start;
}

.signal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  padding: 4px 6px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
}

.signal.ok { border-color: rgba(16, 185, 129, 0.22); color: #34d399; }
.signal.warning { border-color: rgba(245, 158, 11, 0.22); color: #fbbf24; }
.signal.ko { border-color: rgba(239, 68, 68, 0.22); color: #f87171; }
.signal.unknown { border-color: rgba(100, 116, 139, 0.22); color: #cbd5e1; }

body[data-theme="light"] .signal.ok { color: #047857; }
body[data-theme="light"] .signal.warning { color: #b45309; }
body[data-theme="light"] .signal.ko { color: #b91c1c; }
body[data-theme="light"] .signal.unknown { color: #475569; }

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  border: 1px solid var(--border);
}

.chip.ok { background: rgba(16, 185, 129, 0.12); }
.chip.warning { background: rgba(245, 158, 11, 0.12); }
.chip.ko { background: rgba(239, 68, 68, 0.13); }
.chip.neutral { background: var(--bg-soft); }

.tooltip {
  position: fixed;
  z-index: 100;
  width: min(390px, calc(100vw - 16px));
  padding: 14px;
  border-radius: 18px;
  background: rgba(8, 15, 30, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.14);
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.35);
  color: #e5edf7;
  backdrop-filter: blur(18px);
  pointer-events: none;
  transform: translate3d(0, 0, 0);
}

body[data-theme="light"] .tooltip {
  background: rgba(255, 255, 255, 0.97);
  color: #122033;
  border-color: rgba(15, 23, 42, 0.08);
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.12);
}

.tooltip-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.tooltip-title {
  font-size: 1rem;
  font-weight: 800;
}

.tooltip-host {
  font-size: 0.82rem;
  color: var(--text-soft);
  margin-top: 3px;
}

.tooltip-section {
  margin-top: 12px;
}

.tooltip-section-tight {
  margin-top: 8px;
}

.tooltip-summary {
  font-size: 0.88rem;
  line-height: 1.45;
}

.tooltip-meta {
  font-size: 0.78rem;
  color: var(--text-soft);
  margin-top: 6px;
}

.tooltip-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.tooltip-grid-trend {
  margin-top: 10px;
}

.tooltip-kpi {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-soft);
  padding: 10px;
}

.tooltip-kpi.tone-ok {
  border-color: rgba(16, 185, 129, 0.24);
}

.tooltip-kpi.tone-warning {
  border-color: rgba(245, 158, 11, 0.28);
}

.tooltip-kpi.tone-ko {
  border-color: rgba(239, 68, 68, 0.32);
}

.tooltip-head-tight {
  align-items: center;
}

.tooltip-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(96, 165, 250, 0.14);
  border: 1px solid rgba(96, 165, 250, 0.24);
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.tooltip-kpi span {
  display: block;
  color: var(--text-soft);
  font-size: 0.75rem;
}

.tooltip-kpi strong {
  display: block;
  margin-top: 4px;
}

.tooltip-kpi small {
  display: block;
  margin-top: 2px;
  color: var(--text-soft);
}

.tooltip-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 4px;
  font-size: 0.82rem;
}

.empty-state {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 28px;
  text-align: center;
  box-shadow: var(--shadow);
}

.empty-state h3 {
  margin: 0 0 8px;
}

.empty-state p {
  margin: 0;
  color: var(--text-soft);
}

@media (max-width: 980px) {
  .topbar,
  .toolbar,
  .trend-panel-head,
  .history-hero {
    grid-template-columns: 1fr;
  }

  .header-actions,
  .action-row {
    justify-items: stretch;
    justify-content: flex-start;
  }

  .trend-panel-side,
  .trend-metric-bar,
  .trend-view-bar {
    justify-content: flex-start;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .external-service-card {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .external-service-counters {
    grid-column: 1 / -1;
  }

  .trend-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .history-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .history-timeline-item {
    grid-template-columns: 28px 74px minmax(0, 1fr);
  }
}

@media (max-width: 600px) {
  .app-shell {
    width: calc(100vw - 14px);
    margin: 7px auto;
  }

  .topbar {
    padding: 16px;
    border-radius: 18px;
  }

  .operations-panel {
    padding: 16px;
    border-radius: 18px;
  }

  .operations-panel-head,
  .external-service-title-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .operations-meta {
    text-align: left;
  }

  .external-service-summary-card {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .external-service-summary-state {
    grid-column: 1 / -1;
    justify-items: start;
    text-align: left;
  }

  .external-service-card {
    grid-template-columns: 1fr;
    padding: 15px;
  }

  .external-service-status-mark {
    width: 38px;
    height: 38px;
  }

  .external-service-counters {
    grid-column: auto;
  }

  .server-grid {
    grid-template-columns: 1fr;
  }

  body[data-density="comfortable"] .site-grid {
    grid-template-columns: 1fr;
  }

  .trend-summary {
    grid-template-columns: 1fr;
  }

  .volume-control {
    min-width: 0;
    width: 100%;
  }

  .resource-alert-head {
    align-items: flex-start;
  }

  .resource-alert-grid {
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  }

  .resource-alert-tile {
    min-height: 132px;
    padding: 9px;
  }

  .freshness-warning {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 12px;
    min-height: 0;
    padding: 16px;
  }

  .freshness-warning-icon {
    width: 48px;
    height: 48px;
    font-size: 2rem;
  }

  .freshness-warning-threshold {
    grid-column: 1 / -1;
    min-width: 0;
    min-height: 44px;
  }

  .history-summary-grid {
    grid-template-columns: 1fr;
  }

  .history-search-meta-row,
  .trend-insight-head,
  .history-timeline-head,
  .history-timeline-transition-row,
  .history-timeline-footer {
    flex-direction: column;
    align-items: start;
  }

  .history-timeline-item {
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 12px;
    padding: 16px 14px;
  }

  .history-timeline-time,
  .history-timeline-main {
    grid-column: 2;
  }

  .history-timeline-date,
  .history-timeline-tail {
    text-align: left;
    white-space: normal;
  }

  .trend-chart-svg {
    height: 180px;
  }

  .tooltip {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .server-metric-track span {
    transition: none;
  }
}


body[data-automation="true"] {
  margin: 0;
  min-height: 100vh;
}

body[data-automation="true"][data-automation-status="ok"] {
  background: #07120b;
}

body[data-automation="true"][data-automation-status="warn"] {
  background: #1a1204;
}

body[data-automation="true"][data-automation-status="ko"] {
  background: #17070a;
}

.automation-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.automation-output {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: clamp(1.1rem, 2.6vw, 1.8rem);
  line-height: 1.7;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-align: center;
  white-space: pre-wrap;
}

body[data-automation="true"][data-automation-status="ok"] .automation-output {
  color: #86efac;
}

body[data-automation="true"][data-automation-status="warn"] .automation-output {
  color: #fcd34d;
}

body[data-automation="true"][data-automation-status="ko"] .automation-output {
  color: #fda4af;
}
