:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --border: #e1e4e8;
  --text: #1b1f23;
  --muted: #616a73;
  --primary: #0f6cbd;
  --primary-hover: #0b5cab;
  --ok: #107c10;
  --warn: #b8860b;
  --bad: #c42b1c;
  --radius: 8px;
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--bad); min-height: 1em; }

.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 32px; width: 340px; display: flex; flex-direction: column; gap: 12px;
}
.login-card h1 { margin: 0; font-size: 22px; letter-spacing: 2px; }

.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; background: var(--surface); border-right: 1px solid var(--border);
  padding: 16px 12px; display: flex; flex-direction: column; gap: 16px;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 8px; background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.brand-name { font-weight: 600; }
.brand-sub { font-size: 11px; color: var(--muted); letter-spacing: 1px; }
.sidebar nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  text-align: left; padding: 9px 12px; border: none; background: transparent; border-radius: 6px;
  cursor: pointer; font-size: 14px; color: var(--text);
}
.nav-item:hover { background: var(--bg); }
.nav-item.active { background: #eaf3fb; color: var(--primary); font-weight: 600; }

.content { flex: 1; padding: 20px 28px; max-width: 1200px; }
.topbar { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 16px; }
.topbar h2 { margin: 0; font-size: 20px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; margin-bottom: 16px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px;
}
.card .label { color: var(--muted); font-size: 12px; }
.card .value { font-size: 22px; font-weight: 650; margin-top: 4px; }
.card .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 16px;
}
.panel h3 { margin: 0 0 12px; font-size: 15px; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.table th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
.table tr:hover td { background: #fafbfc; }

.btn {
  border: 1px solid var(--border); background: var(--surface); border-radius: 6px;
  padding: 8px 14px; cursor: pointer; font-size: 13px;
}
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); }
.btn.ghost { background: transparent; }
.btn.small { padding: 4px 8px; font-size: 12px; }

.toolbar { margin-bottom: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; align-items: center; }
.form-row { display: flex; gap: 10px; flex-wrap: wrap; }
.form-row label { flex: 1; min-width: 120px; }
input, select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px;
  font-size: 13px; font-family: inherit; background: var(--surface);
}
label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); margin-bottom: 10px; }

.progress { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.progress > div { height: 100%; background: var(--primary); }

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600;
}
.badge.ok { background: #dff6dd; color: var(--ok); }
.badge.warn { background: #fff4ce; color: var(--warn); }
.badge.bad { background: #fde7e9; color: var(--bad); }
.badge.info { background: #eaf3fb; color: var(--primary); }

dialog {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; width: 520px; max-width: 92vw;
}
dialog::backdrop { background: rgba(0,0,0,.35); }
.dialog-form { display: flex; flex-direction: column; gap: 4px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }

.pipeline-row { display: flex; align-items: center; gap: 12px; padding: 6px 0; }
.pipeline-row .name { width: 190px; font-size: 13px; }
.pipeline-row .bar { flex: 1; height: 14px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.pipeline-row .bar > div { height: 100%; background: var(--primary); opacity: .8; }
.pipeline-row .nums { width: 210px; text-align: right; color: var(--muted); font-size: 12px; }
