:root {
  --bg: #09090b;
  --surface: #0e0e11;
  --surface-2: #141418;
  --surface-3: #1b1b21;
  --border: rgba(255, 255, 255, 0.07);
  --border-hover: rgba(255, 255, 255, 0.14);
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --dim: #71717a;
  --emerald: #10b981;
  --amber: #f59e0b;
  --red: #ef4444;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 13.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.hidden {
  display: none !important;
}

.shell {
  max-width: 1020px;
  margin: 0 auto;
  padding-left: 20px;
  padding-right: 20px;
}

/* Minimal Preview Sandbox Strip */
.preview-strip {
  background: #0c0c0f;
  border-bottom: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--muted);
}

.preview-strip-inner {
  min-height: 30px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 5px;
  padding-bottom: 5px;
}

.dot-amber {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--amber);
  flex-shrink: 0;
}

/* Architectural Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(9, 9, 11, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 8px;
  padding-bottom: 8px;
}

.brand-cluster {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  display: block;
  flex-shrink: 0;
}

.breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
}

.crumb-dim {
  color: var(--dim);
}

.crumb-sep {
  color: rgba(255, 255, 255, 0.22);
}

.crumb-primary {
  color: var(--text);
  font-weight: 500;
  letter-spacing: -0.015em;
}

.ip-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 8px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11.5px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.ip-pill:hover {
  border-color: var(--border-hover);
  color: var(--text);
  background: var(--surface-3);
}

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--emerald);
}

.status-indicator.is-error {
  color: #f87171;
}

.status-indicator.is-error .status-dot {
  background: var(--red);
}

.utility-cluster {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.mono-clock {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
  margin-right: 4px;
}

/* Minimal Buttons */
.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border-radius: 7px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn-ghost:hover {
  background: var(--surface-2);
  border-color: var(--border-hover);
  color: var(--text);
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn-icon:hover {
  background: var(--surface-2);
  border-color: var(--border-hover);
  color: var(--text);
}

@keyframes spinOnce {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.btn-icon.is-spinning svg {
  animation: spinOnce 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.btn-solid {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: 7px;
  background: #f4f4f5;
  color: #09090b;
  border: 1px solid #f4f4f5;
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease, opacity 0.15s ease;
}

.btn-solid:hover {
  background: #ffffff;
}

.btn-solid.btn-danger-solid {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

.btn-solid.btn-danger-solid:hover {
  background: rgba(239, 68, 68, 0.24);
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border);
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn-outline:hover {
  background: var(--surface-3);
  border-color: var(--border-hover);
  color: var(--text);
}

.btn-xs {
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
}

/* Main Content */
.main-content {
  padding-top: 22px;
  padding-bottom: 56px;
}

.hw-substrip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 12px;
  font-size: 12px;
  color: var(--dim);
}

.hw-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.hw-host {
  color: var(--muted);
  font-weight: 500;
}

.hw-updated {
  font-family: var(--font-mono);
  font-size: 11px;
}

/* Unified Hairline Telemetry Ledger */
.telemetry-ledger {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.ledger-cell {
  background: var(--surface);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.cell-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.cell-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--dim);
}

.cell-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.cell-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 30px;
}

.cell-value {
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.cell-value-uptime {
  font-size: 21px;
}

.cell-subval {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.sparkline-wrap {
  width: 88px;
  height: 26px;
  flex-shrink: 0;
}

.sparkline-wrap svg {
  width: 100%;
  height: 100%;
  display: block;
}

.thin-track {
  width: 100%;
  height: 2px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 2px;
  overflow: hidden;
}

.thin-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.35s ease, background-color 0.25s ease;
}

.level-ok { background: #e4e4e7; }
.level-warn { background: var(--amber); }
.level-crit { background: var(--red); }

.cell-foot, .cell-boot {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cell-boot {
  margin-top: -4px;
  color: var(--muted);
}

/* Services Section */
.services-section {
  margin-top: 28px;
}

.section-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.section-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--text);
}

h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.count-tag {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--dim);
}

.filter-field {
  position: relative;
  display: flex;
  align-items: center;
}

.filter-icon {
  position: absolute;
  left: 10px;
  color: var(--dim);
  pointer-events: none;
}

.filter-field input {
  width: 220px;
  height: 32px;
  padding: 0 32px 0 30px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 12.5px;
  outline: none;
  transition: border-color 0.15s ease, width 0.15s ease;
}

.filter-field input::placeholder {
  color: var(--dim);
}

.filter-field input:focus {
  border-color: var(--border-hover);
  width: 250px;
}

.kbd-hint {
  position: absolute;
  right: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--dim);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  pointer-events: none;
}

.services-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.empty-state {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 28px;
  text-align: center;
  color: var(--dim);
  font-size: 13px;
}

/* Full-Width Architectural Service Row */
.service-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
  transition: border-color 0.15s ease;
}

.service-row:hover {
  border-color: var(--border-hover);
}

.service-main {
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.service-info {
  min-width: 0;
  flex: 1;
}

.service-title-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
}

.led {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.led-running {
  background: var(--emerald);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.55);
}

.led-stopped {
  background: #52525b;
}

.led-busy {
  background: var(--amber);
}

.service-name {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.015em;
  color: var(--text);
}

.route-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 6px;
}

.category-tag {
  font-size: 11.5px;
  color: var(--dim);
}

.service-desc {
  margin: 6px 0 0 15px;
  font-size: 12.5px;
  color: var(--muted);
  max-width: 64ch;
}

.service-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.segmented-controls {
  display: inline-flex;
  align-items: center;
  background: #131317;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 2px;
  gap: 2px;
}

.seg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 30px;
  padding: 0 10px;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease, opacity 0.12s ease;
}

.seg-btn:hover:not(:disabled) {
  background: #1e1e24;
  color: var(--text);
}

.seg-btn[data-action="stop"]:hover:not(:disabled) {
  color: #f87171;
  background: rgba(239, 68, 68, 0.1);
}

.seg-btn:disabled {
  opacity: 0.34;
  cursor: not-allowed;
}

.btn-open {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: 7px;
  background: #f4f4f5;
  color: #09090b;
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s ease, transform 0.08s ease;
}

.btn-open:hover {
  background: #ffffff;
}

.btn-open:active {
  transform: translateY(1px);
}

/* Service Bottom Spec Strip */
.service-specs {
  padding: 10px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(255, 255, 255, 0.012);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 24px;
  font-family: var(--font-mono);
  font-size: 11.5px;
}

.spec-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.spec-k {
  color: var(--dim);
}

.spec-v {
  color: var(--muted);
}

.spec-ok {
  color: var(--emerald);
}

.spec-down {
  color: var(--dim);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-panel {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-hover);
  border-radius: 12px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.65);
  display: flex;
  flex-direction: column;
  max-height: 86vh;
  overflow: hidden;
}

.modal-sm { max-width: 420px; }
.modal-lg { max-width: 780px; }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: #0b0b0e;
}

.modal-sub {
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--dim);
}

.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: transparent;
  border: none;
  color: var(--dim);
  cursor: pointer;
}

.modal-close:hover {
  background: var(--surface-2);
  color: var(--text);
}

.modal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 18px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar-label {
  font-size: 12px;
  color: var(--muted);
}

.select-minimal {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  height: 28px;
  padding: 0 8px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  outline: none;
}

.modal-body {
  padding: 16px 18px;
  overflow-y: auto;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: #0b0b0e;
}

.confirm-copy {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.55;
}

/* Terminal Logs */
.logs-shell {
  padding: 0;
  background: #070709;
}

.logs-stream {
  min-height: 280px;
  max-height: 56vh;
  overflow: auto;
  padding: 12px 16px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.65;
}

.log-line {
  display: flex;
  gap: 12px;
  padding: 1px 0;
}

.log-idx {
  color: #3f3f46;
  user-select: none;
  min-width: 22px;
  text-align: right;
  flex-shrink: 0;
}

.log-ts {
  color: #71717a;
  flex-shrink: 0;
}

.log-msg {
  color: #d4d4d8;
  word-break: break-word;
}

/* Registry Code Blocks */
.registry-note {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
}

.code-group + .code-group {
  margin-top: 14px;
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
}

.code-surface {
  margin: 0;
  padding: 12px 14px;
  background: #070709;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.55;
  color: #e4e4e7;
  overflow-x: auto;
}

code {
  font-family: var(--font-mono);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 11.5px;
  color: var(--text);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 80;
  max-width: min(340px, calc(100vw - 32px));
  background: #18181b;
  color: var(--text);
  border: 1px solid var(--border-hover);
  border-radius: 8px;
  padding: 9px 14px;
  font-size: 12.5px;
  font-weight: 500;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Responsive Design */
@media (max-width: 880px) {
  .service-main {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }

  .service-actions {
    justify-content: space-between;
  }
}

@media (max-width: 760px) {
  .shell {
    padding-left: 14px;
    padding-right: 14px;
  }

  .mono-clock {
    display: none;
  }

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

  .ledger-cell {
    padding: 14px;
  }

  .cell-value {
    font-size: 20px;
  }

  .sparkline-wrap {
    width: 64px;
    height: 22px;
  }

  .filter-field,
  .filter-field input,
  .filter-field input:focus {
    width: 100%;
  }

  .kbd-hint {
    display: none;
  }

  .service-main {
    padding: 16px;
  }

  .service-desc {
    margin-left: 0;
  }

  .service-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .btn-open {
    width: 100%;
    height: 40px;
  }

  .segmented-controls {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: 100%;
  }

  .seg-btn {
    height: 38px;
    padding: 0 6px;
  }

  .service-specs {
    padding: 10px 16px;
    gap: 6px 16px;
  }

  .log-line {
    flex-wrap: wrap;
    gap: 4px 8px;
  }
}

/* Minimalist Login Page */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-wrap {
  width: 100%;
  max-width: 360px;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 26px 24px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03), 0 24px 64px rgba(0, 0, 0, 0.5);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.login-crumbs {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
}

.login-title {
  margin: 0;
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text);
}

.login-subtitle {
  margin: 4px 0 18px;
  font-size: 12.5px;
  color: var(--muted);
}

.login-error {
  margin-bottom: 14px;
  padding: 9px 11px;
  border-radius: 7px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  font-size: 12px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}

.field-group input {
  width: 100%;
  height: 36px;
  padding: 0 11px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: #09090b;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s ease;
}

.field-group input:focus {
  border-color: var(--border-hover);
}

.login-btn {
  width: 100%;
  height: 36px;
  margin-top: 4px;
}

