:root {
  --bg: #0f1220;
  --panel: #191d2f;
  --panel-2: #212639;
  --border: #2c3350;
  --text: #e7e9f3;
  --muted: #9aa2c0;
  --primary: #5b8cff;
  --primary-2: #3f6fe0;
  --green: #38c172;
  --red: #ff5c6c;
  --amber: #f0a92b;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, #1c2240 0%, var(--bg) 55%);
  color: var(--text);
  min-height: 100vh;
}

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(20, 24, 40, 0.6);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo { font-size: 28px; }
.topbar h1 { font-size: 18px; margin: 0; }
.sub { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.api-config { display: flex; align-items: center; gap: 8px; }
.api-config label { font-size: 12px; color: var(--muted); }
.api-config input {
  width: 260px; padding: 7px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--panel); color: var(--text);
}

/* Layout */
main { padding: 24px; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.col { display: flex; flex-direction: column; gap: 20px; }
@media (max-width: 1100px) { .grid { grid-template-columns: 1fr; } }

/* Cards */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.card.highlight { border-color: var(--primary-2); box-shadow: 0 0 0 1px rgba(91, 140, 255, 0.25); }
.card h2 { margin: 0 0 12px; font-size: 15px; }
.card h3 { margin: 0; font-size: 13px; color: var(--muted); }
.list-head { display: flex; align-items: center; justify-content: space-between; margin: 14px 0 8px; }
.hint { color: var(--muted); font-size: 13px; margin: 4px 0 12px; }

/* Forms */
.form { display: flex; flex-direction: column; gap: 10px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.form input, .form select {
  padding: 9px 11px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--panel-2); color: var(--text); font-size: 14px;
}
.form input:focus, .form select:focus, .api-config input:focus { outline: 2px solid var(--primary-2); border-color: transparent; }
.suffixed { display: flex; align-items: stretch; }
.suffixed input { border-top-right-radius: 0; border-bottom-right-radius: 0; flex: 1; }
.suffix {
  display: flex; align-items: center; padding: 0 10px; font-size: 13px; color: var(--muted);
  background: var(--panel); border: 1px solid var(--border); border-left: none;
  border-top-right-radius: 8px; border-bottom-right-radius: 8px;
}

/* Buttons */
.btn {
  border: 1px solid var(--border); background: var(--panel-2); color: var(--text);
  padding: 9px 14px; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 600;
  transition: filter .15s, transform .05s;
}
.btn:hover { filter: brightness(1.15); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #08122b; }
.btn.ghost { background: transparent; }
.btn.danger { background: transparent; border-color: var(--red); color: var(--red); }
.btn.danger:hover { background: var(--red); color: #fff; }
.btn.sm { padding: 5px 10px; font-size: 12px; font-weight: 500; }
.tenant-actions { display: flex; align-items: center; gap: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Lists */
.mini-list { display: flex; flex-direction: column; gap: 8px; }
.row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 12px; background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 8px; font-size: 13px;
}
.row .meta { color: var(--muted); font-size: 12px; }
.row strong { font-weight: 600; }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-size: 12px; padding: 4px 9px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
}

/* Badges */
.badge { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; text-transform: uppercase; letter-spacing: .04em; }
.badge.muted { background: #2a3150; color: var(--muted); }
.badge.ok { background: rgba(56,193,114,.15); color: var(--green); }
.badge.err { background: rgba(255,92,108,.15); color: var(--red); }
.badge.warn { background: rgba(240,169,43,.15); color: var(--amber); }
.badge.run { background: rgba(91,140,255,.15); color: var(--primary); }

/* Pipeline */
.pipeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.pipeline li {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; font-size: 13px;
}
.pipeline .step-icon { width: 18px; text-align: center; }
.pipeline .step-name { flex: 1; }
.pipeline .step-detail { color: var(--muted); font-size: 12px; }
.pipeline li.done { border-color: rgba(56,193,114,.4); }
.pipeline li.running { border-color: var(--primary); }
.pipeline li.failed { border-color: var(--red); }

/* Tenants */
.tenant-list { display: flex; flex-direction: column; gap: 8px; }
.tenant {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px;
}
.tenant .name { font-weight: 600; font-size: 14px; }
.tenant .name small { color: var(--muted); font-weight: 400; }
.tenant .id { color: var(--muted); font-size: 12px; }

/* Log */
.log { max-height: 320px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.log-entry { padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel-2); white-space: pre-wrap; word-break: break-word; }
.log-entry.ok { border-left: 3px solid var(--green); }
.log-entry.err { border-left: 3px solid var(--red); }
.log-entry .t { color: var(--muted); }
.empty { color: var(--muted); font-size: 13px; padding: 6px 0; }
