:root {
  color-scheme: dark;
  --bg: #05090b;
  --panel: #0b1114;
  --panel-2: #10191d;
  --panel-3: #162227;
  --ink: #f5fbff;
  --muted: #a5b4bc;
  --dim: #6f8089;
  --line: #26363e;
  --line-strong: #3b535c;
  --cyan: #18d8ff;
  --cyan-soft: #9feeff;
  --green: #5dffa8;
  --amber: #ffd45c;
  --red: #ff6b6b;
  --white: #ffffff;
  --shadow: 0 18px 70px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--panel-3);
  color: var(--ink);
  cursor: pointer;
}

button:hover,
button:focus-visible {
  border-color: var(--cyan);
  outline: none;
}

input,
select {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: #071013;
  color: var(--ink);
  padding: 7px 9px;
}

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

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto auto 1fr;
}

.topbar {
  display: grid;
  grid-template-columns: auto minmax(240px, 640px) auto;
  align-items: center;
  gap: 18px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: #030607;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 2px solid var(--white);
  border-radius: 50%;
  font-family: Georgia, serif;
  font-size: 18px;
  font-weight: 800;
}

.brand p,
.eyebrow {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0;
}

.brand h1 {
  font-size: 20px;
  line-height: 1.15;
}

.path-control {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.path-control span {
  font-size: 12px;
  text-transform: uppercase;
}

.top-actions,
.button-row,
.toolbar,
.filter-row,
.option-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.top-actions {
  justify-content: end;
}

.primary {
  border-color: var(--cyan);
  background: var(--cyan);
  color: #001317;
  font-weight: 700;
}

.ghost {
  background: transparent;
}

.danger {
  border-color: rgba(255, 107, 107, 0.7);
  background: rgba(255, 107, 107, 0.12);
  color: #ffd9d9;
}

.icon-button {
  width: 38px;
  padding: 0;
}

.workspace-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 10px 18px 0;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.workspace-tabs button {
  min-width: max-content;
  border-color: transparent;
  border-bottom: 2px solid transparent;
  border-radius: 6px 6px 0 0;
  background: transparent;
  color: var(--muted);
  padding: 9px 13px;
}

.workspace-tabs button.is-active {
  border-color: var(--line);
  border-bottom-color: var(--cyan);
  background: var(--bg);
  color: var(--white);
}

main {
  min-height: 0;
  padding: 18px;
}

.tab-panel {
  display: none;
}

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

.monitor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
}

.hero-console,
.panel-card,
.preview-card,
.quick-actions,
.console-window,
.file-tree,
.code-pane,
.log-nav {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.hero-console,
.panel-card,
.quick-actions {
  padding: 18px;
}

.section-head,
.flow-header,
.gallery-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
  margin-bottom: 16px;
}

.section-head h2,
.flow-header h2,
.gallery-head h2 {
  font-size: clamp(22px, 2.4vw, 34px);
  line-height: 1.05;
}

.section-head.compact {
  margin-bottom: 10px;
}

.section-head.compact h3 {
  font-size: 16px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 13px;
}

.status-pill.ok {
  border-color: rgba(93, 255, 168, 0.55);
  color: var(--green);
}

.status-pill.warn {
  border-color: rgba(255, 212, 92, 0.55);
  color: var(--amber);
}

.signal-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.signal-grid article {
  display: grid;
  gap: 6px;
  min-height: 106px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--cyan);
  border-radius: 6px;
  background: #071013;
  padding: 12px;
}

.signal-grid span,
.metrics span,
.progress-block span,
.saved-table span {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.signal-grid strong {
  font-size: 16px;
}

.signal-grid em {
  color: var(--dim);
  font-size: 13px;
  font-style: normal;
}

.console-window {
  overflow: hidden;
  background: #020506;
}

.console-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #081114;
}

.chip {
  min-height: 28px;
  padding: 4px 8px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
}

.chip.is-active {
  border-color: var(--cyan);
  color: var(--cyan-soft);
}

.log-lines {
  list-style: none;
  margin: 0;
  padding: 8px 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}

.log-lines li {
  display: grid;
  grid-template-columns: 86px 56px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 7px 12px;
  border-bottom: 1px solid rgba(38, 54, 62, 0.65);
}

.log-lines time {
  color: var(--dim);
}

.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  border-radius: 4px;
  padding: 2px 5px;
  font-size: 11px;
}

.tag.ok {
  background: rgba(93, 255, 168, 0.14);
  color: var(--green);
}

.tag.info {
  background: rgba(24, 216, 255, 0.14);
  color: var(--cyan-soft);
}

.tag.warn {
  background: rgba(255, 212, 92, 0.14);
  color: var(--amber);
}

code {
  white-space: normal;
  color: #e9fbff;
}

.repro-strip {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #071013;
  padding: 12px;
}

.repro-strip > div {
  flex: 1 1 290px;
}

.side-stack {
  display: grid;
  gap: 18px;
  align-content: start;
}

.preview-card {
  overflow: hidden;
  background: var(--white);
  color: #111;
}

.mini-browser {
  display: grid;
  grid-template-columns: 9px 9px 9px minmax(0, 1fr);
  gap: 7px;
  align-items: center;
  padding: 10px;
  background: #1d2529;
  color: #d9e2e6;
}

.mini-browser span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--cyan);
}

.mini-browser strong {
  overflow: hidden;
  font-size: 12px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wp-mini-admin {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  background: #202529;
  color: #fff;
  font-size: 11px;
}

.wp-mini-page {
  min-height: 280px;
  padding: 46px 28px;
  background:
    radial-gradient(circle at 88% 54%, transparent 0 62px, #1e1e1e 63px 70px, transparent 71px),
    radial-gradient(circle at 94% 64%, transparent 0 112px, #31e878 113px 136px, transparent 137px),
    #fff;
}

.wp-mini-page h3 {
  max-width: 250px;
  font-family: Georgia, serif;
  font-size: 26px;
  line-height: 1.25;
}

.wp-mini-page h3 span {
  color: #3858f6;
}

.wp-mini-page p {
  max-width: 250px;
  margin-top: 16px;
  color: #111;
  line-height: 1.45;
}

.wp-mini-page button {
  margin-top: 18px;
  border: 0;
  background: #3858f6;
  color: #fff;
  padding: 8px 12px;
}

.quick-actions {
  display: grid;
  gap: 8px;
}

.flow-card,
.blueprint-grid article,
.saved-table article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

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

.flow-card {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 16px;
}

.flow-card p,
.panel-card p {
  color: var(--muted);
  line-height: 1.45;
}

.flow-card label,
.wide-field,
.settings-grid label,
.search-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.shortcut-list,
.action-list {
  display: grid;
  gap: 8px;
}

.split-layout,
.manager-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.8fr);
  gap: 18px;
}

.progress-block {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.progress-block > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

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

.progress span {
  display: block;
  height: 100%;
  background: var(--cyan);
}

.saved-table {
  display: grid;
  gap: 10px;
}

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

.saved-table article strong,
.saved-table article span {
  grid-column: 1;
}

.saved-table article button {
  grid-row: 1 / span 2;
}

.saved-table article button:first-of-type {
  grid-column: 2;
}

.saved-table article button:last-of-type {
  grid-column: 3;
}

.saved-table .selected {
  border-color: var(--cyan);
}

.notice {
  border-left: 3px solid var(--cyan);
  background: rgba(24, 216, 255, 0.08);
  color: #d9f8ff;
  padding: 12px;
  margin-bottom: 14px;
}

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

.settings-grid .check {
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-grid input[type="checkbox"],
.option-row input,
.repro-strip input {
  width: auto;
  min-height: 0;
}

.editor-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 1px;
  min-height: 640px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--line);
}

.file-tree,
.code-pane {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.file-tree {
  padding: 12px;
  overflow: auto;
}

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

.file-tree li {
  border-radius: 5px;
  padding: 9px 10px;
  color: var(--muted);
}

.file-tree li.open,
.file-tree li.selected {
  background: rgba(24, 216, 255, 0.1);
  color: var(--white);
}

.file-tree li.selected {
  border: 1px solid var(--cyan);
}

.code-head {
  border-bottom: 1px solid var(--line);
  background: #071013;
  color: var(--muted);
  padding: 12px 14px;
}

pre {
  margin: 0;
  overflow: auto;
  min-height: 590px;
  padding: 18px;
  background: #020506;
  color: #e9fbff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
  line-height: 1.6;
}

.compact-tree {
  display: grid;
  align-content: start;
  gap: 14px;
}

.database-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.2fr) minmax(280px, 0.6fr);
  gap: 18px;
}

.panel-card.loud {
  border-top: 4px solid var(--cyan);
}

.metrics {
  display: grid;
  gap: 12px;
}

.metrics article {
  display: grid;
  gap: 5px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.metrics strong {
  overflow-wrap: anywhere;
}

.logs-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 14px;
}

.log-nav {
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 12px;
}

.log-nav button.is-active {
  border-color: var(--cyan);
  color: var(--cyan-soft);
}

.console-window.full {
  min-height: 520px;
}

.gallery-head {
  align-items: end;
}

.search-field {
  width: min(100%, 320px);
}

.filter-row {
  margin-bottom: 16px;
}

.filter-row button {
  border-radius: 999px;
  min-height: 32px;
  padding: 5px 12px;
  color: var(--muted);
}

.filter-row button.is-active {
  border-color: var(--cyan);
  background: var(--cyan);
  color: #001317;
}

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

.blueprint-grid article {
  overflow: hidden;
  padding-bottom: 14px;
}

.blueprint-grid article.selected {
  border-color: var(--cyan);
}

.blueprint-grid h3,
.blueprint-grid p,
.blueprint-grid span {
  margin: 10px 14px 0;
}

.blueprint-grid p {
  color: var(--muted);
  line-height: 1.4;
}

.blueprint-grid span {
  display: inline-flex;
  border-radius: 999px;
  background: var(--panel-3);
  color: var(--muted);
  padding: 4px 8px;
  font-size: 12px;
}

.thumb {
  height: 150px;
  border-bottom: 1px solid var(--line);
}

.thumb.art {
  background:
    linear-gradient(90deg, rgba(4, 9, 11, 0.1), rgba(4, 9, 11, 0.45)),
    linear-gradient(135deg, #866121 0 32%, #b8ded2 32% 50%, #2d5147 50% 70%, #d9a05b 70%);
}

.thumb.coffee {
  background:
    radial-gradient(circle at 72% 58%, #ef8b42 0 16%, transparent 17%),
    linear-gradient(180deg, #4b1a78 0 45%, #e8a457 45%);
}

.thumb.feed {
  background:
    linear-gradient(90deg, rgba(255,255,255,0.95) 0 35%, rgba(230,236,255,0.9) 35%),
    repeating-linear-gradient(0deg, #4056e8 0 2px, transparent 2px 25px);
}

.thumb.gaming {
  background:
    radial-gradient(circle at 26% 64%, #d55c23 0 22%, transparent 23%),
    linear-gradient(180deg, #050505 0 45%, #f8f8f8 45%);
}

.thumb.nonprofit {
  background:
    linear-gradient(90deg, rgba(0,0,0,0.15), rgba(0,0,0,0.45)),
    radial-gradient(circle at 62% 42%, #e0b080 0 22%, #69401e 23%, #24130a 60%);
}

.thumb.personal {
  background:
    linear-gradient(90deg, rgba(10,0,8,0.15), rgba(10,0,8,0.6)),
    linear-gradient(135deg, #6e0f3c, #2a071b);
}

.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.74);
  padding: 20px;
}

.modal-layer[hidden] {
  display: none;
}

.modal {
  position: relative;
  width: min(100%, 560px);
  border: 1px solid var(--cyan);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 22px;
}

.modal p {
  color: var(--muted);
  margin: 8px 0 16px;
}

.close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  min-height: 34px;
  padding: 0;
}

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

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

  .monitor-grid,
  .split-layout,
  .manager-layout,
  .database-grid {
    grid-template-columns: 1fr;
  }

  .signal-grid,
  .start-grid,
  .blueprint-grid,
  .settings-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  main {
    padding: 12px;
  }

  .topbar {
    padding: 12px;
  }

  .path-control {
    grid-template-columns: 1fr;
  }

  .section-head,
  .flow-header,
  .gallery-head {
    display: grid;
  }

  .signal-grid,
  .start-grid,
  .blueprint-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .editor-layout,
  .logs-layout {
    grid-template-columns: 1fr;
  }

  .editor-layout {
    min-height: auto;
  }

  .log-lines li {
    grid-template-columns: 74px 48px minmax(0, 1fr);
    font-size: 12px;
  }

  .saved-table article {
    grid-template-columns: 1fr;
  }

  .saved-table article button,
  .saved-table article button:first-of-type,
  .saved-table article button:last-of-type {
    grid-column: auto;
    grid-row: auto;
  }

  pre {
    min-height: 360px;
  }
}
