:root {
  --bg: #0b0e19;
  --bg-soft: #12162a;
  --panel: #ffffff;
  --ink: #12162a;
  --ink-2: #4b5266;
  --ink-3: #8b91a5;
  --line: #e8eaf2;
  --brand: #6d5cff;
  --brand-2: #9a8bff;
  --ok: #16a34a;
  --warn: #d97706;
  --danger: #e5484d;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(16, 20, 40, 0.09);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: #f4f5fa;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }

/* ---------- 登录 ---------- */

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: radial-gradient(1200px 600px at 15% 10%, #1c1f3a 0%, #0b0e19 55%, #070912 100%);
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: rgba(255, 255, 255, 0.98);
  border-radius: 20px;
  padding: 34px 30px 28px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}

.login-card .logo {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand), #22d3ee);
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 18px;
  margin-bottom: 18px;
}

.login-card h1 { font-size: 20px; margin: 0 0 6px; }
.login-card p.sub { margin: 0 0 22px; color: var(--ink-3); font-size: 13px; }

label.field { display: block; margin-bottom: 14px; }
label.field span { display: block; font-size: 12px; color: var(--ink-2); margin-bottom: 6px; }

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 14px;
  color: var(--ink);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(109, 92, 255, 0.14);
}

textarea { min-height: 84px; resize: vertical; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 10px;
  padding: 10px 16px;
  font-size: 14px; font-weight: 600;
  cursor: pointer;
  background: #f0f1f7;
  color: var(--ink);
  transition: transform .12s, filter .12s;
}
.btn:hover { filter: brightness(0.97); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(135deg, var(--brand), #8b6cff); color: #fff; }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.danger { background: #fdecec; color: var(--danger); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn.sm { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.btn.ok { background: #e7f8f1; color: var(--ok); }

.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); margin-bottom: 12px; }
.check input { width: auto; }

.tabs { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 7px 14px; font-size: 13px; cursor: pointer; color: var(--ink-2); }
.tabs button.active { background: var(--brand); border-color: var(--brand); color: #fff; }

.thumb { width: 54px; height: 54px; border-radius: 10px; object-fit: cover; background: #f0f1f7; flex: 0 0 54px; }
.span2 { grid-column: span 2; }

/* ---------- 分享推广 ---------- */

.share-preview {
  display: flex; gap: 14px; align-items: flex-start;
  border: 1px solid var(--line); border-radius: 14px; padding: 14px;
  background: #fafbff;
}
.share-preview .sp-cover {
  width: 120px; height: 120px; flex: 0 0 120px; border-radius: 10px; overflow: hidden;
  background: #eef0f8; display: flex; align-items: center; justify-content: center;
  color: #9aa0b4; font-size: 12px;
}
.share-preview .sp-cover img { width: 100%; height: 100%; object-fit: cover; }
.share-preview .sp-body { min-width: 0; flex: 1; }
.share-preview .sp-title { font-weight: 700; font-size: 16px; color: var(--ink); }
.share-preview .sp-desc { margin-top: 6px; font-size: 13px; color: var(--ink-2); line-height: 1.6; }
.share-preview .sp-link { margin-top: 10px; font-size: 12px; color: var(--brand); word-break: break-all; }
.share-wechat { margin-top: 18px; }
.share-wechat .hint { font-size: 12px; color: var(--ink-2); margin-bottom: 8px; }
.share-wechat img { width: 180px; height: 180px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }

.err { color: var(--danger); font-size: 13px; min-height: 18px; margin: 6px 0 4px; }

/* ---------- 布局 ---------- */

.shell { display: flex; min-height: 100vh; }

.side {
  width: 224px; flex: 0 0 224px;
  background: var(--bg);
  color: #cfd2e4;
  padding: 22px 14px;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}

.side .brand { display: flex; gap: 10px; align-items: center; padding: 0 6px 22px; }
.side .brand .mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--brand), #22d3ee);
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 15px;
}
.side .brand small { display: block; color: #7b819c; font-size: 11px; margin-top: 2px; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav button {
  text-align: left;
  border: 0; background: transparent; color: #b9bed2;
  padding: 10px 12px; border-radius: 10px;
  font-size: 13.5px; cursor: pointer; display: flex; gap: 10px; align-items: center;
}
.nav button:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav button.active { background: rgba(109, 92, 255, .18); color: #fff; }
.nav .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--brand-2); opacity: .8; }

.side .foot { margin-top: auto; font-size: 12px; color: #6f7590; padding: 0 8px; }
.side .foot .who { color: #cdd0e3; margin-bottom: 8px; }

.main { flex: 1; padding: 26px 30px 40px; min-width: 0; }

.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 16px; }
.page-head h2 { font-size: 21px; margin: 0; }
.page-head p { margin: 6px 0 0; color: var(--ink-3); font-size: 13px; }

.card {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.grid { display: grid; gap: 16px; }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.metric .k { font-size: 12px; color: var(--ink-3); }
.metric .v { font-size: 26px; font-weight: 700; margin-top: 6px; }
.metric .h { font-size: 12px; color: var(--ink-3); margin-top: 4px; }

.project-card { display: flex; flex-direction: column; gap: 12px; cursor: pointer; transition: transform .15s, box-shadow .15s; }
.project-card:hover { transform: translateY(-2px); box-shadow: 0 16px 36px rgba(16,20,40,.13); }
.project-card .top { display: flex; gap: 12px; align-items: center; }
.project-card .app-icon {
  width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 17px; flex: 0 0 46px;
}
.project-card h3 { margin: 0; font-size: 16px; }
.project-card .meta { color: var(--ink-3); font-size: 12px; margin-top: 4px; }
.project-card .stats { display: flex; gap: 18px; font-size: 12px; color: var(--ink-2); }
.project-card .stats b { display: block; font-size: 18px; color: var(--ink); margin-top: 2px; }

.tag {
  display: inline-block; font-size: 11px; padding: 3px 8px; border-radius: 999px;
  background: #eef0ff; color: var(--brand); font-weight: 600;
}
.tag.gray { background: #f0f1f6; color: var(--ink-3); }
.tag.green { background: #e8f7ee; color: var(--ok); }
.tag.amber { background: #fff5e5; color: var(--warn); }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--ink-3); font-weight: 600; font-size: 12px; }
tr:last-child td { border-bottom: 0; }

.row { display: flex; gap: 12px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }

.modal-mask {
  position: fixed; inset: 0; background: rgba(9, 11, 22, .55);
  display: none; place-items: center; padding: 20px; z-index: 50;
  backdrop-filter: blur(3px);
}
.modal-mask.show { display: grid; }
.modal {
  width: 100%; max-width: 560px; background: #fff; border-radius: 18px;
  padding: 24px; box-shadow: 0 30px 80px rgba(0,0,0,.3);
  max-height: 88vh; overflow: auto;
}
.modal h3 { margin: 0 0 4px; font-size: 17px; }
.modal .hint { color: var(--ink-3); font-size: 12.5px; margin: 0 0 16px; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

.perm-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.perm-item {
  display: flex; align-items: center; gap: 9px;
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  font-size: 13px; cursor: pointer;
}
.perm-item input { width: 16px; height: 16px; }
.perm-item small { display: block; color: var(--ink-3); font-size: 11.5px; margin-top: 2px; }

.chip-list { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px;
  font-size: 12.5px; cursor: pointer; background: #fff;
}
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }

.block-item { border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 10px; }
.block-item .head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.block-item .key { font-family: ui-monospace, Menlo, monospace; font-size: 11.5px; color: var(--ink-3); }

.empty { padding: 36px; text-align: center; color: var(--ink-3); font-size: 13px; }

.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%) translateY(20px);
  background: #12162a; color: #fff; padding: 11px 18px; border-radius: 10px;
  font-size: 13px; opacity: 0; pointer-events: none; transition: all .22s; z-index: 90;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.bad { background: #b91c1c; }

/* ---------- 可视化模拟编辑：手机端实时预览 ---------- */
.work-grid { display: grid; grid-template-columns: minmax(0, 1fr) 318px; gap: 18px; align-items: start; }
.preview-panel { position: sticky; top: 12px; }
.preview-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; padding: 0 2px; }
.preview-head b { font-size: 13.5px; }
.preview-head span { font-size: 11.5px; color: var(--ink-3); }
.phone {
  width: min(100%, calc((100vh - 170px) / 2.164)); margin: 0 auto; background: #12152a; border-radius: 30px; padding: 8px 8px 10px;
  box-shadow: 0 18px 46px rgba(16, 20, 40, .24), inset 0 0 0 1px rgba(255, 255, 255, .06);
}
.phone-notch { width: 72px; height: 13px; border-radius: 0 0 11px 11px; background: #0a0c16; margin: 0 auto 6px; }
/* 手机屏按 iPhone 14 逻辑尺寸 390×844 的真实比例渲染 */
.phone-screen { border-radius: 22px; overflow-y: auto; width: 100%; aspect-ratio: 390 / 844; max-height: none; min-height: 0; background: #FBF8F4; color: #241d18; }
.phone-home { width: 104px; height: 4px; border-radius: 999px; background: rgba(255, 255, 255, .28); margin: 8px auto 0; }
.preview-tip { font-size: 11.5px; color: var(--ink-3); margin: 10px 2px 0; line-height: 1.55; }

/* 预览按真实 App 视觉渲染：暖白底、大标题 + 齿轮、渐变入口卡、说明白卡 */
.p-status { display: flex; justify-content: space-between; padding: 9px 16px 2px; font-size: 10.5px; color: rgba(45, 35, 28, .45); }
.pa-body { padding: 4px 18px 24px; color: #241d18; }
.pa-head { display: flex; align-items: flex-start; gap: 8px; padding-top: 6px; }
.pa-headtext { min-width: 0; flex: 1; }
.pa-title { font-size: 27px; font-weight: 700; line-height: 1.28; letter-spacing: -.5px; color: #1d1714; }
.pa-sub { margin-top: 6px; font-size: 11.5px; line-height: 1.55; color: #817770; }
.pa-gear { flex: 0 0 32px; width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; color: #b1a8a1; background: #fff; box-shadow: 0 2px 8px rgba(60, 40, 30, .06); }
.pa-gear svg { width: 17px; height: 17px; }

.pa-card { margin-top: 14px; border-radius: 16px; padding: 15px 16px 14px; box-shadow: 0 10px 22px rgba(255, 107, 74, .18); }
.pa-card.primary { background: linear-gradient(135deg, #FFB37C 0%, #FF6B4C 100%); color: #fff; }
.pa-card.soft { background: linear-gradient(135deg, #E9F7F4 0%, #FFFFFF 100%); color: #22201e; box-shadow: 0 8px 18px rgba(20, 130, 108, .08); }
.pa-card.plain { background: #fff; color: #22201e; box-shadow: 0 8px 18px rgba(60, 40, 30, .06); }
.pa-row1 { display: flex; align-items: center; gap: 10px; }
.pa-ico { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: rgba(255, 255, 255, .22); }
.pa-ico svg { width: 15px; height: 15px; }
.pa-card.soft .pa-ico, .pa-card.plain .pa-ico { background: rgba(24, 160, 140, .1); color: #12A08C; }
.pa-badge { margin-left: auto; padding: 3px 9px; border-radius: 999px; font-size: 9.5px; font-weight: 600; letter-spacing: .2px; background: rgba(255, 255, 255, .24); color: #fff; }
.pa-card.soft .pa-badge { background: rgba(24, 160, 140, .14); color: #0f9c86; }
.pa-card.plain .pa-badge { background: rgba(60, 40, 30, .08); color: #86756a; }
.pa-t { margin-top: 12px; font-size: 18px; font-weight: 700; letter-spacing: -.2px; }
.pa-d { margin-top: 7px; font-size: 10.5px; line-height: 1.62; white-space: pre-line; opacity: .92; }
.pa-card.soft .pa-d { color: #6d7570; opacity: 1; }
.pa-go { margin-top: 10px; display: flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; }
.pa-go svg { width: 13px; height: 13px; }

.pa-note { margin-top: 16px; border-radius: 15px; background: #fff; border: 1px solid #EEE6DE; padding: 13px 14px; }
.pa-note h4 { margin: 0; font-size: 13px; font-weight: 600; color: #2a2320; }
.pa-note p { margin: 7px 0 0; font-size: 10px; line-height: 1.75; color: #847a72; white-space: pre-line; }
.pa-addr { margin-top: 7px; font-size: 9.5px; color: #b6ada6; word-break: break-all; }

.pa-text { margin-top: 12px; font-size: 11.5px; line-height: 1.65; color: #4a4039; white-space: pre-line; }
.pa-media { margin-top: 12px; border-radius: 12px; overflow: hidden; background: #EEE7E1; }
.pa-media img { width: 100%; display: block; object-fit: cover; max-height: 130px; }
.pa-media.broken img { display: none; }
.pa-media.placeholder { height: 80px; display: grid; place-items: center; font-size: 10.5px; color: #a99f97; }
.pa-btn { margin-top: 12px; background: linear-gradient(135deg, #FFA76A, #FF6B4C); color: #fff; text-align: center; padding: 11px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.p-empty { padding: 34px 14px; text-align: center; font-size: 11px; line-height: 1.7; color: #a89d95; }
.p-safe { height: 18px; }

.perm-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12px; color: #8b91a5; margin: 16px 0 8px; }
.perm-actions { display: flex; gap: 6px; }

@media (max-width: 1180px) {
  .work-grid { grid-template-columns: 1fr; }
  .preview-panel { position: static; }
  .phone { max-width: 300px; margin: 0 auto; }
}

@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .side { width: 100%; flex: none; height: auto; position: relative; flex-direction: column; }
  .side .nav { flex-direction: row; flex-wrap: wrap; }
  .main { padding: 18px 16px 32px; }
  .grid.cols-4, .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; }
}
