/* =========================================================
   易码付AI中台 · 小程序 SaaS 中台   后台 UI
   ========================================================= */

:root {
  --bg: #f4f6fa;
  --panel: #ffffff;
  --line: #e8ecf3;
  --line-soft: #f1f4f9;
  --ink: #1b2430;
  --ink-2: #54606f;
  --ink-3: #8d98a8;
  --brand: #d81e2c;
  --brand-dark: #a80f1b;
  --brand-soft: #fdedef;
  --ok: #12b76a;
  --warn: #ff8f1f;
  --danger: #f04438;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(27, 36, 48, 0.05);
  --shadow-lg: 0 12px 40px rgba(27, 36, 48, 0.12);
  --side-bg: #131a26;
  --side-ink: #9aa6b8;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; outline: none; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #cfd7e3; border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------- 通用控件 ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink-2);
  cursor: pointer;
  transition: .15s;
  white-space: nowrap;
}
.btn:hover { border-color: #c6d2e3; color: var(--ink); }
.btn-primary {
  background: linear-gradient(135deg, #e8455a, var(--brand-dark));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 14px rgba(216, 30, 44, .26);
}
.btn-primary:hover { color: #fff; filter: brightness(1.06); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 6px; }
.btn-danger { color: var(--danger); border-color: #ffd4d1; background: #fff5f4; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 12px; color: var(--ink-3); }
.input, .select, .textarea {
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  width: 100%;
}
.textarea { height: auto; padding: 8px 12px; line-height: 1.6; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(216,30,44,.12); }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
}
.card-title { font-size: 14px; font-weight: 700; }
.card-body { padding: 18px; }

.tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 12px;
  background: var(--brand-soft);
  color: var(--brand-dark);
}
.tag-gray { background: #f1f4f9; color: var(--ink-3); }
.tag-green { background: #e7f8ef; color: #0b8155; }
.tag-orange { background: #fff3e4; color: #b35c00; }
.tag-red { background: #ffeeec; color: #b42318; }
.tag-purple { background: #f2ecff; color: #6b3ce0; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-3);
  padding: 10px 18px;
  background: #fafbfd;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td {
  padding: 12px 18px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #fafbfe; }

.empty { padding: 60px 0; text-align: center; color: var(--ink-3); }
.muted { color: var(--ink-3); }
.small { font-size: 12px; }
.b { font-weight: 700; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; }
.mt20 { margin-top: 20px; } .mt24 { margin-top: 24px; }

/* ---------------- 登录页 ---------------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(1200px 600px at 12% 10%, #1d3a6e 0%, transparent 60%),
    linear-gradient(135deg, #0d1524 0%, #172033 45%, #1d2b45 100%);
  padding: 30px;
}
.login-card {
  width: 940px;
  max-width: 100%;
  background: #fff;
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  overflow: hidden;
}
.login-side {
  padding: 38px 40px;
  color: var(--ink);
  background:
    radial-gradient(620px 340px at 100% -6%, rgba(219, 0, 36, 0.085), transparent 62%),
    linear-gradient(170deg, #ffffff 0%, #fffafb 62%, #fdf1f3 100%);
  position: relative;
  overflow: hidden;
  border-right: 1px solid var(--line);
}
.login-brand { display: flex; align-items: center; position: relative; z-index: 2; }
.login-logo { height: 64px; width: auto; display: block; }
.login-h1 { margin-top: 24px; font-size: 29px; line-height: 1.3; font-weight: 800; color: #131a26; letter-spacing: .5px; }
.login-slogan { margin-top: 9px; font-size: 14px; font-weight: 600; color: #cf1220; letter-spacing: .3px; }
.login-desc { margin-top: 16px; font-size: 13px; line-height: 1.85; color: var(--ink-2); }
.login-points { margin-top: 24px; display: grid; gap: 11px; position: relative; z-index: 2; }
.login-point { display: flex; gap: 10px; font-size: 13px; color: #39424f; }
.login-point i { font-style: normal; color: #d81e2c; opacity: .95; }

.login-main { padding: 40px 42px; display: flex; flex-direction: column; justify-content: center; }
.login-tabs { display: flex; gap: 6px; background: #f1f4f9; padding: 4px; border-radius: 10px; }
.login-tab {
  flex: 1; height: 36px; border-radius: 8px; border: none; cursor: pointer;
  background: transparent; color: var(--ink-2); font-weight: 600;
}
.login-tab.on { background: #fff; color: var(--brand-dark); box-shadow: var(--shadow); }

.role-list { margin-top: 20px; display: grid; gap: 10px; }
.role-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px;
  cursor: pointer; transition: .15s; background: #fff;
}
.role-item:hover { border-color: #f3bfc5; background: #fff8f9; }
.role-item.on { border-color: var(--brand); background: var(--brand-soft); }
.role-avatar {
  width: 34px; height: 34px; border-radius: 9px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  background: #eef2f8; color: var(--brand-dark); font-weight: 700;
}
.role-name { font-weight: 600; }
.role-desc { font-size: 12px; color: var(--ink-3); margin-top: 2px; }

.login-hint {
  margin-top: 16px; padding: 10px 12px; border-radius: 8px;
  background: #fff8e8; color: #8a6100; font-size: 12px; line-height: 1.7;
}

/* ---------------- 后台框架 ---------------- */
.app { display: flex; min-height: 100vh; }
.side {
  width: 216px; flex: 0 0 216px;
  background: var(--side-bg);
  color: var(--side-ink);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.side-top { padding: 18px 16px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid rgba(255,255,255,.06); }
.side-mark {
  width: 34px; height: 34px; flex: 0 0 auto;
  display: block; object-fit: contain;
}
.side-name { color: #fff; font-weight: 700; font-size: 15px; }
.side-env { font-size: 11px; color: #6f7d92; }

.side-user { padding: 14px 16px; border-bottom: 1px solid rgba(255,255,255,.06); }
.side-user-name { color: #fff; font-weight: 600; }
.side-user-role { margin-top: 4px; font-size: 12px; color: #7d8ba1; }

.side-nav { flex: 1; padding: 10px 8px; overflow-y: auto; }
.side-group { padding: 12px 10px 6px; font-size: 11px; color: #5f6c80; letter-spacing: .5px; }
.side-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px; cursor: pointer; font-size: 13px;
  color: var(--side-ink); margin-bottom: 2px;
}
.side-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.side-item.on { background: linear-gradient(135deg, #e03546, #c2141f); color: #fff; box-shadow: 0 4px 12px rgba(200,20,35,.35); }
.side-item i { font-style: normal; width: 18px; text-align: center; }
.side-item .badge-dot {
  margin-left: auto; width: 6px; height: 6px; border-radius: 50%; background: #ff8f1f;
}

.side-foot { padding: 12px; border-top: 1px solid rgba(255,255,255,.06); }
.side-logout {
  width: 100%; height: 34px; border-radius: 8px; cursor: pointer;
  background: rgba(255,255,255,.06); border: none; color: #b9c3d2;
}
.side-logout:hover { background: rgba(255,255,255,.12); color: #fff; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 58px; flex: 0 0 58px;
  background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; position: sticky; top: 0; z-index: 20;
}
.topbar-title { font-size: 16px; font-weight: 700; }
.topbar-sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-chip {
  display: flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 12px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand-dark); font-size: 12px; font-weight: 600;
}
.content { padding: 20px; flex: 1; min-width: 0; }

/* 数据统计卡 */
.stat {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow);
}
.stat-label { font-size: 12px; color: var(--ink-3); }
.stat-value { margin-top: 8px; font-size: 26px; font-weight: 800; letter-spacing: .5px; }
.stat-trend { margin-top: 6px; font-size: 12px; }
.up { color: var(--ok); } .down { color: var(--danger); }

/* ---------------- 手机预览区 ---------------- */
.preview-rail {
  width: 372px; flex: 0 0 372px;
  border-left: 1px solid var(--line);
  background: #fbfcfe;
  position: sticky; top: 58px;
  height: calc(100vh - 58px);
  overflow-y: auto;
  padding: 16px;
}
.preview-panel {
  background: #fff; border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow); overflow: hidden;
}
.preview-head {
  padding: 10px 14px; border-bottom: 1px solid var(--line-soft);
  display: flex; align-items: center; justify-content: space-between;
}
.preview-head-title { font-size: 13px; font-weight: 700; }
.preview-tabs {
  display: flex; gap: 2px; padding: 8px; border-bottom: 1px solid var(--line-soft);
  background: #fafbfd;
}
.preview-tab {
  flex: 1; height: 26px; border: none; border-radius: 6px; cursor: pointer;
  background: transparent; font-size: 11px; color: var(--ink-3);
}
.preview-tab.on { background: #fff; color: var(--brand-dark); font-weight: 700; box-shadow: var(--shadow); }
.preview-body { padding: 14px; display: flex; justify-content: center; }
.preview-note { padding: 10px 14px; font-size: 11px; color: var(--ink-3); line-height: 1.7; border-top: 1px solid var(--line-soft); }

.phone {
  width: 375px; border-radius: 30px; overflow: hidden; position: relative;
  border: 9px solid #1b2430;
  box-shadow: 0 16px 40px rgba(27,36,48,.22);
  background: #fff; flex: 0 0 auto;
  transform: scale(.86); transform-origin: top center;
  margin-bottom: -14%;
}
.phone-notch {
  position: absolute; left: 50%; top: 6px; transform: translateX(-50%);
  width: 96px; height: 20px; border-radius: 999px; background: #1b2430; z-index: 30;
}

/* ---------------- 模板市场卡片 ---------------- */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(292px, 1fr)); gap: 18px; }
.theme-card { cursor: pointer; transition: .18s; }
.theme-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.theme-card.on { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(216,30,44,.14); }
.theme-shot { height: 190px; position: relative; overflow: hidden; background: #f6f8fb; }
.theme-shot .mp { position: absolute; left: 50%; top: 0; transform: translateX(-50%) scale(.44); transform-origin: top center; width: 375px; pointer-events: none; }
.theme-shot-mask { position: absolute; inset: 0; }
.theme-info { padding: 14px 16px; }
.theme-name { font-weight: 700; }
.theme-desc { margin-top: 4px; font-size: 12px; color: var(--ink-3); line-height: 1.6; }
.theme-palette { margin-top: 10px; display: flex; gap: 5px; }
.theme-palette span { width: 20px; height: 20px; border-radius: 6px; border: 1px solid rgba(0,0,0,.06); }
.theme-meta { margin-top: 10px; display: flex; align-items: center; justify-content: space-between; }

/* ---------------- 生成中心 ---------------- */
.gen-steps { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; }
.gen-step { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-3); }
.gen-step .dot {
  width: 24px; height: 24px; border-radius: 50%; background: #eef1f6; color: #8d98a8;
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700;
}
.gen-step.on { color: var(--brand-dark); font-weight: 700; }
.gen-step.on .dot { background: var(--brand); color: #fff; }
.gen-step.done .dot { background: #12b76a; color: #fff; }
.gen-line { flex: 1; height: 1px; background: var(--line); }

.code-tree { font-family: Consolas, Monaco, monospace; font-size: 12px; line-height: 1.9; }
.code-tree div { padding-left: var(--indent, 0px); }
.code-tree .folder { color: var(--brand-dark); font-weight: 600; }
.code-tree .file { color: var(--ink-2); }

.pick-list { display: grid; gap: 10px; max-height: 340px; overflow-y: auto; padding-right: 4px; }
.pick-item {
  display: flex; align-items: center; gap: 12px; padding: 12px;
  border: 1px solid var(--line); border-radius: 10px; cursor: pointer;
}
.pick-item:hover { border-color: #f3bfc5; background: #fff8f9; }
.pick-item.on { border-color: var(--brand); background: var(--brand-soft); }
.pick-check {
  width: 18px; height: 18px; border-radius: 50%; border: 1px solid #c9d3e2; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center; font-size: 11px; color: #fff;
}
.pick-item.on .pick-check { background: var(--brand); border-color: var(--brand); }

.toast-wrap { position: fixed; left: 50%; top: 24px; transform: translateX(-50%); z-index: 999; display: grid; gap: 8px; }
.toast {
  padding: 10px 18px; border-radius: 10px; background: #1b2430; color: #fff; font-size: 13px;
  box-shadow: var(--shadow-lg); animation: popIn .25s ease;
}
@keyframes popIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }

.modal-mask {
  position: fixed; inset: 0; background: rgba(16, 24, 40, .5); z-index: 500;
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal {
  width: 620px; max-width: 100%; max-height: 86vh; overflow-y: auto;
  background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg);
}
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; justify-content: space-between; }
.modal-body { padding: 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line-soft); display: flex; justify-content: flex-end; gap: 10px; }

@media (max-width: 1400px) {
  .preview-rail { width: 340px; flex-basis: 340px; }
}
