:root {
  --ink: #172033;
  --muted: #5b6576;
  --line: #d5dce6;
  --paper: #e8eee9;
  --card: #fbfcfa;
  --accent: #0e5c63;
  --danger: #9b2335;
  --shadow: 0 8px 24px rgb(23 32 51 / 6%);
  --not-tested: #667085;
  --in-progress: #1d4f91;
  --passed: #1b6b4a;
  --failed: #9b2335;
  --blocked: #9a5b12;
  --skipped: #5c6570;
  --radius: 14px;
  --top: 72px;
  --max: 1500px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background:
    radial-gradient(1200px 400px at 10% -10%, #d9ebe6 0%, transparent 55%),
    var(--paper);
  color: var(--ink);
  font: 16px/1.5 "IBM Plex Sans", "Segoe UI", sans-serif;
}

.skip {
  position: absolute;
  left: -999px;
  top: 0;
}

.skip:focus {
  left: 12px;
  top: 12px;
  background: #fff;
  padding: 8px 12px;
  z-index: 40;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  gap: 10px 20px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--line);
  background: rgb(251 252 250 / 94%);
  backdrop-filter: blur(10px);
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
}

.top h1 {
  margin: 2px 0 0;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.views {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.views button,
.chip {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 13px;
  cursor: pointer;
}

.views button[aria-pressed="true"],
.chip[aria-pressed="true"] {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.run-pill {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
}

.sync {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
}

.sync[data-state="saving"] { color: var(--in-progress); }
.sync[data-state="saved"] { color: var(--passed); }
.sync[data-state="failed"],
.sync[data-state="offline"] { color: var(--failed); }
.sync[data-state="loading"] { color: var(--muted); }

.saved-at {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.top__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

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

button {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 12px;
  cursor: pointer;
}

button:hover { background: #eef4f2; }
button:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button.danger {
  color: var(--danger);
  border-color: #e4c4c8;
}

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

button.primary:hover { filter: brightness(1.06); }

.more { position: relative; }

.more__menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 200px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  z-index: 50;
}

.more__menu[hidden] { display: none; }
.more__menu:not([hidden]) { display: grid; }

.more__label {
  margin: 8px 8px 2px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.more__label:first-child { margin-top: 4px; }

.more__menu button {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
}

.banner {
  margin: 16px 24px 0;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: #fdecea;
  border: 1px solid #e7c1c4;
}

.banner__actions { margin-top: 8px; display: flex; gap: 8px; }

.complete {
  margin: 16px auto 0;
  max-width: var(--max);
  padding: 18px 20px;
  border-radius: var(--radius);
  background: #eef7f2;
  border: 1px solid #b9d8c6;
}

.complete.is-failed {
  background: #fbf3f3;
  border-color: #f0d5d8;
}

.complete h2 { margin: 0 0 8px; font-size: 1.15rem; }
.complete p { margin: 0 0 10px; }
.complete__actions { display: flex; flex-wrap: wrap; gap: 8px; }

.run-overview,
.continue-card,
.toolbar,
.filter-chips,
.workspace {
  width: min(var(--max), calc(100% - 32px));
  margin-left: auto;
  margin-right: auto;
}

.run-overview {
  margin-top: 12px;
  padding: 12px 14px 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.run-overview__head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  flex-wrap: wrap;
}

.run-overview h2 { margin: 0; font-size: 1rem; }
.progress-summary { margin: 2px 0 0; color: var(--muted); font-weight: 600; }
.priority-summary { margin: 0; color: var(--muted); font-size: 13px; font-weight: 600; }

.bar {
  margin: 10px 0 12px;
  height: 10px;
  background: #dde5df;
  border-radius: 99px;
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #0e5c63, #2a9d8f);
  transition: width 160ms ease;
}

.counts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.counts button {
  width: 100%;
  text-align: left;
  font-size: 12px;
  color: var(--muted);
}

.counts strong {
  display: block;
  color: var(--ink);
  font-size: 22px;
  line-height: 1.15;
}

.counts .passed strong { color: var(--passed); }
.counts .failed strong { color: var(--failed); }
.counts .blocked strong { color: var(--blocked); }
.counts .not_tested strong,
.counts .in_progress strong { color: var(--in-progress); }
.counts button[aria-pressed="true"] {
  background: #eef4f2;
  border-color: var(--accent);
}

.next-card {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #eef6f4;
  border: 1px solid #cfe3de;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.next-card p { margin: 0; }
.next-card strong { display: block; }
.next-card .muted { font-size: 13px; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
  margin-top: 14px;
}

.search input,
.section-filter select {
  min-width: min(100%, 240px);
  width: min(100%, 260px);
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.section-filter select { min-width: 180px; width: auto; }

.sections-open,
.sidebar-close,
.sidebar-backdrop { display: none; }

.more-filters {
  position: relative;
}

.more-filters summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
}

.more-filters .chips {
  margin-top: 8px;
}

.continue-card {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: #eef6f4;
  border: 1px solid #cfe3de;
}

.continue-card h2 {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.continue-card__row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.continue-card p { margin: 0; }
.continue-card strong { display: block; }

.toast {
  position: fixed;
  top: 76px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 28;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.toolbar__tools {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 0;
  margin-top: 8px;
}

.filter-chips:empty { display: none; }

.filter-chips button {
  font-size: 12px;
  border-radius: 999px;
  padding: 4px 10px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 320px) minmax(0, 1fr) minmax(280px, 340px);
  gap: 16px;
  align-items: start;
  padding: 14px 0 48px;
}

.sidebar,
.detail,
.section,
.test-row,
.empty {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.sidebar,
.detail {
  padding: 12px;
}

.howto {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.howto summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--accent);
}

.sidebar__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.sidebar__head h2 { margin: 0; }

.workspace.is-sidebar-collapsed {
  grid-template-columns: 72px minmax(0, 1fr) minmax(280px, 340px);
}

.sidebar.is-collapsed .mini-bar,
.sidebar.is-collapsed .section-go,
.sidebar.is-collapsed .howto,
.sidebar.is-collapsed .sidebar__head h2,
.sidebar.is-collapsed .title small {
  display: none;
}

.sidebar.is-collapsed .nav-section {
  align-items: center;
  padding: 8px 4px;
}

.sidebar.is-collapsed .nav-section__top {
  grid-template-columns: auto auto;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.sidebar.is-collapsed .title {
  font-weight: 700;
  font-size: 14px;
}

.nav-num { display: block; }

.sidebar h2,
.detail h2 {
  margin: 0 0 10px;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.nav-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
  text-align: left;
  padding: 10px 8px;
  border-radius: 12px;
  margin-bottom: 6px;
  border: 1px solid transparent;
}

.nav-section__top {
  width: 100%;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 0;
}

.nav-section:hover { background: #eef4f2; }
.nav-section.is-active {
  background: #e7f2f0;
  border-color: #b9d8d2;
  box-shadow: 0 0 0 2px rgb(14 92 99 / 12%);
}

.nav-section .mark {
  font-weight: 700;
  color: var(--muted);
}

.nav-section.is-done .mark { color: var(--passed); }
.nav-section.is-current .mark { color: var(--in-progress); }
.nav-section.is-failed .mark { color: var(--failed); }

.nav-section .title {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.nav-section small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.section-more { position: relative; }

.section-more .more__menu {
  right: 0;
  left: auto;
}

.section__tools {
  position: relative;
  z-index: 2;
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

.section__grow {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
}

.section .chevron {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.section.is-current {
  box-shadow: 0 0 0 2px rgb(14 92 99 / 16%);
}

.nav-section .section-go {
  align-self: start;
  font-size: 12px;
  padding: 4px 8px;
  color: var(--muted);
}

.mini-bar {
  height: 4px;
  background: #dde5df;
  border-radius: 99px;
  overflow: hidden;
}

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

.main { min-width: 0; }

.section {
  margin: 0 0 12px;
  overflow: visible;
  scroll-margin-top: 88px;
}

.section__head {
  display: flex;
  gap: 10px;
  align-items: center;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  padding: 12px 14px;
}

.section__head:hover { background: #f4f8f6; }
.section__grow { flex: 1; min-width: 0; }
.section h3 { margin: 0; font-size: 1rem; }
.meta { color: var(--muted); font-size: 13px; }

.section__body { padding: 0 10px 10px; }

.subsection-label {
  margin: 10px 4px 6px;
  font-size: 12px;
  font-weight: 650;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.test-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  margin: 6px 0 0;
  padding: 10px 12px;
  text-align: left;
  border-left: 4px solid #c5cdd6;
  cursor: pointer;
}

.test-row.is-in_progress { border-left-color: var(--in-progress); }
.test-row.is-passed { border-left-color: var(--passed); }
.test-row.is-failed {
  border-left-color: var(--failed);
  background: #fbf3f3;
}
.test-row.is-blocked { border-left-color: var(--blocked); }
.test-row.is-skipped { border-left-color: var(--skipped); }
.test-row.is-active,
.test-row:focus-visible {
  box-shadow: 0 0 0 2px rgb(14 92 99 / 22%);
}

.test-row h4 { margin: 0; font-size: 0.95rem; }
.test-row .id {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 12px;
  color: var(--muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 108px;
  justify-content: center;
  font-size: 12px;
  font-weight: 650;
  border-radius: 999px;
  padding: 3px 8px;
  background: #eeeae1;
  color: var(--not-tested);
}

.badge.in_progress { background: #e7eef8; color: var(--in-progress); }
.badge.passed { background: #e5f4ea; color: var(--passed); }
.badge.failed { background: #f8e6e8; color: var(--failed); }
.badge.blocked { background: #f8edd9; color: var(--blocked); }
.badge.skipped { background: #eceff2; color: var(--skipped); }

.prio {
  font-size: 11px;
  font-weight: 650;
  color: #7a3e08;
  background: #f8edd9;
  border-radius: 999px;
  padding: 1px 7px;
}

.prio.p1 { color: var(--muted); background: #eef1f4; }

.empty {
  padding: 28px;
  text-align: center;
  color: var(--muted);
}

.detail h3 { margin: 0 0 4px; font-size: 1.05rem; }
.detail .id {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 12px;
  color: var(--muted);
}

.detail__head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
}

.detail__nav {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--muted);
}

.spec {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.spec__row {
  display: grid;
  gap: 4px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #f4f7f5;
}

.spec__row dt {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.spec__row dd { margin: 0; }
.spec__row.given { border-left: 3px solid #5b6576; }
.spec__row.when { border-left: 3px solid var(--in-progress); }
.spec__row.then { border-left: 3px solid var(--passed); background: #eef7f2; }

.detail code,
.test-row .id {
  word-break: break-all;
}

.status-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.status-actions button[aria-pressed="true"] {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.status-actions button[data-status="passed"][aria-pressed="true"] { background: var(--passed); border-color: var(--passed); }
.status-actions button[data-status="failed"][aria-pressed="true"] { background: var(--failed); border-color: var(--failed); }

.field {
  display: grid;
  gap: 4px;
  margin: 10px 0 0;
}

.field span,
.field legend { font-size: 13px; color: var(--muted); }

.field label { display: block; margin: 4px 0; }

textarea, .field input, .field select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

textarea { min-height: 72px; resize: vertical; }

.failure-box {
  margin-top: 12px;
  padding: 10px;
  border-radius: 10px;
  background: #fbf3f3;
  border: 1px solid #f0d5d8;
}

.muted { color: var(--muted); font-size: 13px; }

.mobile-bar {
  position: fixed;
  inset: auto 0 0;
  display: flex;
  gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: rgb(251 252 250 / 96%);
  border-top: 1px solid var(--line);
  z-index: 22;
}

.mobile-bar button { flex: 1; }
.mobile-bar .primary { flex: 1.3; }

.modal {
  position: fixed;
  inset: 0;
  background: rgb(23 32 51 / 40%);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 30;
}

.modal[hidden] { display: none; }

.modal__card {
  width: min(520px, 100%);
  background: #fff;
  border-radius: 14px;
  padding: 18px;
  border: 1px solid var(--line);
}

.modal__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

.keys-list {
  display: grid;
  gap: 8px;
  margin: 0 0 12px;
}

.keys-list > div {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 10px;
  align-items: center;
}

.keys-list dt { margin: 0; }
.keys-list dd { margin: 0; }

kbd {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 11px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 4px;
  padding: 0 4px;
}

@media (min-width: 1100px) {
  .top {
    grid-template-columns: minmax(180px, 1fr) auto auto auto;
    align-items: center;
  }
  .sidebar,
  .detail {
    position: sticky;
    top: calc(var(--top) + 12px);
  }
}

@media (max-width: 1099px) {
  .workspace,
  .workspace.is-sidebar-collapsed {
    grid-template-columns: 1fr;
  }
  .sidebar,
  .detail {
    position: static;
    max-height: none;
  }
  .detail { display: none; }
  .sidebar {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 4px 10px;
  }
  .sidebar__head,
  .howto { grid-column: 1 / -1; }
  .sidebar-collapse { display: none; }
  .run-overview,
  .continue-card,
  .toolbar,
  .filter-chips,
  .workspace {
    width: calc(100% - 28px);
  }
}

@media (max-width: 800px) {
  .sections-open { display: inline-flex; }
  .sidebar-close { display: inline-flex; }
  .workspace { display: block; }
  .sidebar {
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    width: min(320px, 88vw);
    z-index: 36;
    transform: translateX(-110%);
    transition: transform 160ms ease;
    border-radius: 0;
    overflow: auto;
    padding-bottom: 24px;
  }
  .sidebar.is-drawer-open { transform: translateX(0); }
  .sidebar-backdrop.is-open {
    display: block;
    position: fixed;
    inset: 0;
    background: rgb(23 32 51 / 40%);
    z-index: 35;
  }
}

body.is-runner .top__actions #btn-continue { display: none; }

.runner-wrap {
  width: min(860px, calc(100% - 32px));
  margin: 16px auto 96px;
}

.runner {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px 20px;
}

.runner__top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.runner h2 { margin: 8px 0 4px; font-size: 1.2rem; }
.runner .id { font-family: "IBM Plex Mono", ui-monospace, monospace; }
.runner__meta { color: var(--muted); font-size: 13px; margin: 0 0 10px; }
.runner__stats { display: flex; flex-wrap: wrap; gap: 10px 16px; color: var(--muted); font-size: 13px; margin: 0 0 14px; }

.runner__result {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 16px 0;
}

.runner__result button { min-height: 48px; font-weight: 700; }
.runner__result [data-status="passed"] { color: var(--passed); border-color: #b9d8c6; }
.runner__result [data-status="failed"] { color: var(--failed); border-color: #e7c1c4; }
.runner__result [data-status="blocked"] { color: var(--blocked); border-color: #e7d3b0; }
.runner__result [data-status="skipped"] { color: var(--skipped); }

.runner__nav {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.runner-complete { text-align: center; padding: 12px 0; }
.runner-complete h2 { margin-bottom: 8px; }
.runner-complete .actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; }

.auto-next { display: flex; align-items: center; gap: 8px; margin: 8px 0 0; font-size: 13px; }

.runner-sticky {
  display: none;
}

@media (max-width: 700px) {
  .runner-wrap { margin-bottom: 140px; }
  .runner-sticky {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    position: fixed;
    inset: auto 0 0;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    background: rgb(251 252 250 / 96%);
    border-top: 1px solid var(--line);
    z-index: 22;
  }
  .runner-sticky button { min-height: 46px; font-weight: 700; }
}

@media (max-width: 700px) {
  .top, .banner { padding-left: 14px; padding-right: 14px; }
  .counts { grid-template-columns: repeat(2, 1fr); }
  .test-row { grid-template-columns: 1fr; }
  .toolbar__tools { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .bar span { transition: none; }
}
