:root {
  color-scheme: light;
  --ink: #111820;
  --muted: #5c6670;
  --subtle: #7b8490;
  --line: #d6dde5;
  --soft-line: #e9edf2;
  --panel: #ffffff;
  --panel-soft: #f6f8fa;
  --canvas: #eef2f5;
  --shell: #1d242b;
  --shell-2: #141a20;
  --blue: #0969da;
  --blue-dark: #0757b3;
  --blue-soft: #e8f1ff;
  --green: #1a7f37;
  --green-soft: #e7f6ed;
  --amber: #9a6700;
  --amber-soft: #fff4ce;
  --red: #b42318;
  --red-soft: #fff0ee;
  --shadow: 0 18px 60px rgba(17, 24, 32, 0.16);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

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

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

button {
  cursor: pointer;
}

code {
  padding: 1px 5px;
  border-radius: 4px;
  background: #eef1f4;
  color: #26313b;
  font-size: 12px;
}

.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;
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-rows: 54px minmax(0, 1fr);
  background: var(--canvas);
}

.shell {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(260px, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  color: #f4f7fa;
  background: var(--shell);
  border-bottom: 1px solid #303a44;
}

.brand,
.shell-actions,
.pathbar,
.summary-strip,
.view-tabs,
.table-toolbar,
.detail-head,
.preview-toolbar,
.button-row,
.manager-tabs,
.form-grid,
.inline-actions,
.blueprint-actions,
.checkbox-line {
  display: flex;
  align-items: center;
}

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

.brand strong,
.brand span:last-child {
  display: block;
}

.brand strong {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand span:last-child {
  margin-top: 2px;
  color: #acb7c0;
  font-size: 12px;
}

.brand-mark,
.wp-dot {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, #0969da, #1a7f37);
  font-weight: 800;
  font-size: 12px;
}

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

.path-input {
  flex: 1;
  min-width: 110px;
}

.path-input input,
.form-field input,
.form-field select,
.form-field textarea,
.search-input,
.code-editor,
.mini-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

.path-input input {
  height: 34px;
  border-color: #3b4651;
  background: #303943;
  color: #f2f7fb;
  padding: 0 12px;
}

.shell-actions {
  justify-content: flex-end;
  gap: 8px;
}

.icon-button,
.ghost,
.primary,
.danger,
.view-tabs button,
.manager-tabs button,
.manager-index button,
.chip,
.small-link,
.wp-cta {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 11px;
  font-weight: 650;
}

.icon-button {
  width: 34px;
  padding: 0;
  color: #eef5fa;
  background: #2a343e;
  border-color: #3d4954;
}

.ghost {
  color: #eef5fa;
  background: #2a343e;
  border-color: #3d4954;
}

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

.primary:hover {
  background: var(--blue-dark);
}

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

.danger-text {
  color: #ffd4d0;
}

.runtime-pill,
.state-badge {
  display: inline-flex;
  align-items: center;
  width: max-content;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 750;
  white-space: nowrap;
}

.runtime-pill {
  color: #dbe6ee;
  background: #27313a;
  border-color: #3b4650;
}

.state-badge.warning {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: #f0d98a;
}

.state-badge.success {
  color: var(--green);
  background: var(--green-soft);
  border-color: #b8e1c2;
}

.state-badge.danger {
  color: var(--red);
  background: var(--red-soft);
  border-color: #f1beb8;
}

.state-badge.neutral {
  color: #475260;
  background: #f1f4f7;
  border-color: #dce2e8;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 440px);
  gap: 12px;
  min-height: 0;
  padding: 12px;
}

.ledger,
.detail {
  min-width: 0;
}

.ledger {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 10px;
  min-height: calc(100vh - 78px);
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.ledger-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

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

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

h1 {
  margin-bottom: 0;
  font-size: 23px;
  line-height: 1.2;
}

h2 {
  margin-bottom: 8px;
  font-size: 18px;
  line-height: 1.25;
}

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

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

.summary-strip {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.summary-strip span {
  padding: 7px 9px;
  border: 1px solid var(--soft-line);
  border-radius: 6px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 12px;
}

.view-tabs {
  gap: 6px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--soft-line);
  overflow-x: auto;
}

.view-tabs button,
.manager-tabs button,
.chip,
.small-link {
  color: var(--muted);
  background: var(--panel-soft);
  white-space: nowrap;
}

.view-tabs button.is-active,
.manager-tabs button.is-active,
.manager-index button.is-active,
.chip.is-active {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
}

.table-panel {
  display: none;
  min-height: 0;
}

.table-panel.is-active {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
}

.table-toolbar {
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.table-toolbar strong {
  color: var(--ink);
}

.admin-table {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.table-row {
  display: grid;
  grid-template-columns: minmax(190px, 1.15fr) minmax(160px, 0.95fr) minmax(220px, 1.25fr) minmax(120px, 0.55fr) minmax(90px, 0.45fr);
  width: 100%;
  min-height: 68px;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 0;
  border-bottom: 1px solid var(--soft-line);
  background: #fff;
  color: var(--muted);
  text-align: left;
}

.objects-table .table-row {
  grid-template-columns: minmax(190px, 1.2fr) minmax(180px, 1fr) minmax(150px, 0.75fr) minmax(130px, 0.55fr) minmax(110px, 0.5fr);
}

.transfers-table .table-row {
  grid-template-columns: 74px minmax(150px, 0.9fr) minmax(180px, 1fr) minmax(120px, 0.6fr) minmax(220px, 1.2fr);
}

.table-row:hover,
.table-row.is-selected {
  background: #f4f8ff;
}

.table-row.is-selected {
  box-shadow: inset 3px 0 0 var(--blue);
}

.table-row.table-header {
  min-height: auto;
  padding-top: 9px;
  padding-bottom: 9px;
  color: #66717d;
  background: #f7f9fb;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.table-row strong,
.table-row small {
  display: block;
}

.table-row strong {
  color: var(--ink);
}

.table-row small {
  margin-top: 3px;
  color: var(--subtle);
}

.linklike,
.row-actions b {
  color: var(--blue);
  font-weight: 750;
}

.row-actions {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
}

.deleted-row {
  opacity: 0.72;
  background: #fafafa;
}

.manager-tabs {
  gap: 6px;
  flex-wrap: wrap;
}

.manager-shell {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  min-height: 410px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.manager-index {
  padding: 10px;
  background: #f7f9fb;
  border-right: 1px solid var(--line);
}

.manager-index button {
  display: block;
  width: 100%;
  margin-bottom: 6px;
  text-align: left;
}

.manager-panel {
  min-width: 0;
  padding: 14px;
  overflow: auto;
}

.detail {
  display: grid;
  grid-template-rows: minmax(286px, 38vh) minmax(0, 1fr);
  gap: 12px;
  min-height: calc(100vh - 78px);
}

.preview-card,
.detail-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.preview-toolbar {
  gap: 9px;
  min-width: 0;
  padding: 10px 12px;
  border-bottom: 1px solid var(--soft-line);
}

.preview-toolbar strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-toolbar span:last-child {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}

.wp-adminbar {
  display: flex;
  gap: 12px;
  padding: 8px 12px;
  color: #f5f7f8;
  background: #1e252b;
  font-size: 12px;
}

.wp-adminbar span:last-child {
  margin-left: auto;
}

.preview-surface {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px;
  gap: 16px;
  align-items: center;
  min-height: calc(100% - 82px);
  padding: 24px;
  background: #fff;
}

.preview-surface h2 {
  margin-bottom: 10px;
  font-family: Georgia, serif;
  font-size: 34px;
  font-weight: 500;
  color: #1f4fff;
}

.wp-cta {
  color: #fff;
  background: #3858e9;
  border-color: #3858e9;
}

.wp-art {
  position: relative;
  display: grid;
  place-items: center;
  width: 118px;
  height: 118px;
  border: 14px solid #2fe875;
  border-radius: 50%;
}

.wp-art span {
  display: grid;
  place-items: center;
  width: 78px;
  height: 78px;
  border: 8px solid #1b1b1b;
  border-radius: 50%;
  color: #1b1b1b;
  font-family: Georgia, serif;
  font-size: 50px;
  font-weight: 700;
}

.detail-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.detail-head {
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--soft-line);
}

#detailBody {
  min-height: 0;
  overflow: auto;
  padding: 14px;
}

.detail-section {
  display: grid;
  gap: 12px;
}

.cardlet,
.notice,
.progress-box,
.file-browser,
.blueprint-gallery,
.db-grid,
.log-list,
.confirm-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.cardlet,
.notice,
.confirm-box {
  padding: 12px;
}

.notice.warning {
  border-color: #f0d98a;
  background: var(--amber-soft);
}

.notice.success {
  border-color: #b8e1c2;
  background: var(--green-soft);
}

.notice.danger {
  border-color: #f1beb8;
  background: var(--red-soft);
}

.form-grid {
  align-items: start;
  gap: 10px;
}

.form-grid.two {
  grid-template-columns: 1fr 1fr;
}

.form-field {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.form-field input,
.form-field select,
.search-input,
.mini-input {
  height: 36px;
  padding: 0 10px;
}

.form-field textarea,
.code-editor {
  min-height: 130px;
  resize: vertical;
  padding: 10px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
}

.checkbox-line {
  gap: 8px;
  color: var(--ink);
  font-size: 14px;
}

.button-row,
.inline-actions,
.blueprint-actions {
  gap: 8px;
  flex-wrap: wrap;
}

.inline-actions .ghost,
.button-row .ghost,
.button-row .primary,
.button-row .danger,
.blueprint-actions .ghost,
.blueprint-actions .primary,
.small-link {
  color: var(--ink);
  background: #fff;
  border-color: var(--line);
}

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

.progress-box {
  display: none;
  padding: 12px;
}

.progress-box.is-visible {
  display: block;
}

.progress-copy {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

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

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

.meter.success span {
  background: var(--green);
}

.file-browser {
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) minmax(0, 1.2fr);
  min-height: 310px;
  overflow: hidden;
}

.file-tree {
  padding: 10px;
  border-right: 1px solid var(--line);
  background: #f7f9fb;
}

.file-tree button {
  display: block;
  width: 100%;
  margin-bottom: 5px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  padding: 8px;
  color: var(--muted);
  text-align: left;
}

.file-tree button.is-active {
  color: var(--blue);
  background: var(--blue-soft);
}

.editor-pane {
  padding: 10px;
  min-width: 0;
}

.blueprint-gallery {
  padding: 10px;
}

.filter-row {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  overflow-x: auto;
}

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

.blueprint-cardlet {
  min-height: 88px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  padding: 10px;
  text-align: left;
}

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

.blueprint-cardlet strong,
.blueprint-cardlet small {
  display: block;
}

.blueprint-cardlet small {
  margin-top: 4px;
  color: var(--muted);
}

.db-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  overflow: hidden;
}

.db-grid div {
  padding: 12px;
  border-right: 1px solid var(--soft-line);
}

.db-grid div:last-child {
  border-right: 0;
}

.db-grid dt {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.db-grid dd {
  margin: 0;
  font-weight: 700;
}

.log-list {
  overflow: hidden;
}

.log-line {
  display: grid;
  grid-template-columns: 92px 92px minmax(0, 1fr);
  gap: 8px;
  padding: 10px;
  border-bottom: 1px solid var(--soft-line);
  font-size: 13px;
}

.log-line:last-child {
  border-bottom: 0;
}

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

@media (max-width: 1120px) {
  .shell {
    grid-template-columns: minmax(180px, 270px) minmax(220px, 1fr);
  }

  .shell-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .app {
    grid-template-rows: auto minmax(0, 1fr);
  }

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

  .detail {
    grid-template-rows: auto auto;
    min-height: auto;
  }
}

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

  .pathbar,
  .shell-actions,
  .summary-strip,
  .table-toolbar {
    align-items: stretch;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .workspace {
    padding: 8px;
  }

  .ledger,
  .detail {
    min-height: auto;
  }

  .ledger-head {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 20px;
  }

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

  .table-row.table-header {
    display: none;
  }

  .manager-shell,
  .file-browser,
  .preview-surface,
  .form-grid.two,
  .db-grid {
    grid-template-columns: 1fr;
  }

  .manager-index,
  .file-tree {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .preview-surface {
    padding: 18px;
  }

  .preview-surface h2 {
    font-size: 28px;
  }

  .wp-art {
    width: 92px;
    height: 92px;
  }

  .wp-art span {
    width: 62px;
    height: 62px;
    font-size: 38px;
  }

  .blueprint-list {
    grid-template-columns: 1fr;
  }

  .log-line {
    grid-template-columns: 1fr;
  }
}
