/* ============================================================
   Armadillo 控制台 · 深色主题
   ============================================================ */
:root {
  --bg: #0a0d13;
  --bg-soft: #0f131b;
  --panel: #121722;
  --panel-2: #161c28;
  --line: #1e2635;
  --line-soft: #182030;
  --text: #e6eaf2;
  --text-2: #9aa6bd;
  --text-3: #6b778d;
  --primary: #6366f1;
  --primary-2: #818cf8;
  --primary-dim: rgba(99, 102, 241, .14);
  --green: #22c55e;
  --green-dim: rgba(34, 197, 94, .13);
  --red: #ef4444;
  --red-dim: rgba(239, 68, 68, .13);
  --amber: #f59e0b;
  --amber-dim: rgba(245, 158, 11, .13);
  --blue: #38bdf8;
  --blue-dim: rgba(56, 189, 248, .12);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.hidden { display: none !important; }
.muted { color: var(--text-3); font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* ---------------- 图标 ---------------- */
i[data-ic] {
  display: inline-flex; width: 18px; height: 18px;
  align-items: center; justify-content: center; flex: none;
}
i[data-ic] svg { width: 100%; height: 100%; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------------- 登录 ---------------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(1000px 500px at 15% -10%, rgba(99, 102, 241, .20), transparent 60%),
    radial-gradient(800px 400px at 100% 100%, rgba(56, 189, 248, .10), transparent 60%),
    var(--bg);
  padding: 24px;
}
.login-card {
  width: 380px; max-width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 34px 30px 26px;
  box-shadow: var(--shadow);
}
.brand-lg { display: flex; gap: 14px; align-items: center; margin-bottom: 26px; }
.brand-lg h1 { font-size: 21px; letter-spacing: .3px; }
.brand-lg p { color: var(--text-3); font-size: 12px; margin-top: 2px; }
.logo {
  width: 42px; height: 42px; border-radius: 12px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  font-weight: 800; font-size: 20px; color: #fff;
  box-shadow: 0 6px 18px rgba(99, 102, 241, .35);
}
.login-card label { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 14px; }
.login-card input {
  width: 100%; margin-top: 6px; height: 42px; padding: 0 13px;
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: var(--radius-sm); color: var(--text); font-size: 14px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.login-card input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-dim); }
.login-tip { margin-top: 18px; font-size: 11.5px; color: var(--text-3); text-align: center; line-height: 1.7; }
.login-tip code { color: var(--text-2); background: var(--panel-2); padding: 1px 5px; border-radius: 4px; }
.form-err {
  background: var(--red-dim); color: #fca5a5; border: 1px solid rgba(239, 68, 68, .25);
  padding: 8px 11px; border-radius: var(--radius-sm); font-size: 12.5px; margin-bottom: 12px;
}

/* ---------------- 框架 ---------------- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 236px; flex: none; background: var(--bg-soft);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 20px 18px 16px; }
.brand .logo { width: 34px; height: 34px; border-radius: 10px; font-size: 16px; }
.brand-text strong { display: block; font-size: 14.5px; letter-spacing: .2px; }
.brand-text small { color: var(--text-3); font-size: 11px; }

#nav { flex: 1; overflow-y: auto; padding: 4px 10px 10px; }
#nav::-webkit-scrollbar { width: 4px; }
#nav::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
.nav-group {
  font-size: 10.5px; letter-spacing: 1px; color: var(--text-3);
  text-transform: uppercase; padding: 14px 10px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  height: 38px; padding: 0 10px; border-radius: 9px;
  color: var(--text-2); font-size: 13.5px; margin-bottom: 2px;
  transition: background .14s, color .14s;
}
.nav-item:hover { background: var(--panel-2); color: var(--text); }
.nav-item.active { background: var(--primary-dim); color: #c7cbff; }
.nav-item.active i[data-ic] { color: var(--primary-2); }
.nav-item em {
  margin-left: auto; font-style: normal; font-size: 11px;
  background: var(--red); color: #fff; border-radius: 10px; padding: 0 6px; height: 17px;
  display: none; align-items: center;
}
.nav-item em.show { display: inline-flex; }

.sidebar-foot {
  border-top: 1px solid var(--line); padding: 12px 14px;
  display: flex; align-items: center; gap: 10px;
}
.me { display: flex; gap: 9px; align-items: center; flex: 1; min-width: 0; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
}
.me strong { display: block; font-size: 12.5px; }
.me small { color: var(--text-3); font-size: 10.5px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 62px; flex: none; display: flex; align-items: center; gap: 12px;
  padding: 0 24px; border-bottom: 1px solid var(--line);
  background: rgba(10, 13, 19, .82); backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 20;
}
.crumb h2 { font-size: 16.5px; font-weight: 600; }
.crumb span { color: var(--text-3); font-size: 12px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--green-dim); }
.dot.off { background: var(--red); box-shadow: 0 0 0 3px var(--red-dim); }

.content { padding: 22px 24px 60px; }

/* ---------------- 基础组件 ---------------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  height: 34px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); font-size: 13px; cursor: pointer;
  transition: background .14s, border-color .14s, transform .05s;
  white-space: nowrap;
  /* 纯图标按钮（如删除）没有文字基线，与带文字的按钮同排时会被基线拉低，
     在表格操作列里就表现成「歪的」；统一按中线对齐 */
  vertical-align: middle;
}
.btn:hover { background: #1b2231; border-color: #2a3446; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: #5558e6; border-color: #5558e6; }
.btn-danger { background: var(--red-dim); border-color: rgba(239, 68, 68, .3); color: #f87171; }
.btn-danger:hover { background: rgba(239, 68, 68, .2); }
.btn-ghost { background: transparent; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 6px; }
/* 只放一个图标的按钮（表格里的删除）：图标缩到 16，按钮接近正方形，不与文字按钮抢宽度 */
.btn > i[data-ic]:only-child { width: 16px; height: 16px; }
.btn-block { width: 100%; height: 42px; }
.icon-btn {
  width: 32px; height: 32px; display: inline-grid; place-items: center;
  background: transparent; border: 1px solid transparent; border-radius: 8px;
  color: var(--text-2); cursor: pointer; vertical-align: middle;
}
.icon-btn:hover { background: var(--panel-2); color: var(--text); }

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px;
}
.card-h { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-h h3 { font-size: 13.5px; font-weight: 600; }
.card-h .spacer { flex: 1; }


/* 表格 */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left; font-weight: 500; color: var(--text-3); font-size: 11.5px;
  letter-spacing: .4px; text-transform: uppercase;
  padding: 11px 14px; background: var(--panel-2); border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
/* 单元格不换行：中文没有空格，压到极限会一个字一行（竖排）；内容多就让外层横向滚动 */
tbody td { padding: 12px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; white-space: nowrap; }
tbody td.wrap-cell { white-space: normal; }
/* 操作列里的按钮不许换行（否则窄屏会上下叠成一列） */
tbody td.act-cell { white-space: nowrap; }
tbody td.act-cell .btn { flex: none; }
/* 徽章文字也不许竖排 */
.badge { flex: none; }
/* 列多放不下时横向滚动，但「操作」列钉在右侧，按钮永远点得到 */
.table-wrap thead th:last-child { position: sticky; right: 0; z-index: 3; background: var(--panel-2); }
.table-wrap tbody td:last-child { position: sticky; right: 0; z-index: 2; background: var(--panel); }
.table-wrap tbody tr:hover td:last-child { background: #1a2130; }
.table-wrap thead th:last-child::before, .table-wrap tbody td:last-child::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 10px;
  transform: translateX(-10px); box-shadow: 6px 0 10px -6px rgba(0, 0, 0, .55); pointer-events: none;
}
/* 卡密表列多：只在这张表里收紧内边距、长字段省略号，保证 9 列都放得下 */
table.tbl-compact thead th, table.tbl-compact tbody td { padding: 11px 8px; }

table.tbl-compact .ellip { max-width: 104px; overflow: hidden; text-overflow: ellipsis; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(255, 255, 255, .018); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { padding: 46px 0; text-align: center; color: var(--text-3); font-size: 13px; }

/* 徽章 */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  height: 21px; padding: 0 8px; border-radius: 6px;
  font-size: 11.5px; white-space: nowrap;
  background: var(--panel-2); color: var(--text-2); border: 1px solid var(--line);
}
.badge.green { background: var(--green-dim); color: #4ade80; border-color: rgba(34, 197, 94, .22); }
.badge.red { background: var(--red-dim); color: #f87171; border-color: rgba(239, 68, 68, .22); }
.badge.amber { background: var(--amber-dim); color: #fbbf24; border-color: rgba(245, 158, 11, .22); }
.badge.blue { background: var(--blue-dim); color: #7dd3fc; border-color: rgba(56, 189, 248, .22); }
.badge.indigo { background: var(--primary-dim); color: #a5b4fc; border-color: rgba(99, 102, 241, .25); }

/* 公告/更新里的小标签：【修复】【新增】【注意】… */
.tag {
  display: inline-block; padding: 0 6px; margin-right: 4px; border-radius: 4px;
  font-size: 11.5px; font-weight: 600; line-height: 18px; border: 1px solid transparent;
  vertical-align: 1px; white-space: nowrap;
}
.tag-pick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag-pick button {
  background: var(--bg-soft); border: 1px solid var(--line); color: var(--text-2);
  border-radius: 6px; padding: 4px 9px; font-size: 12px; cursor: pointer;
}
.tag-pick button:hover { border-color: var(--primary); color: var(--text); }

/* 抽屉标签页（应用配置拆成 基础/卡密弹窗/远程公告/远程更新） */
.drawer-tabs {
  display: flex; gap: 4px; margin: -18px -20px 16px; padding: 0 20px;
  border-bottom: 1px solid var(--line); background: var(--bg-soft);
}
.drawer-tabs button {
  background: none; border: 0; border-bottom: 2px solid transparent;
  color: var(--text-2); font-size: 13px; padding: 10px 14px; cursor: pointer;
}
.drawer-tabs button:hover { color: var(--text); }
.drawer-tabs button.on { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.ap-pane { display: none; }
.ap-pane.on { display: block; }
.ph-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; margin-top: 8px; }
.ph-list code {
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 4px;
  padding: 1px 5px; font-size: 11.5px; color: #a5b4fc; cursor: pointer;
}
.ph-list .ph-desc { font-size: 11.5px; color: var(--text-3); }

/* 表单 */
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 6px; }
.input, select.input, textarea.input {
  width: 100%; background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: var(--radius-sm); color: var(--text); font-size: 13px;
  padding: 9px 11px; outline: none; font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
select.input { height: 36px; padding: 0 10px; }
textarea.input { min-height: 96px; resize: vertical; line-height: 1.65; }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-dim); }
.input:disabled { opacity: .55; cursor: not-allowed; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
/* 广告抽屉用的网格类（此前只写了 class 没有 CSS，字段全部竖排堆叠，抽屉被拉成一根长条） */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
/* 投放模式四态（与客户端注入向导一致）：胶囊单选 */
.ad-modes { display: flex; flex-wrap: wrap; gap: 8px; }
.ad-mode { position: relative; }
.ad-mode input { position: absolute; opacity: 0; pointer-events: none; }
.ad-mode span {
  display: inline-block; padding: 7px 15px; border: 1px solid var(--line);
  border-radius: 999px; font-size: 12.5px; color: var(--text-2); cursor: pointer;
  user-select: none; transition: border-color .15s, color .15s, background .15s;
}
.ad-mode span:hover { border-color: var(--primary); color: var(--text); }
.ad-mode input:checked + span {
  border-color: var(--primary); color: var(--text);
  background: var(--primary-dim); font-weight: 600;
}
.hint { font-size: 11.5px; color: var(--text-3); margin-top: 5px; line-height: 1.6; }

/* 工具条 */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar .grow { flex: 1; }
.search { position: relative; }
.search input {
  width: 240px; height: 34px; padding: 0 12px 0 34px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  color: var(--text); font-size: 13px; outline: none;
}
.search input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-dim); }
.search i[data-ic] { position: absolute; left: 10px; top: 8px; color: var(--text-3); width: 17px; height: 17px; }

/* 统计卡 */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; position: relative; overflow: hidden;
}
.stat .k { font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 7px; }
.stat .v { font-size: 27px; font-weight: 650; letter-spacing: -.5px; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat .d { font-size: 11.5px; color: var(--text-3); margin-top: 3px; }
.stat .ic {
  position: absolute; right: 14px; top: 14px; width: 34px; height: 34px;
  border-radius: 9px; display: grid; place-items: center; color: var(--primary-2);
  background: var(--primary-dim);
}
.stat.green .ic { color: #4ade80; background: var(--green-dim); }
.stat.amber .ic { color: #fbbf24; background: var(--amber-dim); }
.stat.red .ic { color: #f87171; background: var(--red-dim); }

.grid2 { display: grid; grid-template-columns: 1.45fr 1fr; gap: 14px; }
.grid2b { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* 图表 */
.chart { width: 100%; }
.legend { display: flex; gap: 14px; font-size: 11.5px; color: var(--text-3); }
.legend i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-right: 5px; }

.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 11px; font-size: 12.5px; }
.bar-row .nm { width: 74px; color: var(--text-2); flex: none; }
.bar-row .bar { flex: 1; height: 7px; background: var(--panel-2); border-radius: 5px; overflow: hidden; }
.bar-row .bar > i { display: block; height: 100%; border-radius: 5px; background: linear-gradient(90deg, #6366f1, #8b5cf6); }
.bar-row .vl { width: 40px; text-align: right; color: var(--text-2); font-variant-numeric: tabular-nums; }

/* 列表小行 */
.mini-list { display: flex; flex-direction: column; gap: 2px; }
.mini-item { display: flex; align-items: center; gap: 10px; padding: 9px 6px; border-radius: 8px; }
.mini-item:hover { background: var(--panel-2); }
.mini-item .av { width: 28px; height: 28px; border-radius: 50%; background: var(--panel-2); display: grid; place-items: center; font-size: 11.5px; color: var(--text-2); flex: none; }
.mini-item .tx { flex: 1; min-width: 0; }
.mini-item .tx b { font-size: 12.5px; font-weight: 500; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-item .tx small { color: var(--text-3); font-size: 11px; }

/* 分页 */
.pager { display: flex; align-items: center; gap: 8px; justify-content: flex-end; margin-top: 14px; font-size: 12.5px; color: var(--text-3); }
.pager button {
  height: 28px; min-width: 28px; padding: 0 8px; border-radius: 6px;
  background: var(--panel); border: 1px solid var(--line); color: var(--text-2); cursor: pointer;
}
.pager button:hover:not(:disabled) { border-color: #2a3446; color: var(--text); }
.pager button:disabled { opacity: .35; cursor: not-allowed; }

/* 抽屉 */
.overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .55);
  z-index: 40; opacity: 0; transition: opacity .18s;
}
.overlay.show { opacity: 1; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: 860px; max-width: 96vw;
  background: var(--bg-soft); border-left: 1px solid var(--line);
  z-index: 50; display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .22s cubic-bezier(.3, .8, .3, 1);
  box-shadow: -20px 0 40px rgba(0, 0, 0, .4);
}
.drawer.open { transform: none; }
.drawer-head, .modal-head {
  height: 58px; flex: none; display: flex; align-items: center; gap: 10px;
  padding: 0 18px; border-bottom: 1px solid var(--line);
}
.drawer-head h3, .modal-head h3 { font-size: 14.5px; flex: 1; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px; }
.drawer-foot { padding: 14px 18px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; }

/* 弹窗 */
.modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -48%) scale(.98);
  width: 520px; max-width: 94vw; max-height: 86vh;
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 14px;
  z-index: 50; display: flex; flex-direction: column;
  box-shadow: var(--shadow); opacity: 0; transition: opacity .16s, transform .16s;
}
.modal.open { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-foot { padding: 14px 18px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; }

/* 详情描述 */
.kv { display: grid; grid-template-columns: 96px 1fr; gap: 9px 12px; font-size: 13px; }
.kv dt { color: var(--text-3); font-size: 12.5px; }
.kv dd { color: var(--text); word-break: break-all; }

.section-title { font-size: 12px; color: var(--text-3); letter-spacing: .6px; text-transform: uppercase; margin: 22px 0 10px; }
.section-title:first-child { margin-top: 0; }

.seg { display: inline-flex; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 2px; }
.seg button {
  height: 28px; padding: 0 12px; border: 0; background: transparent; color: var(--text-3);
  font-size: 12.5px; border-radius: 6px; cursor: pointer;
}
.seg button.on { background: var(--panel); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }

.code-box {
  background: #070a0f; border: 1px solid var(--line); border-radius: 8px;
  padding: 12px; font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12.5px; line-height: 1.9; max-height: 260px; overflow: auto;
  white-space: pre; color: #a5b4fc;
}

/* 提示条 */
.notice-bar {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--amber-dim); border: 1px solid rgba(245, 158, 11, .25);
  color: #fcd34d; border-radius: var(--radius-sm); padding: 11px 13px;
  font-size: 12.5px; margin-bottom: 16px; line-height: 1.65;
}
/* 文本条里的 span 要能收缩换行：flex item 默认 min-width:auto，
   中文长文本会被压到最小内容宽度（一字一列竖排） */
.notice-bar > span { min-width: 0; }
.notice-bar.blue { background: var(--blue-dim); border-color: rgba(56, 189, 248, .22); color: #7dd3fc; }

/* Toast */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 90; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--panel-2); border: 1px solid var(--line); border-left: 3px solid var(--primary);
  padding: 11px 16px; border-radius: 8px; font-size: 13px; box-shadow: var(--shadow);
  animation: slidein .2s ease; max-width: 340px;
}
.toast.ok { border-left-color: var(--green); }
.toast.err { border-left-color: var(--red); }
@keyframes slidein { from { opacity: 0; transform: translateX(14px); } }

/* 空状态 */
.blank { text-align: center; padding: 60px 20px; color: var(--text-3); }
.blank i[data-ic] { width: 40px; height: 40px; color: var(--line); margin-bottom: 10px; }
.blank h4 { font-size: 14px; color: var(--text-2); font-weight: 500; margin-bottom: 6px; }
.blank p { font-size: 12.5px; }

/* 响应式 */
.only-mobile { display: none; }
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid2, .grid2b { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .only-mobile { display: inline-grid; }
  .sidebar {
    position: fixed; z-index: 60; left: 0; top: 0;
    transform: translateX(-100%); transition: transform .2s;
  }
  .sidebar.open { transform: none; box-shadow: 20px 0 40px rgba(0, 0, 0, .5); }
  .content { padding: 16px 14px 60px; }
  .topbar { padding: 0 14px; }
  .stats { gap: 10px; }
  .stat .v { font-size: 23px; }
  .row2, .row3 { grid-template-columns: 1fr; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
  .search input { width: 160px; }
}

/* ============================================================
   手机端（<= 640px）
   目标：字号可读、行距不挤、表格可横滑、输入不被 iOS 放大、
        抽屉/弹窗全屏化、操作按钮有足够点击区
   ============================================================ */
@media (max-width: 640px) {
  html { -webkit-text-size-adjust: 100%; }
  body { font-size: 15px; line-height: 1.65; }

  /* ---------- 顶栏 ---------- */
  .topbar { height: 54px; gap: 8px; }
  .crumb { min-width: 0; flex: 1; }
  .crumb h2 {
    font-size: 15.5px; line-height: 1.35;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .crumb span { display: none; }
  .topbar-right { gap: 8px; flex: none; }
  .topbar-right .muted { font-size: 11px; }

  .content { padding: 12px 12px calc(44px + env(safe-area-inset-bottom)); }

  /* ---------- 卡片 ---------- */
  .card { padding: 14px; border-radius: 10px; }
  .card-h { flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
  .card-h h3 { font-size: 14px; }

  /* ---------- 统计卡：两列，压缩留白，图标收敛 ---------- */
  .stats { gap: 8px; margin-bottom: 12px; }
  .stat { padding: 10px 11px; border-radius: 9px; }
  .stat .k { font-size: 11px; gap: 5px; }
  .stat .v { font-size: 19px; margin-top: 3px; letter-spacing: -.3px; }
  .stat .d { font-size: 10.5px; margin-top: 1px; }
  .stat .ic { width: 22px; height: 22px; right: 8px; top: 8px; border-radius: 6px; }
  .stat .ic i[data-ic] { width: 12px; height: 12px; }

  /* ---------- 列表：两列紧凑卡片，只留关键字段，长内容进详情 ---------- */
  .table-wrap { -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
  table { font-size: 12.5px; }

  /* 有表头的表 → 两列卡片网格（data-carded 由 app.js 打标，桌面端不受影响） */
  .table-wrap { border: 0; }
  .table-wrap table[data-carded="1"] { display: block; border-collapse: separate; }
  .table-wrap table[data-carded="1"] thead { display: none; }
  .table-wrap table[data-carded="1"] tbody {
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  }
  .table-wrap table[data-carded="1"] tbody tr {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas: "title title" "left right" "acts acts";
    align-content: start; column-gap: 8px; row-gap: 3px;
    background: var(--panel-2); border: 1px solid var(--line);
    border-radius: 9px; padding: 8px 10px; margin: 0;
    min-width: 0; cursor: pointer;
  }
  .table-wrap table[data-carded="1"] tbody tr:active { border-color: var(--primary); }
  /* 卡片里所有字段统一：单行、超出省略，长内容去详情看 */
  .table-wrap table[data-carded="1"] tbody td {
    display: block; min-width: 0; padding: 0; border: 0; text-align: left;
    font-size: 12px; line-height: 1.5;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .table-wrap table[data-carded="1"] tbody td::before { display: none; }
  /* 第 1 列当标题，第 2/3 列当副信息，第 4 列起收进详情 */
  .table-wrap table[data-carded="1"] tbody td:nth-child(1) {
    grid-area: title; font-size: 13px; font-weight: 600; color: var(--text);
  }
  /* 标题格里塞的副行内容（更新说明标签/备注等）一律不进卡片，长内容看详情 */
  .table-wrap table[data-carded="1"] tbody td:nth-child(1) > div { display: none; }
  /* 兜底：任何子元素都不许把卡片网格撑宽（flex 标签的省略号会失效） */
  .table-wrap table[data-carded="1"] tbody td > * { max-width: 100%; }
  .table-wrap table[data-carded="1"] tbody td:nth-child(1) .muted,
  .table-wrap table[data-carded="1"] tbody td:nth-child(1) small { display: none; }
  .table-wrap table[data-carded="1"] tbody td:nth-child(2) {
    grid-area: left; font-size: 11.5px; color: var(--text-2);
  }
  .table-wrap table[data-carded="1"] tbody td:nth-child(3) {
    grid-area: right; font-size: 11.5px; color: var(--text-3); text-align: right;
  }
  .table-wrap table[data-carded="1"] tbody td:nth-child(n+4) { display: none; }
  /* 操作：最多两个小按钮，其余动作进详情 */
  .table-wrap table[data-carded="1"] tbody td.cell-actions {
    grid-area: acts; display: flex; gap: 6px; margin-top: 3px;
    padding-top: 7px; border-top: 1px solid var(--line-soft);
    overflow: visible; text-overflow: clip;
  }
  .table-wrap table[data-carded="1"] tbody td.cell-actions .btn {
    flex: 1 1 0; height: 27px; padding: 0 6px;
    font-size: 11.5px; border-radius: 6px;
  }
  .table-wrap table[data-carded="1"] tbody td.cell-actions > *:nth-child(n+3) { display: none; }
  /* 无按钮的占位操作列（只有「-」）：手机卡片上不占地方 */
  .table-wrap table[data-carded="1"] tbody td.cell-empty { display: none !important; }
  /* 空数据行 */
  .table-wrap table[data-carded="1"] tbody td[colspan] {
    grid-column: 1 / -1; text-align: center; color: var(--text-3);
  }

  /* ---------- 崩溃日志专属卡片：保留异常摘要+机型，空状态文字可见 ---------- */
  .table-wrap table.crash-table tbody td:nth-child(1) > div,
  .table-wrap table.crash-table tbody td[colspan] > div { display: block !important; }
  /* 6列信息压进 3 行：时间/MAC 副行、异常(第6列)升为标题、机型(第4列)为副信息 */
  .table-wrap table.crash-table tbody tr {
    grid-template-areas: "title title" "left right" "acts acts";
  }
  .table-wrap table.crash-table tbody td:nth-child(6) { grid-area: title; font-weight: 600; color: var(--text); }
  .table-wrap table.crash-table tbody td:nth-child(6) > div { display: block !important; color: var(--text-2); font-size: 11px; }
  .table-wrap table.crash-table tbody td:nth-child(4) { grid-area: left; display: block; }
  .table-wrap table.crash-table tbody td:nth-child(2) { grid-area: right; display: block; }
  .table-wrap table.crash-table tbody td:nth-child(1):not([colspan]),
  .table-wrap table.crash-table tbody td:nth-child(3):not([colspan]),
  .table-wrap table.crash-table tbody td:nth-child(5):not([colspan]) { display: none; }
  /* 空数据/错误行：唯一 td[colspan] 必须显示，否则被 nth-child(1) 规则藏成无字暗条 */
  .table-wrap table.crash-table tbody td[colspan] {
    display: block !important; grid-column: 1 / -1; text-align: center;
  }
  .table-wrap table.crash-table tbody td.cell-actions,
  .table-wrap table.crash-table tbody td:nth-child(7) {
    grid-area: acts; display: flex; gap: 6px; margin-top: 3px; padding-top: 7px;
    border-top: 1px solid var(--line-soft);
  }
  .table-wrap table.crash-table tbody td:nth-child(7) .btn {
    flex: 1 1 0; height: 27px; padding: 0 6px; font-size: 11.5px; border-radius: 6px;
  }
  .table-wrap table.crash-table tbody td:nth-child(7) > *:nth-child(n+3) { display: none; }
  /* 空状态/错误行：文字必须显示（通用 nth-child(1)>div 规则会吃掉它） */
  .table-wrap table.crash-table tbody td[colspan] > div.empty { display: block !important; padding: 34px 0; }
  /* 首列是批量复选框的表（用户/卡密，has-check 由 app.js 打标）：
     手机端隐藏复选框列，字段整体前移一位 */
  .table-wrap table[data-carded="1"].has-check td:nth-child(1) { display: none; }
  .table-wrap table[data-carded="1"].has-check td:nth-child(2) {
    grid-area: title; font-size: 13px; font-weight: 600; color: var(--text);
  }
  .table-wrap table[data-carded="1"].has-check td:nth-child(3) {
    grid-area: left; font-size: 11.5px; color: var(--text-2);
  }
  .table-wrap table[data-carded="1"].has-check td:nth-child(4) {
    grid-area: right; display: block;
    font-size: 11.5px; color: var(--text-3); text-align: right;
  }
  .table-wrap table[data-carded="1"].has-check td:nth-child(n+5):not(.cell-actions) { display: none; }
  .table-wrap table[data-carded="1"].has-check td:nth-child(2) .muted,
  .table-wrap table[data-carded="1"].has-check td:nth-child(2) small,
  .table-wrap table[data-carded="1"].has-check td:nth-child(2) > div { display: none; }
  /* 无表头的表保持横滑表格 */
  .table-wrap table:not([data-carded="1"]) thead th { font-size: 11px; padding: 9px 10px; letter-spacing: 0; }
  .table-wrap table:not([data-carded="1"]) thead th,
  .table-wrap table:not([data-carded="1"]) tbody td { white-space: nowrap; }
  .table-wrap table:not([data-carded="1"]) tbody td { padding: 10px; line-height: 1.55; }
  .empty { padding: 34px 0; font-size: 12.5px; }

  /* ---------- 表单：16px 防止 iOS 聚焦时整页放大 ---------- */
  .input, select.input, textarea.input, .search input, .login-card input { font-size: 16px; }
  .input { padding: 10px 12px; }
  select.input { height: 40px; }
  textarea.input { min-height: 120px; }
  .field { margin-bottom: 12px; }
  .field > label { font-size: 12.5px; margin-bottom: 5px; }
  .row2, .row3 { grid-template-columns: 1fr; gap: 10px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }

  /* ---------- 工具条：搜索独占一行，按钮自动换行 ---------- */
  .toolbar { gap: 8px; }
  .toolbar .grow { flex: 1 0 100%; }
  .search { width: 100%; }
  .search input { width: 100%; height: 38px; }
  .search i[data-ic] { top: 10px; }

  /* ---------- 按钮：加大点击区 ---------- */
  .btn { height: 36px; padding: 0 13px; }
  .btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
  .icon-btn { width: 36px; height: 36px; }

  /* ---------- 详情键值对：单列堆叠，标签在上值在下 ---------- */
  .kv { grid-template-columns: 1fr; gap: 0; font-size: 13.5px; }
  .kv dt { font-size: 11.5px; margin-top: 8px; }
  .kv dd { margin-bottom: 2px; }
  .section-title { margin: 16px 0 8px; font-size: 11.5px; }

  /* ---------- 抽屉：铺满整屏 ---------- */
  .drawer { width: 100vw; max-width: 100vw; }
  .drawer-head { padding: 0 14px; }
  .drawer-body { padding: 14px; }
  .drawer-foot { padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); gap: 8px; }
  .drawer-foot .btn { flex: 1; }
  .drawer-tabs {
    margin: -14px -14px 12px; padding: 0 8px;
    overflow-x: auto; white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }
  .drawer-tabs::-webkit-scrollbar { display: none; }
  .drawer-tabs button { padding: 10px; flex: none; font-size: 13px; }

  /* ---------- 弹窗：从底部升起 ---------- */
  .modal {
    top: auto; bottom: 0; left: 0; transform: translateY(14px);
    width: 100%; max-width: 100%; max-height: 88vh;
    border-radius: 16px 16px 0 0; border-bottom: 0;
  }
  .modal.open { transform: none; }
  .modal-body { padding: 14px; }
  .modal-foot { padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); gap: 8px; }
  .modal-foot .btn { flex: 1; }

  /* ---------- 其余细节 ---------- */
  .ph-list { grid-template-columns: 1fr; gap: 4px; }
  .pager { justify-content: center; font-size: 12px; }
  .pager button { height: 32px; min-width: 32px; }
  .code-box { font-size: 11.5px; white-space: pre-wrap; word-break: break-all; max-height: 40vh; }
  .bar-row .nm { width: 58px; font-size: 12px; }
  .bar-row .vl { width: 34px; font-size: 12px; }
  .badge { font-size: 11px; height: 20px; padding: 0 7px; }
  .tag { font-size: 11px; }
  .toasts { left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); }
  .toast { max-width: none; }
  .login-wrap { padding: 16px; }
  .login-card { padding: 26px 20px 20px; border-radius: 16px; }
  .brand-lg h1 { font-size: 19px; }
  .mini-item { padding: 10px 4px; }
  .mini-item .tx b { font-size: 13px; }
  .mini-item .tx small { font-size: 11px; }
  .notice-bar { font-size: 12.5px; padding: 10px 12px; }
  .blank { padding: 44px 16px; }
}

/* 超窄屏（<= 380px）两列放不下，退回单列 */
@media (max-width: 380px) {
  .table-wrap table[data-carded="1"] tbody { grid-template-columns: 1fr; }
}

/* 触摸设备去掉 hover 残留态 */
@media (hover: none) {
  .btn:hover { background: var(--panel-2); border-color: var(--line); }
  .btn-primary:hover { background: var(--primary); border-color: var(--primary); }
}

/* iOS 地址栏伸缩：用动态视口高度，避免抽屉底部被裁 */
@supports (height: 100dvh) {
  .sidebar, .drawer { height: 100dvh; }
}


