:root {
  --bg: #f3f0e8;
  --ink: #1c1917;
  --muted: #78716c;
  --line: #e7e1d6;
  --card: #fffdf8;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --warn: #c2410c;
  --danger: #b91c1c;
  --side: #1c1917;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  color: var(--ink);
  background: var(--bg);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) 1.1fr;
}
.login-hero {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 48px;
  background: var(--side);
  color: #f5f5f4;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: 0.04em; }
.brand i {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #0f766e;
  font-style: normal;
}
.login-hero h1 { margin: 0 0 12px; font-size: 48px; line-height: 1.15; font-weight: 650; }
.login-hero p { margin: 0; max-width: 360px; color: #d6d3d1; line-height: 1.7; }
.hero-points { display: grid; gap: 10px; margin-top: 28px; color: #e7e5e4; }
.hero-points span { color: #5eead4; margin-right: 8px; }
.login-panel { display: grid; place-items: center; padding: 32px; }
.login-card { width: min(400px, 100%); }
.login-card h2 { margin: 0 0 8px; font-size: 28px; }
.login-card .muted { margin: 0 0 24px; }
.stack { display: grid; gap: 8px; margin-bottom: 14px; }
.stack span { font-size: 13px; color: var(--muted); }
.stack input, .field input, .field textarea, .field select, .title-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  outline: none;
}
.stack input:focus, .field input:focus, .field textarea:focus, .field select:focus, .title-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
}
.form-error { min-height: 22px; margin: 8px 0 0; color: var(--danger); font-size: 13px; }

.btn {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 10px 16px;
  background: #fff;
  line-height: 1.2;
}
.btn:disabled { opacity: 0.55; cursor: default; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-ghost { border-color: var(--line); background: transparent; }
.btn-warn { background: #fff7ed; color: var(--warn); border-color: #fed7aa; }
.btn-danger { background: #fef2f2; color: var(--danger); border-color: #fecaca; }
.btn-small { padding: 6px 10px; font-size: 13px; }
.btn-block { width: 100%; }

.app { min-height: 100vh; display: grid; grid-template-columns: 228px 1fr; }
.side {
  display: flex;
  flex-direction: column;
  padding: 22px 14px;
  background: var(--side);
  color: #f5f5f4;
}
.side nav { display: grid; gap: 6px; margin-top: 28px; }
.side a {
  padding: 10px 12px;
  border-radius: 12px;
  text-decoration: none;
  color: #d6d3d1;
}
.side a.active, .side a:hover { background: #292524; color: #fff; }
.side-user { margin-top: auto; padding: 12px; border-top: 1px solid #292524; }
.side-user strong, .side-user span { display: block; }
.side-user span { margin: 4px 0 10px; color: #a8a29e; font-size: 13px; }
.main { min-width: 0; }
.topbar, .content { padding: 22px 28px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.topbar h1 { margin: 0; font-size: 26px; }
.top-actions { display: flex; gap: 8px; align-items: center; }
.search {
  width: 220px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
}
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 18px; }
.stat, .page-card, .table-wrap, .panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
}
.stat { padding: 14px 16px; }
.stat b { display: block; margin-top: 6px; font-size: 24px; }
.stat span, .muted { color: var(--muted); font-size: 13px; }
.page-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.page-card { padding: 16px; display: flex; flex-direction: column; gap: 10px; min-height: 180px; }
.page-card h3 { margin: 0; font-size: 18px; }
.card-meta { display: flex; gap: 12px; color: var(--muted); font-size: 13px; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }
.badge { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 999px; font-size: 12px; background: #f5f5f4; }
.badge-on { background: #ccfbf1; color: #115e59; }
.badge-off { background: #f5f5f4; color: #57534e; }
.badge-tpl { background: #ffedd5; color: #9a3412; }
.card-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.tpl-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.tpl-card { border: 1px solid var(--line); border-radius: 14px; padding: 12px; background: #fff; text-align: left; }
.tpl-card strong { display: block; margin-bottom: 4px; }
.tpl-card span { color: var(--muted); font-size: 12px; line-height: 1.4; }
.tpl-card.on { border-color: var(--accent); background: #f0fdfa; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; font-size: 14px; }
th { color: var(--muted); font-weight: 600; font-size: 12px; }
td .sub { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; word-break: break-all; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.pager { display: flex; gap: 10px; align-items: center; justify-content: flex-end; margin-top: 14px; }
.empty { padding: 48px 16px; text-align: center; color: var(--muted); }
.panel { padding: 16px; margin-bottom: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 10px; align-items: end; }
.modal-mask {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(28, 25, 23, 0.46);
  z-index: 20;
}
.modal { width: min(480px, 100%); padding: 18px; border-radius: 18px; background: var(--card); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.icon-btn { border: 0; background: transparent; font-size: 22px; line-height: 1; }
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(12px);
  padding: 10px 16px;
  border-radius: 999px;
  background: #1c1917;
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transition: 0.2s ease;
  z-index: 30;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.editor { height: 100vh; display: flex; flex-direction: column; background: #efeae2; }
.editor-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.title-input { max-width: 360px; font-weight: 650; }
.bar-actions { display: flex; gap: 8px; margin-left: auto; }
.editor-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 220px minmax(420px, 1fr) 320px; }
.palette, .inspector { overflow: auto; padding: 16px; background: var(--card); }
.inspector { border-left: 1px solid var(--line); }
.palette { border-right: 1px solid var(--line); }
.palette h3, .inspector h3 { margin: 16px 0 8px; font-size: 12px; color: #a8a29e; font-weight: 650; }
.palette h3:first-child { margin-top: 0; }
.block-btn {
  display: block;
  width: 100%;
  margin-bottom: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  text-align: left;
}
.block-btn:hover, .block-btn.on { border-color: #99f6e4; background: #f0fdfa; }
.palette-note { margin: 0 0 12px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.jump-mp { display: grid; gap: 6px; }
.stage { display: grid; place-items: center; overflow: auto; padding: 28px 16px; }
.phone { width: 390px; padding: 12px 12px 16px; border-radius: 36px; background: #1c1917; box-shadow: 0 24px 50px rgba(28, 25, 23, 0.18); }
.phone-top { display: flex; justify-content: space-between; padding: 4px 12px 8px; color: #e7e5e4; font-size: 12px; }
.phone-sig { width: 46px; height: 8px; margin-top: 3px; border-radius: 99px; background: #44403c; }
.phone-screen { height: 640px; overflow: auto; border-radius: 24px; background: #fff; }
.phone-home { width: 108px; height: 4px; margin: 12px auto 0; border-radius: 99px; background: #57534e; }
.inspector-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.inspector-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; }
.field { display: grid; gap: 6px; margin-bottom: 12px; }
.field-label { font-size: 13px; color: var(--muted); }
.color-row, .upload-row { display: flex; gap: 8px; align-items: center; }
.color-row input[type="color"] { width: 42px; height: 36px; padding: 0; border: 0; background: transparent; }
.image-row { display: grid; gap: 6px; margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px dashed var(--line); }
.check { display: flex; align-items: center; gap: 8px; }
.check input { width: auto; }

@media (max-width: 1080px) {
  .login, .app, .editor-body, .stats, .form-row { grid-template-columns: 1fr; }
  .editor { height: auto; }
  .login-hero { min-height: 240px; }
  .side { position: static; }
}
