* { box-sizing: border-box; }
:root {
  --bg: #f4f5f7;
  --panel: #fff;
  --line: #e6e8eb;
  --ink: #1f2328;
  --muted: #8a9099;
  --accent: #2b6cb0;
}
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 13px/1.5 -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  display: flex; flex-direction: column;
}

/* topbar */
.topbar {
  height: 52px; flex: none; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; padding: 0 16px;
}
.brand { display: flex; align-items: center; gap: 8px; }
.brand .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: linear-gradient(135deg, #07c160, #38d47e);
}
.brand strong { font-size: 15px; }
.brand .sub { color: var(--muted); font-size: 12px; }
.topright { display: flex; align-items: center; gap: 8px; }
.status { color: var(--muted); font-size: 12px; margin-right: 4px; }

button {
  font: inherit; border-radius: 7px; padding: 7px 14px; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
}
button:hover { border-color: #c9ced5; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { filter: brightness(1.08); }
button.ghost { background: #fff; }

/* layout */
main {
  flex: 1; min-height: 0; display: grid;
  grid-template-columns: 290px minmax(420px, 1fr) 260px; gap: 0;
}
.col { overflow: auto; }
.left, .right { background: var(--panel); padding: 14px; }
.left { border-right: 1px solid var(--line); }
.right { border-left: 1px solid var(--line); }
.center { display: flex; flex-direction: column; min-height: 0; }

.group { margin-bottom: 20px; }
.group h4 {
  margin: 0 0 10px; font-size: 12px; letter-spacing: .06em; color: var(--muted);
  text-transform: uppercase; font-weight: 600;
}
.hint { color: var(--muted); font-weight: 400; font-size: 11px; }

label { display: block; margin-bottom: 10px; font-size: 12px; color: #4a5058; }
label > output { float: right; color: var(--accent); font-variant-numeric: tabular-nums; }
input[type=text], textarea, select {
  width: 100%; margin-top: 4px; padding: 6px 8px; font: inherit; color: var(--ink);
  border: 1px solid var(--line); border-radius: 6px; background: #fff;
}
textarea { resize: vertical; font-family: Menlo, Consolas, monospace; font-size: 12px; line-height: 1.6; }
input[type=color] { width: 100%; height: 30px; padding: 0; border: 1px solid var(--line); border-radius: 6px; }
input[type=range] { width: 100%; margin-top: 6px; }
.row { display: flex; gap: 10px; }
.chk { display: flex; align-items: center; gap: 5px; font-size: 12px; }
.chk input { margin: 0; }

/* tabs */
.tabs { flex: none; display: flex; align-items: center; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fff; }
.tab { border: none; background: transparent; color: var(--muted); padding: 5px 10px; border-radius: 6px; }
.tab.on { background: #eef3fa; color: var(--accent); font-weight: 600; }
.tabs .tip { margin-left: auto; color: var(--muted); font-size: 11px; }

.view { flex: 1; min-height: 0; display: none; overflow: auto; padding: 20px; }
.view.on { display: block; }
#viewMd, #viewHtml { padding: 0; }
#mdSource, #htmlOut {
  width: 100%; height: 100%; border: none; border-radius: 0; padding: 18px 20px;
  font-family: "JetBrains Mono", Menlo, Consolas, monospace; font-size: 12.5px; line-height: 1.7;
  outline: none; resize: none; background: #fbfbfc; color: #2b2b2b;
}

/* phone */
.phone {
  width: 414px; margin: 0 auto; background: #fff; border-radius: 22px;
  box-shadow: 0 10px 40px rgba(0,0,0,.14); overflow: hidden; border: 1px solid #e3e5e8;
}
.phone-bar { height: 26px; background: #f2f3f5; display: flex; align-items: center; gap: 5px; padding: 0 12px; }
.phone-bar span { width: 7px; height: 7px; border-radius: 50%; background: #d3d6da; }
.phone-head { padding: 18px 18px 12px; border-bottom: 1px solid #f0f1f3; }
.ph-title { font-size: 19px; font-weight: 700; line-height: 1.4; color: #1a1a1a; }
.ph-meta { margin-top: 8px; font-size: 12px; color: #9a9a9a; }
.phone-body { padding: 16px 16px 30px; }

/* right panel */
.steps { margin: 0; padding-left: 18px; color: #4a5058; }
.steps li { margin-bottom: 7px; font-size: 12px; line-height: 1.6; }
.checks { list-style: none; margin: 0; padding: 0; }
.checks li { font-size: 12px; padding: 3px 0; display: flex; gap: 6px; }
.checks .ok { color: #07c160; }
.checks .bad { color: #e0483c; }
.drafts { list-style: none; margin: 0; padding: 0; }
.drafts li { font-size: 12px; padding: 6px 0; border-bottom: 1px dashed #f0f1f3; line-height: 1.5; }
.drafts .muted, .muted { color: var(--muted); }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%) translateY(20px);
  background: #1f2328; color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 13px;
  opacity: 0; pointer-events: none; transition: .22s; max-width: 70vw;
}
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.bad { background: #b33226; }
