:root {
  --bg: #0b0f17;
  --panel: #121826;
  --panel-2: #0f1522;
  --border: #1f2937;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --accent: #6366f1;
  --accent-2: #818cf8;
  --green: #22c55e;
  --amber: #f59e0b;
  --red: #ef4444;
  --cyan: #06b6d4;
  --radius: 10px;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: radial-gradient(1200px 600px at 10% -10%, #17203a 0%, var(--bg) 55%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  min-height: 100vh;
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }

.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  flex: 0 0 220px;
  border-right: 1px solid var(--border);
  background: rgba(10, 14, 24, 0.85);
  backdrop-filter: blur(8px);
  padding: 18px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 20px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, #6366f1, #06b6d4);
  display: grid; place-items: center; font-weight: 700; color: white;
}
.brand-name { font-size: 16px; font-weight: 700; letter-spacing: 0.4px; }
.brand-sub { font-size: 11px; color: var(--muted); }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px; cursor: pointer;
  color: var(--muted); font-size: 13.5px; border: 1px solid transparent;
}
.nav-item:hover { background: #161d2e; color: var(--text); }
.nav-item.active { background: #1a2340; color: #fff; border-color: #26304d; }
.nav-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: 0.7; }

.sidebar-foot { margin-top: auto; padding: 10px 8px; color: var(--muted); font-size: 11.5px; line-height: 1.6; }

.main { flex: 1; min-width: 0; padding: 22px 26px 60px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 14px; }
.page-title { font-size: 21px; font-weight: 700; margin: 0; }
.page-sub { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }

.grid { display: grid; gap: 14px; }
.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.card {
  background: linear-gradient(180deg, rgba(23, 30, 48, 0.9), rgba(16, 22, 36, 0.92));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.card-title { font-size: 13px; color: var(--muted); margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; }
.stat { font-size: 26px; font-weight: 700; line-height: 1.1; }
.stat small { font-size: 13px; color: var(--muted); font-weight: 500; }
.stat-note { margin-top: 6px; color: var(--muted); font-size: 12px; }

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  border: 1px solid transparent; white-space: nowrap;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ONLINE, .pill.SUCCEEDED, .pill.enabled { color: #4ade80; background: rgba(34, 197, 94, 0.12); border-color: rgba(34, 197, 94, 0.25); }
.pill.RUNNING, .pill.LEASED, .pill.BOOTSTRAPPING { color: #67e8f9; background: rgba(6, 182, 212, 0.12); border-color: rgba(6, 182, 212, 0.28); }
.pill.QUEUED, .pill.PENDING, .pill.DRAINING, .pill.UNKNOWN { color: #fbbf24; background: rgba(245, 158, 11, 0.12); border-color: rgba(245, 158, 11, 0.25); }
.pill.OFFLINE, .pill.FAILED, .pill.ERROR, .pill.TIMEOUT { color: #f87171; background: rgba(239, 68, 68, 0.12); border-color: rgba(239, 68, 68, 0.28); }
.pill.CANCELED, .pill.DISABLED { color: #cbd5e1; background: rgba(148, 163, 184, 0.12); border-color: rgba(148, 163, 184, 0.25); }

.bar { height: 6px; background: #1e293b; border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #6366f1, #06b6d4); }
.bar.warn > i { background: linear-gradient(90deg, #f59e0b, #f97316); }
.bar.danger > i { background: linear-gradient(90deg, #ef4444, #dc2626); }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.5px; padding: 8px 10px; border-bottom: 1px solid var(--border); }
td { padding: 10px; border-bottom: 1px solid rgba(31, 41, 55, 0.6); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(99, 102, 241, 0.05); }
.mono { font-family: var(--mono); font-size: 12px; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.truncate { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.btn {
  border: 1px solid #2a3550; background: #161d2e; color: var(--text);
  padding: 6px 12px; border-radius: 8px; cursor: pointer; font-size: 12.5px;
  transition: all 0.15s ease;
}
.btn:hover { border-color: #3b4a6b; background: #1b2438; }
.btn.primary { background: linear-gradient(135deg, #4f46e5, #6366f1); border-color: #6366f1; color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { border-color: #7f1d1d; background: #1f1418; color: #fca5a5; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 3px 9px; font-size: 11.5px; border-radius: 7px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-row { display: flex; gap: 6px; flex-wrap: wrap; }

input, select, textarea {
  background: #0d1320; border: 1px solid #26304a; color: var(--text);
  border-radius: 8px; padding: 7px 10px; font-size: 13px; font-family: inherit; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15); }
textarea { font-family: var(--mono); font-size: 12px; line-height: 1.55; resize: vertical; }
label { display: block; font-size: 12px; color: var(--muted); margin: 10px 0 5px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar input, .toolbar select { width: auto; min-width: 130px; }
.spacer { flex: 1; }

.empty { padding: 26px; text-align: center; color: var(--muted); font-size: 13px; }

.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-all; }

pre.log {
  background: #080c14; border: 1px solid #1c2538; border-radius: 8px;
  padding: 12px; font-family: var(--mono); font-size: 11.5px; line-height: 1.6;
  max-height: 260px; overflow: auto; color: #cbd5e1; white-space: pre-wrap; word-break: break-word;
}

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 16px 0; }
.tab { padding: 8px 14px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; font-size: 13px; }
.tab.active { color: #fff; border-bottom-color: var(--accent); }

.modal-mask {
  position: fixed; inset: 0; background: rgba(4, 7, 13, 0.72);
  display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 100;
  overflow: auto;
}
.modal {
  width: 100%; max-width: 620px; background: #111827; border: 1px solid #26304a;
  border-radius: 14px; padding: 20px; box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}
.modal.wide { max-width: 860px; }
.modal h3 { margin: 0 0 4px; font-size: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.modal-note { color: var(--muted); font-size: 12px; line-height: 1.6; margin-top: 6px; }

.toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 200;
  background: #111a2c; border: 1px solid #2b3856; color: var(--text);
  padding: 10px 16px; border-radius: 10px; font-size: 13px;
  opacity: 0; transform: translateY(8px); transition: all 0.2s ease; pointer-events: none;
  max-width: 420px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-color: #7f1d1d; color: #fecaca; }

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: 100%; max-width: 380px; }
.login-card .brand { padding-bottom: 8px; }

.spark { width: 100%; height: 60px; display: block; }
.spark path { fill: none; stroke: var(--accent); stroke-width: 1.6; }
.spark .fill { fill: rgba(99, 102, 241, 0.12); stroke: none; }
.spark.util path { stroke: var(--cyan); }
.spark.util .fill { fill: rgba(6, 182, 212, 0.10); }

.node-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.node-card { border: 1px solid var(--border); border-radius: 10px; padding: 14px; background: #101725; }
.node-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 10px; }
.node-card-name { font-weight: 650; font-size: 14px; }
.node-card-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.node-metric { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); margin: 9px 0 4px; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: #172033; border: 1px solid #24304a; color: #b6c2d9; }
.chip.cap { background: rgba(99, 102, 241, 0.12); border-color: rgba(99, 102, 241, 0.3); color: #c7d2fe; }

.timeline { border-left: 2px solid #24304a; margin-left: 6px; padding-left: 14px; }
.timeline-item { position: relative; padding-bottom: 14px; font-size: 12.5px; }
.timeline-item::before { content: ""; position: absolute; left: -20px; top: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.timeline-item .t { color: var(--muted); font-size: 11.5px; margin-left: 8px; }

.section-title { font-size: 14px; font-weight: 650; margin: 22px 0 10px; display: flex; align-items: center; gap: 8px; }
.section-title .hint { font-size: 11.5px; color: var(--muted); font-weight: 400; }

.artifact-list { display: flex; flex-direction: column; gap: 6px; }
.artifact { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 12.5px; background: #0d1320; }

.pager { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; align-items: center; font-size: 12px; color: var(--muted); }

@media (max-width: 1100px) {
  .cols-5, .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols-3 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; }
  .sidebar-foot { display: none; }
  .main { padding: 16px; }
  .cols-5, .cols-4, .cols-2 { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
}
