/* cmdcenter — fleet service dashboard. */
:root {
  --bg: #0b0f14;
  --bg2: #0e131a;
  --panel: #121821;
  --panel2: #161d28;
  --border: #202a38;
  --border2: #2a3749;
  --text: #d6deea;
  --dim: #6b7889;
  --dim2: #4a5260;
  --accent: #5fb3ff;
  --accent2: #84caff;
  --green: #3fb950;
  --amber: #d29922;
  --red: #f85149;
  --gray: #6e7681;
  --tls: #a371f7;
  --mono: "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
  padding: 0;
}

/* sticky header */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 16px;
  padding: 12px 22px;
  background: rgba(11, 15, 20, 0.86);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 15px; font-weight: 700; color: var(--accent2); letter-spacing: .5px; white-space: nowrap; }
.topbar .brand-mark { color: var(--accent); font-size: 16px; }
.search-wrap { position: relative; flex: 1; max-width: 460px; }
.search {
  width: 100%; background: var(--bg2); color: var(--text);
  border: 1px solid var(--border2); border-radius: 7px;
  padding: 6px 10px 6px 28px; font: inherit; font-size: 12px; outline: none;
}
.search:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(95,179,255,.18); }
.search-wrap::before { content: "⌕"; position: absolute; left: 9px; top: 2px; color: var(--dim); font-size: 14px; }
.topbar .stats { display: flex; gap: 14px; font-size: 11px; color: var(--dim); }
.topbar .stats b { color: var(--text); font-weight: 600; }
.topbar .stats a { color: var(--dim); text-decoration: none; }
.topbar .stats a:hover { color: var(--accent); }

/* layout */
.grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
  padding: 16px 22px;
}
.grid > .panel-wide, .grid > #services-section, .grid > #peers-section { grid-column: 1 / -1; }
.detail-cols { grid-column: 1 / -1; display: grid; grid-template-columns: 1.1fr 1fr 1fr; gap: 14px; }
@media (max-width: 1100px) { .grid { grid-template-columns: 1fr; } .detail-cols { grid-template-columns: 1fr; } }

/* host strip */
.host-strip { grid-column: 1 / -1; }
.host-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px; background: var(--panel); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px;
}
.host-cell { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.host-label { font-size: 10px; letter-spacing: .8px; color: var(--dim); text-transform: uppercase; }
.host-big { font-size: 14px; font-weight: 600; color: var(--text); word-break: break-all; }
.host-sub { font-size: 10px; color: var(--dim); }
.host-meta { border-left: 1px solid var(--border2); padding-left: 10px; }
.bar { height: 4px; background: var(--bg2); border-radius: 2px; overflow: hidden; margin-top: 2px; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .5s; }
.live-indicator { color: var(--green); }

/* panels */
.panel {
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  padding: 14px 16px; min-width: 0;
}
.panel h2 {
  font-size: 11px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase;
  color: var(--dim); margin-bottom: 12px; display: flex; align-items: center; gap: 8px;
}
.panel h2 .hint { color: var(--dim2); font-weight: 400; text-transform: none; letter-spacing: 0; font-size: 11px; margin-left: auto; }
.count-chip { color: var(--accent2); background: rgba(95,179,255,.1); border: 1px solid rgba(95,179,255,.2); border-radius: 10px; padding: 0 7px; font-size: 10px; font-weight: 600; }
.empty { color: var(--dim2); font-style: italic; padding: 8px 0; }

/* host group block (services) */
.host-group { margin-bottom: 16px; }
.host-group:last-child { margin-bottom: 0; }
.host-group-head {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 0 8px; border-bottom: 1px solid var(--border); margin-bottom: 10px;
}
.host-group-name { font-size: 13px; font-weight: 600; color: var(--accent2); letter-spacing: .3px; }
.host-group-count { color: var(--dim); font-size: 11px; }

/* service list: icon | title | what | port | url */
.svc-list { display: flex; flex-direction: column; gap: 2px; }
.svc-row {
  display: grid;
  grid-template-columns: 22px minmax(150px, 1.3fr) minmax(130px, 1fr) 56px minmax(180px, 1.4fr);
  gap: 10px; align-items: center;
  padding: 5px 8px; border-radius: 6px; min-width: 0;
  background: var(--bg2); border: 1px solid transparent;
}
.svc-row:not(.svc-head):hover { border-color: var(--border2); }
.svc-head {
  background: none; color: var(--dim2); font-size: 10px; letter-spacing: .6px;
  text-transform: uppercase; padding-bottom: 2px;
}
.c-icon { display: flex; align-items: center; justify-content: center; }
.c-icon img { border-radius: 3px; }
.c-title {
  font-size: 12px; font-weight: 600; color: var(--text); text-decoration: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
a.c-title:hover { color: var(--accent2); text-decoration: underline; }
.c-title.nolink { color: var(--dim); font-weight: 500; }
.c-what { font-size: 11px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.c-port { font-size: 11px; color: var(--accent2); font-weight: 600; }
.c-url { font-size: 11px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.c-url a { color: var(--dim); text-decoration: none; }
.c-url a:hover { color: var(--accent2); text-decoration: underline; }

/* relevance tiers — highlights stay up, rest hides behind "more" */
.tier-0 { background: rgba(63,185,80,.05); border-color: rgba(63,185,80,.14); }
.tier-0 .c-title { color: var(--accent2); }
.is-noise { opacity: .45; }
.is-noise:hover { opacity: 1; }

.more-btn {
  margin-top: 4px; align-self: flex-start;
  background: none; border: 1px dashed var(--border2); border-radius: 6px;
  color: var(--dim); font-size: 11px; padding: 4px 12px; cursor: pointer;
}
.more-btn:hover { color: var(--text); border-color: var(--accent); }

/* status dots */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--gray); }
.dot-ok { background: var(--green); box-shadow: 0 0 5px rgba(63,185,80,.5); }
.dot-stale { background: var(--amber); }
.dot-offline { background: var(--red); }
.dot-online { background: var(--green); }
.dot-offline-2, .dot-true { background: var(--green); }
.source-list { display: grid; gap: 6px; }
.source-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: var(--bg2); border-radius: 5px; }
.source-row .dim { margin-left: auto; color: var(--dim); }
.source-row time { margin-left: 8px; }
.source-ok { border-left: 2px solid var(--green); }
.source-unavailable { border-left: 2px solid var(--amber); color: var(--amber); }
.dot-source-ok { background: var(--green); }
.dot-source-unavailable { background: var(--amber); }

/* tables */
table { width: 100%; border-collapse: collapse; font-size: 12px; }
.table-scroll { overflow-x: auto; }
th, td { text-align: left; padding: 5px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--dim); font-weight: 500; font-size: 10px; letter-spacing: .4px; text-transform: uppercase; }
td .dim { color: var(--dim); }
tbody tr:hover { background: rgba(95,179,255,.04); }
.state-running, .state-online { color: var(--green); }
.state-exited, .state-offline, .state-dead { color: var(--red); }
.state-paused { color: var(--amber); }
.badge { font-size: 10px; padding: 1px 5px; border-radius: 3px; background: var(--bg2); border: 1px solid var(--border2); }
.badge-any { color: var(--red); border-color: rgba(248,81,73,.3); }
.badge-local { color: var(--dim); }
.badge-ts { color: var(--accent); border-color: rgba(95,179,255,.3); }
.peer-ports td, td.peer-ports { color: var(--text); }
.peer-ports a { color: var(--accent); text-decoration: none; }

/* footer */
.footer {
  grid-column: 1 / -1; padding: 14px 22px 40px; font-size: 11px; color: var(--dim2);
  display: flex; gap: 14px; flex-wrap: wrap;
}
.footer a { color: var(--dim); text-decoration: none; }
.footer a:hover { color: var(--accent); }

#stat-live { color: var(--dim2); }
#stat-live.on { color: var(--green); }

/* hidden by search filter */
.hidden { display: none !important; }
