:root {
  color-scheme: dark;
  --bg: #12171c;
  --surface: #182029;
  --surface-2: #202a34;
  --surface-3: #293541;
  --line: #394653;
  --muted: #a8b2bd;
  --text: #f5f7fa;
  --blue: #4f7dff;
  --cyan: #22b8c7;
  --green: #55d18c;
  --yellow: #ffd65a;
  --red: #ff6f6f;
  --paper: #f8fafc;
  --ink: #171a1f;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(260px, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(18, 23, 28, 0.96);
  backdrop-filter: blur(12px);
}

.brand,
.pathbar,
.top-actions,
.run-meta,
.button-row,
.row-actions,
.filter-row {
  display: flex;
  align-items: center;
}

.brand {
  gap: 10px;
  min-width: 0;
}

.brand strong,
.brand span,
.path-input input,
.preview-url {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand strong {
  display: block;
  font-size: 15px;
}

.brand span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid #6f87ff;
  border-radius: 8px;
  color: #dce4ff;
  font-weight: 800;
  letter-spacing: 0;
  background: #1b2a52;
}

.pathbar {
  gap: 8px;
  min-width: 0;
}

.path-input {
  display: grid;
  grid-template-columns: auto minmax(120px, 1fr);
  gap: 8px;
  align-items: center;
  min-width: 0;
  flex: 1;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #0d1116;
  color: var(--muted);
  font-size: 12px;
}

.path-input input {
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.top-actions {
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.icon-button,
.small-button,
.primary-button,
.secondary-button,
.ticket-action,
.text-button {
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
}

.icon-button {
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 11px;
}

.small-button {
  min-height: 36px;
  padding: 0 12px;
  color: #d9e0e8;
}

.primary-button,
.secondary-button,
.ticket-action {
  min-height: 38px;
  padding: 0 14px;
  font-weight: 700;
}

.primary-button,
.ticket-action {
  border-color: #5b7dff;
  background: var(--blue);
  color: #fff;
}

.secondary-button {
  background: #10161c;
}

.text-button {
  min-height: 30px;
  padding: 0 8px;
  border-color: transparent;
  background: transparent;
  color: #8bb0ff;
}

.status-pill,
.badge,
.ticket-type,
.lane-note {
  border-radius: 999px;
  font-size: 12px;
  white-space: nowrap;
}

.status-pill {
  padding: 7px 10px;
  background: #223027;
  color: #a6f0c2;
}

.status-pill.warning {
  background: #352b14;
  color: var(--yellow);
}

main {
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0 64px;
}

.hero-board {
  display: grid;
  grid-template-columns: minmax(280px, 0.78fr) minmax(420px, 1.22fr);
  gap: 16px;
  align-items: stretch;
}

.board-summary,
.preview-card,
.flow-proof,
.lane,
.consequence-box,
.result-strip {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.board-summary {
  min-height: 360px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.ticket-id,
.eyebrow {
  color: var(--cyan);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 10ch;
  margin-bottom: 14px;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 0.98;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 24px;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 16px;
}

p {
  color: var(--muted);
  line-height: 1.55;
}

.run-meta {
  flex-wrap: wrap;
  gap: 8px;
}

.run-meta span {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #111820;
  color: #d7dee7;
  font-size: 12px;
}

.preview-card {
  overflow: hidden;
  background: #0c1117;
}

.preview-toolbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-bottom: 1px solid var(--line);
}

.traffic {
  width: 38px;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, #ff7070 0 28%, #ffce5a 28% 60%, #55d18c 60% 100%);
}

.preview-url {
  padding: 7px 10px;
  border-radius: 6px;
  background: #1b242e;
  color: #cbd4df;
  font-size: 13px;
}

.saved-indicator {
  color: var(--yellow);
  font-size: 12px;
  font-weight: 700;
}

.wp-preview {
  min-height: 310px;
  background: var(--paper);
  color: var(--ink);
}

.wp-adminbar,
.wp-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.wp-adminbar {
  height: 32px;
  padding: 0 14px;
  background: #1d2327;
  color: #f0f0f1;
  font-size: 12px;
}

.wp-nav {
  gap: 18px;
  min-height: 58px;
  padding: 0 26px;
  border-bottom: 1px solid #eef0f2;
}

.wp-nav span {
  color: #2f343b;
}

.wp-content {
  display: grid;
  grid-template-columns: 1fr 0.8fr;
  gap: 28px;
  align-items: center;
  padding: 48px 38px;
}

.wp-content h2 {
  font-family: Georgia, serif;
  font-size: 34px;
  line-height: 1.2;
  color: #050505;
}

.wp-content h2 span {
  color: #3957f2;
}

.wp-content p {
  color: #111;
  font-size: 18px;
}

.wp-content mark {
  display: inline;
  background: #fff2a8;
}

.wp-content button {
  display: block;
  width: min(100%, 360px);
  margin-top: 24px;
  padding: 14px;
  border: 0;
  border-radius: 2px;
  background: #3b55e9;
  color: #fff;
  font-weight: 700;
}

.wp-logo {
  display: grid;
  width: min(220px, 100%);
  aspect-ratio: 1;
  place-items: center;
  justify-self: end;
  border: 16px solid #1a1a1a;
  border-radius: 50%;
  color: #1a1a1a;
  font-family: Georgia, serif;
  font-size: 130px;
  font-weight: 800;
  outline: 34px solid #31e978;
}

.lane-nav {
  position: sticky;
  top: 57px;
  z-index: 15;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 0;
  background: var(--bg);
}

.lane-nav a {
  flex: 0 0 auto;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: #e2e8f0;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.flow-proof {
  display: grid;
  grid-template-columns: minmax(220px, 0.45fr) minmax(360px, 1fr);
  gap: 18px;
  align-items: center;
  margin-bottom: 14px;
  padding: 18px;
}

.proof-steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.proof-steps li {
  min-height: 50px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #10171f;
  color: var(--muted);
  font-size: 12px;
}

.proof-steps .is-current {
  border-color: var(--blue);
  color: #fff;
  background: #1c2b55;
}

.lane {
  margin-top: 16px;
  padding: 18px;
}

.lane-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
  margin-bottom: 16px;
}

.lane-note {
  padding: 7px 10px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: #111820;
}

.warning-text {
  color: var(--yellow);
}

.ticket-grid,
.launch-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.ticket {
  min-width: 0;
  min-height: 190px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.ticket.is-selected,
.save-ticket.is-selected {
  border-color: var(--blue);
  box-shadow: inset 3px 0 0 var(--blue);
}

.ticket.danger {
  border-color: #6b3c43;
}

.ticket-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
}

.ticket-type,
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  background: #10171f;
  color: #d4dbe4;
}

.badge {
  color: #9fb3c8;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

input,
select {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: 0;
  background: #10161c;
  color: var(--text);
}

.ticket-action {
  width: 100%;
  margin-top: 12px;
}

.result-strip,
.consequence-box {
  margin-top: 12px;
  padding: 12px 14px;
  color: #dce5ef;
  line-height: 1.45;
}

.gallery-workbench {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.gallery-tools,
.catalog-layout,
.save-board,
.ide-grid {
  display: grid;
  gap: 12px;
}

.gallery-tools {
  grid-template-columns: minmax(260px, 1fr) minmax(240px, 360px);
  align-items: end;
}

.search-box {
  justify-self: end;
  width: min(100%, 360px);
}

.filter-row {
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.filter-chip {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: #cfd8e3;
}

.filter-chip.is-active {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.catalog-layout {
  grid-template-columns: minmax(0, 1fr) 340px;
}

.blueprint-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  max-height: 520px;
  overflow: auto;
  padding-right: 4px;
}

.blueprint-card {
  min-height: 132px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  text-align: left;
}

.blueprint-card.is-selected {
  border-color: var(--blue);
}

.thumb {
  height: 54px;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.14), transparent),
    var(--thumb-color, #4f7dff);
}

.blueprint-card strong,
.blueprint-card span {
  display: block;
  padding: 0 10px;
}

.blueprint-card strong {
  margin-top: 9px;
  font-size: 13px;
}

.blueprint-card span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.blueprint-detail {
  position: sticky;
  top: 112px;
  align-self: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111820;
}

.code-panel {
  min-width: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #071017;
}

.code-panel pre,
.log-grid pre {
  margin: 0;
  padding: 16px;
  color: #d7f6ff;
  font: 13px/1.65 "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.code-panel.small pre {
  max-height: 150px;
  font-size: 12px;
}

.button-row {
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.save-board {
  grid-template-columns: minmax(220px, 0.75fr) minmax(220px, 0.75fr) minmax(300px, 1fr);
}

.save-progress {
  min-height: 190px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #10171f;
}

.progress-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.meter {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #2d3743;
}

.meter span {
  display: block;
  width: 80%;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.management-table {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.table-row {
  display: grid;
  grid-template-columns: 140px minmax(160px, 1fr) minmax(190px, 1fr) 170px;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.table-row:last-child {
  border-bottom: 0;
}

.table-head {
  background: #10171f;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.table-row.is-highlighted {
  background: #1b2b4c;
}

.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 7px;
  border-radius: 50%;
}

.warning-dot {
  background: var(--yellow);
}

.ok-dot {
  background: var(--green);
}

.danger-text {
  color: var(--red);
}

.danger-box {
  border-color: #6b3c43;
  background: #24181c;
}

.inspector-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-bottom: 12px;
}

.inspector-tab {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  color: #dce4ee;
}

.inspector-tab.is-active {
  border-color: var(--cyan);
  color: #fff;
  box-shadow: inset 0 -3px 0 var(--cyan);
}

.inspector-panel {
  display: none;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.inspector-panel.is-active {
  display: block;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.check-row {
  display: flex;
  gap: 9px;
  align-items: center;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #10171f;
}

.check-row input {
  width: 16px;
  min-height: 16px;
}

.ide-grid {
  grid-template-columns: 260px minmax(0, 1fr);
}

.file-tree {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #10171f;
}

.file-tree strong {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
}

.file-tree button {
  min-height: 30px;
  margin: 0 4px 6px 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #17222d;
  color: #d9e2ec;
  font-size: 12px;
}

.file-tree ul {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.file-tree li {
  padding: 7px 8px;
  border-radius: 5px;
  color: #dce4ee;
  font-size: 13px;
}

.file-tree li:not(.open)::before {
  content: "file ";
  color: var(--muted);
}

.file-tree .selected {
  background: #1c2b55;
  color: #fff;
}

.database-card {
  padding: 6px;
}

dl {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 8px 14px;
}

dt {
  color: var(--muted);
  font-weight: 800;
}

dd {
  margin: 0;
}

.log-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.log-grid article {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #10171f;
}

.empty-log {
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 6px;
}

.timeline {
  display: grid;
  gap: 8px;
}

.timeline div {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.timeline time {
  color: var(--cyan);
  font-weight: 800;
}

@media (max-width: 980px) {
  .topbar {
    position: static;
    grid-template-columns: 1fr;
  }

  .top-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .hero-board,
  .flow-proof,
  .catalog-layout,
  .save-board {
    grid-template-columns: 1fr;
  }

  .board-summary {
    min-height: auto;
    gap: 24px;
  }

  .proof-steps,
  .ticket-grid,
  .launch-grid,
  .blueprint-list,
  .settings-grid,
  .log-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .blueprint-detail,
  .lane-nav {
    position: static;
  }

  .table-row {
    grid-template-columns: 120px minmax(140px, 1fr);
  }

  .table-row span:nth-child(3),
  .table-head span:nth-child(3) {
    display: none;
  }
}

@media (max-width: 680px) {
  main {
    width: min(100% - 20px, 1220px);
    padding-top: 10px;
  }

  .topbar {
    gap: 8px;
    padding: 8px 10px;
  }

  .pathbar,
  .wp-nav,
  .progress-head,
  .lane-head {
    align-items: stretch;
    flex-direction: column;
  }

  .gallery-tools {
    grid-template-columns: 1fr;
  }

  .lane-nav,
  .inspector-tabs {
    flex-wrap: wrap;
    overflow-x: visible;
  }

  .lane-note,
  .status-pill,
  .badge,
  .ticket-type {
    white-space: normal;
  }

  .pathbar,
  .top-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .pathbar .icon-button {
    grid-column: 1;
  }

  .path-input {
    grid-column: 2 / 5;
  }

  .pathbar .small-button {
    grid-column: span 2;
  }

  .status-pill {
    grid-column: 1 / 3;
  }

  .top-actions .primary-button {
    grid-column: 3 / 5;
  }

  .hero-board {
    gap: 10px;
  }

  h1 {
    max-width: none;
    font-size: 34px;
  }

  h2 {
    font-size: 21px;
  }

  .wp-content {
    grid-template-columns: 1fr;
    padding: 26px 18px;
  }

  .wp-content h2 {
    font-size: 28px;
  }

  .wp-logo {
    justify-self: center;
    width: 120px;
    outline-width: 18px;
    border-width: 10px;
    font-size: 72px;
  }

  .proof-steps,
  .ticket-grid,
  .launch-grid,
  .blueprint-list,
  .settings-grid,
  .ide-grid,
  .log-grid {
    grid-template-columns: 1fr;
  }

  .lane {
    padding: 12px;
  }

  .ticket {
    min-height: auto;
  }

  .search-box {
    justify-self: stretch;
    width: 100%;
  }

  .table-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .table-head {
    display: none;
  }

  dl {
    grid-template-columns: 1fr;
  }

  .timeline div {
    grid-template-columns: 1fr;
  }
}
