:root {
  --bg: #090a0f;
  --fg: #f8fafc;
  --muted: #94a3b8;
  --card: rgba(20, 22, 30, 0.72);
  --card-solid: #101219;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --indigo: #6366f1;
  --indigo-2: #818cf8;
  --purple: #a855f7;
  --cyan: #67e8f9;
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --radius: 14px;
  --sidebar: 256px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
::selection { background: rgba(99, 102, 241, 0.35); color: #f8fafc; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #272a38; border-radius: 8px; border: 2px solid #090a0f; }

.hidden { display: none !important; }
.mono { font-family: "JetBrains Mono", ui-monospace, monospace; }
.display { font-family: Outfit, "Plus Jakarta Sans", sans-serif; }

.ambient-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(600px 420px at 12% -5%, rgba(99, 102, 241, 0.16), transparent 60%),
    radial-gradient(700px 500px at 95% 0%, rgba(6, 182, 212, 0.09), transparent 60%),
    radial-gradient(900px 620px at 50% 115%, rgba(168, 85, 247, 0.1), transparent 60%),
    #090a0f;
}
.text-gradient {
  background: linear-gradient(90deg, #818cf8, #c084fc, #67e8f9);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- login ---------- */
.login-screen { min-height: 100vh; display: flex; }
.login-hero {
  position: relative;
  flex: 1;
  display: none;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--line);
  padding: 48px;
}
.login-hero-inner { max-width: 440px; }
.brand-row { display: flex; align-items: center; gap: 12px; }
.logo-mark {
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #6366f1, #a855f7, #22d3ee);
  box-shadow: 0 0 24px rgba(99, 102, 241, 0.45);
  color: white;
}
.logo-mark.sm { width: 36px; height: 36px; border-radius: 12px; box-shadow: 0 0 20px rgba(99, 102, 241, 0.4); }
.brand-name { font-family: Outfit, sans-serif; font-weight: 700; font-size: 18px; margin: 0; }
.login-hero h1 {
  font-family: Outfit, sans-serif;
  font-size: 40px;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 28px 0 0;
}
.feature-list { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 14px; }
.feature-list li { display: flex; gap: 10px; align-items: center; color: rgba(248, 250, 252, 0.82); font-size: 14px; }
.feature-list svg { color: #67e8f9; flex: 0 0 auto; }
.login-panel { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card {
  width: min(400px, 100%);
  background: linear-gradient(180deg, rgba(28, 30, 40, 0.92), rgba(16, 18, 25, 0.92));
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  padding: 28px 26px 22px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
}
.login-card h2 { font-family: Outfit, sans-serif; font-size: 22px; margin: 0 0 6px; text-align: center; }
.login-card .hint { text-align: center; margin-bottom: 18px; }
.mobile-brand { display: flex; justify-content: center; margin-bottom: 18px; }

/* ---------- chrome ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 30;
  width: var(--sidebar);
  display: none;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px;
  border-right: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(18px);
}
.nav { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.nav-section {
  margin: 18px 0 6px;
  padding: 0 12px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(148, 163, 184, 0.7);
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  border-radius: 10px;
  padding: 8px 12px;
  text-align: left;
  font-size: 14px;
  transition: 0.2s ease;
}
.nav-item svg { width: 16px; height: 16px; }
.nav-item:hover { background: rgba(255, 255, 255, 0.05); color: white; }
.nav-item.active { border-color: rgba(99, 102, 241, 0.3); background: rgba(99, 102, 241, 0.15); color: white; }
.sidebar-foot { display: grid; gap: 10px; }
.service-dots, .user-chip {
  display: flex; align-items: center; justify-content: space-between;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  border-radius: 10px;
  padding: 12px;
  font-size: 11px;
  color: var(--muted);
}
.user-chip { justify-content: flex-start; gap: 10px; }
.avatar {
  width: 28px; height: 28px; border-radius: 999px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #6366f1, #22d3ee);
  color: white; font-size: 12px; font-weight: 700;
}
.dots { display: flex; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 999px; background: #fbbf24; }
.dot.ok { background: #34d399; }
.dot.bad { background: #f87171; }
.dot.warn { background: #fbbf24; }
.pulse { animation: pulse-dot 1.8s ease-in-out infinite; }
@keyframes pulse-dot { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

.workspace { min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  height: 56px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(18px);
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 12px; }
.icon-btn {
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--muted);
  border-radius: 10px;
  width: 36px; height: 36px;
  display: grid; place-items: center;
}
.icon-btn:hover { color: white; }
.main { width: min(1440px, 100%); margin: 0 auto; padding: 32px 16px 64px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 28px; }
.page-head h1 {
  font-family: Outfit, sans-serif;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-size: clamp(30px, 4vw, 40px);
  margin: 0;
}
.lede { margin: 6px 0 0; max-width: 640px; color: var(--muted); font-size: 14px; }

.animate-fade-up { animation: fade-up 0.5s ease-out both; }
@keyframes fade-up { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ---------- controls ---------- */
.btn {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  background: linear-gradient(90deg, #6366f1, #a855f7);
  color: white;
  font-weight: 650;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.2);
}
.btn:hover { filter: brightness(1.06); }
.btn:disabled { opacity: 0.6; cursor: wait; }
.btn.ghost, .btn.outline {
  background: transparent;
  box-shadow: none;
  border: 1px solid var(--line-strong);
  color: white;
  font-weight: 600;
}
.btn.ghost:hover, .btn.outline:hover { background: rgba(255, 255, 255, 0.05); }
.btn.danger { background: #ef4444; box-shadow: none; }
.btn.sm { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.btn.icon { width: 32px; height: 32px; padding: 0; }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
input, select, textarea {
  width: 100%;
  background: #161822;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
}
textarea { resize: vertical; min-height: 72px; }
input:focus, select:focus, textarea:focus { border-color: rgba(99, 102, 241, 0.7); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15); }
.field { margin-bottom: 14px; }
.hint { color: var(--muted); font-size: 12px; margin: 6px 0 0; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.span-2 { grid-column: span 2; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 3px 10px;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.01em;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  white-space: nowrap;
}
.badge .pip { width: 6px; height: 6px; border-radius: 99px; background: currentColor; }
.badge.ok { color: #6ee7b7; border-color: rgba(16, 185, 129, 0.35); background: rgba(16, 185, 129, 0.1); }
.badge.warn { color: #fcd34d; border-color: rgba(245, 158, 11, 0.35); background: rgba(245, 158, 11, 0.1); }
.badge.bad { color: #fca5a5; border-color: rgba(239, 68, 68, 0.35); background: rgba(239, 68, 68, 0.1); }
.badge.info { color: #c7d2fe; border-color: rgba(99, 102, 241, 0.35); background: rgba(99, 102, 241, 0.12); }
.badge.lg { font-size: 11px; padding: 5px 12px; }

.card {
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  backdrop-filter: blur(8px);
}
.card-pad { padding: 22px; }
.card-hover { transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease; }
.card-hover:hover { transform: translateY(-3px); border-color: rgba(99, 102, 241, 0.4); box-shadow: 0 0 25px rgba(99, 102, 241, 0.15); }
.stat-grid, .svc-grid, .quick-grid, .settings-grid { display: grid; gap: 18px; }
.stat-grid { grid-template-columns: repeat(1, 1fr); }
.svc-grid, .quick-grid, .settings-grid { grid-template-columns: 1fr; }
.stat-label { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 14px; }
.ico-bubble {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center; flex: 0 0 auto;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.22), rgba(34, 211, 238, 0.08));
  color: #a5b4fc;
}
.ico-bubble svg, .logo-mark svg, .nav-item svg, .quick svg, .feature-list svg {
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ico-bubble svg { width: 16px; height: 16px; }
.ico-bubble.cyan { color: #67e8f9; background: rgba(255, 255, 255, 0.05); }
.svc-id { display: flex; gap: 14px; align-items: flex-start; min-width: 0; }
.quick-main { display: flex; align-items: center; gap: 12px; }
.quick svg.chev { width: 16px; height: 16px; color: var(--muted); flex: 0 0 auto; }
.stat-value { font-family: Outfit, sans-serif; font-size: 32px; font-weight: 800; letter-spacing: -0.03em; margin: 8px 0 2px; }
.stat-sub { color: var(--muted); font-size: 12px; margin: 0; }
.svc-link { text-decoration: none; color: inherit; display: block; }
.svc-row { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.svc-title { font-family: Outfit, sans-serif; font-weight: 650; margin: 0; }
.dash-split { display: grid; gap: 18px; margin-top: 18px; align-items: start; }
.section-title { font-family: Outfit, sans-serif; font-size: 18px; font-weight: 650; margin: 0; }
.activity { display: grid; gap: 14px; margin-top: 16px; }
.activity-item { display: flex; gap: 10px; align-items: flex-start; }
.activity-item p { margin: 0; font-size: 14px; }
.activity-item .when { color: var(--muted); font-size: 11px; margin-top: 2px; }
.quick {
  display: flex; align-items: center; justify-content: space-between;
  text-decoration: none; color: inherit;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.08), rgba(34, 211, 238, 0.04));
  padding: 18px 18px;
}
.quick strong { display: block; font-size: 14px; }
.quick span { color: var(--muted); font-size: 12px; }
.banner {
  border-radius: 12px;
  border: 1px solid rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.1);
  color: #fcd34d;
  padding: 12px 14px;
  font-size: 14px;
  margin-bottom: 18px;
}
.chart-wrap { height: 256px; }
.chart-wrap svg { width: 100%; height: 100%; display: block; }
.empty {
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  padding: 48px 20px;
  text-align: center;
  color: var(--muted);
}
.empty h3 { color: white; margin: 10px 0 6px; font-family: Outfit, sans-serif; }

.cards { display: grid; gap: 18px; }
.app-card { display: flex; flex-direction: column; gap: 10px; min-height: 188px; }
.app-card h3 { margin: 0; font-family: Outfit, sans-serif; font-size: 18px; }
.app-card .desc { color: var(--muted); font-size: 14px; min-height: 40px; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.app-card .foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: 8px; }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
td { padding: 12px 14px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); vertical-align: middle; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: rgba(255, 255, 255, 0.03); }
.model-cell { display: flex; align-items: center; gap: 10px; }
.search { width: 190px; }

.yaml-card pre, .codebox {
  margin: 0;
  max-height: 420px;
  overflow: auto;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  color: rgba(165, 243, 252, 0.92);
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  line-height: 1.55;
  white-space: pre-wrap;
}
.infer-grid { display: grid; gap: 18px; }
.switch { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
.switch input { width: auto; }

.subhead { margin: 28px 0 12px; display: flex; justify-content: space-between; align-items: end; gap: 12px; }
.subhead h2 { font-family: Outfit, sans-serif; font-size: 18px; margin: 0; }
.fit-grid { display: grid; gap: 14px; margin-top: 12px; color: var(--muted); font-size: 14px; line-height: 1.55; }
.fit-grid strong { color: #a5b4fc; }

/* ---------- dialogs ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0, 0, 0, 0.62);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 6vh 16px 24px;
  overflow: auto;
}
.dialog {
  width: min(640px, 100%);
  background: #101219;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  padding: 22px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}
.dialog.wide { width: min(860px, 100%); }
.dialog h2 { font-family: Outfit, sans-serif; margin: 0; font-size: 20px; }
.dialog-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.step, .kv {
  display: flex; gap: 10px; align-items: flex-start;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 8px;
}
.kv { justify-content: space-between; align-items: center; }
.kv .k { color: var(--muted); font-size: 11px; }
.kv .v { font-family: "JetBrains Mono", monospace; font-size: 12px; color: #a5f3fc; word-break: break-all; }
.secret {
  margin-top: 10px;
  border-radius: 10px;
  border: 1px solid rgba(34, 211, 238, 0.25);
  background: rgba(8, 47, 73, 0.35);
  padding: 12px;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  white-space: pre-wrap;
  color: #cffafe;
}
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.checks label {
  display: flex; gap: 6px; align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  margin: 0;
  color: #e2e8f0;
}
.checks input { width: auto; }
.advanced { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 10px; }
.advanced summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.error { color: #fca5a5; font-size: 13px; margin-top: 8px; }
.okmsg { color: #6ee7b7; font-size: 13px; margin-top: 8px; }
.meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.meta-grid .kv { margin: 0; display: block; }
.timeline { margin-top: 8px; display: grid; gap: 12px; }
.obs { position: relative; border-left: 1px solid var(--line-strong); padding-left: 18px; }
.obs::before {
  content: "";
  position: absolute; left: -5px; top: 14px;
  width: 9px; height: 9px; border-radius: 99px;
  background: linear-gradient(135deg, #818cf8, #67e8f9);
}
.audit { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.audit li { font-size: 12px; color: var(--muted); }

.drawer {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(0, 0, 0, 0.55);
}
.drawer-panel {
  width: min(300px, 86vw);
  height: 100%;
  background: #0d0e15;
  border-right: 1px solid var(--line-strong);
  padding: 20px;
  overflow: auto;
}

.toasts { position: fixed; top: 16px; right: 16px; z-index: 80; display: grid; gap: 8px; }
.toast {
  background: #13151d;
  border: 1px solid var(--line-strong);
  border-left: 3px solid #34d399;
  color: white;
  border-radius: 12px;
  padding: 10px 12px;
  min-width: 220px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  font-size: 13px;
}
.toast.bad { border-left-color: #f87171; }

@media (min-width: 640px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 900px) {
  .login-hero { display: flex; }
  .mobile-brand { display: none; }
  .stat-grid, .svc-grid, .quick-grid { grid-template-columns: repeat(3, 1fr); }
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .dash-split { grid-template-columns: 2fr 1fr; }
  .cards { grid-template-columns: 1fr 1fr; }
  .settings-grid { grid-template-columns: repeat(3, 1fr); }
  .fit-grid { grid-template-columns: repeat(3, 1fr); }
  .infer-grid { grid-template-columns: 2fr 1fr; align-items: start; }
  .yaml-card { position: sticky; top: 76px; }
}
@media (min-width: 1024px) {
  .sidebar { display: flex; }
  .workspace { padding-left: var(--sidebar); }
  .menu-btn, .top-brand { display: none; }
  .topbar { padding: 0 32px; }
  .main { padding: 32px 32px 72px; }
  .cards { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 720px) {
  .grid-2, .meta-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
}
