:root {
  color-scheme: light;
  --bg: #eef2f6;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --ink: #17202a;
  --muted: #657184;
  --line: #d7dde7;
  --blue: #285cff;
  --blue-2: #e8eeff;
  --green: #0a8f5b;
  --green-2: #e7f8f0;
  --amber: #ad6900;
  --amber-2: #fff2d4;
  --red: #bd2b2b;
  --red-2: #ffe8e8;
  --dark: #172028;
  --shadow: 0 18px 48px rgba(22, 32, 42, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

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

button {
  border: 0;
  cursor: pointer;
}

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

.shellbar {
  min-height: 64px;
  padding: 10px 14px;
  background: var(--dark);
  color: #f8fafc;
  display: grid;
  grid-template-columns: minmax(220px, 330px) minmax(280px, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.shellbar__brand,
.shellbar__actions,
.pathbox,
.preview-toolbar,
.wp-adminbar,
.action-row,
.section-title,
.progress-line,
.manager-tabs,
.chip-row,
.editor-head {
  display: flex;
  align-items: center;
}

.shellbar__brand {
  gap: 12px;
  min-width: 0;
}

.mark {
  width: 40px;
  height: 40px;
  border: 2px solid #f8fafc;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: Georgia, serif;
  font-weight: 800;
  font-size: 24px;
  flex: 0 0 auto;
}

.shellbar strong,
.shellbar span {
  display: block;
}

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

.shellbar__brand span {
  margin-top: 2px;
  color: #aeb8c5;
  font-size: 12px;
}

.pathbox {
  min-width: 0;
  background: #26313b;
  border: 1px solid #3c4854;
  border-radius: 8px;
  padding: 4px;
  gap: 6px;
}

.pathbox input {
  min-width: 0;
  width: 100%;
  border: 0;
  background: #111820;
  color: #f8fafc;
  border-radius: 6px;
  padding: 9px 10px;
}

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

.primary,
.secondary,
.danger,
.icon-button,
.chip,
.op-tab,
.manager-tab {
  min-height: 36px;
  border-radius: 7px;
  padding: 8px 12px;
  font-weight: 700;
}

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

.secondary,
.icon-button,
.chip,
.manager-tab {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}

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

.state-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 5px 10px;
  background: var(--blue-2);
  color: #2147c9;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.state-pill--warn {
  color: #7a4b00;
  background: var(--amber-2);
}

.state-pill--saved {
  color: #08643f;
  background: var(--green-2);
}

.workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 96px minmax(420px, 1fr) minmax(420px, 520px);
  gap: 14px;
  padding: 14px;
}

.op-tabs {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-self: start;
  position: sticky;
  top: 14px;
}

.op-tab {
  width: 100%;
  background: transparent;
  color: var(--muted);
  text-align: left;
}

.op-tab.is-active {
  background: var(--blue);
  color: #fff;
}

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

.preview-shell {
  display: flex;
  flex-direction: column;
  min-height: 690px;
}

.preview-toolbar {
  gap: 8px;
  padding: 10px;
  background: #f5f7fa;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.preview-toolbar strong {
  min-width: 0;
  flex: 1;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.dot--red { background: #e65f57; }
.dot--yellow { background: #f0bf4f; }
.dot--green { background: #53c76a; }

.wp-adminbar {
  gap: 18px;
  padding: 8px 12px;
  background: #1f252b;
  color: #dbe2ea;
  font-size: 13px;
}

.push {
  margin-left: auto;
}

.preview-page {
  position: relative;
  flex: 1;
  overflow: hidden;
  padding: clamp(30px, 6vw, 80px);
  background: #fff;
  display: grid;
  grid-template-columns: minmax(260px, 470px) 1fr;
  align-items: center;
}

.preview-copy {
  position: relative;
  z-index: 1;
}

.site-name {
  font-weight: 800;
  margin: 0 0 60px;
}

.preview-copy h1 {
  margin: 0 0 20px;
  font-family: Georgia, serif;
  color: #1f4fff;
  font-size: clamp(34px, 4vw, 52px);
  line-height: 1.2;
  font-weight: 500;
}

.preview-copy p {
  font-size: 18px;
  line-height: 1.55;
}

.preview-copy .note {
  display: inline;
  background: #fff0a8;
}

.wp-orbit {
  position: absolute;
  right: -190px;
  bottom: -180px;
  width: 660px;
  height: 660px;
}

.ring {
  position: absolute;
  border: 48px solid #29e36f;
  border-radius: 50%;
}

.ring--one {
  inset: 120px 0 120px 0;
}

.ring--two {
  inset: 300px 80px 40px 80px;
}

.wp-logo {
  position: absolute;
  top: 80px;
  left: 170px;
  width: 260px;
  height: 260px;
  border: 14px solid #1d1d1f;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: Georgia, serif;
  font-size: 190px;
  font-weight: 800;
  background: #fff;
}

.control-panel {
  min-height: 690px;
  display: flex;
  flex-direction: column;
}

.panel-head {
  padding: 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

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

.panel-head h2 {
  margin: 0;
  font-size: 22px;
}

.panel-view {
  display: none;
  padding: 18px;
  overflow: auto;
}

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

.callout,
.result-card,
.progress-card,
.confirm-box {
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 14px;
}

.callout strong,
.callout span,
.result-card strong,
.result-card p {
  display: block;
}

.callout span,
.result-card p,
article p,
.route-card span,
#folderStatus,
#zipSource,
#fileResult,
#databaseResult,
#blueprintResult {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.callout--danger {
  border-color: #f0b8b8;
  background: var(--red-2);
}

.settings-grid,
.save-layout,
.route-grid,
.transfer-grid,
.mini-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

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

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

.checkline {
  grid-template-columns: auto 1fr;
  align-items: center;
  color: var(--ink);
}

.checkline input {
  width: auto;
}

.action-row {
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.progress-card {
  margin-top: 14px;
}

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

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

.bar span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--blue);
  transition: width 180ms ease;
}

.mini-grid {
  margin-top: 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.mini-grid article,
.route-card,
.save-card,
.transfer-grid article {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 14px;
}

.route-card,
.save-card,
.transfer-grid article {
  display: grid;
  gap: 9px;
}

.route-card strong,
.save-card h3,
.transfer-grid h3,
.history h3,
.section-title h3 {
  margin: 0;
  font-size: 16px;
}

.route-card--zip {
  border-color: #aabaff;
  background: var(--blue-2);
}

.flow-box {
  margin: 16px 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.flow-step {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  background: #fff;
}

.flow-step.is-current {
  border-color: var(--blue);
  color: #2147c9;
  background: var(--blue-2);
}

.flow-step.is-done {
  border-color: #8ed7b7;
  color: #08643f;
  background: var(--green-2);
}

.section-title {
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0 12px;
}

.section-title span {
  color: var(--muted);
  font-size: 12px;
}

.chip-row {
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.chip {
  min-height: 30px;
  padding: 6px 10px;
}

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

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

.blueprint-card {
  min-height: 70px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  padding: 10px;
  color: var(--ink);
  font-weight: 800;
}

.blueprint-card span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

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

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

.library-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 12px;
}

.library-row.is-active {
  border-color: var(--blue);
  box-shadow: inset 4px 0 0 var(--blue);
}

.library-row strong,
.library-row span {
  display: block;
}

.library-row span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.manager-tabs {
  overflow-x: auto;
  gap: 6px;
  margin-bottom: 14px;
  padding-bottom: 2px;
}

.manager-tab {
  white-space: nowrap;
}

.manager-tab.is-active {
  color: #fff;
  background: var(--dark);
  border-color: var(--dark);
}

.manager-view {
  display: none;
}

.manager-view.is-active {
  display: block;
}

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

.summary-table div {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 10px;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
}

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

.summary-table span {
  color: var(--muted);
  font-size: 12px;
}

.summary-table strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.file-workbench {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 12px;
}

.file-tree {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: var(--panel-2);
}

.file-tree button {
  width: 100%;
  margin-bottom: 6px;
  min-height: 32px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.file-tree ul {
  padding-left: 17px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
}

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

.editor {
  min-width: 0;
}

.editor-head {
  justify-content: space-between;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
  padding: 9px 10px;
  background: var(--panel-2);
  gap: 10px;
}

textarea {
  min-height: 210px;
  border-radius: 0 0 10px 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.55;
  resize: vertical;
}

#blueprintEditor {
  margin-top: 12px;
}

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

.log-list div,
.history-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 11px 12px;
}

.log-list span,
.history-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.log-list p,
.history-item p {
  margin: 4px 0 0;
  line-height: 1.4;
}

.history {
  margin-top: 16px;
}

#historyList {
  display: grid;
  gap: 9px;
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: 84px minmax(360px, 1fr) minmax(360px, 440px);
  }

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

  .shellbar__actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

@media (max-width: 940px) {
  .app {
    padding-bottom: 72px;
  }

  .shellbar {
    position: sticky;
    top: 0;
    z-index: 4;
  }

  .workspace {
    display: flex;
    flex-direction: column;
    padding: 10px;
  }

  .op-tabs {
    position: fixed;
    z-index: 5;
    inset: auto 10px 10px 10px;
    flex-direction: row;
    justify-content: space-between;
    overflow-x: auto;
    border-radius: 14px;
  }

  .op-tab {
    min-width: 92px;
    text-align: center;
  }

  .preview-shell,
  .control-panel {
    min-height: auto;
  }

  .preview-page {
    min-height: 430px;
    grid-template-columns: 1fr;
    padding: 24px;
  }

  .site-name {
    margin-bottom: 34px;
  }

  .wp-orbit {
    opacity: 0.28;
    right: -360px;
    bottom: -310px;
  }
}

@media (max-width: 680px) {
  .shellbar {
    padding: 10px;
    gap: 10px;
  }

  .pathbox {
    flex-wrap: wrap;
  }

  .pathbox input {
    order: -1;
    flex-basis: 100%;
  }

  .shellbar__actions .secondary {
    flex: 1 1 110px;
  }

  .shellbar__actions .primary,
  .shellbar__actions .state-pill {
    flex: 1 1 100%;
  }

  .wp-adminbar {
    overflow-x: auto;
    white-space: nowrap;
  }

  .panel-head,
  .library-row {
    grid-template-columns: 1fr;
    display: grid;
  }

  .settings-grid,
  .save-layout,
  .route-grid,
  .transfer-grid,
  .mini-grid,
  .blueprint-grid,
  .flow-box,
  .file-workbench {
    grid-template-columns: 1fr;
  }

  .flow-step {
    min-height: auto;
  }

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

  .row-actions,
  .action-row {
    justify-content: stretch;
  }

  .row-actions button,
  .action-row button {
    flex: 1 1 130px;
  }

  .preview-copy h1 {
    font-size: 34px;
  }

  .preview-copy p {
    font-size: 16px;
  }
}
