:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --panel-strong: #ffffff;
  --panel-soft: #f8fafc;
  --text: #17202a;
  --muted: #5d6977;
  --faint: #8490a0;
  --line: #d9e0e8;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
  --soft-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  --ok: #16803c;
  --warn: #b7791f;
  --bad: #c92a2a;
  --unknown: #718096;
  --focus: #2563a7;
}

* { box-sizing: border-box; }

html { min-width: 320px; }

body {
  min-height: 100vh;
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

button, input {
  font: inherit;
}

button {
  color: inherit;
}

.operations-shell {
  position: relative;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  width: 100%;
  min-height: 100vh;
  margin: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: var(--bg);
  box-shadow: none;
}

.sidebar {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 18px 14px;
  border-right: 1px solid var(--line);
  background: #eef2f6;
}

.nav-list {
  display: grid;
  gap: 6px;
  margin-top: 0;
}

.nav-item,
.soft-button,
.environment-switch,
.icon-button,
.filter-chip,
.attention-link {
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 10px;
  border-radius: 6px;
  color: #34404e;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  border-color: var(--line);
  background: var(--panel);
  box-shadow: var(--soft-shadow);
}

.nav-icon,
.kind-icon,
.fleet-mark,
.field-prefix {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  color: #2f3a46;
  background: #f8fafc;
}

.nav-icon {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  font-size: 0.74rem;
  font-weight: 700;
}

.fleet-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin-top: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--soft-shadow);
}

.mode-badge,
.button-kicker,
.trend-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #45515f;
  background: var(--panel-soft);
  font-size: 0.76rem;
  font-weight: 650;
  line-height: 1;
}

.mode-badge {
  min-height: 24px;
  padding: 0 9px;
}

.button-kicker {
  min-height: 22px;
  padding: 0 8px;
}

.trend-label {
  min-height: 22px;
  padding: 0 7px;
  color: var(--muted);
}

.fleet-mark {
  width: 36px;
  height: 36px;
  border-radius: 7px;
  font-weight: 800;
}

.fleet-mark.small {
  width: 28px;
  height: 28px;
  border-radius: 8px;
}

h1, h2, h3, p { margin: 0; }

.fleet-card h1,
.mobile-title strong,
.environment-switch {
  font-size: 1rem;
  font-weight: 700;
}

.fleet-card p,
.sidebar-status p,
.host-card p,
.service-main p,
.attention-card p,
.table-summary,
.section-title span,
.metric-tile p,
.attention-header p {
  color: var(--muted);
}

.icon-button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: var(--panel-soft);
}

.sidebar-status {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 48px;
  gap: 10px;
  align-items: center;
  margin-top: 16px;
  padding: 10px 0;
  min-height: 54px;
}

.pulse-line {
  height: 24px;
  background:
    linear-gradient(90deg, transparent 0 18%, var(--ok) 18% 23%, transparent 23% 36%, var(--ok) 36% 40%, transparent 40% 54%, var(--ok) 54% 61%, transparent 61%);
  opacity: 0.85;
}

.main-surface {
  min-width: 0;
  padding: 0 24px 24px;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr minmax(260px, 300px) auto;
  gap: 12px;
  align-items: center;
  min-height: 64px;
  border-bottom: 1px solid var(--line);
}

.mobile-title { display: none; }

.environment-switch {
  justify-self: center;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 6px;
}

.search-box {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--faint);
  background: var(--panel);
}

.field-prefix {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  font-size: 0.74rem;
  font-weight: 800;
}

.search-box input {
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.topbar-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.soft-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 0 12px;
  border-color: var(--line);
  border-radius: 7px;
  background: var(--panel);
  box-shadow: var(--soft-shadow);
  white-space: nowrap;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
}

.workspace,
.side-column {
  min-width: 0;
}

.side-column {
  display: grid;
  align-content: start;
  gap: 16px;
  padding-top: 16px;
}

.filter-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 12px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 12px;
  border-color: var(--line);
  border-radius: 7px;
  background: var(--panel);
  color: #303946;
  box-shadow: none;
  white-space: nowrap;
}

.filter-chip.active {
  border-color: #9fb4ca;
  background: #e8f0f8;
}

.filter-chip strong,
.attention-header h2 span {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(21, 28, 38, 0.07);
  font-size: 0.82rem;
}

.filter-panel {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin: -6px 0 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
}

.filter-panel[hidden] {
  display: none;
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.metric-tile,
.table-panel,
.host-panel,
.attention-dock {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--soft-shadow);
}

.metric-tile {
  min-height: 70px;
  padding: 12px;
  border-radius: 8px;
}

.metric-tile span {
  display: block;
  font-size: 1.28rem;
  font-weight: 800;
  line-height: 1.1;
}

.metric-tile p,
.table-summary,
.host-card p,
.service-main p,
.attention-card p {
  font-size: 0.82rem;
}

.table-panel,
.host-panel {
  border-radius: 8px;
  overflow: hidden;
}

.table-head,
.service-row {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 132px 118px 142px;
  gap: 12px;
  align-items: center;
}

.table-head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
  color: #444d59;
  font-size: 0.84rem;
}

.service-table {
  display: grid;
  gap: 0;
  padding: 0;
}

.service-row {
  min-height: 64px;
  padding: 10px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: var(--panel);
}

.service-row:hover {
  background: #f8fafc;
}

.service-main,
.attention-card-main,
.host-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.service-main > div,
.attention-card-main > div {
  min-width: 0;
}

.service-main h3,
.attention-card h3 {
  overflow: hidden;
  font-size: 0.96rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.service-main p,
.attention-card p {
  overflow-wrap: anywhere;
  line-height: 1.38;
}

.kind-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 800;
}

.status-dot {
  display: inline-block;
  flex: 0 0 auto;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--unknown);
  box-shadow: 0 0 0 3px rgba(124, 135, 148, 0.12);
}

.status-dot.healthy,
.healthy .status-dot { background: var(--ok); box-shadow: 0 0 0 3px rgba(66, 163, 68, 0.13); }
.status-dot.warning,
.warning .status-dot { background: var(--warn); box-shadow: 0 0 0 3px rgba(242, 170, 29, 0.16); }
.status-dot.failed,
.failed .status-dot { background: var(--bad); box-shadow: 0 0 0 3px rgba(220, 51, 63, 0.14); }
.status-dot.unknown,
.unknown .status-dot { background: var(--unknown); }

.host-pill {
  justify-self: start;
  max-width: 132px;
  min-height: 26px;
  padding: 4px 9px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #4e5866;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: var(--panel-soft);
}

.service-row time,
.attention-card time {
  color: #4e5866;
  font-size: 0.84rem;
}

.health-cell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--faint);
  min-width: 0;
}

.sparkline {
  width: 86px;
  height: 30px;
  flex: 0 0 auto;
}

.sparkline path {
  fill: none;
  stroke: var(--unknown);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sparkline.trend-unavailable path {
  stroke-dasharray: 4 5;
  opacity: 0.55;
}

.sparkline.healthy path { stroke: var(--ok); }
.sparkline.warning path { stroke: var(--warn); }
.sparkline.failed path { stroke: var(--bad); }

.table-summary {
  padding: 10px 14px;
  border-top: 0;
}

.section-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
}

.section-title h2,
.attention-header h2 {
  font-size: 0.98rem;
}

.host-list {
  display: grid;
  gap: 0;
  padding: 0;
}

.host-card {
  padding: 12px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: var(--panel);
}

.host-card-top {
  justify-content: space-between;
}

.host-card-top strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.host-runtime {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.78rem;
}

.host-card p {
  margin-top: 6px;
  line-height: 1.4;
}

.attention-dock {
  width: 100%;
  max-height: none;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  border-radius: 8px;
  overflow: hidden;
}

.attention-dock.collapsed {
  max-height: none;
}

.attention-dock.collapsed .attention-list,
.attention-dock.collapsed .attention-link {
  display: none;
}

.attention-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
}

.attention-list {
  display: grid;
  gap: 0;
  overflow: auto;
  padding: 0;
}

.attention-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: var(--panel);
}

.attention-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.attention-meta .sparkline {
  width: 72px;
  height: 24px;
}

.attention-link {
  min-height: 38px;
  margin: 10px 12px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
}

.empty {
  padding: 18px;
  color: var(--muted);
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

@media (max-width: 1180px) {
  .operations-shell {
    grid-template-columns: 86px minmax(0, 1fr);
  }

  .sidebar {
    padding-inline: 12px;
  }

  .nav-item,
  .fleet-card,
  .sidebar-status {
    justify-content: center;
  }

  .nav-item span:last-child,
  .fleet-card div:not(.fleet-mark),
  .fleet-card .mode-badge,
  .sidebar-status div,
  .pulse-line {
    display: none;
  }

  .fleet-card {
    grid-template-columns: 1fr;
    padding: 10px;
  }

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

  .side-column {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding-top: 0;
  }

  .attention-dock {
    align-self: start;
  }
}

@media (max-width: 860px) {
  .operations-shell {
    width: 100%;
    min-height: auto;
    grid-template-columns: 1fr;
    margin: 0;
    border-radius: 0;
  }

  .sidebar {
    display: none;
  }

  .main-surface {
    padding: 0 14px 18px;
  }

  .topbar {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 14px 0;
  }

  .mobile-title {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .environment-switch {
    display: none;
  }

  .topbar-actions {
    justify-content: stretch;
    flex-wrap: wrap;
  }

  .soft-button {
    flex: 1;
    justify-content: center;
  }

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

  .filter-chip {
    justify-content: center;
    padding: 0 12px;
  }

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

  .table-head {
    display: none;
  }

  .service-row {
    grid-template-columns: 1fr;
    gap: 10px;
    align-items: start;
  }

  .host-pill {
    max-width: 100%;
  }

  .health-cell {
    justify-content: flex-start;
  }

  .side-column {
    grid-template-columns: 1fr;
    order: -1;
    margin-top: 12px;
  }

  .attention-dock {
    width: auto;
    max-height: none;
    margin: 0;
  }

  .attention-dock.collapsed {
    max-height: none;
  }

  .attention-dock.collapsed .attention-list,
  .attention-dock.collapsed .attention-link {
    display: grid;
  }
}

@media (max-width: 460px) {
  .filter-strip,
  .metric-row {
    grid-template-columns: 1fr;
  }

  .attention-card {
    grid-template-columns: 1fr;
  }

  .attention-meta {
    align-items: flex-start;
    flex-direction: column;
  }
}
