/* ==========================================================================
   7EAI 授权管理台 · 设计系统 v2
   深色控制台风格：低饱和底 + 单一品牌绿 + 等宽数据字体
   断点：≥1024 桌面侧栏 / 768–1023 图标栏 / <768 底部标签栏 + 卡片化
   ========================================================================== */
:root {
  --bg: #0b0f14;
  --surface: #141a22;
  --surface-2: #10161d;
  --surface-3: #1a222c;
  --line: #232b36;
  --line-2: #2c3644;
  --ink: #e6e9ee;
  --muted: #8b94a3;
  --dim: #5c6675;
  --accent: #2ee27a;
  --accent-d: #1fae5e;
  --accent-soft: rgba(46, 226, 122, .10);
  --blue: #5aa7f0;
  --blue-soft: rgba(90, 167, 240, .10);
  --warn: #e8c04a;
  --warn-soft: rgba(232, 192, 74, .10);
  --danger: #f0616d;
  --danger-soft: rgba(240, 97, 109, .10);
  --r: 12px;
  --r-sm: 8px;
  --r-lg: 16px;
  --sidebar-w: 200px;
  --rail-w: 64px;
  --tabbar-h: 60px;
  --ease: cubic-bezier(.4, 0, .2, 1);
  --mono: "JetBrains Mono", "Cascadia Mono", Consolas, "Courier New", monospace;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font: 13px/1.6 "Segoe UI", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  min-height: 100vh;
  overscroll-behavior-y: contain;
}

button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font: inherit; color: var(--ink); }
a { color: var(--blue); text-decoration: none; cursor: pointer; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2a3442; border-radius: 5px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #3a475a; }
::selection { background: rgba(46, 226, 122, .28); }

.hidden { display: none !important; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.2px; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.accent { color: var(--accent); }
.danger-text { color: var(--danger); }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------ 表单控件 ------------------------------ */
/* 注意：必须包含 input:not([type])——未写 type 的 <input> 默认是 text，
   但属性选择器 input[type=text] 匹配不到，会退回浏览器默认白底，在深色主题下变成白块。 */
input[type=text], input:not([type]), input[type=password], input[type=number], input[type=search],
input[type=date], select, textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 8px 11px;
  outline: none;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), background .15s;
  -webkit-appearance: none;
  appearance: none;
}
select {
  background-image: linear-gradient(45deg, transparent 50%, var(--dim) 50%),
    linear-gradient(135deg, var(--dim) 50%, transparent 50%);
  background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 28px;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent-d);
  box-shadow: 0 0 0 3px rgba(46, 226, 122, .10);
  background: #0d1319;
}
input::placeholder, textarea::placeholder { color: var(--dim); }
input[type=checkbox] {
  width: 16px; height: 16px; accent-color: var(--accent-d);
  vertical-align: -3px; cursor: pointer;
}
textarea { resize: vertical; min-height: 70px; line-height: 1.7; }
.field { margin-bottom: 13px; }
.field > label {
  display: block; font-size: 11.5px; color: var(--muted);
  margin-bottom: 6px; letter-spacing: .2px;
}
.field .hint { font-size: 11px; color: var(--dim); margin-top: 5px; line-height: 1.5; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ------------------------------ 按钮 ------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--r-sm);
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--ink); font-size: 12.5px; white-space: nowrap;
  transition: all .15s var(--ease); user-select: none;
}
.btn:hover { border-color: var(--line-2); background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.green { background: var(--accent-d); border-color: var(--accent-d); color: #06210f; font-weight: 700; }
.btn.green:hover { background: var(--accent); border-color: var(--accent); }
.btn.blue { background: transparent; border-color: #2b4a6b; color: var(--blue); }
.btn.blue:hover { background: var(--blue-soft); border-color: var(--blue); }
.btn.red { background: transparent; border-color: #5b2a30; color: var(--danger); }
.btn.red:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-3); color: var(--ink); }
.btn.sm { padding: 4px 10px; font-size: 11.5px; border-radius: 6px; }
.btn.block { width: 100%; }
.btn.icon { padding: 7px 9px; }

/* ------------------------------ 徽标 ------------------------------ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 8px; border-radius: 20px;
  font-size: 11px; line-height: 18px; white-space: nowrap;
  border: 1px solid transparent;
}
.b-green { background: var(--accent-soft); color: var(--accent); border-color: rgba(46, 226, 122, .18); }
.b-red { background: var(--danger-soft); color: var(--danger); border-color: rgba(240, 97, 109, .18); }
.b-yellow { background: var(--warn-soft); color: var(--warn); border-color: rgba(232, 192, 74, .18); }
.b-blue { background: var(--blue-soft); color: var(--blue); border-color: rgba(90, 167, 240, .18); }
.b-gray { background: rgba(139, 148, 163, .10); color: var(--muted); border-color: rgba(139, 148, 163, .14); }
.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 5px; vertical-align: 1px; }

/* ==========================================================================
   登录页
   ========================================================================== */
#login {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  background:
    radial-gradient(900px 600px at 78% -12%, #123027 0%, transparent 60%),
    radial-gradient(700px 500px at 10% 110%, #101c2b 0%, transparent 55%),
    var(--bg);
}
.login-card {
  width: 100%; max-width: 372px;
  background: linear-gradient(180deg, #151d26 0%, #111820 100%);
  border: 1px solid var(--line); border-radius: 20px;
  padding: 34px 30px 26px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .03);
  animation: pop .4s var(--ease);
}
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.985); } to { opacity: 1; transform: none; } }
.login-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 6px; }
.login-mark {
  width: 38px; height: 38px; border-radius: 11px; flex: none;
  background: linear-gradient(140deg, var(--accent) 0%, var(--accent-d) 100%);
  color: #06210f; font-weight: 800; font-size: 15px; letter-spacing: -.5px;
  display: grid; place-items: center;
  box-shadow: 0 6px 18px rgba(46, 226, 122, .28);
}
.login-card h1 { font-size: 17px; font-weight: 700; letter-spacing: .3px; }
.login-card h1 b { color: var(--accent); font-weight: 800; }
.login-card .sub { color: var(--muted); font-size: 11.5px; margin: 2px 0 24px 49px; }
.login-err {
  background: var(--danger-soft); border: 1px solid rgba(240, 97, 109, .25);
  color: var(--danger); font-size: 12px; border-radius: var(--r-sm);
  padding: 8px 11px; margin-bottom: 12px;
}
.login-tip {
  margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--line);
  font-size: 10.5px; color: var(--dim); line-height: 1.8;
}
.login-tip code { color: var(--muted); font-family: var(--mono); }

/* ==========================================================================
   应用骨架
   ========================================================================== */
#app { display: none; min-height: 100vh; }

/* 侧栏（桌面） */
.side {
  position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar-w);
  background: var(--surface-2); border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: 18px 12px 12px; z-index: 30;
}
.side .brand {
  display: flex; align-items: center; gap: 9px;
  padding: 0 8px 18px; margin-bottom: 6px;
}
.side .brand .mark {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  background: linear-gradient(140deg, var(--accent), var(--accent-d));
  color: #06210f; font-weight: 800; font-size: 12px;
  display: grid; place-items: center;
}
.side .brand .name { font-size: 13.5px; font-weight: 700; letter-spacing: .3px; line-height: 1.25; }
.side .brand .name small { display: block; font-size: 10px; color: var(--dim); font-weight: 400; letter-spacing: 0; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: 9px;
  color: var(--muted); font-size: 13px; position: relative;
  transition: all .15s var(--ease);
}
.nav a svg { width: 17px; height: 17px; flex: none; opacity: .8; }
.nav a:hover { background: var(--surface-3); color: var(--ink); }
.nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav a.on svg { opacity: 1; }
.nav a.on::before {
  content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 16px; border-radius: 0 3px 3px 0; background: var(--accent);
}
.nav .nav-group {
  font-size: 10px; color: var(--dim); letter-spacing: .8px;
  padding: 14px 11px 6px; text-transform: uppercase;
}
.side .foot {
  margin-top: auto; padding: 12px 10px 4px; border-top: 1px solid var(--line);
  font-size: 11px; color: var(--dim); line-height: 1.9;
}
.side .foot b { color: var(--ink); font-weight: 600; }
.side .foot .links { display: flex; gap: 12px; margin-top: 4px; }
.side .foot .links a { color: var(--muted); }
.side .foot .links a:hover { color: var(--accent); }

/* 主区 */
.main {
  margin-left: var(--sidebar-w);
  padding: 22px 26px 48px;
  min-height: 100vh;
  max-width: 1560px;
}

.topbar {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 20px; min-height: 34px;
}
.topbar .titles h2 { font-size: 19px; font-weight: 700; letter-spacing: .2px; line-height: 1.25; }
.topbar .titles .sub { font-size: 11.5px; color: var(--dim); margin-top: 1px; }
.topbar .right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* 全局搜索 */
.search-box { position: relative; width: 280px; }
.search-box input {
  padding-left: 32px; height: 34px; font-size: 12.5px;
  background: var(--surface); border-radius: 9px;
}
.search-box .icon {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px; color: var(--dim); pointer-events: none;
}
.search-box kbd {
  position: absolute; right: 9px; top: 50%; transform: translateY(-50%);
  font-size: 10px; color: var(--dim); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px;
  font-family: var(--mono);
}
.search-pop {
  position: absolute; top: 40px; left: 0; right: 0; z-index: 80;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r);
  box-shadow: 0 18px 44px rgba(0, 0, 0, .6); overflow: hidden;
  max-height: 62vh; overflow-y: auto;
}
.search-group-title {
  font-size: 10px; letter-spacing: .7px; color: var(--dim);
  padding: 10px 12px 5px; text-transform: uppercase;
}
.search-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 12px; font-size: 12.5px; cursor: pointer;
}
.search-item:hover, .search-item.sel { background: var(--surface-3); }
.search-item .k { color: var(--muted); margin-left: auto; font-size: 10.5px; }
.search-empty { padding: 22px 12px; text-align: center; color: var(--dim); font-size: 12px; }

/* 页面切换动画 */
.page { display: none; }
.page.on { display: block; animation: fadeUp .22s var(--ease); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ==========================================================================
   KPI / 面板 / 表格
   ========================================================================== */
.kpis {
  display: grid; gap: 12px; margin-bottom: 16px;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
}
.kpi {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 14px 16px 13px;
  position: relative; overflow: hidden;
  transition: border-color .18s var(--ease), transform .18s var(--ease);
}
.kpi:hover { border-color: var(--line-2); transform: translateY(-1px); }
.kpi::after {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--kcolor, var(--accent)), transparent);
  opacity: .55;
}
.kpi .t { font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.kpi .v {
  font-size: 25px; font-weight: 750; letter-spacing: -.4px;
  margin-top: 5px; font-family: var(--mono); font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.kpi .d { font-size: 11px; color: var(--dim); margin-top: 3px; }
.up { color: var(--accent); }
.down { color: var(--warn); }
.bad { color: var(--danger); }

.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); margin-bottom: 16px; overflow: hidden;
}
.panel > header {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 17px; border-bottom: 1px solid var(--line);
}
.panel > header h3 { font-size: 13px; font-weight: 650; letter-spacing: .2px; }
.panel > header .r { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--dim); }
.panel > .body { padding: 15px 17px; }
.panel > .body.flush { padding: 0; }
.panel > .body.pad-sm { padding: 8px 10px 10px; }

.toolbar {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  margin-bottom: 13px;
}
.toolbar input, .toolbar select { width: auto; height: 32px; padding: 5px 10px; font-size: 12px; }
.toolbar .sp { flex: 1; }
.toolbar .divider { width: 1px; height: 20px; background: var(--line); margin: 0 2px; }

/* 数据表 */
.table-wrap { overflow-x: auto; }
table.dt { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.dt th {
  color: var(--muted); font-weight: 600; text-align: left;
  padding: 10px 14px; border-bottom: 1px solid var(--line);
  white-space: nowrap; font-size: 11.5px; letter-spacing: .2px;
  background: var(--surface-2); position: sticky; top: 0; z-index: 1;
}
table.dt td {
  padding: 10px 14px; border-bottom: 1px solid #1a212b;
  white-space: nowrap; vertical-align: middle;
}
table.dt tbody tr { transition: background .12s; }
table.dt tbody tr:hover td { background: rgba(255, 255, 255, .022); }
table.dt tbody tr:last-child td { border-bottom: none; }
table.dt tr.is-warn td { background: rgba(232, 192, 74, .035); }
table.dt tr.is-off td { opacity: .55; }
table.dt td.wrap { white-space: normal; min-width: 180px; max-width: 380px; word-break: break-word; }
table.dt .rowbtn { display: flex; gap: 5px; flex-wrap: wrap; }
table.dt td.actions { padding-top: 7px; padding-bottom: 7px; }

.empty {
  text-align: center; color: var(--dim); padding: 34px 12px; font-size: 12.5px;
}
.empty .ico { font-size: 22px; opacity: .35; display: block; margin-bottom: 6px; }

.pager {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 16px; border-top: 1px solid var(--line);
  font-size: 11.5px; color: var(--muted); flex-wrap: wrap;
}
.pager .sp { flex: 1; }
.pager button { padding: 3px 9px; font-size: 11.5px; }

/* 通栏提示条 */
.notice {
  /* 注意：必须用 block 而非 flex。提示语里混有行内 <b>/<code>，
     一旦容器是 flex，每段文本与每个 <b> 都会各自变成 flex item 被压缩换行，
     窄屏下会出现「每项能力都可独 / 立开关」这种逐字断行的错乱排版。 */
  display: block;
  background: var(--blue-soft); border: 1px solid rgba(90, 167, 240, .20);
  color: #a9cdf4; border-radius: var(--r-sm);
  padding: 9px 13px; font-size: 11.5px; line-height: 1.65; margin-bottom: 14px;
}
.notice.warn { background: var(--warn-soft); border-color: rgba(232, 192, 74, .22); color: #e2cf8e; }
.notice.danger { background: var(--danger-soft); border-color: rgba(240, 97, 109, .22); color: #f3a7ad; }
.notice strong { color: var(--ink); font-weight: 600; }

/* 分段控件（看板 range） */
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 2px; gap: 2px; }
.seg button {
  padding: 4px 11px; border-radius: 6px; font-size: 11.5px; color: var(--muted);
  transition: all .15s var(--ease);
}
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--surface-3); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .3); }

/* 趋势图 */
.chart-legend { display: flex; gap: 16px; font-size: 11px; color: var(--muted); margin-bottom: 8px; flex-wrap: wrap; }
.chart-box { position: relative; }
.chart-box svg { display: block; width: 100%; height: 168px; overflow: visible; }

/* 批量操作条 */
.bulkbar {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  background: var(--accent-soft); border: 1px solid rgba(46, 226, 122, .22);
  border-radius: var(--r-sm); padding: 9px 13px; margin-bottom: 12px;
  font-size: 12px; animation: fadeUp .18s var(--ease);
}
.bulkbar .count { font-weight: 700; color: var(--accent); }
.bulkbar .sp { flex: 1; }

/* ==========================================================================
   抽屉（详情）
   ========================================================================== */
#mask {
  position: fixed; inset: 0; background: rgba(4, 7, 10, .62);
  z-index: 60; opacity: 0; pointer-events: none; transition: opacity .2s;
  backdrop-filter: blur(2px);
}
#mask.on { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 460px; max-width: 100vw;
  background: var(--surface); border-left: 1px solid var(--line);
  z-index: 70; transform: translateX(102%);
  transition: transform .26s var(--ease);
  display: flex; flex-direction: column;
  box-shadow: -20px 0 50px rgba(0, 0, 0, .45);
}
.drawer.on { transform: none; }
.drawer > header {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 20px; border-bottom: 1px solid var(--line); flex: none;
}
.drawer > header h3 { font-size: 15px; font-weight: 650; }
.drawer > header .sub { font-size: 11px; color: var(--dim); }
.drawer > header .close {
  margin-left: auto; width: 28px; height: 28px; border-radius: 7px;
  display: grid; place-items: center; color: var(--muted);
}
.drawer > header .close:hover { background: var(--surface-3); color: var(--ink); }
.drawer > .content { padding: 16px 20px 30px; overflow-y: auto; flex: 1; }
.drawer .kv {
  display: grid; grid-template-columns: 92px 1fr; gap: 9px 12px;
  font-size: 12.5px; margin-bottom: 18px;
}
.drawer .kv .k { color: var(--muted); }
.drawer .kv .v { word-break: break-word; }
.drawer h4 {
  font-size: 11px; color: var(--dim); letter-spacing: .7px; text-transform: uppercase;
  margin: 20px 0 9px; display: flex; align-items: center; gap: 8px;
}
.drawer h4::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.drawer .action-row { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 6px; }
.mini-list { display: flex; flex-direction: column; gap: 7px; }
.mini-item {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 9px 11px; font-size: 12px;
}
.mini-item .t { display: flex; gap: 8px; align-items: center; }
.mini-item .s { color: var(--dim); font-size: 11px; margin-top: 2px; }

/* ==========================================================================
   弹窗
   ========================================================================== */
.modal {
  position: fixed; inset: 0; z-index: 90; display: none;
  align-items: center; justify-content: center; padding: 20px;
  background: rgba(4, 7, 10, .66); backdrop-filter: blur(3px);
}
.modal.on { display: flex; animation: fadeIn .15s var(--ease); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal .box {
  width: 100%; max-width: 480px; max-height: 90vh;
  background: var(--surface); border: 1px solid var(--line-2);
  border-radius: var(--r-lg); padding: 22px 24px;
  overflow-y: auto; box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
  animation: pop .2s var(--ease);
  display: flex; flex-direction: column;
}
.modal .box.wide { max-width: 620px; }
.modal .box.narrow { max-width: 400px; }
.modal h3 { font-size: 15px; font-weight: 650; margin-bottom: 4px; }
.modal .desc { font-size: 11.5px; color: var(--muted); margin-bottom: 18px; line-height: 1.6; }
.modal .foot {
  display: flex; justify-content: flex-end; gap: 8px;
  margin-top: 20px; padding-top: 15px; border-top: 1px solid var(--line);
}
.modal .foot .sp { flex: 1; }

/* 明文卡密输出 */
.codes {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 12px;
  max-height: 300px; overflow-y: auto;
  font-family: var(--mono); font-size: 12.5px; color: var(--accent);
  line-height: 2; white-space: pre-wrap; word-break: break-all;
  user-select: all;
}
.code-meta { display: flex; gap: 14px; font-size: 11px; color: var(--dim); margin-bottom: 10px; flex-wrap: wrap; }

/* ==========================================================================
   开关（设置页）
   ========================================================================== */
.switch {
  position: relative; width: 40px; height: 22px; flex: none;
  background: var(--surface-3); border: 1px solid var(--line-2);
  border-radius: 20px; transition: all .18s var(--ease); cursor: pointer;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--muted); transition: all .18s var(--ease);
}
.switch.on { background: var(--accent-d); border-color: var(--accent-d); }
.switch.on::after { left: 20px; background: #06210f; }

.setting-row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 0; border-bottom: 1px solid #1a212b;
}
.setting-row:last-child { border-bottom: none; }
.setting-row .meta { min-width: 0; }
.setting-row .meta .n { font-size: 12.5px; font-weight: 600; }
.setting-row .meta .d { font-size: 11px; color: var(--dim); margin-top: 1px; }
.setting-row .r { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: none; }

/* 卡片网格（模板 / 版本 / 管理员） */
.tiles { display: grid; gap: 11px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.tile {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 13px 15px; position: relative;
  transition: border-color .15s var(--ease);
}
.tile:hover { border-color: var(--line-2); }
.tile .n { font-size: 13px; font-weight: 650; display: flex; align-items: center; gap: 7px; }
.tile .s { font-size: 11px; color: var(--dim); margin-top: 4px; line-height: 1.6; }
.tile .act { display: flex; gap: 6px; margin-top: 10px; }
.tile.on { border-color: rgba(46, 226, 122, .35); box-shadow: inset 0 0 0 1px rgba(46, 226, 122, .12); }

/* 标签页 */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button {
  padding: 9px 15px; font-size: 12.5px; color: var(--muted);
  border-bottom: 2px solid transparent; white-space: nowrap;
  transition: all .15s var(--ease);
}
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

/* ==========================================================================
   Toast
   ========================================================================== */
#toast {
  position: fixed; left: 50%; top: 20px; transform: translate(-50%, -14px);
  background: var(--accent-d); color: #05200f; font-weight: 600;
  padding: 10px 20px; border-radius: 9px; font-size: 12.5px;
  z-index: 300; opacity: 0; pointer-events: none;
  transition: all .22s var(--ease); box-shadow: 0 12px 34px rgba(0, 0, 0, .45);
  max-width: 88vw; text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.err { background: var(--danger); color: #fff; }
#toast.warn { background: var(--warn); color: #2a2105; }

/* ==========================================================================
   移动端：底部标签栏（默认隐藏）
   ========================================================================== */
.tabbar {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  height: calc(var(--tabbar-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: rgba(16, 22, 29, .96);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.tabbar .tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--dim); font-size: 10px; padding-top: 4px;
  transition: color .15s;
}
.tabbar .tab svg { width: 20px; height: 20px; }
.tabbar .tab.on { color: var(--accent); }
.tabbar .tab.on svg { filter: drop-shadow(0 0 8px rgba(46, 226, 122, .35)); }

/* 移动端「更多」面板 */
.more-sheet { display: none; }
.more-sheet.on {
  display: block; position: fixed; inset: 0; z-index: 85;
  background: rgba(4, 7, 10, .7); backdrop-filter: blur(3px);
}
.more-sheet .sheet {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: var(--surface); border-top: 1px solid var(--line-2);
  border-radius: 18px 18px 0 0; padding: 8px 14px calc(20px + var(--safe-b));
  animation: sheetUp .26s var(--ease); max-height: 82vh; overflow-y: auto;
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
.more-sheet .grab {
  width: 38px; height: 4px; border-radius: 3px; background: var(--line-2);
  margin: 6px auto 14px;
}
.more-sheet .m-item {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 10px; border-radius: 10px; font-size: 13.5px;
  border-bottom: 1px solid #1a212b;
}
.more-sheet .m-item:last-child { border-bottom: none; }
.more-sheet .m-item:active { background: var(--surface-3); }
.more-sheet .m-item svg { width: 18px; height: 18px; color: var(--muted); }

/* ==========================================================================
   断点 1：平板（768–1023）→ 图标栏
   ========================================================================== */
@media (max-width: 1023px) {
  :root { --sidebar-w: var(--rail-w); }
  .side { padding: 16px 8px 10px; align-items: center; }
  .side .brand { padding: 0 0 16px; justify-content: center; }
  .side .brand .name { display: none; }
  .nav { width: 100%; align-items: center; }
  .nav a { justify-content: center; padding: 11px 0; width: 46px; height: 44px; }
  .nav a span { display: none; }
  .nav a svg { width: 19px; height: 19px; }
  .nav .nav-group { display: none; }
  .side .foot { font-size: 10px; padding: 10px 0 0; text-align: center; width: 100%; }
  .side .foot .who, .side .foot .links { display: none; }
  .main { padding: 18px 18px 40px; }
  .search-box { width: 220px; }
  .drawer { width: 420px; }
}

/* ==========================================================================
   断点 2：手机（<768）→ 底部标签栏 + 卡片化表格
   ========================================================================== */
@media (max-width: 767px) {
  body { font-size: 13.5px; }
  .side { display: none; }
  .tabbar { display: flex; }
  .main {
    margin-left: 0;
    padding: 14px 13px calc(var(--tabbar-h) + var(--safe-b) + 22px);
  }
  .topbar { margin-bottom: 15px; gap: 10px; flex-wrap: wrap; }
  .topbar .titles h2 { font-size: 18px; }
  .topbar .titles .sub { display: none; }
  .topbar .right { margin-left: auto; gap: 6px; }
  .search-box { width: 100%; order: 3; flex-basis: 100%; }
  .search-box kbd { display: none; }
  .search-pop { top: 42px; }

  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-bottom: 13px;
  }
  .kpi { padding: 11px 12px 10px; border-radius: 10px; }
  .kpi .v { font-size: 21px; }
  .kpi .t { font-size: 10.5px; }
  .kpi .d { font-size: 10px; }

  .panel { border-radius: 11px; margin-bottom: 13px; }
  .panel > header { padding: 11px 13px; }
  .panel > .body { padding: 12px 13px; }
  .panel > .body.pad-sm { padding: 6px 8px 8px; }

  .toolbar { gap: 6px; }
  .toolbar input, .toolbar select { height: 34px; flex: 1 1 130px; min-width: 0; }
  .toolbar .sp { display: none; }
  .toolbar .btn { flex: 0 0 auto; }
  /* 主行动按钮与普通按钮同行平分，避免单独占一行留下大片空白 */
  .toolbar > .btn.green, .toolbar > .btn.blue { flex: 1 1 auto; }

  /* 表格 → 卡片 */
  table.dt { display: block; }
  table.dt thead { display: none; }
  table.dt tbody { display: block; }
  table.dt tbody tr {
    display: block; position: relative;
    background: var(--surface-2); border: 1px solid var(--line);
    border-radius: 10px; padding: 11px 12px 9px; margin: 8px 6px;
  }
  table.dt tbody tr:hover td { background: transparent; }
  table.dt tbody tr.is-warn { border-color: rgba(232, 192, 74, .35); background: rgba(232, 192, 74, .04); }
  table.dt td {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 3px 0; border: none; white-space: normal;
    font-size: 12.5px; line-height: 1.55;
  }
  table.dt td::before {
    content: attr(data-label);
    flex: none; width: 74px; color: var(--dim); font-size: 11px; padding-top: 1px;
  }
  table.dt td[data-label=""]::before { display: none; }
  table.dt td.wrap { max-width: none; }
  table.dt td.actions {
    margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line);
    flex-wrap: wrap; gap: 6px;
  }
  table.dt td.actions::before { content: "操作"; }
  table.dt td.actions .btn { flex: 1 1 auto; }
  table.dt td.hide-m { display: none; }
  table.dt .rowbtn { flex: 1; }

  .pager { padding: 10px 12px; }
  .pager .sp { display: none; }
  .pager button { flex: 1; }

  /* 抽屉全屏 */
  .drawer {
    width: 100%; max-width: 100%; border-left: none;
    border-radius: 0; transform: translateY(100%);
  }
  .drawer.on { transform: none; }
  .drawer > header { padding: 13px 15px; padding-top: calc(13px + env(safe-area-inset-top, 0px)); }
  .drawer > .content { padding: 14px 15px calc(30px + var(--safe-b)); }
  .drawer .kv { grid-template-columns: 80px 1fr; font-size: 12.5px; }

  /* 弹窗底部化 */
  .modal { padding: 0; align-items: flex-end; }
  .modal .box {
    max-width: 100% !important; border-radius: 18px 18px 0 0;
    border-bottom: none; max-height: 92vh;
    padding: 18px 17px calc(18px + var(--safe-b));
    animation: sheetUp .24s var(--ease);
  }
  .modal .box > .foot { position: sticky; bottom: 0; background: var(--surface); }
  .modal .foot .btn { flex: 1; }
  .field-row { grid-template-columns: 1fr; }

  .tiles { grid-template-columns: 1fr; }
  .seg button { padding: 5px 10px; }
  .chart-box svg { height: 150px; }
  #toast { top: auto; bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px); }

  .bulkbar { font-size: 11.5px; padding: 8px 10px; }
  .bulkbar .btn { padding: 5px 9px; font-size: 11px; }
  .tabs button { padding: 9px 12px; font-size: 12px; }
}

/* 横屏手机压缩 */
@media (max-width: 767px) and (orientation: landscape) {
  .main { padding-bottom: calc(var(--tabbar-h) * .7); }
}

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
