:root {
  /* Single solid Apache Flink accent (teal/cyan) — no gradients */
  --accent: #11a8cd;
  --accent-dark: #0d8aa8;
  --accent-soft: #e3f5fa;

  --bg: #f4f6f8;
  --card: #ffffff;
  --border: #e4e8ec;
  --border-strong: #d4dae0;
  --text: #1d2733;
  --muted: #64748b;
  --muted-2: #94a3b8;

  --ok: #15803d;
  --ok-bg: #e6f6ec;
  --warn: #b45309;
  --warn-bg: #fdf0dd;
  --err: #b91c1c;
  --err-bg: #fdeaea;
  --info: #1d4ed8;
  --info-bg: #e8eefb;

  --radius: 12px;
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

#app { min-height: 100%; }

/* ---------- Header ---------- */
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.75rem;
}

.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  object-fit: cover;
  display: block;
  border: 1px solid var(--border);
}

.brand h1 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.brand .sub {
  margin: 0;
  font-size: 0.76rem;
  color: var(--muted);
}

.spacer { flex: 1; }

.controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.search { position: relative; }
.search input {
  width: 240px;
  max-width: 60vw;
  padding: 0.5rem 0.8rem 0.5rem 2rem;
  border: 1px solid var(--border-strong);
  background: var(--card);
  color: var(--text);
  border-radius: 9px;
  font-size: 0.9rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search input::placeholder { color: var(--muted-2); }
.search input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(17, 168, 205, 0.15);
}
.search .icn {
  position: absolute;
  left: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-2);
  font-size: 0.9rem;
  pointer-events: none;
}

button {
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--border-strong);
  background: var(--card);
  color: var(--text);
  border-radius: 9px;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 500;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
button:hover { background: #f7f9fa; border-color: var(--muted-2); }
button:active { transform: translateY(1px); }
button:disabled { opacity: 0.55; cursor: default; }

.btn-refresh { display: inline-flex; align-items: center; gap: 0.4rem; }
.btn-refresh .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ok);
}

.updated { color: var(--muted-2); font-size: 0.76rem; }

/* ---------- Main ---------- */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 1.75rem 3rem;
}

/* Stat chips */
.stats {
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
  margin-bottom: 1.4rem;
}
.stat {
  flex: 1 1 150px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.9rem 1.1rem;
  position: relative;
  overflow: hidden;
}
.stat::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--accent);
}
.stat .num { font-size: 1.6rem; font-weight: 700; line-height: 1; }
.stat .lbl { color: var(--muted); font-size: 0.78rem; margin-top: 0.35rem; }
.stat.ok .num { color: var(--ok); }
.stat.err .num { color: var(--err); }
.stat.warn .num { color: var(--warn); }

/* Table card */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

table { width: 100%; border-collapse: collapse; }

thead th {
  text-align: left;
  padding: 0.8rem 1.1rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  background: #f8fafb;
  border-bottom: 1px solid var(--border);
}

tbody td {
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.12s; }
tbody tr:hover { background: #f8fafb; }

td.name {
  font-weight: 600;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: -0.01em;
}

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--muted); }

/* Status pill */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; }
.pill.running { background: var(--ok-bg); color: var(--ok); }
.pill.running .dot { background: var(--ok); animation: pulse 1.8s infinite; }
.pill.finished { background: var(--info-bg); color: var(--info); }
.pill.finished .dot { background: var(--info); }
.pill.failed { background: var(--err-bg); color: var(--err); }
.pill.failed .dot { background: var(--err); }
.pill.other { background: #eef1f4; color: var(--muted); }
.pill.other .dot { background: var(--muted); }

@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.35; }
  100% { opacity: 1; }
}

.badge {
  margin-left: 0.45rem;
  padding: 0.08rem 0.45rem;
  border-radius: 6px;
  background: var(--warn-bg);
  color: var(--warn);
  font-size: 0.68rem;
  font-weight: 600;
  vertical-align: middle;
}

.lifecycle { color: var(--muted); font-size: 0.85rem; }

/* Open button */
button.open {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}
button.open:hover { background: var(--accent-dark); border-color: var(--accent-dark); }

td.actions { text-align: right; white-space: nowrap; }

/* States */
.error {
  background: var(--err-bg);
  border: 1px solid #f3c9c9;
  color: var(--err);
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
}
.muted { color: var(--muted); }
.empty {
  text-align: center;
  padding: 3.5rem 1rem;
  color: var(--muted);
}
.empty .big { font-size: 2rem; margin-bottom: 0.5rem; }

@media (max-width: 720px) {
  thead { display: none; }
  table, tbody, tr, td { display: block; width: 100%; }
  tbody tr {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 0.85rem;
    padding: 0.4rem 0.2rem;
  }
  tbody td { border: none; padding: 0.35rem 1rem; }
  tbody td::before {
    content: attr(data-label);
    display: inline-block;
    width: 90px;
    color: var(--muted-2);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }
  td.actions { text-align: left; }
}
