/* ============ 流量卡业务管理系统 · 共享样式 ============ */
/* 主题：灰色磨砂 + 低饱和霓虹点缀，轻拟态卡片，匀速缓动 */
:root {
  --bg: #16181d;
  --bg2: #1b1e24;
  --card: rgba(255, 255, 255, 0.055);
  --card-hi: rgba(255, 255, 255, 0.09);
  --line: rgba(255, 255, 255, 0.08);
  --txt: #d6d9e0;
  --txt-dim: #8a909c;
  --neon-c: #6ee7ff;
  --neon-p: #a78bfa;
  --neon-k: #ff9ecf;
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --radius: 16px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: linear-gradient(160deg, var(--bg) 0%, var(--bg2) 100%);
  color: var(--txt);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}
/* 磨砂颗粒质感 */
.bg-noise {
  position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.045 0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}
.glow { position: fixed; border-radius: 50%; filter: blur(90px); opacity: 0.14; pointer-events: none; z-index: 0; }
.glow-1 { width: 420px; height: 420px; background: var(--neon-c); top: -120px; right: -80px; }
.glow-2 { width: 380px; height: 380px; background: var(--neon-p); bottom: -100px; left: -80px; }

main, .top, .foot, .admin-wrap { position: relative; z-index: 1; }

/* ---------- 顶部 ---------- */
.top { max-width: 1080px; margin: 0 auto; padding: 40px 20px 8px; display: flex; flex-direction: column; gap: 26px; }
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  font-weight: 700; font-size: 18px; color: #10131a;
  background: linear-gradient(135deg, var(--neon-c), var(--neon-p));
  box-shadow: 0 0 18px rgba(110, 231, 255, 0.25);
}
.brand b { font-size: 18px; letter-spacing: 1px; display: block; }
.brand i { font-style: normal; font-size: 12px; color: var(--txt-dim); display: block; margin-top: 2px; }

.search {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: 999px; padding: 14px 22px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(110, 231, 255, 0.06);
  transition: box-shadow 0.5s var(--ease), border-color 0.5s var(--ease);
}
.search:focus-within {
  border-color: rgba(110, 231, 255, 0.35);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35), 0 0 24px rgba(110, 231, 255, 0.12);
}
.search svg { width: 18px; height: 18px; stroke: var(--txt-dim); flex: none; }
.search input { flex: 1; background: none; border: none; outline: none; color: var(--txt); font-size: 15px; }
.search input::placeholder { color: var(--txt-dim); }

/* ---------- 快捷导航 ---------- */
.quick { max-width: 1080px; margin: 22px auto 0; padding: 0 20px; display: flex; gap: 10px; flex-wrap: wrap; }
.chip {
  cursor: pointer; user-select: none; font-size: 13px; padding: 8px 18px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line); color: var(--txt-dim);
  backdrop-filter: blur(10px); transition: all 0.45s var(--ease);
}
.chip:hover { color: var(--txt); background: var(--card-hi); }
.chip.on {
  color: #10131a; background: linear-gradient(135deg, var(--neon-c), var(--neon-p));
  border-color: transparent; box-shadow: 0 0 14px rgba(110, 231, 255, 0.2);
}

/* ---------- 结果区 ---------- */
main { max-width: 1080px; margin: 0 auto; padding: 10px 20px 60px; }
.sect { margin-top: 26px; }
.sect-t { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.sect-t h2 { font-size: 16px; font-weight: 600; letter-spacing: 1px; }
.sect-t .bar { width: 4px; height: 16px; border-radius: 2px; background: linear-gradient(180deg, var(--neon-c), var(--neon-p)); }
.sect-t .cnt { font-size: 12px; color: var(--txt-dim); }
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }

.card {
  position: relative; display: flex; flex-direction: column; gap: 6px; padding: 18px;
  min-height: 118px;
  background: var(--card); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--txt);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 6px 20px rgba(0,0,0,0.25);
  transition: background 0.45s var(--ease), transform 0.45s var(--ease), border-color 0.45s var(--ease), box-shadow 0.45s var(--ease);
  /* 整卡可点：触摸零延迟、去点击高亮、按压不选中文字 */
  cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  user-select: none; -webkit-user-select: none;
}
.card:hover { background: var(--card-hi); border-color: rgba(110, 231, 255, 0.28); box-shadow: 0 6px 24px rgba(0,0,0,0.3), 0 0 18px rgba(110,231,255,0.08); }
a.card:hover { transform: translateY(-3px); }
/* 按压凹入：鼠标 :active 与触摸 .pressed 同一形态；松开回到 .card 的 0.45s 缓动恢复凸出 */
a.card:active, .card.pressed {
  transition-duration: 0.12s;
  transform: translateY(1px) scale(0.98);
  background: rgba(255, 255, 255, 0.035);
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.4), 0 2px 6px rgba(0, 0, 0, 0.3);
  border-color: rgba(110, 231, 255, 0.18);
}
.card .ic { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: rgba(255,255,255,0.06); }
.card .ic svg { width: 20px; height: 20px; }
.c-name { font-size: 15px; font-weight: 600; }
.c-desc { font-size: 12px; color: var(--txt-dim); line-height: 1.5; }
.c-tag { position: absolute; top: 12px; right: 12px; font-size: 11px; color: var(--txt-dim); border: 1px dashed var(--line); padding: 2px 8px; border-radius: 999px; }

/* 卡片滑入（匀速缓动，无弹跳） */
.enter { opacity: 0; transform: translateY(14px); animation: slidein 0.7s var(--ease) forwards; animation-delay: var(--d, 0ms); }
@keyframes slidein { to { opacity: 1; transform: translateY(0); } }
.empty { padding: 40px 0; text-align: center; color: var(--txt-dim); font-size: 13px; }

/* ---------- 弹层 ---------- */
/* 关键修复：弹层关闭时必须彻底不可交互。
   1) [hidden] 显式 display:none（类的 display:grid 会覆盖浏览器默认隐藏）
   2) pointer-events:none 保证即使状态异常，透明弹层也绝不吞掉页面点击 */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(10, 11, 14, 0.6); backdrop-filter: blur(6px); opacity: 0; pointer-events: none; transition: opacity 0.4s var(--ease); }
.modal[hidden] { display: none; }
.modal.show { opacity: 1; pointer-events: auto; }
.modal-box {
  position: relative; width: min(360px, 88vw); padding: 28px; border-radius: 20px;
  background: var(--bg2); border: 1px solid var(--line);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 30px rgba(110,231,255,0.06);
  transform: translateY(10px); transition: transform 0.4s var(--ease);
}
.modal.show .modal-box { transform: translateY(0); }
.modal-x { position: absolute; top: 12px; right: 14px; background: none; border: none; color: var(--txt-dim); font-size: 20px; cursor: pointer; }
.modal-box h3 { font-size: 16px; margin-bottom: 12px; }
.modal-box .m-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; background: rgba(255,255,255,0.05); border-radius: 10px; margin-bottom: 8px; font-size: 14px; }
.modal-box img.qr { width: 180px; height: 180px; object-fit: cover; border-radius: 12px; display: block; margin: 10px auto; background: rgba(255,255,255,0.06); }
/* 自动生成的二维码容器：白底保证扫码对比度 */
.qr-box { width: 200px; height: 200px; margin: 10px auto; padding: 10px; background: #fff; border-radius: 12px; }
.qr-box svg { width: 100%; height: 100%; display: block; }
.qr-cap { text-align: center; font-size: 12px; color: var(--txt-dim); margin: -4px 0 8px; }
/* 卡片点击数徽标：贴卡片底部，实时更新 */
.hits { font-size: 11px; color: var(--txt-dim); margin-top: auto; padding-top: 8px; display: inline-flex; align-items: center; gap: 4px; }
.hits::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: rgba(110, 231, 255, 0.25); box-shadow: 0 0 6px rgba(110, 231, 255, 0.35); }
.btn {
  cursor: pointer; border: 1px solid var(--line); background: var(--card-hi); color: var(--txt);
  padding: 8px 18px; border-radius: 10px; font-size: 13px; transition: all 0.4s var(--ease);
}
.btn:hover { border-color: rgba(110,231,255,0.35); }
.btn.pri { background: linear-gradient(135deg, var(--neon-c), var(--neon-p)); color: #10131a; border: none; font-weight: 600; }
.btn.pri:hover { box-shadow: 0 0 16px rgba(110,231,255,0.25); }
.btn.danger { color: #ff9a9a; }
.btn.ok { color: #8fd6a0; border-color: rgba(143, 214, 160, 0.45); }

.foot { max-width: 1080px; margin: 0 auto; padding: 0 20px 30px; text-align: center; color: var(--txt-dim); font-size: 12px; }

/* ---------- 管理后台 ---------- */
.admin-wrap { max-width: 1080px; margin: 0 auto; padding: 40px 20px 60px; }
.login-box {
  width: min(360px, 90vw); margin: 12vh auto 0; padding: 34px; border-radius: 20px;
  background: var(--card); backdrop-filter: blur(16px); border: 1px solid var(--line);
  box-shadow: 0 16px 50px rgba(0,0,0,0.4);
}
.login-box h1 { font-size: 18px; margin-bottom: 6px; }
.login-box p { font-size: 12px; color: var(--txt-dim); margin-bottom: 20px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--txt-dim); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px; font-size: 13px;
  background: rgba(255,255,255,0.05); border: 1px solid var(--line); color: var(--txt); outline: none;
  transition: border-color 0.4s var(--ease);
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: rgba(110,231,255,0.4); }
.field input::placeholder, .field textarea::placeholder { color: #6a707c; }
.err { color: #ff9a9a; font-size: 12px; min-height: 18px; margin: 6px 0; }

.admin-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 26px; }
.admin-head .brand i { margin-top: 0; }
.admin-nav { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 24px; }
.panel {
  background: var(--card); backdrop-filter: blur(14px); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; box-shadow: 0 8px 26px rgba(0,0,0,0.28);
}
.panel h2 { font-size: 15px; margin-bottom: 16px; letter-spacing: 1px; }
.panel + .panel { margin-top: 18px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; color: var(--txt-dim); font-weight: 500; padding: 8px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 6px 4px; border-bottom: 1px solid rgba(255,255,255,0.04); vertical-align: middle; }
.tbl input, .tbl select {
  width: 100%; min-width: 70px; padding: 7px 9px; border-radius: 8px; font-size: 12px;
  background: rgba(255,255,255,0.05); border: 1px solid var(--line); color: var(--txt); outline: none;
}
.tbl input[type="checkbox"] { min-width: 0; width: 16px; height: 16px; accent-color: var(--neon-c); }
.tbl input[type="color"] { min-width: 0; width: 34px; height: 30px; padding: 2px; cursor: pointer; }
.tbl .rowdel { background: none; border: 1px solid rgba(255,154,154,0.3); color: #ff9a9a; border-radius: 8px; padding: 5px 10px; cursor: pointer; font-size: 12px; }
.tbl .url-empty { color: #ffd479; font-size: 11px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.stat { padding: 18px; border-radius: 14px; background: rgba(255,255,255,0.05); border: 1px solid var(--line); }
.stat b { font-size: 26px; display: block; margin-bottom: 4px; }
.stat span { font-size: 12px; color: var(--txt-dim); }
.logline { display: flex; gap: 14px; padding: 9px 4px; border-bottom: 1px solid rgba(255,255,255,0.04); font-size: 12px; }
.logline .t { color: var(--txt-dim); white-space: nowrap; }
.hint { font-size: 12px; color: var(--txt-dim); margin-top: 10px; line-height: 1.6; }
/* 长按拖拽排序 */
.tbl .grip {
  display: inline-flex; align-items: center; color: var(--txt-dim);
  touch-action: none; -webkit-touch-callout: none; user-select: none; -webkit-user-select: none;
  cursor: grab; padding: 4px 8px; margin: -4px -8px; border-radius: 8px;
}
.tbl .grip:active { cursor: grabbing; color: var(--neon-c); }
.tbl .grip svg { width: 14px; height: 14px; }
/* 长按起手：条目放大 1.03 + 深阴影悬浮（transform 由 JS 内联控制） */
.tbl tr.row-lift { position: relative; z-index: 6; }
.tbl tr.row-lift td {
  background: var(--bg2);
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(110, 231, 255, 0.18);
}
.tbl tr.row-lift td:first-child { border-radius: 10px 0 0 10px; }
.tbl tr.row-lift td:last-child { border-radius: 0 10px 10px 0; }
.tbl.sort-active { user-select: none; -webkit-user-select: none; }
.tbl .mv { background: none; border: 1px solid var(--line); color: var(--txt-dim); border-radius: 6px; padding: 3px 7px; cursor: pointer; font-size: 12px; margin-right: 4px; }
.tbl .mv:hover { color: var(--txt); border-color: rgba(110,231,255,0.35); }
.save-bar { margin-top: 16px; display: flex; align-items: center; gap: 12px; }
.save-bar .ok { color: #8fd6a0; font-size: 12px; opacity: 0; transition: opacity 0.5s var(--ease); }
.save-bar .ok.show { opacity: 1; }

/* 全局 toast 提示（底部居中，内嵌 webview 下替代 alert） */
.toast {
  position: fixed; left: 50%; bottom: 34px; transform: translate(-50%, 12px); z-index: 99;
  max-width: 86vw; padding: 11px 22px; border-radius: 999px; font-size: 13px; color: var(--txt);
  background: rgba(18, 21, 28, 0.94); border: 1px solid rgba(143, 214, 160, 0.45);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  opacity: 0; pointer-events: none;
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { border-color: rgba(255, 154, 154, 0.5); color: #ffb3b3; }

@media (max-width: 640px) {
  .top { padding-top: 24px; gap: 20px; }
  /* 导航横向滑动，不换行挤压 */
  .quick { flex-wrap: nowrap; overflow-x: auto; padding: 0 16px 6px; margin-left: 0; margin-right: 0; scrollbar-width: none; }
  .quick::-webkit-scrollbar { display: none; }
  .chip { flex: none; padding: 9px 16px; font-size: 12px; }
  /* 保持每行 2 卡，紧凑排版 */
  .grid { gap: 10px; }
  .card { padding: 13px; min-height: 104px; gap: 4px; }
  .card .ic { width: 28px; height: 28px; border-radius: 8px; }
  .card .ic svg { width: 16px; height: 16px; }
  .c-name { font-size: 13.5px; }
  .c-desc { font-size: 11px; }
  /* 待配置角标改为行内，不与文字重叠 */
  .c-tag { position: static; align-self: flex-start; margin-top: 2px; font-size: 10px; padding: 1px 7px; }
  main { padding-bottom: 40px; }
  .sect { margin-top: 22px; }
  .sect-t { margin-bottom: 12px; }
}
