/* === Server Health — Theme === */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --ci-cyan: #01F7F6;
  --ci-purple: #7650E0;
  --ci-magenta: #DB1FF8;
  --accent-cyan: #00ccff;
  --fg: #b3b3b3;
  --fg-muted: #666666;
  --fg-dim: #444444;
  --link: #01f7f6;
  --hover: #DB1FF8;
  --card-bg: rgba(22, 22, 22, 0.85);
  --card-border: rgba(0, 204, 255, 0.2);
  --status-green: #2ecc71;
  --status-yellow: #f1c40f;
  --status-red: #e74c3c;
  --status-orange: #e67e22;
  --status-blue: #3498db;
  --status-dark-red: #c0392b;
  --status-grey: #666666;
}

html {
  height: 100%;
  background: #000;
}

body {
  height: 100%;
  min-height: 100vh;
  /* Body must stay transparent so the #mesh-canvas (position: fixed,
     z-index: -1, child of body) paints above html's black background.
     Putting `background: #000` on body hides the canvas entirely. */
  background: transparent;
  color: var(--fg);
  font-family: 'Montserrat', 'Poppins', sans-serif;
  font-size: 14px;
  line-height: 1.4;
  display: flex;
  flex-direction: column;
}

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--hover); }

#mesh-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: -1;
  pointer-events: none;
}

.gradient-text {
  background: linear-gradient(90deg, #01F7F6, #7650E0, #DB1FF8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent;
  word-break: break-all;
}

/* Nav */
.topnav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(22, 22, 22, 0.9);
  border-bottom: 1px solid rgba(0, 204, 255, 0.15);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.75rem 1.5rem;
}
.nav-logo img { height: 32px; display: block; }
.nav-links { display: flex; gap: 0.25rem; flex: 1; }
.nav-links a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--fg);
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  transition: all 0.15s ease;
}
.nav-links a:hover { color: #01f7f6; background: rgba(1, 247, 246, 0.08); }
.nav-links a.active { color: #00ccff; background: rgba(0, 204, 255, 0.12); }
.nav-user { display: flex; align-items: center; gap: 0.75rem; }
.user-name { font-size: 0.85rem; color: var(--fg); }
.logout-btn {
  border: 1px solid rgba(0, 204, 255, 0.3);
  color: var(--fg);
  padding: 0.35rem 0.8rem;
  border-radius: 6px;
  font-size: 0.8rem;
}
.logout-btn:hover { border-color: #DB1FF8; color: #DB1FF8; }

/* Main */
.app {
  flex: 1;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem;
}
.footer {
  padding: 0.5rem 1.5rem;
  font-size: 0.7rem;
  color: #444;
  text-align: right;
  border-top: 1px solid rgba(255,255,255,0.04);
}

/* Section heading */
.section-title {
  font-size: 0.9rem;
  color: #00ccff;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 1.5rem 0 0.6rem;
  font-weight: 600;
}
.page-header { margin-bottom: 1rem; }
.page-header h1 { font-size: 1.4rem; color: #00ccff; font-weight: 700; }
.page-sub { color: var(--fg-muted); font-size: 0.8rem; }

/* Key numbers */
.key-numbers {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
}
.key-number {
  background: rgba(22, 22, 22, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  padding: 1.2rem 1rem;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}
.key-number .label {
  font-family: 'Courier New', monospace;
  font-size: 0.75rem;
  font-weight: 500;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 0.6rem;
}
.key-number .value {
  font-family: 'Montserrat', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
  word-break: break-all;
}

/* Status boxes */
.status-boxes {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
}
.status-box {
  background: rgba(22, 22, 22, 0.85);
  border: 1px solid rgba(0, 204, 255, 0.2);
  border-bottom: 4px solid #2ecc71;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  overflow: hidden;
}
.status-box .box-title {
  font-family: 'Courier New', monospace;
  font-size: 14px;
  font-weight: 600;
  color: #00ccff;
  margin-bottom: 0.4rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.status-box .box-body {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.status-box .status-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}
.status-box .box-stats {
  font-family: 'Montserrat', sans-serif;
  font-size: 11px;
  color: #999;
  line-height: 1.4;
}
.status-box .stat-line { display: block; }
.status-box .stat-value { color: #b3b3b3; font-weight: 500; }

/* Charts row */
.charts-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.chart-container {
  background: rgba(22, 22, 22, 0.85);
  border: 1px solid rgba(0, 204, 255, 0.2);
  border-radius: 10px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.chart-header {
  font-size: 22px;
  font-weight: 700;
  color: #ffffff;
  text-align: center;
  margin-bottom: 0.5rem;
  width: 100%;
}
.chart-canvas-wrap {
  position: relative;
  width: 100%;
  max-width: 200px;
  aspect-ratio: 1 / 1;
}
.chart-canvas-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.chart-center-label {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Courier New', monospace;
  font-size: 18px;
  font-weight: 700;
  color: #01f7f6;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  pointer-events: none;
}
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  justify-content: center;
  margin-top: 0.75rem;
  width: 100%;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.legend-dot {
  width: 8px; height: 8px; border-radius: 50%;
}
.legend-label {
  font-size: 0.7rem;
  color: #b3b3b3;
}
.legend-value {
  font-size: 0.7rem;
  color: #666;
  margin-left: 0.2rem;
}

.chart-tooltip {
  position: fixed;
  background: rgba(22, 22, 22, 0.95);
  border: 1px solid rgba(0, 204, 255, 0.3);
  border-radius: 6px;
  padding: 0.3rem 0.6rem;
  font-size: 0.75rem;
  color: #b3b3b3;
  pointer-events: none;
  z-index: 500;
  white-space: nowrap;
}
.chart-tooltip .tt-label { color: #00ccff; }

/* Stack cards */
.stacks-wrap { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 10px; }
.stack-card {
  background: rgba(22, 22, 22, 0.85);
  border: 1px solid rgba(0, 204, 255, 0.2);
  border-radius: 10px;
  padding: 0.8rem 1rem;
}
.stack-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}
.stack-header .stack-name {
  font-weight: 600;
  color: #00ccff;
  font-size: 0.95rem;
}
.stack-badges { display: flex; gap: 6px; }
.stack-badge {
  font-size: 0.7rem;
  padding: 0.15rem 0.45rem;
  border-radius: 10px;
  font-weight: 500;
}
.stack-badge.running { background: rgba(46,204,113,0.15); color: #2ecc71; }
.stack-badge.exited { background: rgba(231,76,60,0.15); color: #e74c3c; }
.stack-badge.other { background: rgba(241,196,15,0.15); color: #f1c40f; }
.stack-info {
  font-size: 0.72rem;
  color: #666;
  display: flex;
  gap: 0.8rem;
  margin-bottom: 0.5rem;
}
.stack-info span.val { color: #b3b3b3; }
.stack-containers {
  font-size: 0.75rem;
}
.stack-container-row {
  display: grid;
  grid-template-columns: 1.5fr 1fr 0.8fr 0.6fr;
  gap: 0.4rem;
  padding: 0.2rem 0.4rem;
  border-bottom: 1px solid rgba(255,255,255,0.02);
}
.stack-container-row a { color: #01f7f6; font-weight: 500; }
.stack-container-row a:hover { color: #DB1FF8; }
.state-dot { font-size: 0.5rem; margin-right: 4px; }

/* Containers page */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 1rem;
}
.filter-bar input[type="text"] {
  width: 300px;
  height: 36px;
  padding: 0 12px;
  font-size: 0.8rem;
  font-family: Montserrat, sans-serif;
  border-radius: 6px;
  border: 1px solid rgba(0,204,255,0.2);
  background: rgba(22,22,22,0.85);
  color: #b3b3b3;
  outline: none;
  line-height: 36px;
}
.filter-bar input[type="text"]:focus { border-color: #01f7f6; }
.filter-bar input[type="text"]::placeholder { color: #444; }
.filter-btn {
  height: 36px;
  padding: 0 16px;
  background: transparent;
  border: 1px solid rgba(0,204,255,0.2);
  color: #666;
  border-radius: 6px;
  font-size: 0.8rem;
  font-family: Montserrat, sans-serif;
  cursor: pointer;
  line-height: 36px;
}
.filter-btn:hover { border-color: #01f7f6; color: #01f7f6; }
.filter-btn.active {
  background: rgba(0,204,255,0.15);
  border-color: #00ccff;
  color: #00ccff;
}

.table-scroll { overflow-x: auto; }
.containers-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}
.containers-table th {
  font-size: 0.7rem;
  font-weight: 600;
  color: #00ccff;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(22,22,22,0.95);
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid rgba(0,204,255,0.15);
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
}
.containers-table th:hover { color: #01f7f6; }
.containers-table td {
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: middle;
}
.containers-table tr:hover td { background: rgba(0,204,255,0.04); }
.containers-table td.image { color: #666; }
.containers-table a.cname { color: #01f7f6; font-weight: 600; }
.containers-table a.cname:hover { color: #DB1FF8; }
.progress-cell { min-width: 120px; }
.progress-bar {
  height: 6px;
  background: rgba(255,255,255,0.05);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 2px;
}
.progress-bar > span {
  display: block;
  height: 100%;
  transition: width 0.5s ease;
}

.restart-btn {
  width: 24px;
  height: 24px;
  color: #666;
  background: transparent;
  border: 1px solid rgba(0, 204, 255, 0.2);
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.restart-btn:hover {
  color: #e67e22;
  background: rgba(230, 126, 34, 0.1);
  border-color: rgba(230, 126, 34, 0.3);
}

/* Modal */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-dialog {
  background: rgba(22,22,22,0.95);
  border: 1px solid rgba(0,204,255,0.2);
  border-radius: 8px;
  padding: 1.5rem;
  max-width: 400px;
  width: 90%;
}
.modal-title { font-size: 1rem; font-weight: 600; color: #b3b3b3; margin-bottom: 0.5rem; }
.modal-msg { font-size: 0.85rem; color: #666; margin-bottom: 1rem; }
.modal-msg .cname { color: #01f7f6; font-weight: 600; }
.modal-err { color: #e74c3c; font-size: 0.8rem; margin-bottom: 0.6rem; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
.btn {
  border-radius: 6px;
  font-size: 0.8rem;
  padding: 0.4rem 1rem;
  cursor: pointer;
  font-family: Montserrat, sans-serif;
  border: 1px solid transparent;
}
.btn.primary { background: #e67e22; color: #fff; border-color: #e67e22; }
.btn.primary:hover { background: #d35400; }
.btn.secondary { background: transparent; color: var(--fg-muted); border-color: rgba(0,204,255,0.2); }
.btn.secondary:hover { color: #b3b3b3; }

/* Container Detail */
.detail-header { display: flex; gap: 1rem; align-items: baseline; margin-bottom: 1rem; flex-wrap: wrap; }
.detail-header h2 { font-size: 1.5rem; color: #00ccff; font-weight: 700; }
.detail-header .img { color: #666; font-size: 0.85rem; }
.back-link { font-size: 0.85rem; color: #666; }
.back-link:hover { color: #01f7f6; }

.info-cards {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin-bottom: 1.5rem;
}
.info-card {
  background: rgba(22,22,22,0.85);
  border: 1px solid rgba(0,204,255,0.2);
  border-radius: 8px;
  padding: 0.75rem;
}
.info-card .label { font-size: 0.65rem; color: #00ccff; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 0.3rem; }
.info-card .val { font-size: 0.95rem; font-weight: 600; color: #b3b3b3; }

.kv-section { margin-bottom: 1.5rem; }
.kv-row {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 0.5rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 0.78rem;
}
.kv-row .k { color: #00ccff; font-family: 'Courier New', monospace; font-size: 0.72rem; word-break: break-all; }
.kv-row .v { color: #b3b3b3; word-break: break-all; }
.kv-row .v code { font-family: 'Courier New', monospace; }
.env-sensitive { color: #666; }
.reveal-btn {
  border: 1px solid rgba(0, 204, 255, 0.2);
  background: transparent;
  color: #666;
  padding: 0.05rem 0.4rem;
  font-size: 0.65rem;
  border-radius: 4px;
  cursor: pointer;
  margin-left: 0.5rem;
}
.reveal-btn:hover { color: #01f7f6; }

.log-box {
  position: relative;
  background: rgba(22,22,22,0.95);
  border: 1px solid rgba(0,204,255,0.1);
  border-radius: 8px;
  padding: 1rem;
  max-height: 500px;
  overflow-y: auto;
  font-family: 'Courier New', monospace;
  font-size: 0.75rem;
  line-height: 1.5;
  color: #b3b3b3;
  white-space: pre-wrap;
  word-break: break-all;
}
.log-pill {
  position: sticky;
  bottom: 0;
  float: right;
  background: rgba(0,204,255,0.2);
  border: 1px solid rgba(0,204,255,0.3);
  border-radius: 12px;
  padding: 0.25rem 0.75rem;
  font-size: 0.7rem;
  color: #00ccff;
  cursor: pointer;
  margin-top: 0.5rem;
}

/* Backups */
.backups-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.backup-box {
  background: rgba(22,22,22,0.85);
  border: 1px solid rgba(0,204,255,0.2);
  border-radius: 8px;
  overflow: hidden;
  max-height: 400px;
  overflow-y: auto;
}
.backup-box-header {
  background: rgba(22,22,22,0.95);
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid rgba(0,204,255,0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.backup-volume-name { font-weight: 600; color: #00ccff; font-size: 0.85rem; }
.backup-snapshot-count { font-weight: 400; color: #666; font-size: 0.75rem; margin-left: 0.5rem; }
.backup-time-ago { font-size: 0.75rem; }
.backup-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-left: 0.4rem; }
.backup-snapshot {
  padding: 0.35rem 0.8rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  font-size: 0.8rem;
}
.backup-snapshot .time { color: #b3b3b3; }
.backup-snapshot .id { font-size: 0.75rem; font-family: monospace; color: #666; }

/* Config */
.config-list {
  background: rgba(22,22,22,0.85);
  border: 1px solid rgba(0,204,255,0.2);
  border-radius: 8px;
  padding: 0.75rem;
  min-height: 60px;
  margin-bottom: 1.5rem;
}
.config-list-title {
  font-size: 0.85rem;
  color: #00ccff;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}
.config-item {
  background: rgba(30,30,30,0.9);
  border: 1px solid rgba(0,204,255,0.15);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: grab;
  transition: background 0.2s;
}
.config-item.dragging {
  opacity: 0.5;
  border: 1px dashed rgba(0,204,255,0.3);
}
.config-item.drag-over { background: rgba(0,204,255,0.05); }
.config-item .drag-handle { color: #666; font-size: 1rem; cursor: grab; user-select: none; }
.config-item .type-ic { color: #666; font-size: 16px; }
.config-item .name { flex: 1; font-weight: 600; color: #b3b3b3; font-size: 0.85rem; }
.config-item .detail { font-size: 0.7rem; color: #666; }
.drop-indicator { height: 2px; background: #00ccff; margin: 2px 0; border-radius: 1px; }
.empty-placeholder {
  color: #444;
  font-size: 0.8rem;
  font-style: italic;
  text-align: center;
  padding: 1rem;
}

.monitored-path-row {
  background: rgba(22,22,22,0.85);
  border: 1px solid rgba(0,204,255,0.15);
  border-radius: 6px;
  padding: 0.6rem 0.8rem;
  margin-bottom: 8px;
}
.monitored-path-row .head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.monitored-path-row .type-badge {
  font-family: monospace;
  font-size: 0.65rem;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  background: rgba(0,204,255,0.1);
  color: #00ccff;
  text-transform: uppercase;
}
.monitored-path-row .label {
  font-size: 0.85rem;
  font-weight: 500;
  color: #b3b3b3;
  flex: 1;
}
.monitored-path-row .icon-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: #666;
  font-size: 0.85rem;
}
.monitored-path-row .icon-btn.delete:hover { color: #e74c3c; font-size: 1rem; }
.monitored-path-row .icon-btn.edit:hover { color: #01f7f6; }
.monitored-path-row .path-line {
  font-family: 'Courier New', monospace;
  font-size: 0.75rem;
  color: #555;
  padding-top: 0.3rem;
}
.monitored-path-row .path-line .pfx { color: #666; margin-right: 0.3rem; }
.monitored-path-row input {
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(0,204,255,0.3);
  color: #b3b3b3;
  padding: 0.1rem 0;
  outline: none;
  width: 100%;
  font-family: inherit;
  font-size: inherit;
}

.add-path-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 1rem;
}
.add-path-form input, .add-path-form select {
  height: 36px;
  background: rgba(22,22,22,0.85);
  border: 1px solid rgba(0,204,255,0.2);
  color: #b3b3b3;
  font-family: Montserrat, sans-serif;
  font-size: 0.8rem;
  padding: 0 12px;
  border-radius: 6px;
  outline: none;
}
.add-path-form input:focus, .add-path-form select:focus { border-color: #01f7f6; }
.add-path-form .add-btn {
  height: 36px;
  border: 1px solid #00ccff;
  color: #00ccff;
  background: transparent;
  border-radius: 6px;
  padding: 0 16px;
  font-size: 0.8rem;
  cursor: pointer;
}
.add-path-form .add-btn:hover { background: rgba(0,204,255,0.1); }

/* Login */
.login-body {
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}
.login-card {
  background: rgba(22,22,22,0.85);
  border: 1px solid rgba(0,204,255,0.2);
  border-radius: 12px;
  padding: 2.5rem 3rem;
  max-width: 420px;
  width: 90%;
  text-align: center;
  backdrop-filter: blur(8px);
}
.login-logo { max-height: 48px; margin-bottom: 1.5rem; }
.login-title { font-size: 1.3rem; color: #00ccff; margin-bottom: 0.4rem; font-weight: 700; }
.login-sub { font-size: 0.85rem; color: #666; margin-bottom: 1.5rem; }
.login-btn {
  display: inline-block;
  background: rgba(0,204,255,0.12);
  border: 1px solid #00ccff;
  color: #00ccff;
  padding: 0.6rem 1.5rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
}
.login-btn:hover { background: rgba(0,204,255,0.2); color: #01f7f6; border-color: #01f7f6; }

/* Skeleton / loading */
.skeleton {
  background: rgba(22, 22, 22, 0.6);
  border-radius: 8px;
  animation: pulse 1.5s ease-in-out infinite;
  min-height: 80px;
}
@keyframes pulse {
  0% { opacity: 0.3; }
  50% { opacity: 0.6; }
  100% { opacity: 0.3; }
}

/* Responsive */
@media (max-width: 1024px) {
  .key-numbers { grid-template-columns: repeat(3, 1fr); }
  .status-boxes { grid-template-columns: repeat(3, 1fr); }
  .info-cards { grid-template-columns: repeat(3, 1fr); }
  .charts-row { grid-template-columns: 1fr; }
  .stacks-wrap { grid-template-columns: 1fr; }
  .backups-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .app { padding: 1rem 0.75rem; }
  .topnav { gap: 0.5rem; padding: 0.5rem 1rem; flex-wrap: wrap; }
  .nav-links { order: 3; flex-basis: 100%; overflow-x: auto; }
  .nav-links a { font-size: 0.8rem; padding: 0.35rem 0.6rem; }
  .nav-user { margin-left: auto; }
  .key-numbers { grid-template-columns: repeat(2, 1fr); }
  .status-boxes { grid-template-columns: repeat(2, 1fr); }
  .info-cards { grid-template-columns: repeat(2, 1fr); }
  .backups-grid { grid-template-columns: 1fr; }
  .stack-container-row { grid-template-columns: 1.3fr 0.8fr 0.7fr 0.4fr; font-size: 0.7rem; }
  .filter-bar input[type="text"] { width: 180px; }
}
