:root {
  --blue: #1268f3;
  --blue-soft: #eef5ff;
  --green: #14a56a;
  --orange: #f58a1f;
  --purple: #6257e8;
  --cyan: #0ea5b7;
  --text: #172033;
  --muted: #6b7280;
  --line: #e6eaf0;
  --bg: #f6f8fb;
  --panel: #fff;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 220px;
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.brand { display: flex; align-items: center; gap: 10px; height: 40px; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px; color: #fff; font-weight: 800;
  display: grid; place-items: center; background: linear-gradient(135deg, #0ea5b7, var(--blue));
}
.brand strong { font-size: 17px; }
.icon-button { margin-left: auto; border: 0; background: transparent; font-size: 18px; }
.nav { display: grid; gap: 4px; overflow: auto; }
.nav a, .nav summary {
  display: block; padding: 10px 12px; border-radius: 6px; color: #283344; cursor: pointer;
}
.nav details a { padding-left: 34px; color: #3f4b5f; }
.nav .active, .nav summary:hover, .nav a:hover {
  background: var(--blue);
  color: #fff;
}
.nav .subactive { background: var(--blue-soft); color: var(--blue); border-right: 3px solid var(--blue); }
.runtime {
  margin-top: auto; padding: 14px; border-radius: 8px; background: #f8fafc; display: grid; gap: 8px;
  color: #536071; font-size: 12px;
}
.runtime strong { color: var(--text); font-size: 14px; }
.progress { height: 5px; background: #e5e7eb; border-radius: 99px; overflow: hidden; }
.progress i { display: block; width: 30%; height: 100%; background: var(--green); }

.main { margin-left: 220px; min-height: 100vh; }
.topbar {
  height: 62px; background: #fff; border-bottom: 1px solid var(--line); padding: 12px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.search {
  width: 380px; height: 36px; border: 1px solid var(--line); border-radius: 6px; display: flex;
  align-items: center; gap: 8px; padding: 0 10px; color: #8b95a5; background: #fff;
}
.search input { border: 0; outline: 0; flex: 1; min-width: 0; }
.search kbd { color: #6b7280; font-size: 12px; }
.top-actions { display: flex; align-items: center; gap: 22px; color: #101827; }
.top-actions a { position: relative; white-space: nowrap; }
.top-actions b {
  position: absolute; top: -10px; right: -12px; background: #ef4444; color: #fff;
  border-radius: 99px; padding: 1px 5px; font-size: 10px;
}
.user { display: flex; gap: 8px; align-items: center; font-weight: 600; }
.user small { display: block; color: var(--muted); font-weight: 400; }

.page-head { padding: 18px 24px; display: flex; justify-content: space-between; align-items: center; }
.breadcrumbs { color: #5d6878; }
.date-tabs { display: flex; gap: 0; }
.date-tabs button {
  border: 1px solid var(--line); background: #fff; padding: 8px 14px; margin-left: -1px; cursor: pointer;
}
.date-tabs button:first-child { border-radius: 6px 0 0 6px; }
.date-tabs button:last-child { border-radius: 0 6px 6px 0; margin-left: 12px; }

.metrics { padding: 0 24px 16px; display: grid; grid-template-columns: repeat(7, minmax(132px, 1fr)); gap: 12px; }
.metrics.compact { padding-bottom: 14px; }
.metric {
  min-height: 96px; background: #fff; border: 1px solid var(--line); border-radius: 8px;
  padding: 16px 14px; display: flex; gap: 12px; align-items: center;
}
.metric-icon {
  width: 48px; height: 48px; border-radius: 6px; color: #fff; display: grid; place-items: center;
  font-size: 13px; font-weight: 700;
}
.metric.blue .metric-icon { background: var(--blue); }
.metric.green .metric-icon { background: var(--green); }
.metric.orange .metric-icon { background: var(--orange); }
.metric.purple .metric-icon { background: var(--purple); }
.metric.cyan .metric-icon { background: var(--cyan); }
.metric span { color: #4b5563; }
.metric strong { display: block; font-size: 22px; margin: 4px 0; }
.metric small { color: var(--green); }

.dashboard-grid { padding: 0 24px 24px; display: grid; grid-template-columns: 2fr 1fr; gap: 14px; }
.panel {
  background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 16px;
}
.panel.wide { min-height: 240px; }
.panel-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.panel-title a { color: var(--blue); }
.chart-bars { height: 180px; display: flex; gap: 18px; align-items: end; padding: 20px; border: 1px solid #eef2f7; border-radius: 8px; }
.chart-bars i { flex: 1; background: linear-gradient(180deg, #2f7df4, #a8cdfd); border-radius: 6px 6px 0 0; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px; text-align: left; border-bottom: 1px solid var(--line); }

.badge { padding: 2px 8px; border-radius: 5px; font-size: 12px; }
.badge.green, .ok { background: #e9f8f1; color: var(--green); }
.badge.orange { background: #fff3e8; color: var(--orange); }
.badge.blue { background: var(--blue-soft); color: var(--blue); }
.danger { background: #fee2e2; color: #dc2626; }
.muted { color: var(--muted); }
.status-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); }

.editor-shell { margin: 0 24px 24px; background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.editor-title { height: 58px; display: flex; align-items: center; gap: 12px; padding: 0 18px; border-bottom: 1px solid var(--line); font-size: 18px; }
.editor-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.editor-actions form { margin: 0; }
.button {
  border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 8px 14px; cursor: pointer;
}
.button.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.button.ghost { color: #354154; }
.button.small { padding: 6px 10px; font-size: 12px; }
.editor-grid { display: grid; grid-template-columns: 300px 300px minmax(380px, 1fr) 288px; min-height: 650px; }
.editor-grid > * { border-right: 1px solid var(--line); }
.editor-grid > *:last-child { border-right: 0; }
.section-title { height: 48px; padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; font-weight: 700; }
.filters { display: flex; gap: 8px; padding: 12px; border-bottom: 1px solid var(--line); }
.filters input, .filters select { min-width: 0; border: 1px solid var(--line); border-radius: 6px; padding: 8px; }
.template-item { display: grid; grid-template-columns: 48px 1fr 24px; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); align-items: center; }
.template-item.selected { background: var(--blue-soft); outline: 1px solid #9ec5fe; outline-offset: -1px; }
.template-item strong { display: block; color: var(--blue); }
.template-item small { display: block; color: var(--muted); margin-top: 4px; }
.template-item button { border: 0; background: transparent; color: #6b7280; }
.thumb { width: 48px; height: 60px; background: linear-gradient(180deg, #eef5ff, #fff); border: 1px solid var(--line); border-radius: 4px; }
.pager { padding: 14px; display: flex; gap: 14px; align-items: center; justify-content: center; color: #6b7280; }
.pager b { color: var(--blue); border: 1px solid #b9d4ff; padding: 4px 9px; border-radius: 6px; }

.phone-column { background: #fbfcfe; }
.device-tabs button { border: 1px solid var(--line); background: #fff; border-radius: 4px; padding: 4px 8px; }
.device-tabs .on { border-color: #88bafd; color: var(--blue); }
.phone {
  width: 232px; min-height: 520px; margin: 24px auto; background: #fff; border: 1px solid #e0e5ec;
  border-radius: 28px; box-shadow: 0 14px 34px rgba(15, 23, 42, .12); padding: 30px 18px; text-align: center;
}
.avatar img { width: 58px; height: 58px; border-radius: 12px; }
.phone h2 { font-size: 18px; margin: 10px 0 2px; }
.phone p { color: #6b7280; margin: 6px 0; white-space: pre-line; text-align: left; }
.price { color: #ef4444; font-size: 18px; font-weight: 800; margin: 12px 0; }
.price small { color: #9ca3af; font-size: 11px; margin-left: 4px; font-weight: 400; }
.feature-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; font-size: 10px; color: var(--green); margin: 12px 0; }
.pay-box { border: 1px solid #8bd5b3; border-radius: 6px; padding: 8px; margin-top: 8px; display: flex; justify-content: space-between; color: var(--green); background: #f4fbf7; }
.muted-pay { border-color: var(--line); color: #6b7280; background: #fff; }
.pay-button, .public-pay { display: block; background: var(--green); color: #fff; border-radius: 6px; padding: 10px; margin-top: 12px; font-weight: 700; text-align: center; }
.safe { color: #9ca3af; margin-top: 8px; display: block; }

.field-editor { background: #fff; }
.field-row { display: grid; grid-template-columns: 24px 110px 1fr 28px; gap: 12px; padding: 14px 10px; border-bottom: 1px solid var(--line); align-items: center; }
.field-row.changed { background: #fbfdff; }
.drag { color: #9ca3af; cursor: grab; }
.field-row label strong, .field-row label small { display: block; }
.field-row label small { color: var(--muted); font-size: 12px; }
.field-row input:not([type="checkbox"]), .field-row textarea {
  border: 1px solid var(--line); border-radius: 5px; padding: 9px; width: 100%; resize: vertical;
}
.field-row textarea { min-height: 90px; }
.image-input { display: flex; align-items: center; gap: 12px; }
.image-input img { width: 42px; height: 42px; border-radius: 6px; border: 1px solid var(--line); }
.image-input button, .resource-title button { border: 1px solid var(--line); background: #fff; color: var(--blue); border-radius: 5px; padding: 7px 10px; }
.tag-input { border: 1px solid var(--line); border-radius: 5px; padding: 6px; display: flex; gap: 6px; flex-wrap: wrap; }
.tag-input span { background: #f3f4f6; border: 1px solid #e5e7eb; border-radius: 4px; padding: 4px 6px; }
.checks { display: grid; gap: 8px; color: #344154; }
.field-enable { width: 16px; height: 16px; }
.add-field { margin: 14px; width: calc(100% - 28px); border: 1px dashed #7eb2ff; color: var(--blue); background: #f7fbff; border-radius: 6px; padding: 14px; }

.materials { background: #fcfdff; }
.tabs { display: flex; gap: 24px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.tabs b { color: var(--blue); border-bottom: 2px solid var(--blue); padding-bottom: 8px; }
.resource-card { margin: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.resource-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-weight: 700; }
.asset-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.asset-grid img, .asset-grid span {
  width: 70px; height: 54px; border-radius: 6px; border: 1px solid var(--line); object-fit: cover;
}
.asset-grid span { display: grid; place-items: center; background: #374151; color: #fff; font-size: 12px; }
.asset-grid.bg img { height: 64px; }
.qr-row { display: flex; gap: 12px; align-items: center; }
.qr-row img { width: 78px; height: 78px; border: 1px solid var(--line); }
.qr-row a { color: var(--blue); font-size: 12px; }
.footer {
  padding: 18px 24px 28px;
  text-align: center;
  color: #6b7280;
  font-size: 12px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
}
.admin-panel {
  margin: 0 24px 24px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}
.link { color: var(--blue); cursor: pointer; }
.material-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}
.material-tile {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 8px;
  background: #fcfdff;
}
.material-tile img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
}
.material-tile span { color: var(--muted); font-size: 12px; }
.analytics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.analytics-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fbfdff;
}
.analytics-grid span, .analytics-grid small { color: var(--muted); display: block; }
.analytics-grid strong { display: block; font-size: 28px; margin: 8px 0; }
.settings-grid {
  margin: 0 24px 24px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.settings-grid .admin-panel { margin: 0; }
.setting-line {
  display: grid;
  gap: 7px;
  color: #3f4b5f;
  margin-bottom: 14px;
}
.setting-line input {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  width: 100%;
}
.public-pay {
  border: 0;
  width: 100%;
  cursor: pointer;
  font: inherit;
}
.help-hero {
  margin: 0 24px 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.help-hero h1 { margin: 0 0 6px; }
.help-hero p { margin: 0; color: var(--muted); }
.help-grid {
  margin: 0 24px 24px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.help-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}
.help-card b { display: block; margin-bottom: 8px; font-size: 15px; }
.help-card p { color: #566276; margin: 0; }
code {
  background: #f3f6fb;
  border: 1px solid #e6eaf0;
  border-radius: 4px;
  padding: 1px 5px;
  font-family: Consolas, monospace;
}
.steps { margin: 0; padding-left: 22px; display: grid; gap: 10px; color: #344154; }

.public-page {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: linear-gradient(180deg, #f8fbff, #eef5ff);
}
.public-card {
  width: min(420px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, .12); padding: 28px; text-align: center;
}
.public-avatar { width: 74px; height: 74px; border-radius: 16px; }
.public-card h1 { margin: 14px 0 6px; }
.public-card p { color: #5b6678; }
.public-price { color: #ef4444; font-size: 24px; font-weight: 800; margin: 16px 0; }
.public-price small { color: #9ca3af; font-size: 13px; font-weight: 400; }
.public-tags { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 14px 0; }
.public-tags span { color: var(--green); background: #ecfdf5; border-radius: 999px; padding: 5px 9px; font-size: 12px; }
.preline { white-space: pre-line; text-align: left; }
.success-mark { width: 64px; height: 64px; border-radius: 50%; margin: 0 auto; display: grid; place-items: center; background: #e9f8f1; color: var(--green); font-size: 34px; }
.success-qr { width: 180px; height: 180px; border: 1px solid var(--line); margin: 16px auto; }
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: #f6f8fb;
  padding: 24px;
}
.login-card {
  width: min(380px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, .10);
  padding: 28px;
}
.login-brand { margin-bottom: 22px; }
.login-card h1 { margin: 0 0 8px; }
.login-card p { color: var(--muted); margin: 0 0 22px; }
.login-card form { display: grid; gap: 14px; }
.login-card label { display: grid; gap: 7px; color: #344154; }
.login-card input {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 12px;
}
.login-error {
  color: #dc2626;
  background: #fee2e2;
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 14px;
}
.brand-note, .public-brand {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

@media (max-width: 1200px) {
  .metrics { grid-template-columns: repeat(3, 1fr); }
  .editor-grid { grid-template-columns: 280px 280px minmax(360px, 1fr); }
  .materials { grid-column: 1 / -1; border-top: 1px solid var(--line); }
  .analytics-grid, .settings-grid, .help-grid { grid-template-columns: 1fr 1fr; }
}
