:root {
  color-scheme: light;
  --navy: #012650;
  --navy-2: #0a376e;
  --pink: #df61aa;
  --purple: #8130f1;
  --gold: #eac632;
  --ink: #142033;
  --muted: #5d6b80;
  --line: #e2e8f1;
  --paper: #f4f7fb;
  --card: #ffffff;
  --up: #157a45;
  --warn: #9a7410;
  --down: #c53b4b;
  --idle: #607089;
  font-family: "IBM Plex Sans", sans-serif;
}

* { box-sizing: border-box; }
/* Author display rules (e.g. .login-shell { display: grid }) beat the UA [hidden]
   stylesheet, so without this the Sign-in screen stays on top after a successful login. */
[hidden] {
  display: none !important;
}
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(720px 280px at 100% -40px, rgba(129, 48, 241, 0.08), transparent 60%),
    var(--paper);
  color: var(--ink);
}
button { font: inherit; }
.mono { font-family: "IBM Plex Mono", monospace; }

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 18px;
  background:
    radial-gradient(720px 320px at 12% -10%, rgba(223, 97, 170, 0.18), transparent 55%),
    radial-gradient(640px 280px at 100% 0%, rgba(129, 48, 241, 0.12), transparent 50%),
    linear-gradient(160deg, var(--navy) 0%, var(--navy-2) 48%, #071a38 100%);
}
.login-card {
  width: min(420px, 100%);
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 22px;
  padding: 28px 26px 24px;
  box-shadow: 0 24px 60px rgba(1, 38, 80, 0.28);
  display: grid;
  gap: 12px;
}
.login-logo {
  height: 58px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  justify-self: start;
}
.login-card .product {
  margin: 4px 0 0;
}
.login-card h1 {
  margin: 0;
  color: var(--navy);
  font-size: 28px;
  letter-spacing: -0.03em;
}
.login-lead {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}
.field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.field input {
  font: inherit;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  background: #fbfcfe;
}
.field input:focus {
  outline: 2px solid rgba(223, 97, 170, 0.35);
  border-color: var(--pink);
}
.login-error {
  margin: 0;
  color: var(--down);
  font-size: 13px;
}
.login-card button {
  margin-top: 4px;
  width: 100%;
}
button.ghost {
  background: transparent;
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.28);
}
button.ghost:hover {
  background: rgba(255, 255, 255, 0.08);
}

.mast {
  background: var(--navy);
  color: white;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 28px;
  align-items: center;
  padding: 18px 28px;
}
.logo {
  height: 68px;
  width: auto;
  max-width: min(420px, 42vw);
  object-fit: contain;
  display: block;
}
.product {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--pink);
}
.mast-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}
.target-pick {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.target-pick select {
  font: inherit;
  letter-spacing: 0;
  text-transform: none;
  color: var(--navy);
  background: white;
  border: 0;
  border-radius: 999px;
  padding: 8px 14px;
  min-width: 150px;
}
.stamp { margin: 6px 0 0; color: rgba(255, 255, 255, 0.72); font-size: 12px; }
.live {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.08);
}
.live.up { color: #b7ebc9; }
.live.degraded { color: var(--gold); }
.live.down { color: #ffb4bc; }
.live.unknown { color: rgba(255, 255, 255, 0.7); }
button {
  border: 0;
  background: var(--pink);
  color: white;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
}
button:hover { background: #ec77bb; }
button:disabled { opacity: 0.65; cursor: wait; }

.kpis, .split, .checks, .foot {
  width: min(1180px, calc(100% - 36px));
  margin-inline: auto;
}
.kpis {
  display: grid;
  grid-template-columns: 1.35fr repeat(4, 1fr);
  gap: 12px;
  padding: 22px 0 8px;
}
.kpi, .panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
}
.kpi {
  padding: 16px 18px 14px;
  position: relative;
  overflow: hidden;
}
.kpi::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--navy);
}
.kpi.status-up::before { background: var(--up); }
.kpi.status-degraded::before { background: var(--gold); }
.kpi.status-down::before { background: var(--pink); }
.kpi.status-unknown::before { background: var(--idle); }
.kpi span, .panel-head p { color: var(--muted); font-size: 12px; }
.kpi strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
  letter-spacing: -0.04em;
  color: var(--navy);
}
.kpi em { font-style: normal; font-size: 13px; color: var(--muted); }
.status-up strong { color: var(--up); }
.status-degraded strong { color: var(--warn); }
.status-down strong { color: var(--down); }

.split {
  display: grid;
  grid-template-columns: 1.45fr 0.8fr;
  gap: 12px;
  padding-top: 12px;
}
.panel { padding: 16px 18px 18px; min-height: 280px; }
.panel-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.panel-head h2, .group h2 { margin: 0; font-size: 16px; color: var(--navy); }
.panel-head p { margin: 0; }
.chart { height: 210px; margin-top: 8px; }
.chart svg { width: 100%; height: 100%; display: block; }
.chart .empty, .incidents .empty, .group .empty { color: var(--muted); padding: 28px 0; }

.incident {
  display: grid;
  grid-template-columns: 10px 1fr;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.incident:first-child { border-top: 0; }
.dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; background: var(--pink); }
.dot.closed { background: var(--up); }
.incident strong { display: block; font-size: 14px; }
.incident p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }

.checks { padding: 12px 0 8px; display: grid; gap: 12px; }
.group h2 { margin-bottom: 12px; }
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: #fbfcfe;
  min-height: 112px;
  border-top: 3px solid var(--navy);
}
.card.tone-pass { border-top-color: var(--up); }
.card.tone-degraded { border-top-color: var(--gold); }
.card.tone-fail { border-top-color: var(--pink); }
.card.tone-unlicensed, .card.tone-skipped { border-top-color: var(--idle); }
.card header { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.card h3 { margin: 0; font-size: 14px; font-weight: 600; color: var(--navy); }
.pill {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 3px 7px;
}
.pass { color: var(--up); background: rgba(21, 122, 69, 0.1); }
.degraded { color: var(--warn); background: rgba(234, 198, 50, 0.22); }
.fail { color: var(--down); background: rgba(223, 97, 170, 0.14); }
.unlicensed, .skipped { color: var(--idle); background: rgba(96, 112, 137, 0.12); }
.card p { margin: 10px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.card .meta { font-family: "IBM Plex Mono", monospace; }

.foot {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0 28px;
  color: var(--muted);
}
.foot img {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 8px;
  background: white;
}
.foot p { margin: 0; font-size: 13px; letter-spacing: 0.04em; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.agent-launch {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 40;
  background: var(--navy);
  color: white;
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 600;
  letter-spacing: 0.04em;
  box-shadow: 0 12px 28px rgba(1, 38, 80, 0.28);
}
.agent-launch:hover { background: var(--navy-2); }
.agent-launch[aria-expanded="true"] { background: var(--purple); }

.agent-panel {
  position: fixed;
  right: 18px;
  bottom: 78px;
  z-index: 45;
  width: min(400px, calc(100vw - 28px));
  height: min(520px, calc(100vh - 120px));
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 18px 48px rgba(1, 38, 80, 0.2);
  overflow: hidden;
}
.agent-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--navy) 0%, #0a376e 70%, rgba(129, 48, 241, 0.85) 100%);
  color: white;
}
.agent-head h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0.04em;
}
.agent-sub {
  margin: 4px 0 0;
  color: rgba(255, 255, 255, 0.75);
  font-size: 12px;
}
.agent-close {
  background: rgba(255, 255, 255, 0.12);
  color: white;
  border: 0;
  border-radius: 10px;
  width: 34px;
  height: 34px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
}
.agent-close:hover { background: rgba(255, 255, 255, 0.22); }

.agent-messages {
  overflow: auto;
  padding: 14px 16px;
  display: grid;
  gap: 10px;
  align-content: start;
  background: #f8fafc;
}
.agent-empty {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}
.agent-msg {
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
}
.agent-msg.user {
  justify-self: end;
  background: var(--navy);
  color: white;
}
.agent-msg.agent {
  justify-self: start;
  background: white;
  border: 1px solid var(--line);
  color: var(--ink);
}
.agent-msg .who {
  display: block;
  margin-bottom: 4px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--pink);
  font-weight: 600;
}
.agent-msg.user .who { color: rgba(255, 255, 255, 0.72); }

.agent-error {
  margin: 0;
  padding: 8px 16px;
  color: var(--down);
  font-size: 12px;
  background: rgba(197, 59, 75, 0.08);
}

.agent-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 12px 14px 14px;
  border-top: 1px solid var(--line);
  background: white;
}
.agent-form input {
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fbfcfe;
  color: var(--ink);
}
.agent-form input:focus {
  outline: 2px solid rgba(223, 97, 170, 0.35);
  border-color: var(--pink);
}
.agent-form button {
  border-radius: 12px;
  padding: 10px 14px;
}

@media (max-width: 980px) {
  .mast, .kpis, .split, .grid { grid-template-columns: 1fr 1fr; }
  .mast { display: flex; flex-wrap: wrap; }
  .logo { width: min(360px, 100%); }
}
@media (max-width: 640px) {
  .kpis, .split, .grid { grid-template-columns: 1fr; }
  .mast-actions { width: 100%; justify-content: space-between; }
  .agent-panel {
    right: 10px;
    left: 10px;
    width: auto;
    bottom: 72px;
  }
  .agent-launch { right: 14px; bottom: 14px; }
}
