:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #eef2f6;
  --line: #d7dee7;
  --line-strong: #c2ccd8;
  --text: #15202b;
  --muted: #5b6b7c;
  --accent: #09a2f1;
  --accent-soft: #e6f6fd;
  --accent-ink: #045f8f;
  --pass: #1a7f4b;
  --pass-bg: #e7f7ee;
  --fail: #b42318;
  --fail-bg: #fdecec;
  --block: #9a6700;
  --block-bg: #fff6e0;
  --idle: #667085;
  --idle-bg: #eef1f4;
  --radius: 8px;
  --font: "IBM Plex Sans", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", "Consolas", monospace;
  --sidebar-w: 200px;
  --header-h: 56px;
  --shadow: 0 1px 2px rgba(21, 32, 43, 0.06);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
}

a {
  color: var(--accent-ink);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--header-h) 1fr;
  min-height: 100vh;
}

.top-header {
  grid-column: 1 / -1;
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.top-header .brand-inline {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.brand-logo {
  height: 28px;
  width: auto;
  display: block;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  min-width: 0;
}

.brand-copy strong {
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-ink);
}

.brand-copy span,
.top-header .brand-inline span {
  color: var(--muted);
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-chip {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.55rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.session-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.btn-quiet {
  border: 0;
  background: transparent;
  color: var(--accent-ink);
  padding: 0.2rem 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-quiet:hover {
  text-decoration: underline;
  background: transparent;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.35rem 0.55rem 1rem;
  margin-bottom: 0.35rem;
  border-bottom: 1px solid var(--line);
}

.sidebar-brand img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.sidebar-brand strong {
  display: block;
  font-size: 0.95rem;
}

.sidebar-brand span {
  color: var(--muted);
  font-size: 0.75rem;
}

.page-title h1 {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.grid-kpi-primary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid-kpi-secondary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.kpi-primary {
  border-color: #b9dcf2;
  background: linear-gradient(180deg, #fff 0%, #f3faff 100%);
}

.kpi-primary .kpi-value {
  font-size: 1.75rem;
  color: var(--accent-ink);
}

.kpi-danger {
  border-color: #f0b4b4;
  background: var(--fail-bg);
}

.kpi-danger .kpi-value {
  color: var(--fail);
}

.kpi-secondary {
  box-shadow: none;
  background: var(--surface-2);
}

.kpi-secondary .kpi-value {
  font-size: 1.15rem;
}

.pin-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(900px 420px at 50% -10%, rgba(9, 162, 241, 0.18), transparent 55%),
    var(--bg);
}

.pin-card {
  width: min(100%, 400px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.5rem 1.35rem 1.35rem;
  box-shadow: 0 12px 40px rgba(21, 32, 43, 0.08);
}

.pin-logo {
  height: 36px;
  width: auto;
  display: block;
  margin-bottom: 1rem;
}

.pin-card h1 {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.pin-card .muted {
  margin: 0 0 1rem;
}

.header-controls {
  display: flex;
  align-items: end;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.sidebar {
  grid-column: 1;
  grid-row: 2;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 1rem 0.75rem;
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow: auto;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.nav a {
  color: var(--text);
  padding: 0.55rem 0.75rem;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 500;
}

.nav a:hover {
  background: var(--surface-2);
  text-decoration: none;
}

.nav a.active {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.sidebar-footer {
  margin-top: 1.5rem;
  padding: 0.75rem;
  color: var(--muted);
  font-size: 0.75rem;
  border-top: 1px solid var(--line);
}

.main {
  grid-column: 2;
  grid-row: 2;
  padding: 1.25rem 1.5rem 2.5rem;
  width: 100%;
  min-width: 0;
}

.page-title {
  margin: 0 0 1rem;
}

.page-title h1 {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.page-title p {
  margin: 0.3rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

label.field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 0.45rem 0.6rem;
  min-width: 0;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(9, 162, 241, 0.35);
  border-color: var(--accent);
}

textarea {
  width: 100%;
  min-height: 96px;
  resize: vertical;
}

button,
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  border-radius: 6px;
  padding: 0.45rem 0.8rem;
  cursor: pointer;
  font-weight: 550;
  text-decoration: none;
}

button:hover,
.btn:hover {
  background: var(--surface-2);
  text-decoration: none;
}

button.primary,
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

button.primary:hover,
.btn.primary:hover {
  filter: brightness(0.96);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel-pad {
  padding: 1rem 1.1rem;
}

.panel + .panel,
.stack > * + * {
  margin-top: 1rem;
}

.panel h2 {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  font-weight: 650;
}

.grid-kpi {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  box-shadow: var(--shadow);
}

.kpi-value {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.kpi-label {
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 4px;
  padding: 0.12rem 0.45rem;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge.healthy,
.badge.status-passed {
  background: var(--pass-bg);
  color: var(--pass);
}

.badge.watch,
.badge.status-blocked {
  background: var(--block-bg);
  color: var(--block);
}

.badge.at-risk,
.badge.status-failed {
  background: var(--fail-bg);
  color: var(--fail);
}

.badge.status-not_tested {
  background: var(--idle-bg);
  color: var(--idle);
}

.badge.platform {
  background: var(--accent-soft);
  color: var(--accent-ink);
  text-transform: none;
  font-weight: 600;
}

.progress {
  height: 8px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}

.progress > span {
  display: block;
  height: 100%;
  background: var(--accent);
}

.health-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.table-wrap {
  overflow: auto;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

table.data th,
table.data td {
  text-align: left;
  padding: 0.65rem 0.7rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

table.data th {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--surface-2);
  position: sticky;
  top: 0;
}

table.data tbody tr:hover td {
  background: #f8fafc;
}

table.data td.summary {
  max-width: 340px;
}

.mono {
  font-family: var(--mono);
  font-size: 0.82rem;
}

.split-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.split-case {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.9fr);
  gap: 1rem;
  align-items: start;
}

.muted {
  color: var(--muted);
}

.list-plain {
  margin: 0;
  padding-left: 1.15rem;
}

.list-plain li + li {
  margin-top: 0.35rem;
}

.steps {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 1.5rem 1fr;
  gap: 0.55rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--line);
}

.steps li::before {
  content: counter(step);
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 0.75rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.steps li:last-child {
  border-bottom: 0;
}

.status-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.4rem;
}

.status-group button[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.flash {
  padding: 0.7rem 0.85rem;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  margin-bottom: 1rem;
}

.flash.ok {
  background: var(--pass-bg);
  border-color: #b7e4c7;
  color: var(--pass);
}

.flash.err {
  background: var(--fail-bg);
  border-color: #f3c1c1;
  color: var(--fail);
}

.filter-bar {
  display: grid;
  grid-template-columns: minmax(180px, 1.6fr) repeat(5, minmax(120px, 1fr));
  gap: 0.65rem;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  align-items: end;
}

.platform-tabs {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}

.platform-tabs button {
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  font-size: 0.85rem;
}

.platform-tabs button[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.suite-group {
  margin-bottom: 1rem;
}

.suite-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.9rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  font-weight: 650;
}

.suite-group-header .count {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.meta-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.65rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--muted);
}

.boot-error {
  max-width: 520px;
  margin: 4rem auto;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.boot-error h1 {
  margin: 0 0 0.5rem;
  font-size: 1.2rem;
}

.boot-error code {
  font-family: var(--mono);
  font-size: 0.85rem;
  background: var(--surface-2);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr;
  }

  .top-header {
    grid-column: 1;
  }

  .sidebar {
    grid-column: 1;
    grid-row: 2;
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .main {
    grid-column: 1;
    grid-row: 3;
    padding: 1rem;
  }

  .grid-kpi,
  .grid-kpi-primary,
  .grid-kpi-secondary,
  .split-2,
  .split-case,
  .filter-bar {
    grid-template-columns: 1fr;
  }

  .status-group {
    grid-template-columns: 1fr 1fr;
  }
}
