:root {
  color-scheme: dark;
  --lime: #d1ff10;
  --lime-fg: #0b0b0b;
  --lime-ring: rgba(230, 250, 0, .55);
  --lime-glow: rgba(209, 255, 16, .06);
  --bg: #0b171f;
  --surface: #0d232d;
  --surface-2: #0a1c24;
  --surface-3: #08121a;
  --fg: #eceff2;
  --fg-muted: #94999e;
  --heading: #c7d0d6;
  --border: rgba(74, 78, 82, .5);
  --border-strong: rgba(74, 78, 82, .9);
  --online: #4ade80;
  --offline: #94999e;
  --destructive: #fe0019;
  --info: #5b8cff;
  --q-excellent: #22c55e;
  --q-good: #a3e635;
  --q-fair: #f0b429;
  --q-poor: #f87171;
  --q-critical: #dc2626;
  --radius-control: 8px;
  --radius-card: 14px;
  --radius-pill: 999px;
  --shadow-card: 0 2px 10px rgba(0, 0, 0, .3);
  --ease: cubic-bezier(.2, .6, .2, 1);
}

* { box-sizing: border-box; }

html { scrollbar-color: var(--border-strong) var(--bg); scrollbar-width: thin; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font: 400 15px/1.55 Inter, "TT Commons Pro", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

a { color: inherit; }
button, input { font: inherit; }

.shell { min-height: 100vh; }

.topbar {
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 18px; }
.brand img { display: block; width: 140px; height: auto; }
.product-name { padding-left: 18px; border-left: 1px solid var(--border); font-weight: 700; letter-spacing: -.02em; }
.environment { color: var(--fg-muted); font-size: 12px; }
.operator { display: flex; align-items: center; gap: 14px; color: var(--fg-muted); font-size: 12px; }
.operator form { margin: 0; }
.ghost { padding: 8px 13px; border: 1px solid var(--border); background: transparent; color: var(--fg); }
.ghost:hover { background: #393e42; }

main { width: min(1180px, 100%); margin: 0 auto; padding: 44px 28px 80px; }

.page-header { display: flex; justify-content: space-between; gap: 24px; align-items: end; margin-bottom: 38px; }
.eyebrow { color: var(--lime); font-size: 11px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; }
h1 { margin: 8px 0 6px; font-size: clamp(34px, 5vw, 48px); line-height: 1.03; letter-spacing: -1.6px; }
h2, h3, p { margin-top: 0; }
h2 { margin-bottom: 0; color: var(--heading); font-size: 14px; font-weight: 900; }
h3 { font-size: 18px; }
p { color: var(--fg-muted); }
.page-header p { margin-bottom: 0; }

.section { margin-top: 40px; }
.section-title { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.section-title span { color: var(--fg-muted); font-size: 12px; }
.section-actions { justify-content: space-between; align-items: end; }
.section-actions > div { display: flex; align-items: baseline; gap: 12px; }
.enrol-form { min-width: min(420px, 100%); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(310px, 1fr)); gap: 16px; }

.card, .empty, .metric {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 24px;
}

.agent-head { display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.agent-name { display: flex; align-items: center; gap: 10px; }
.status { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--offline); }
.status.online { background: var(--online); box-shadow: 0 0 0 4px rgba(74, 222, 128, .1); }
.pill { display: inline-flex; align-items: center; border-radius: var(--radius-pill); padding: 4px 10px; background: var(--surface-2); color: var(--fg-muted); font-size: 12px; }
.pill.state-completed { color: var(--online); background: rgba(74, 222, 128, .1); }
.pill.state-failed, .pill.state-cancelled, .pill.state-expired { color: #ff8d98; background: rgba(254, 0, 25, .1); }
.pill.state-running, .pill.state-queued { color: #9bb8ff; background: rgba(91, 140, 255, .12); }

dl { display: flex; flex-wrap: wrap; gap: 28px; margin: 22px 0; }
dl div { display: flex; flex-direction: column; }
dt, label { color: var(--fg-muted); font-size: 11px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; }
dd { margin: 3px 0 0; font-family: "JetBrains Mono", ui-monospace, Consolas, monospace; font-size: 13px; }

form { display: flex; gap: 10px; align-items: end; }
label { flex: 1; }
input { width: 100%; margin-top: 7px; padding: 11px 12px; background: var(--surface-3); border: 1px solid var(--border); border-radius: var(--radius-control); color: var(--fg); outline: none; }
input:focus { border-color: var(--lime); box-shadow: 0 0 0 1px var(--lime-ring); }
button { padding: 11px 16px; border: 0; border-radius: var(--radius-pill); background: var(--lime); color: var(--lime-fg); font-weight: 700; cursor: pointer; transition: filter 120ms var(--ease), transform 120ms var(--ease); }
button:hover { filter: brightness(1.06); }
button:active { transform: scale(.97); }
button:focus-visible { outline: 1px solid var(--lime); outline-offset: 3px; }
button:disabled { opacity: .35; cursor: not-allowed; }

.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-card); box-shadow: var(--shadow-card); }
table { width: 100%; border-collapse: collapse; background: var(--surface); }
th, td { padding: 14px 16px; text-align: left; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: 0; }
th { color: var(--fg-muted); font-size: 11px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; }
td a { color: var(--fg); font-weight: 600; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
td a:hover { color: var(--lime); }

.back { display: inline-flex; margin-bottom: 28px; color: var(--fg-muted); text-decoration: none; }
.back:hover { color: var(--lime); }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }
.metric span { display: block; color: var(--heading); font-size: 14px; font-weight: 900; }
.metric strong { display: block; margin-top: 15px; font: 700 34px/1.1 "JetBrains Mono", ui-monospace, Consolas, monospace; letter-spacing: -1px; }
.metric small { color: var(--fg-muted); font-size: 13px; font-weight: 400; }

.login-page { background: #004449; }
.login-shell { width: min(1120px, 100%); min-height: 100vh; display: grid; grid-template-columns: 1.15fr .85fr; gap: 64px; align-items: center; padding: 48px 32px; }
.login-brand { display: flex; min-height: 520px; flex-direction: column; justify-content: space-between; }
.login-brand > img { width: 180px; }
.login-brand h1 { max-width: 700px; font-size: clamp(44px, 6vw, 72px); font-weight: 500; }
.login-brand p { max-width: 580px; color: rgba(255, 255, 255, .7); font-size: 18px; }
.login-panel { padding: 34px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); box-shadow: 0 12px 32px rgba(0, 0, 0, .35); }
.login-panel h2 { color: var(--fg); font-size: 24px; font-weight: 700; }
.login-form { display: flex; flex-direction: column; align-items: stretch; gap: 18px; margin-top: 28px; }
.login-form button { margin-top: 6px; }
.form-error { padding: 11px 13px; border: 1px solid rgba(254, 0, 25, .3); border-radius: var(--radius-control); background: rgba(254, 0, 25, .1); color: #ff9ba5; }
.secret-card { max-width: 760px; }
.secret-card code { display: block; overflow-wrap: anywhere; margin: 18px 0; padding: 18px; border: 1px solid var(--lime-ring); border-radius: var(--radius-control); background: var(--surface-3); color: var(--lime); font: 13px/1.6 "JetBrains Mono", ui-monospace, Consolas, monospace; }

@media (max-width: 680px) {
  .topbar { height: auto; padding: 20px; align-items: flex-start; }
  .brand { align-items: flex-start; flex-direction: column; gap: 10px; }
  .product-name { padding: 0; border: 0; }
  main { padding: 32px 18px 64px; }
  .page-header { align-items: flex-start; flex-direction: column; }
  .section-actions { align-items: stretch; flex-direction: column; }
  form { align-items: stretch; flex-direction: column; }
  .operator { align-items: flex-end; flex-direction: column; }
  .operator form { flex-direction: row; }
  .login-shell { display: block; padding: 28px 18px; }
  .login-brand { min-height: 0; margin-bottom: 38px; }
  .login-brand > img { width: 140px; margin-bottom: 54px; }
  .login-brand h1 { font-size: 40px; }
  .login-panel { padding: 24px; }
}
