:root {
  color-scheme: dark;
  --ink: #f5f7fb;
  --muted: #91a0b8;
  --line: #2a3950;
  --canvas: #080d19;
  --card: #111827;
  --panel-2: #172033;
  --navy: #0b1120;
  --yellow: #f8bf00;
  --yellow-hover: #ffd34d;
  --green: #6ee7b7;
  --red: #f87171;
  --red-soft: #2b1118;
  --orange: #fbbf24;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    linear-gradient(rgba(8, 13, 25, .97), rgba(8, 13, 25, .99)),
    repeating-linear-gradient(135deg, transparent 0 48px, #263349 49px 51px);
}
button { font: inherit; cursor: pointer; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 6px; font-size: clamp(28px, 4vw, 42px); letter-spacing: -.04em; }
h2 { margin-bottom: 0; font-size: 24px; }
.eyebrow { margin-bottom: 8px; color: var(--yellow); font-size: 11px; font-weight: 800; letter-spacing: .12em; }
.intro { margin-bottom: 0; color: var(--muted); line-height: 1.55; }

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at 16% 12%, rgba(248, 191, 0, .16), transparent 32%),
    radial-gradient(circle at 86% 80%, rgba(19, 138, 91, .14), transparent 30%),
    var(--navy);
}
.auth-card {
  width: min(460px, 100%);
  padding: 32px;
  border: 1px solid #26364d;
  border-radius: 12px;
  background: rgba(17, 24, 39, .98);
  box-shadow: 0 30px 90px #0008;
}
.auth-brand { display: flex; align-items: center; gap: 16px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(248, 191, 0, .42);
  border-radius: 14px;
  background: #101827;
  box-shadow: 0 12px 30px rgba(248, 191, 0, .16);
}
.brand-mark img { width: 76%; height: 76%; display: block; object-fit: contain; }
.auth-footnote { margin: 18px 0 0; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; text-align: center; }
#sign-in { margin-top: 22px; }

.topbar {
  min-height: 70px;
  padding: 0 max(24px, calc((100vw - 1240px) / 2));
  display: flex;
  align-items: center;
  gap: 18px;
  color: white;
  background: #101827;
  border-bottom: 1px solid var(--line);
}
.topbar-brand { display: flex; align-items: center; gap: 11px; min-width: 245px; }
.topbar-brand strong { display: block; font-size: 15px; }
.topbar-brand span { display: block; margin-top: 2px; color: #9eabc4; font-size: 11px; }
.topbar-title { flex: 1; color: #c6d0e3; font-size: 13px; }
.topbar .brand-mark { width: 36px; height: 36px; border-radius: 11px; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.muted, .auto-refresh { color: var(--muted); font-size: 13px; }
.topbar .muted { color: #b9c5d8; }

button {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 13px;
  color: var(--ink);
  background: var(--panel-2);
  font-weight: 700;
}
button.secondary { border-color: var(--yellow); color: #17120a; background: var(--yellow); box-shadow: 0 8px 22px #f8bf0026; }
button.secondary:hover { background: var(--yellow-hover); }
button.ghost { color: white; background: #ffffff12; }
button.action { padding: 7px 10px; font-size: 12px; }
button.action:hover { border-color: #5d7090; background: #202c40; }
button:disabled { cursor: wait; opacity: .55; }

main { width: min(1240px, calc(100% - 48px)); margin: 28px auto 60px; }
.summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.summary article { padding: 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.summary span { display: block; margin-bottom: 8px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.summary strong { font-size: 28px; }
.section-heading { margin: 34px 0 14px; display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.machines { display: grid; gap: 18px; }
.machine { overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--card); box-shadow: 0 16px 40px rgba(0, 0, 0, .18); }
.machine-head { padding: 18px 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); }
.machine-head h3 { margin-bottom: 4px; }
.machine-meta { color: var(--muted); font-size: 12px; }
.components { display: grid; grid-template-columns: repeat(auto-fit, minmax(245px, 1fr)); }
.component { min-height: 148px; padding: 17px 20px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.component-title { display: flex; justify-content: space-between; gap: 12px; }
.component h4 { margin: 0; font-size: 15px; }
.component dl { margin: 14px 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; color: var(--muted); font-size: 12px; }
.component dd { margin: 0; color: var(--ink); text-align: right; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 750; }
.status::before { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); content: ""; }
.status.healthy::before, .status.online::before, .status.completed::before { background: var(--green); }
.status.error::before, .status.failed::before { background: var(--red); }
.status.degraded::before, .status.leased::before, .status.queued::before { background: var(--orange); }
.table-card { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 13px 16px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); background: #101827; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.banner, .error { margin: 18px 0; padding: 13px 16px; border: 1px solid #7f1d1d; border-radius: 8px; color: #fecaca; background: var(--red-soft); }
.empty { padding: 28px; color: var(--muted); text-align: center; }

@media (max-width: 760px) {
  .topbar { padding: 14px; flex-wrap: wrap; }
  .topbar-title { display: none; }
  .header-actions, .section-heading { align-items: flex-start; flex-direction: column; }
  .header-actions { width: 100%; }
  .summary { grid-template-columns: repeat(2, 1fr); }
  main { width: min(100% - 28px, 1240px); }
  .auto-refresh, #updated { display: none; }
}
