/* === PM2 list readable table === */

.pm2-pretty-card {
  background: #1f1f22 !important;
  border: 1px solid #34343a !important;
  border-radius: 24px !important;
  overflow: hidden !important;
}

.pm2-pretty-wrap {
  margin-top: 16px;
  border: 1px solid #34343a;
  border-radius: 14px;
  overflow: auto;
  background: #18181b;
  max-height: 520px;
}

.pm2-pretty-table {
  width: 100%;
  min-width: 880px;
  border-collapse: collapse;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, sans-serif;
  color: #f5f5f7;
}

.pm2-pretty-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #2a2a2f;
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid #3a3a42;
  white-space: nowrap;
}

.pm2-pretty-table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  color: #d4d4d8;
  font-size: 13px;
  vertical-align: middle;
  white-space: nowrap;
}

.pm2-pretty-table tbody tr:hover td {
  background: #252526;
}

.pm2-name {
  color: #ffffff !important;
  font-weight: 800;
}

.pm2-muted {
  color: #a1a1a6 !important;
  font-size: 12px;
}

.pm2-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 70px;
  height: 26px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  text-transform: capitalize;
}

.pm2-online {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}

.pm2-stopped {
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #d1d5db;
}

.pm2-errored {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.pm2-unknown {
  background: #fff3cd;
  color: #92400e;
  border: 1px solid #fbbf24;
}

.pm2-mono {
  font-family: "SFMono-Regular", Consolas, Menlo, monospace;
  color: #f5f5f7 !important;
  font-size: 12px;
}

.pm2-empty {
  padding: 16px;
  color: #a1a1a6;
  font-size: 13px;
}

.pm2-original-toggle {
  margin-top: 12px;
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid #34343a;
  background: #2a2a2f;
  color: #f5f5f7;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.pm2-original-raw {
  display: none;
  margin-top: 12px !important;
  max-height: 360px !important;
}

/* === PM2 WIDE NO-SCROLL FIX === */

/* Make the PM2 card span its row on Overview.
   It used to set `width: min(920px, calc(100vw - 360px))`, which is a guess at
   the chrome (sidebar 304 + gutters) rather than a measurement, and it ignored
   the fact that the card is a GRID ITEM. .grid lays out
   repeat(auto-fit, minmax(340px,1fr)), so at 1440 the card got a ~330px track
   and then forced itself to 920 -- it ran 413px past the content edge and gave
   the whole document a horizontal scrollbar. Let it own the row instead and
   take its width from the track, which is what every other card here does.
   min-width:0 is the part that actually stops the blowout: a grid item's
   default min-width is auto, so the table inside can push the track wider. */
.pm2-pretty-card {
  grid-column: 1 / -1 !important;
  width: auto !important;
  max-width: 100% !important;
  min-width: 0 !important;
}

/* No horizontal slider */
.pm2-pretty-wrap {
  overflow-x: hidden !important;
  overflow-y: auto !important;
  max-height: 520px !important;
}

/* Table fits card width */
.pm2-pretty-table {
  width: 100% !important;
  min-width: 0 !important;
  table-layout: fixed !important;
}

/* Better column sizing */
.pm2-pretty-table th:nth-child(1),
.pm2-pretty-table td:nth-child(1) {
  width: 30% !important;
}

.pm2-pretty-table th:nth-child(2),
.pm2-pretty-table td:nth-child(2) {
  width: 14% !important;
}

.pm2-pretty-table th:nth-child(3),
.pm2-pretty-table td:nth-child(3) {
  width: 12% !important;
}

.pm2-pretty-table th:nth-child(4),
.pm2-pretty-table td:nth-child(4) {
  width: 12% !important;
}

.pm2-pretty-table th:nth-child(5),
.pm2-pretty-table td:nth-child(5) {
  width: 9% !important;
}

.pm2-pretty-table th:nth-child(6),
.pm2-pretty-table td:nth-child(6) {
  width: 13% !important;
}

.pm2-pretty-table th:nth-child(7),
.pm2-pretty-table td:nth-child(7) {
  width: 10% !important;
}

/* Hide User and Mode columns to avoid sliding */
.pm2-pretty-table th:nth-child(8),
.pm2-pretty-table td:nth-child(8),
.pm2-pretty-table th:nth-child(9),
.pm2-pretty-table td:nth-child(9) {
  display: none !important;
}

/* Compact readable cells */
.pm2-pretty-table thead th {
  padding: 12px 12px !important;
  font-size: 12px !important;
}

.pm2-pretty-table tbody td {
  padding: 12px 12px !important;
  font-size: 12px !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.pm2-name {
  font-size: 13px !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.pm2-muted {
  font-size: 11px !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

/* PM2 status pill smaller */
.pm2-pill {
  min-width: 64px !important;
  height: 24px !important;
  padding: 0 9px !important;
  font-size: 11px !important;
}

/* Mobile/tablet fallback */
@media (max-width: 1100px) {
  .pm2-pretty-card {
    width: 100% !important;
    max-width: 100% !important;
  }

  .pm2-pretty-table th:nth-child(7),
  .pm2-pretty-table td:nth-child(7) {
    display: none !important;
  }
}

/* === END PM2 WIDE NO-SCROLL FIX === */

/* === Light appearance ===============================================
   .pm2-name and .pm2-muted above are !important with no appearance
   qualifier, and this widget's wrapper goes light with the rest of the
   page - so every service name in the PM2 list rendered white-on-white
   (1.00:1) on /overview, and the "default · id N" line under it sat at
   2.43:1. The surrounding table and its hover state are re-stated too,
   since they were built for the dark surface only. */
html[data-appearance="light"] .pm2-name {
  color: #1d1d1f !important;
}

html[data-appearance="light"] .pm2-muted {
  color: #5f5f68 !important;
}

html[data-appearance="light"] .pm2-pretty-wrap,
html[data-appearance="light"] .pm2-pretty-table {
  background: #ffffff !important;
  color: #1d1d1f !important;
}

html[data-appearance="light"] .pm2-pretty-table tbody tr:hover td {
  background: #f7f7f9 !important;
}
