:root {
  color-scheme: light;
  --page: #eef1f4;
  --shell: #1d2327;
  --panel: #ffffff;
  --panel-soft: #f7f8fa;
  --ink: #1d2327;
  --muted: #667085;
  --line: #d7dce2;
  --line-strong: #b8c0ca;
  --blue: #2271b1;
  --blue-dark: #135e96;
  --green: #008a20;
  --amber: #b7791f;
  --red: #b32d2e;
  --violet: #6741d9;
  --teal: #007c89;
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 0;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--page);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

pre,
code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

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

[hidden] {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.shellbar {
  min-height: 52px;
  display: grid;
  grid-template-columns: auto auto minmax(190px, 1fr) auto auto auto auto auto;
  gap: 10px;
  align-items: center;
  padding: 8px 12px;
  background: var(--shell);
  color: #f6f7f7;
  border-bottom: 1px solid #3c434a;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  white-space: nowrap;
}

.brand-mark,
.wp-mark {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 2px solid currentColor;
  border-radius: 50%;
  font-family: Georgia, serif;
  font-weight: 800;
}

.path-box input {
  width: 100%;
  min-width: 0;
  height: 34px;
  border: 1px solid #505a63;
  border-radius: 6px;
  background: #343b43;
  color: #fff;
  padding: 0 12px;
}

.ghost-button,
.bar-button,
.button,
.small-button,
.section-nav button,
.manager-tabs button,
.filters button,
.file-tree button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
  font-weight: 650;
}

.ghost-button,
.bar-button {
  background: #2c3338;
  border-color: #505a63;
  color: #fff;
  white-space: nowrap;
}

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

.button.danger {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

.danger-outline {
  border-color: #e2a4a4;
  color: var(--red);
}

.state-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  max-width: 100%;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #eef0f2;
  color: #3c434a;
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}

.state-chip.success {
  border-color: #b8e6c4;
  background: #e7f7ed;
  color: var(--green);
}

.state-chip.warning {
  border-color: #f1d391;
  background: #fff6dc;
  color: #744b00;
}

.state-chip.danger {
  border-color: #f0b7b7;
  background: #fae8e8;
  color: var(--red);
}

.console {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(470px, 0.92fr) minmax(560px, 1.08fr);
  background: #101517;
}

.ledger-column {
  min-width: 0;
  max-height: calc(100vh - 52px);
  overflow: auto;
  background: var(--panel);
  border-right: 1px solid #3c434a;
}

.preview-column {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(420px, 1fr) auto;
  background: #dfe4ea;
}

.ledger-header,
.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.ledger-header h1,
.preview-toolbar h2,
.section-title h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: 0;
}

.preview-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.object-ledger {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  background: var(--line);
  border-bottom: 1px solid var(--line);
}

.object-ledger div {
  min-width: 0;
  padding: 12px 18px;
  background: #fbfcfd;
}

.object-ledger dt {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.object-ledger dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 14px;
  font-weight: 650;
}

.section-nav {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border-bottom: 1px solid var(--line);
}

.section-nav button {
  border: 0;
  border-radius: 0;
  background: #f7f8fa;
  min-height: 44px;
  color: #3c434a;
}

.section-nav button.active {
  background: #fff;
  color: var(--blue-dark);
  box-shadow: inset 0 -3px 0 var(--blue);
}

.ledger-section {
  display: none;
  padding: 18px;
}

.ledger-section.active {
  display: block;
}

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

.section-title.tight {
  align-items: center;
  margin-top: 22px;
}

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

.contract-card,
.save-panel article,
.confirm-card,
.result-card,
.progress-card,
.callout,
.blueprint-gallery,
.site-row,
.mutation-tools,
.manager-panel,
.preview-ledger article {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.contract-card {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
  padding: 13px;
}

.contract-card.selected {
  border-color: #8ab8df;
  box-shadow: inset 3px 0 0 var(--blue);
}

.contract-type {
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.25;
}

p {
  line-height: 1.45;
}

.contract-card p,
.save-panel p,
.callout span,
.result-card span,
.site-row span,
.manager-panel p,
.log-list span,
.data-grid span {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

label {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: #3c434a;
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-width: 0;
  min-height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
}

.check {
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px;
  min-height: 36px;
}

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

.button-row,
.zip-choice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.zip-choice span {
  flex: 1;
  min-width: 160px;
  color: var(--muted);
  font-size: 13px;
}

.blueprint-gallery {
  margin-top: 14px;
  padding: 14px;
  background: #fbfcfd;
}

.search-box {
  min-width: min(240px, 100%);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.filters button.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

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

.blueprint-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.blueprint-shot {
  height: 76px;
  display: grid;
  align-items: end;
  padding: 8px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(29, 35, 39, 0.8), rgba(34, 113, 177, 0.36)),
    linear-gradient(90deg, #856404, #1d5e70);
  font-weight: 800;
}

.blueprint-card:nth-child(2n) .blueprint-shot {
  background:
    linear-gradient(135deg, rgba(29, 35, 39, 0.78), rgba(103, 65, 217, 0.35)),
    linear-gradient(90deg, #4c1d95, #b7791f);
}

.blueprint-card:nth-child(3n) .blueprint-shot {
  background:
    linear-gradient(135deg, rgba(29, 35, 39, 0.78), rgba(0, 124, 137, 0.35)),
    linear-gradient(90deg, #083344, #047857);
}

.blueprint-body {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.tag-row span {
  border-radius: 999px;
  background: #eef0f2;
  color: #4b5563;
  padding: 3px 7px;
  font-size: 11px;
  font-weight: 700;
}

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

.callout,
.diff-box,
.result-card,
.progress-card {
  margin-bottom: 12px;
}

.callout {
  display: grid;
  gap: 5px;
  padding: 12px;
  border-left: 4px solid var(--teal);
  background: #f0f9fb;
}

.diff-box {
  border: 1px solid #f0d99b;
  border-radius: var(--radius);
  background: #fff8e6;
  color: #744b00;
  padding: 11px 12px;
  font-size: 13px;
  font-weight: 700;
}

.confirm-card {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding: 12px;
  border-color: #9fc4e5;
  background: #f4f9fd;
}

.confirm-card p {
  margin: 0;
  color: #3c434a;
  font-size: 13px;
}

.confirm-card.danger {
  border-color: #e5aaaa;
  background: #fff5f5;
}

.progress-card,
.result-card {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfe3e7;
}

.progress span,
.mini-progress span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
  transition: width 220ms ease;
}

.save-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.save-panel article {
  display: grid;
  gap: 10px;
  padding: 13px;
}

.library-list {
  display: grid;
  gap: 8px;
}

.site-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
}

.site-row div {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.site-row.selected {
  border-color: #8ab8df;
  box-shadow: inset 3px 0 0 var(--blue);
}

.mutation-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: end;
  margin-top: 12px;
  padding: 12px;
  background: #fbfcfd;
}

.manager-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.manager-tabs button.active {
  background: #1d2327;
  border-color: #1d2327;
  color: #fff;
}

.manager-panel {
  display: none;
  padding: 13px;
}

.manager-panel.active {
  display: block;
}

.file-layout {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 12px;
}

.file-tree {
  display: grid;
  align-content: start;
  gap: 8px;
}

.file-tree ul {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.file-tree li {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  color: #3c434a;
  font-size: 13px;
}

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

.file-tree .selected {
  background: #eaf3fb;
  color: var(--blue-dark);
  font-weight: 800;
}

.editor-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  background: #f7f8fa;
  border-bottom: 1px solid var(--line);
}

.editor-card pre,
.json-editor {
  margin: 0;
  overflow: auto;
  padding: 12px;
  background: #0f1720;
  color: #e7eef7;
  font-size: 12px;
  line-height: 1.55;
}

.editor-card .button-row {
  padding: 10px;
  border-top: 1px solid var(--line);
}

.blueprint-tools {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

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

.data-grid div,
.log-list article {
  display: grid;
  gap: 5px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
  padding: 10px;
}

.log-list {
  display: grid;
  gap: 8px;
}

.transfer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.event-stream {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.event-stream li {
  display: grid;
  gap: 4px;
  min-width: 0;
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 7px;
  background: #fff;
  padding: 10px 12px;
}

.event-stream li.warning {
  border-left-color: var(--amber);
}

.event-stream li.danger {
  border-left-color: var(--red);
}

.event-stream span {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.browser-frame {
  min-width: 0;
  min-height: 0;
  margin: 16px;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid #bcc5cf;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 16px 40px rgba(16, 21, 23, 0.12);
}

.browser-top {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 8px 12px;
  background: #f7f8fa;
  border-bottom: 1px solid var(--line);
  color: #4b5563;
  font-size: 13px;
}

.browser-top span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dot {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #c4ccd4;
}

.wp-adminbar {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  min-height: 32px;
  padding: 0 10px;
  background: #1d2327;
  color: #f6f7f7;
  font-size: 13px;
}

.wp-adminbar span {
  white-space: nowrap;
}

.admin-name {
  margin-left: auto;
}

.wp-site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 62px;
  padding: 0 24px;
  border-bottom: 1px solid #edf0f2;
}

.wp-site-header nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.wp-site-header button {
  border: 0;
  background: transparent;
  color: #2c3338;
  padding: 6px;
}

.wp-canvas {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(220px, 0.45fr);
  align-items: center;
  gap: 24px;
  padding: clamp(24px, 5vw, 60px);
  background:
    linear-gradient(90deg, #fff 0%, #fff 55%, #f4f9fd 55%, #f4f9fd 100%);
}

.wp-canvas article {
  min-width: 0;
}

.path-pill {
  display: inline-flex;
  max-width: 100%;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--blue-dark);
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.wp-canvas h2 {
  margin: 0 0 12px;
  color: #111827;
  font-family: Georgia, serif;
  font-size: clamp(32px, 4vw, 52px);
  line-height: 1.08;
  letter-spacing: 0;
}

.wp-canvas p {
  max-width: 650px;
  margin: 0 0 12px;
  font-size: 18px;
  line-height: 1.45;
}

.wp-note {
  display: inline;
  background: #fff2a8;
  box-decoration-break: clone;
}

.wp-button {
  min-height: 44px;
  margin-top: 8px;
  border: 0;
  border-radius: 4px;
  background: #3858e9;
  color: #fff;
  padding: 0 18px;
  font-weight: 750;
}

.runtime-card {
  display: grid;
  gap: 10px;
  align-self: center;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius);
  background: #fff;
  padding: 16px;
}

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

.mini-progress {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e7eb;
}

.mini-progress span {
  width: 34%;
}

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

.preview-ledger article {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 12px;
}

.preview-ledger strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 1180px) {
  .shellbar {
    grid-template-columns: auto auto minmax(150px, 1fr) auto auto;
  }

  .shellbar .bar-button:nth-of-type(2),
  .shellbar .bar-button:nth-of-type(3),
  .shellbar .state-chip:nth-of-type(2) {
    display: none;
  }

  .console {
    grid-template-columns: 1fr;
  }

  .ledger-column {
    max-height: none;
    border-right: 0;
  }

  .preview-column {
    min-height: 720px;
  }
}

@media (max-width: 760px) {
  .shellbar {
    grid-template-columns: 1fr auto;
  }

  .brand,
  .path-box,
  .ghost-button,
  .shellbar > .state-chip,
  .shellbar > .bar-button {
    grid-column: 1 / -1;
  }

  .shellbar > .state-chip {
    justify-self: start;
  }

  .ledger-header,
  .preview-toolbar,
  .section-title {
    align-items: stretch;
    flex-direction: column;
  }

  .section-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .object-ledger,
  .contract-grid,
  .gallery-grid,
  .form-grid,
  .save-panel,
  .mutation-tools,
  .file-layout,
  .data-grid,
  .transfer-grid,
  .preview-ledger,
  .wp-canvas {
    grid-template-columns: 1fr;
  }

  .site-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .preview-column {
    min-height: 620px;
  }

  .browser-frame {
    margin: 10px;
  }

  .wp-adminbar {
    overflow-x: auto;
  }

  .wp-site-header {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px;
  }

  .wp-site-header nav {
    justify-content: flex-start;
  }

  .wp-canvas {
    padding: 24px;
    background: #fff;
  }

  .wp-canvas h2 {
    font-size: 34px;
  }

  .wp-canvas p {
    font-size: 16px;
  }
}
