:root {
  color-scheme: light;
  font-family: "Avenir Next", Avenir, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
  --page: #edf5fb;
  --panel: #ffffff;
  --ink: #101827;
  --muted: #617083;
  --line: #cbd9e5;
  --accent: #1769b3;
  --green: #148a48;
  --green-soft: #e9f8ef;
  --warn: #8a5b00;
  --warn-soft: #fff7df;
  --danger: #a22b2b;
  --danger-soft: #fff0f0;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #eef4fa;
  color: var(--ink);
  font-weight: 850;
  cursor: pointer;
}

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

.shell {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 16px;
  width: min(1480px, calc(100vw - 28px));
  min-height: calc(100vh - 28px);
  margin: 14px auto;
}

.control-panel,
.preview-panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
}

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

.brand {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.brand img {
  width: 54px;
  height: 54px;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(16, 24, 39, 0.18);
}

.brand p,
.brand h1 {
  margin: 0;
}

.brand p {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.brand h1 {
  font-size: 26px;
  line-height: 1.05;
}

.status-card {
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f7fbff;
  color: var(--muted);
  font-weight: 820;
}

.status-card.ready {
  border-color: #a9dabb;
  background: var(--green-soft);
  color: #0f5c33;
}

.status-card.warn {
  border-color: #e7cc78;
  background: var(--warn-soft);
  color: var(--warn);
}

.status-card.error {
  border-color: #eeaaaa;
  background: var(--danger-soft);
  color: var(--danger);
}

.target-box {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f7fbff;
}

.target-box > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.target-box strong {
  font-weight: 900;
}

#refreshTargetsButton {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.target-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.target-pill {
  min-height: 34px;
  max-width: 100%;
  padding: 0 11px;
  border-radius: 999px;
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
}

.target-pill.selected {
  border-color: var(--accent);
  background: #e8f3ff;
  color: #0f4f87;
  box-shadow: inset 0 0 0 1px rgba(23, 105, 179, 0.18);
}

.target-box p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  line-height: 1.3;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.primary {
  border-color: #0f7a3d;
  background: #168a45;
  color: #ffffff;
}

.command-box {
  display: grid;
  gap: 9px;
  padding: 12px;
  border: 1px solid #e4c36d;
  border-radius: var(--radius);
  background: var(--warn-soft);
}

.command-box div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.command-box span {
  color: var(--muted);
  font-weight: 800;
}

code {
  display: block;
  overflow: hidden;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: #2d2110;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-label {
  margin-top: 6px;
  color: var(--ink);
  font-weight: 900;
}

input[type="search"] {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fbff;
  color: var(--ink);
  font-weight: 760;
}

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

.theme-card {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 82px;
  padding: 10px;
  text-align: left;
}

.theme-card.selected {
  border-color: var(--accent);
  background: #e8f3ff;
  box-shadow: inset 0 0 0 2px rgba(23, 105, 179, 0.13);
}

.swatch {
  height: 58px;
  border: 1px solid rgba(15, 23, 42, 0.18);
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.55);
}

.theme-card strong,
.theme-card span {
  display: block;
}

.theme-card strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.theme-card span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.25;
}

.preview-panel {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-width: 0;
  padding: 16px;
}

.mock-window {
  --bg: #d8ebfa;
  --bg2: #f6fbff;
  --sidebar: #bdd5e9;
  --sidebar-text: #0f2638;
  --surface: #f7fbff;
  --surface2: #eaf4fc;
  --text: #0b1f33;
  --muted-text: #4b6174;
  --border: #8fb2cf;
  --accent-color: #1769b3;
  --button-text: #ffffff;
  min-height: 620px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: linear-gradient(180deg, var(--bg2) 0%, color-mix(in srgb, var(--bg2) 44%, var(--bg) 56%) 48%, var(--bg) 100%);
  color: var(--text);
}

.window-bar {
  height: 52px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 18px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  background: color-mix(in srgb, var(--surface) 72%, transparent);
}

.window-bar i {
  width: 13px;
  height: 13px;
  border-radius: 50%;
}

.window-bar .red {
  background: #ff5f57;
}

.window-bar .yellow {
  background: #febc2e;
}

.window-bar .green {
  background: #28c840;
}

.window-bar span {
  flex: 1;
}

.window-bar b {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text);
}

.app-preview {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 568px;
}

.app-preview aside {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 28px;
  background: var(--sidebar);
  color: var(--sidebar-text);
}

.app-preview aside strong,
.app-preview aside span {
  min-height: 28px;
  display: flex;
  align-items: center;
  color: var(--sidebar-text);
  font-size: 17px;
}

.app-preview aside p {
  margin: 18px 0 0;
  color: color-mix(in srgb, var(--sidebar-text) 62%, var(--sidebar));
  font-weight: 900;
}

.app-preview aside span {
  padding: 0 10px;
  border-radius: 7px;
}

.app-preview aside .selected {
  background: color-mix(in srgb, var(--accent-color) 18%, var(--sidebar));
}

.app-preview section {
  padding: 58px 38px;
}

.app-preview h2 {
  margin: 0 0 30px;
  color: var(--text);
  text-align: center;
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 500;
  letter-spacing: 0;
}

.composer-preview {
  max-width: 760px;
  min-height: 136px;
  margin: 0 auto;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 28px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 74%, var(--bg2) 26%) 0%, color-mix(in srgb, var(--surface2) 76%, var(--bg) 24%) 100%);
  box-shadow: 0 24px 62px color-mix(in srgb, var(--text) 14%, transparent);
}

.composer-preview p {
  margin: 0;
  color: color-mix(in srgb, var(--text) 64%, var(--surface));
  font-size: 22px;
  font-weight: 760;
}

.composer-preview footer {
  display: grid;
  grid-template-columns: 1fr 1fr 46px;
  align-items: center;
  gap: 16px;
  margin-top: 34px;
}

.composer-preview span {
  color: var(--accent-color);
  font-weight: 860;
}

.composer-preview button {
  width: 46px;
  height: 46px;
  min-height: 46px;
  border: 0;
  border-radius: 50%;
  background: var(--accent-color);
  color: var(--button-text);
  font-size: 24px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  max-width: 760px;
  margin: 28px auto 0;
}

.cards article {
  min-height: 140px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface2) 84%, transparent);
}

.cards b {
  display: block;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--accent-color), var(--surface));
}

.cards strong {
  display: block;
  margin-top: 14px;
  color: var(--text);
  font-size: 19px;
  line-height: 1.15;
}

.cards p {
  margin: 8px 0 0;
  color: color-mix(in srgb, var(--text) 62%, var(--surface));
  font-size: 14px;
  line-height: 1.3;
  font-weight: 650;
}

.evidence-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.evidence-strip article {
  min-height: 62px;
  padding: 11px 12px;
  border: 1px solid #bcd6f0;
  border-radius: var(--radius);
  background: #edf6ff;
}

.evidence-strip strong,
.evidence-strip span {
  display: block;
}

.evidence-strip strong {
  color: #0d5fae;
}

.evidence-strip span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

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

  .app-preview {
    grid-template-columns: 1fr;
  }

  .app-preview aside {
    display: none;
  }

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

  .evidence-strip,
  .actions {
    grid-template-columns: 1fr;
  }
}
