* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif; background: #f4f6f9; color: #1f2329; }
.hidden { display: none !important; }
.view { min-height: 100vh; }

/* 登录 */
#loginView { display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #07c160, #059b4d); }
.login-card { background: #fff; padding: 40px 32px; border-radius: 18px; width: 340px; text-align: center; box-shadow: 0 16px 50px rgba(0,0,0,.18); }
.login-card .logo { font-size: 44px; }
.login-card h1 { font-size: 22px; margin: 8px 0 2px; }
.login-card .sub { color: #94a3b8; font-size: 13px; margin-bottom: 22px; }
.login-card input { width: 100%; padding: 12px 14px; margin-bottom: 12px; border: 1px solid #e3e8ef; border-radius: 10px; font-size: 15px; }
.login-card input:focus { border-color: #07c160; outline: none; }

/* 按钮 */
.btn { border: none; border-radius: 9px; padding: 10px 16px; font-size: 14px; font-weight: 600; cursor: pointer; transition: opacity .15s; }
.btn:active { opacity: .82; }
.btn.primary { background: #07c160; color: #fff; }
.btn.ghost { background: #eef2f6; color: #334155; }
.btn.danger { background: #fff1f0; color: #e5484d; }
.btn.sm { padding: 7px 12px; font-size: 13px; }
.btn.xs { padding: 5px 9px; font-size: 12px; }

/* 顶栏 */
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 14px 24px; background: #fff; border-bottom: 1px solid #e9edf2; position: sticky; top: 0; z-index: 10; }
.topbar .brand { font-weight: 700; font-size: 17px; }
.topbar .user { display: flex; align-items: center; gap: 10px; }
.topbar .user span { color: #64748b; font-size: 14px; }

.container { max-width: 1000px; margin: 0 auto; padding: 22px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
.stat-card { background: #fff; border-radius: 14px; padding: 20px; text-align: center; box-shadow: 0 2px 10px rgba(0,0,0,.04); }
.stat-card .num { font-size: 30px; font-weight: 800; color: #07c160; }
.stat-card .lbl { color: #94a3b8; font-size: 13px; margin-top: 4px; }

.panel { background: #fff; border-radius: 14px; padding: 18px 20px; margin-bottom: 18px; box-shadow: 0 2px 10px rgba(0,0,0,.04); }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.panel-head h2 { font-size: 16px; }

/* 表格 */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid #f0f2f5; white-space: nowrap; }
th { color: #94a3b8; font-weight: 600; font-size: 13px; }
td.ops { display: flex; gap: 6px; }
.link-cell { display: flex; align-items: center; gap: 6px; }
.link-cell input { width: 240px; border: 1px solid #e3e8ef; border-radius: 7px; padding: 6px 8px; font-size: 12px; background: #f8fafc; color: #475569; }
.muted { color: #b6c0cc; }
.tag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.tag.on { background: #e8f8ef; color: #07c160; }
.tag.off { background: #f1f3f5; color: #98a2b3; }

/* 图表 */
.chart { display: flex; align-items: flex-end; gap: 4px; height: 160px; overflow-x: auto; padding-top: 10px; }
.bar { flex: 1; min-width: 14px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; }
.bar-fill { width: 70%; background: linear-gradient(180deg, #07c160, #059b4d); border-radius: 4px 4px 0 0; min-height: 2px; }
.bar-lbl { font-size: 9px; color: #b6c0cc; margin-top: 4px; }

/* 排名 */
.rank { display: flex; flex-direction: column; gap: 10px; }
.rank-row { display: grid; grid-template-columns: 160px 1fr 50px; align-items: center; gap: 10px; font-size: 14px; }
.rank-name { color: #334155; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-bar { background: #eef2f6; border-radius: 6px; height: 12px; overflow: hidden; }
.rank-bar span { display: block; height: 100%; background: #07c160; }
.rank-num { text-align: right; font-weight: 700; color: #07c160; }

/* 模态 */
.modal { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal-card { background: #fff; border-radius: 16px; padding: 24px; width: 420px; max-width: 100%; }
.modal-card h3 { font-size: 18px; margin-bottom: 16px; }
.modal-card label { display: block; font-size: 13px; color: #64748b; margin-bottom: 12px; }
.modal-card input[type=text], .modal-card input[type=password] { width: 100%; margin-top: 5px; padding: 10px 12px; border: 1px solid #e3e8ef; border-radius: 9px; font-size: 14px; }
.modal-card input[type=file] { margin-top: 5px; font-size: 13px; }
.modal-card label.check { display: flex; align-items: center; gap: 8px; color: #334155; font-size: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.qr-preview { margin: -4px 0 12px; }
.qr-preview img { max-height: 120px; border: 1px solid #eee; border-radius: 10px; }

/* 列表中的链接单元格（落地页 + 短链） */
.link-cell { display: flex; align-items: center; gap: 6px; margin: 3px 0; }
.link-cell .lbl { font-size: 11px; color: #94a3b8; width: 34px; flex: 0 0 34px; }
.link-cell input { flex: 1 1 auto; min-width: 0; padding: 6px 8px; border: 1px solid #e3e8ef; border-radius: 8px; font-size: 12px; color: #334155; background: #f8fafc; }

/* 引导页表单子分组 */
.sub { border: 1px solid #e3e8ef; border-radius: 12px; padding: 8px 16px 14px; margin-bottom: 14px; }
.sub legend { font-size: 13px; color: #475569; font-weight: 600; padding: 0 6px; }
.sub .hint { font-size: 12px; color: #94a3b8; line-height: 1.6; margin: 2px 0 0; }

/* 渠道二维码海报 */
.poster-card { width: 460px; }
.poster-wrap { text-align: center; margin: 10px 0 4px; max-height: 58vh; overflow: auto; }
#posterCanvas { width: 290px; height: auto; border: 1px solid #e9edf2; border-radius: 10px; }
.poster-card .hint { font-size: 12px; color: #94a3b8; line-height: 1.7; margin-bottom: 4px; }

.err { color: #e5484d; font-size: 13px; margin-top: 8px; }

/* toast */
.toast { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%); background: #1f2329; color: #fff; padding: 11px 20px; border-radius: 10px; font-size: 14px; z-index: 100; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.toast.ok { background: #07c160; }

@media (max-width: 640px) {
  .stats { grid-template-columns: 1fr; }
  .link-cell .lbl { width: 30px; flex-basis: 30px; }
  .link-cell input { flex: 1 1 auto; }
  .rank-row { grid-template-columns: 100px 1fr 40px; }
}
